fix: preserve implementation step boundaries

This commit is contained in:
KOKO\Mimi
2026-08-15 03:57:29 +09:00
parent 869b6ce241
commit 79a3c1c666
15 changed files with 187 additions and 33 deletions
+18 -6
View File
@@ -60,21 +60,29 @@ Execution contract:
later pending Step.
- Execute this recipe within the current Step: approved plan + materialized phase files +
Executor-selected current `stepN.md` -> read prerequisites and previous summaries -> RED ->
OBSERVED FAILURE -> MINIMAL GREEN -> FOCUSED VERIFY -> FULL MSVC BUILD/CTEST -> ARTIFACT CHECK
-> COMPARE -> CLASSIFY -> REPORT -> update only current Step status plus
OBSERVED FAILURE -> MINIMAL GREEN -> the Step's declared FOCUSED/FULL VERIFY acceptance commands
-> update only current Step status plus
`summary`/`error_message`/`blocked_reason` -> stop without starting the next Step.
- A non-final Step is complete when its declared acceptance commands pass. It must not fail merely
because final solver output, reference artifacts, or `reference-comparison.md` are not yet available.
- Only when the approved implementation plan places the Executor-selected current Step after all
prerequisite implementation Steps as the final Implementation-owned verification Step/gate,
continue with `ARTIFACT CHECK -> COMPARE -> CLASSIFY -> REPORT`, require generated `results.h5`,
and complete `docs/<feature-id>/reference-comparison.md`.
- Always work in RED -> GREEN -> VERIFY order.
- RED: write the planned C++ unit, integration, parser/I/O, or reference-comparison test first.
- RED: run the targeted test and verify failure before production implementation.
- GREEN: implement the minimum code needed for the planned task and acceptance criterion.
- VERIFY: resolve commands from `.harness/config.json` first, then Harness project defaults; run the targeted CTest command, then the full MSVC x64 Debug build/test commands in the configured order.
- VERIFY: resolve commands from `.harness/config.json` first, then Harness project defaults; run the
targeted command and any focused/full MSVC x64 Debug build/test commands declared by the current
Step in the configured order.
- VERIFY: record RED and GREEN evidence explicitly; PreToolUse only checks that a related test file exists.
- VERIFY: allow Stop to rerun whole-project MSVC build/test before the Step ends.
- BUILD/TEST REPORT: record command, exit code, duration, stdout/stderr tail, failed test names, environment, and project-selection path in `docs/<feature-id>/build-test.md` with `owner_agent: implementation-agent`.
- BUILD/TEST REPORT: stop after the first decisive failure unless the approved plan requires another diagnostic command.
- ARTIFACT CHECK -> COMPARE -> CLASSIFY -> REPORT: require the exact declared input/CSV paths, generated `results.h5`, HDF5 projection from `docs/<feature-id>/io.md`, source identity/component matching, row uniqueness/finite checks, and approved tolerance.
- FINAL VERIFICATION GATE — ARTIFACT CHECK -> COMPARE -> CLASSIFY -> REPORT: require the exact declared input/CSV paths, generated `results.h5`, HDF5 projection from `docs/<feature-id>/io.md`, source identity/component matching, row uniqueness/finite checks, and approved tolerance.
- COMPARE: reject missing, extra, duplicate, or nonfinite required rows before tolerance; preserve warning-only behavior and never alter tolerance or artifacts to obtain a pass.
- REPORT: write `docs/<feature-id>/implementation-report.md`, `docs/<feature-id>/build-test.md`, and `docs/<feature-id>/reference-comparison.md`.
- FINAL VERIFICATION GATE REPORT: complete `docs/<feature-id>/implementation-report.md`, `docs/<feature-id>/build-test.md`, and `docs/<feature-id>/reference-comparison.md`.
- `.codex/hooks.json` is authoritative: PreToolUse runs `scripts/hooks/pre_tool_use.py` and Stop
runs `scripts/hooks/stop_validation.py` automatically. Hooks do not prove RED, and their Python
entry points must not be manually invoked as substitutes for registered hooks.
@@ -139,7 +147,11 @@ Reference comparison quality gate:
- Do not calculate, invent, or treat a metric as required when the approved feature contract does not make it applicable.
Return contract:
- Return `docs/<feature-id>/implementation-report.md`, `docs/<feature-id>/build-test.md`, and `docs/<feature-id>/reference-comparison.md`, plus status, evidence summary, and blockers, to Coordinator Agent.
- For a non-final Step, return only that Step's owned status/summary and applicable evidence without
requiring final solver output or a completed reference comparison.
- From the final Implementation-owned verification Step/gate, return
`docs/<feature-id>/implementation-report.md`, `docs/<feature-id>/build-test.md`, and
`docs/<feature-id>/reference-comparison.md`, plus status, evidence summary, and blockers, to Coordinator Agent.
- Return `pass-for-physics-evaluation` only when the full build/test and all blocking comparisons pass.
- Return repeated or unclear implementation failures as a Correction Agent request through Coordinator Agent.
+13 -7
View File
@@ -25,7 +25,8 @@ Read these first:
- `docs/<feature-id>/implementation-report.md` when present
- `docs/<feature-id>/build-test.md` when present
- `docs/<feature-id>/reference-comparison.md` when present
- Generated FESA `results.h5` and the exact feature-declared reference `.inp` and Abaqus CSV paths
- For the final Implementation-owned verification Step/gate, generated FESA `results.h5` and the
exact feature-declared reference `.inp` and Abaqus CSV paths
For Harness implementation, also read `.agents/skills/harness/SKILL.md`,
`.codex/hooks.json`, the materialized phase indexes, and the Executor-selected current
@@ -47,16 +48,21 @@ For Harness implementation, also read `.agents/skills/harness/SKILL.md`,
5. RED: write the planned unit, integration, parser/I/O, or reference-comparison test first.
6. RED: run the targeted test and verify the expected failure before production code.
7. GREEN: implement the minimum C++17/MSVC-compatible code needed for the task.
8. VERIFY: resolve commands from `.harness/config.json` first, then Harness defaults; run the targeted command, then the full MSVC x64 Debug build/test commands in order.
8. VERIFY: resolve commands from `.harness/config.json` first, then Harness defaults; run the
targeted command and any focused/full MSVC x64 Debug build/test commands declared by the current
Step in order.
9. For C++ production changes, require a related C++ test file in the same patch or already present.
10. Treat PreToolUse as a test-file-existence guardrail, not proof that RED was observed. Record the RED and GREEN commands and results in the implementation report.
11. Let Stop perform the final whole-project MSVC build/test before the Step ends.
12. Record every build/test command, exit code, duration, stdout/stderr tail, failed test names, environment, and project-selection path. Stop after the first decisive failure unless the implementation plan requires another diagnostic command.
13. For failure triage, classify as `configure | compile | link | test | reference-comparison | harness | environment | upstream-contract`.
14. Run reference comparison in this literal order: `ARTIFACT CHECK -> COMPARE -> CLASSIFY -> REPORT`.
15. ARTIFACT CHECK requires exact declared input/CSV paths, generated `results.h5`, the `docs/<feature-id>/io.md` HDF5 projection, source identity/component matching, row uniqueness/finite checks, and approved tolerance.
16. COMPARE matches HDF5 and CSV rows by declared source identity and component, never by row order. Reject missing, extra, duplicate, and nonfinite required rows before tolerance; preserve warning-only behavior.
17. Fix implementation-owned failures only and keep changes traceable to the implementation plan.
14. A non-final Step ends after its declared `RED -> observed failure -> minimal GREEN -> focused/full VERIFY` acceptance commands and owned status/summary update. Do not fail it merely because final solver output, reference artifacts, or `reference-comparison.md` are not yet available.
15. Only when the approved implementation plan places the current Step after all prerequisite
implementation Steps as the final Implementation-owned verification Step/gate, run reference
comparison in this literal order: `ARTIFACT CHECK -> COMPARE -> CLASSIFY -> REPORT`.
16. At that final gate, ARTIFACT CHECK requires exact declared input/CSV paths, generated `results.h5`, the `docs/<feature-id>/io.md` HDF5 projection, source identity/component matching, row uniqueness/finite checks, and approved tolerance.
17. COMPARE matches HDF5 and CSV rows by declared source identity and component, never by row order. Reject missing, extra, duplicate, and nonfinite required rows before tolerance; preserve warning-only behavior.
18. Fix implementation-owned failures only and keep changes traceable to the implementation plan.
## Output Contract
@@ -133,4 +139,4 @@ uv run --with pytest python -m pytest -v -rs
## Handoff
Return the applicable canonical outputs, status, evidence summary, and blockers to Coordinator Agent. Implementation Planning returns `docs/<feature-id>/implementation-plan.md` for one Implementation Agent handoff. Implementation returns `docs/<feature-id>/implementation-report.md`, `docs/<feature-id>/build-test.md`, and `docs/<feature-id>/reference-comparison.md`; send `pass-for-physics-evaluation` to Physics Evaluation Agent through Coordinator Agent. Correction returns `docs/<feature-id>/corrections.md` and a rerun request to Implementation Agent through Coordinator Agent. Return upstream-contract failures to Coordinator Agent for the owning upstream sub-agent.
Return the applicable canonical outputs, status, evidence summary, and blockers to Coordinator Agent. Implementation Planning returns `docs/<feature-id>/implementation-plan.md` for one Implementation Agent handoff. A non-final Implementation Step returns only its owned status/summary and applicable evidence. The final Implementation-owned verification Step/gate returns `docs/<feature-id>/implementation-report.md`, `docs/<feature-id>/build-test.md`, and `docs/<feature-id>/reference-comparison.md`; send `pass-for-physics-evaluation` to Physics Evaluation Agent through Coordinator Agent. Correction returns `docs/<feature-id>/corrections.md` and a rerun request to Implementation Agent through Coordinator Agent. Return upstream-contract failures to Coordinator Agent for the owning upstream sub-agent.