feat: planner parse-the-bytes-you-inline gate (issue #1 Fix 4)
Adds self-review check #9 to planner Step 5, symmetric to Fix 1: when the profile declares `spec_validation.parsers`, every verbatim code body the plan inlines into a task step whose fence label has an entry must parse clean against the live tool before hand-off. Non-zero exit is a plan failure — the last defensive line before implementer dispatch. Trace goes into the planner session. Targets the surface-language snippets the plan lifts verbatim from the spec (the compound-hallucination bytes); source-language test/impl bodies are out of scope — the implement compile gate catches those. Also adds a Common Rationalisation ("came straight from the spec") and a Red Flag (configured parser, no trace in session). refs #1 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -221,6 +221,26 @@ Before handing the plan off, run this checklist inline:
|
||||
so "nothing ran" cannot masquerade as "nothing
|
||||
regressed". This is a recurring defect family — scrub
|
||||
every Run step whose assertion lives in a filter string.
|
||||
9. **Parse-the-bytes-you-inline gate.** If the project profile
|
||||
declares `spec_validation.parsers`, every verbatim code body
|
||||
the plan inlines into a task step whose fence label has a
|
||||
`parsers` entry must be parsed clean against the live tool
|
||||
before hand-off. For each such block: write it to a temp file
|
||||
with the entry's `ext`, run the entry's `cmd` with `{file}`
|
||||
substituted, require exit 0. A non-zero exit is a plan failure
|
||||
— the plan would hand the implementer bytes that do not parse,
|
||||
the last defensive line before dispatch — fix the plan, do not
|
||||
hand off. The parse-trace goes into the planner's self-review
|
||||
activity (the session) as the attestation the gate fired. The
|
||||
target is the surface-language snippets the plan lifts verbatim
|
||||
(example programs, fixtures); the project's source-language
|
||||
test / implementation bodies are NOT the target — the
|
||||
`implement` compile gate catches those. A block whose fence
|
||||
label has no entry is skipped and the skip noted ("no parser
|
||||
for fence label X"); never a silent pass. A malformed entry
|
||||
(`cmd` without `{file}`, or `ext` / `cmd` missing) is a profile
|
||||
error to surface, not a skip. If the profile declares no
|
||||
`spec_validation`, this check is a documented no-op.
|
||||
|
||||
Fix issues inline.
|
||||
|
||||
@@ -252,6 +272,7 @@ The planner skill does not perform the commit itself.
|
||||
| "Step 5 'implement the parser' is fine, I'll detail it at execution time" | Then it's not a step, it's a wish. Steps are bite-sized OR the plan isn't done. |
|
||||
| "Task 7 is similar to Task 4, just say so" | The executor may read tasks out of order. Repeat the code. |
|
||||
| "The spec has a TBD too, I can pass it through" | Bounce back to `brainstorm`. Plans inherit spec gaps; spec gaps are not plan placeholders. |
|
||||
| "The example program came straight from the spec, it must be valid" | The spec's code blocks are hypotheses, not verified bytes — brainstorm's parse gate can be skipped and a post-spec edit can break them. Re-parse every surface-language body you inline; this is the last line before the implementer hits it (issue #1 Fix 4). |
|
||||
|
||||
## Red Flags — STOP
|
||||
|
||||
@@ -262,6 +283,9 @@ The planner skill does not perform the commit itself.
|
||||
- Step descriptions longer than the code they describe
|
||||
- Header missing parent spec reference
|
||||
- Self-review skipped because "the plan looks fine"
|
||||
- A task step inlining a surface-language code body whose fence
|
||||
label has a configured `spec_validation` parser, handed off
|
||||
without a parse-trace in the planner session
|
||||
|
||||
## Cross-references
|
||||
|
||||
|
||||
Reference in New Issue
Block a user