fix(voyage): S23 — make /trekplan Phase 9 dedup executable (defect #1)
Phase 9's dedup hand-off was broken on two layers, both surfaced by the S22
dogfood: (a) plan-critic + scope-guardian (Read/Glob/Grep, no Write) were told
to write /tmp/*-out.json the dedup helper reads — they cannot; (b) even with
Write, their Output format emits markdown, not the helper's
{agent,findings:[{file,line,rule_key,text}]} schema. readJsonOrNull then
swallowed the absent files -> a silent empty merge that discarded every finding.
Fix (operator-chosen A'): keep the reviewers read-only; make the hand-off run.
- plan-review-dedup.mjs gains a --stdin mode reading {plan_critic,scope_guardian};
malformed stdin exits non-zero so a broken hand-off surfaces loudly instead of
collapsing into a silent empty merge. File mode + its tests are untouched.
- plan-critic.md + scope-guardian.md now emit a trailing machine-readable `json`
findings block (the inline hand-off; no Write tool needed).
- trekplan.md + planning-orchestrator.md Phase 9 rewritten in lockstep: extract
both blocks, pipe via heredoc into --stdin. No temp files, portable, no
pathguard dependency.
TDD: malformed-stdin test failed first (CLI ignored stdin -> exit 0 = the bug),
green after impl. New S23 doc-pin asserts both docs use --stdin (not the dead
/tmp paths) and both agents declare the json block. Suite 724 (722/2/0); live
HEAD baseline was 720, not the stale 705 STATE carried forward.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LqBYc8Ltrk7LipyJmGxXiB
This commit is contained in:
parent
a366e332b7
commit
b4edc12bec
7 changed files with 196 additions and 30 deletions
|
|
@ -273,5 +273,27 @@ quality is not scored and Headless readiness returns to 0.15.
|
|||
- Verdict: [APPROVE | APPROVE_WITH_NOTES | REVISE | REPLAN]
|
||||
```
|
||||
|
||||
### Machine-readable findings block (REQUIRED)
|
||||
|
||||
After the human-readable markdown above, emit **one** fenced `json` block as the
|
||||
**last thing in your response**. The /trekplan orchestrator extracts it verbatim
|
||||
and pipes it (with scope-guardian's) into
|
||||
`lib/review/plan-review-dedup.mjs --stdin`. You have **no Write tool** — returning
|
||||
this block inline *is* the hand-off; do not attempt to write a file.
|
||||
|
||||
```json
|
||||
{
|
||||
"agent": "plan-critic",
|
||||
"findings": [
|
||||
{ "file": "<plan path or source file>", "line": 0, "rule_key": "<dimension/short-id>", "severity": "blocker|major|minor", "text": "<one-line finding>" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
One object per finding. `file`/`line` point at the plan section (use the plan
|
||||
path + the step's line) or the source the finding concerns; `rule_key` is a
|
||||
short, stable id for the finding class (used for exact-match dedup). Emit
|
||||
`"findings": []` when the plan is clean.
|
||||
|
||||
Be specific. Reference exact plan sections, step numbers, and file paths.
|
||||
Never use "generally" or "usually" — cite the specific problem in this specific plan.
|
||||
|
|
|
|||
|
|
@ -417,16 +417,21 @@ have zero data dependencies; serializing them wastes 30–60 seconds per run.
|
|||
missing error handling, scope creep, underspecified steps, AND manifest
|
||||
quality (dimension 10: every step has a valid, regex-compilable,
|
||||
path-verified manifest). Missing or invalid manifest = **major** finding.
|
||||
Write structured JSON to `/tmp/plan-critic-out.json`.
|
||||
Returns its findings as a trailing machine-readable `json` block (it has no
|
||||
Write tool — the block is the hand-off).
|
||||
- `scope-guardian` — verify plan matches the brief's requirements, find scope
|
||||
creep (plan does more than the brief specifies) and scope gaps (plan misses
|
||||
brief requirements), validate file/function references. Confirm every
|
||||
Success Criterion in the brief is covered by the plan's Verification section.
|
||||
Write structured JSON to `/tmp/scope-guardian-out.json`.
|
||||
Returns its findings as a trailing machine-readable `json` block (no Write tool).
|
||||
|
||||
After both complete, run an inline dedup pass via
|
||||
`node ${CLAUDE_PLUGIN_ROOT}/lib/review/plan-review-dedup.mjs --plan-critic /tmp/plan-critic-out.json --scope-guardian /tmp/scope-guardian-out.json > /tmp/plan-review-merged.json`.
|
||||
The merged array attributes each finding to `[plan-critic, scope-guardian]`
|
||||
After both complete, extract each reviewer's trailing `json` findings block and
|
||||
pipe both into the dedup helper via **stdin** (the reviewers are read-only and
|
||||
cannot write temp files; the orchestrator persists by piping their inline blocks):
|
||||
`node ${CLAUDE_PLUGIN_ROOT}/lib/review/plan-review-dedup.mjs --stdin` fed
|
||||
`{ "plan_critic": <block>, "scope_guardian": <block> }`. The helper exits
|
||||
non-zero on malformed stdin, so a broken hand-off cannot hide behind an empty
|
||||
merge. The merged array attributes each finding to `[plan-critic, scope-guardian]`
|
||||
if both reviewers raised it. Revise the plan once for the merged set, not
|
||||
twice for the duplicates. Source: research/05 R1 + R2.
|
||||
|
||||
|
|
|
|||
|
|
@ -122,3 +122,25 @@ Evaluate:
|
|||
- Dependency issues: N
|
||||
- Overall: [ALIGNED | CREEP — plan does too much | GAP — plan does too little | MIXED]
|
||||
```
|
||||
|
||||
### Machine-readable findings block (REQUIRED)
|
||||
|
||||
After the human-readable markdown above, emit **one** fenced `json` block as the
|
||||
**last thing in your response**. The /trekplan orchestrator extracts it verbatim
|
||||
and pipes it (with plan-critic's) into
|
||||
`lib/review/plan-review-dedup.mjs --stdin`. You have **no Write tool** — returning
|
||||
this block inline *is* the hand-off; do not attempt to write a file.
|
||||
|
||||
```json
|
||||
{
|
||||
"agent": "scope-guardian",
|
||||
"findings": [
|
||||
{ "file": "<plan path or source file>", "line": 0, "rule_key": "<creep|gap|dependency|...>", "severity": "blocker|major|minor", "text": "<one-line finding>" }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
One object per scope-creep / gap / dependency finding. `file`/`line` point at the
|
||||
plan step (or the brief requirement) the finding concerns; `rule_key` is a short,
|
||||
stable id for the finding class (used for exact-match dedup against plan-critic).
|
||||
Emit `"findings": []` when the plan is fully aligned.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue