feat(ultraplan-local): parallelize Phase 9 review with inline dedup

Strengthen single-message reinforcement for plan-critic + scope-guardian
parallel dispatch in commands/ultraplan-local.md Phase 9 and mirror in
agents/planning-orchestrator.md Phase 6. Reviewers now write structured JSON
to /tmp/{plan-critic,scope-guardian}-out.json which is merged via the
lib/review/plan-review-dedup.mjs CLI shim from S8.

The merged set lets us revise the plan once for duplicate findings instead
of twice. Source: research/05 R1 + R2.

Pin in tests/lib/doc-consistency.test.mjs locks both files against
single-message + dedup-helper regressions.
This commit is contained in:
Kjell Tore Guttormsen 2026-05-04 07:43:50 +02:00
commit 272638aec1
3 changed files with 57 additions and 4 deletions

View file

@ -675,13 +675,17 @@ Create the parent directory if it does not exist.
## Phase 9 — Adversarial review
Launch two review agents **in parallel**:
Launch two review agents **in parallel — emit both Agent tool calls in a
single assistant message turn** (same pattern as Phase 5 exploration). They
have zero data dependencies; serializing them wastes 3060 seconds per run.
**plan-critic** — adversarial review of the plan.
Prompt: "Review this implementation plan for the task: {task}.
Plan file: {plan path}. Read it and find every problem — missing steps,
wrong ordering, fragile assumptions, missing error handling, scope creep,
underspecified steps. Rate each finding as blocker, major, or minor."
underspecified steps. Rate each finding as blocker, major, or minor.
Write the structured JSON output to `/tmp/plan-critic-out.json` so the
dedup helper can merge with scope-guardian's findings."
**scope-guardian** — scope alignment check.
Prompt: "Check this implementation plan against the brief.
@ -689,7 +693,23 @@ Task: {task}. Brief file: {brief_path}. Plan file: {plan path}.
Find scope creep (plan does more than the brief requires) and scope gaps
(plan misses brief requirements). Check that referenced files and functions
exist. Verify that every Success Criterion in the brief is covered by the
plan's Verification section."
plan's Verification section. Write structured JSON output to
`/tmp/scope-guardian-out.json`."
After both complete, run an inline dedup pass:
```bash
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]`
when both reviewers raised the same issue (exact match on
`file:line:rule_key`, or Jaccard ≥ 0.7 on text tokens). Revise the plan
once for the merged set, not twice for the duplicates. Source: research/05
R1 + R2.
After both complete:
- If **blockers** are found: revise the plan to address them. Add a "Revisions"