pan-wizard 3.34.0 → 3.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +16 -10
  2. package/agents/pan-conductor.md +2 -2
  3. package/agents/pan-debugger.md +3 -1
  4. package/agents/pan-design-checker.md +1 -0
  5. package/agents/pan-designer.md +1 -1
  6. package/agents/pan-executor.md +43 -1
  7. package/agents/pan-experiment-runner.md +1 -1
  8. package/agents/pan-hardener.md +3 -1
  9. package/agents/pan-meta-reviewer.md +1 -1
  10. package/agents/pan-phase-researcher.md +16 -2
  11. package/agents/pan-plan-checker.md +37 -9
  12. package/agents/pan-planner.md +14 -2
  13. package/agents/pan-previewer.md +2 -0
  14. package/agents/pan-project-researcher.md +9 -1
  15. package/agents/pan-research-synthesizer.md +1 -1
  16. package/agents/pan-reviewer.md +8 -2
  17. package/agents/pan-verifier.md +3 -3
  18. package/bin/install-lib.cjs +119 -16
  19. package/bin/install.js +34 -62
  20. package/commands/pan/cost.md +21 -5
  21. package/commands/pan/dashboard.md +0 -3
  22. package/commands/pan/design-phase.md +2 -2
  23. package/commands/pan/hud.md +1 -5
  24. package/commands/pan/knowledge.md +0 -1
  25. package/commands/pan/mcp-bridge.md +1 -3
  26. package/commands/pan/optimize.md +2 -0
  27. package/commands/pan/phase-tests.md +1 -1
  28. package/commands/pan/preview.md +2 -3
  29. package/commands/pan/report.md +1 -5
  30. package/commands/pan/research-phase.md +4 -4
  31. package/commands/pan/review-deep.md +0 -2
  32. package/commands/pan/what-if.md +1 -2
  33. package/hooks/dist/pan-context-monitor.js +12 -3
  34. package/hooks/dist/pan-guard.js +244 -0
  35. package/hooks/dist/pan-statusline.js +5 -2
  36. package/package.json +1 -1
  37. package/pan-wizard-core/bin/lib/commands.cjs +24 -2
  38. package/pan-wizard-core/bin/lib/config.cjs +13 -1
  39. package/pan-wizard-core/bin/lib/core.cjs +9 -4
  40. package/pan-wizard-core/bin/lib/cost.cjs +146 -0
  41. package/pan-wizard-core/bin/lib/doc-lint.cjs +5 -3
  42. package/pan-wizard-core/bin/lib/findings.cjs +239 -23
  43. package/pan-wizard-core/bin/lib/git.cjs +1 -1
  44. package/pan-wizard-core/bin/lib/hygiene.cjs +11 -5
  45. package/pan-wizard-core/bin/lib/init.cjs +6 -0
  46. package/pan-wizard-core/bin/lib/mutate.cjs +257 -0
  47. package/pan-wizard-core/bin/lib/optimize.cjs +13 -1
  48. package/pan-wizard-core/bin/lib/phase-gate.cjs +180 -0
  49. package/pan-wizard-core/bin/lib/phase-remove.cjs +91 -11
  50. package/pan-wizard-core/bin/lib/phase.cjs +61 -9
  51. package/pan-wizard-core/bin/lib/plan-lint.cjs +161 -0
  52. package/pan-wizard-core/bin/lib/preview.cjs +35 -31
  53. package/pan-wizard-core/bin/lib/research-lint.cjs +121 -0
  54. package/pan-wizard-core/bin/lib/roadmap.cjs +1 -0
  55. package/pan-wizard-core/bin/lib/test-gate.cjs +433 -0
  56. package/pan-wizard-core/bin/lib/usage.cjs +104 -0
  57. package/pan-wizard-core/bin/lib/verdict.cjs +140 -10
  58. package/pan-wizard-core/bin/lib/verify-integrity.cjs +181 -0
  59. package/pan-wizard-core/bin/lib/verify-plan-set.cjs +230 -0
  60. package/pan-wizard-core/bin/lib/verify-red.cjs +138 -0
  61. package/pan-wizard-core/bin/lib/verify-scope.cjs +148 -6
  62. package/pan-wizard-core/bin/lib/verify.cjs +27 -27
  63. package/pan-wizard-core/bin/lib/whatif.cjs +48 -6
  64. package/pan-wizard-core/bin/pan-tools.cjs +106 -9
  65. package/pan-wizard-core/mcp/merge-gate.cjs +14 -3
  66. package/pan-wizard-core/mcp/native-tools.cjs +3 -3
  67. package/pan-wizard-core/mcp/orchestrator.cjs +4 -1
  68. package/pan-wizard-core/opencode/pan-wizard.js +36 -8
  69. package/pan-wizard-core/references/design-methodology.md +1 -1
  70. package/pan-wizard-core/references/handoff-decisions.md +1 -1
  71. package/pan-wizard-core/references/model-profiles.md +1 -1
  72. package/pan-wizard-core/references/planning-config.md +3 -3
  73. package/pan-wizard-core/references/verdict-contract.md +6 -1
  74. package/pan-wizard-core/templates/config.json +6 -6
  75. package/pan-wizard-core/templates/debug-subagent-prompt.md +2 -1
  76. package/pan-wizard-core/templates/design.md +5 -4
  77. package/pan-wizard-core/templates/phase-prompt.md +9 -0
  78. package/pan-wizard-core/templates/planner-subagent-prompt.md +2 -0
  79. package/pan-wizard-core/templates/preview-report.md +1 -1
  80. package/pan-wizard-core/templates/research-project/architecture.md +6 -0
  81. package/pan-wizard-core/templates/research-project/features.md +6 -0
  82. package/pan-wizard-core/templates/research-project/pitfalls.md +6 -0
  83. package/pan-wizard-core/templates/research-project/stack.md +6 -0
  84. package/pan-wizard-core/templates/research.md +10 -0
  85. package/pan-wizard-core/templates/state.md +4 -4
  86. package/pan-wizard-core/templates/summary-complex.md +5 -1
  87. package/pan-wizard-core/templates/summary-minimal.md +4 -0
  88. package/pan-wizard-core/templates/summary-standard.md +5 -1
  89. package/pan-wizard-core/templates/summary.md +8 -1
  90. package/pan-wizard-core/workflows/diagnose-issues.md +4 -4
  91. package/pan-wizard-core/workflows/discuss-phase.md +2 -1
  92. package/pan-wizard-core/workflows/exec-phase.md +92 -45
  93. package/pan-wizard-core/workflows/execute-plan.md +3 -1
  94. package/pan-wizard-core/workflows/help.md +103 -44
  95. package/pan-wizard-core/workflows/milestone-gaps.md +2 -2
  96. package/pan-wizard-core/workflows/new-project.md +8 -16
  97. package/pan-wizard-core/workflows/plan-phase.md +40 -8
  98. package/pan-wizard-core/workflows/progress.md +1 -1
  99. package/pan-wizard-core/workflows/quick.md +2 -2
  100. package/pan-wizard-core/workflows/remove-phase.md +11 -1
  101. package/pan-wizard-core/workflows/settings.md +17 -0
  102. package/pan-wizard-core/workflows/todo-check.md +3 -2
  103. package/pan-wizard-core/workflows/transition.md +4 -0
  104. package/pan-wizard-core/workflows/verify-phase.md +40 -47
  105. package/scripts/build-help.cjs +106 -0
  106. package/scripts/build-hooks.js +1 -0
  107. package/scripts/generate-skills-docs.py +2 -2
  108. package/scripts/mutation-probe.cjs +7 -80
  109. package/scripts/prompt-lint.cjs +167 -0
  110. package/scripts/test-surface.cjs +169 -6
package/README.md CHANGED
@@ -101,7 +101,7 @@ PAN is the context engineering layer that makes Claude Code reliable. It breaks
101
101
 
102
102
  - **A human merges.** The Release squad prepares a squash-merge and surfaces an `always-ask` approval instead of merging; pair it with branch protection on your repo, which is what makes that unbypassable rather than merely instructed. Recovery is `git revert` or the previous tag, never a force-push.
103
103
  - **Isolated builders.** Each Build agent forks its own `army/<task>` branch + git worktree, so parallel agents never share a file.
104
- - **Caps.** Delegation-depth cap, per-cycle spawn + budget ceilings, and a `.planning/orchestration/abort` kill-switch, re-checked before every spawn by Mission Control's protocol (prompt-enforced; the MCP `pan_next_action` path enforces the cycle cap, the budget cap when `caps.enforceBudget` is set, an `aborted` flag the caller sets (it does not read the abort file) and the human gate in code — delegation depth is bounded by which agents hold the `Task` tool) — the same harness as hierarchical exec, at campaign scale.
104
+ - **Caps.** Delegation-depth cap, per-cycle spawn + budget ceilings, and a `.planning/orchestration/abort` kill-switch, re-checked before every spawn by Mission Control's protocol (prompt-enforced; the MCP `pan_next_action` path applies the cycle cap, the budget cap (when `caps.enforceBudget` is set) and an `aborted` flag to the counts and caps the caller passes in — it tracks none of them and does not read the abort file; only the merge is gated independently of the caller, by `pan_confirm_merge`'s human approval token — delegation depth is bounded by which agents hold the `Task` tool) — the same harness as hierarchical exec, at campaign scale.
105
105
 
106
106
  **Run it over days.** `--schedule` arms a resumable campaign with a per-day budget that burns the backlog down across sessions (the per-day budget is advisory unless the schedule is armed with `--enforce-budget`, which pauses the day's run once spent — `campaign status` shows the day's spend — and an external scheduler triggers each `--continue`) — and *still* waits for you at every merge. **Autonomy runs up to the irreversible step; a human is at the step.**
107
107
 
@@ -364,6 +364,9 @@ The system:
364
364
  2. **Fresh context per plan** — a whole context window purely for implementation, zero accumulated garbage (native sub-agent spawning on Claude Code; the other runtimes delegate through their own agent mechanism)
365
365
  3. **Commits per task** — Every task gets its own atomic commit (consecutive trivial chore or docs tasks may be coalesced into one)
366
366
  4. **Verifies against goals** — Checks the codebase delivers what the phase promised (skipped, and said so, when `workflow.verifier` is off)
367
+ 5. **Gates completion** — `phase complete` refuses (the default `workflow.phase_gate: enforce`) when a check fails, such as a plan with no summary, a missing, failing or stale verification, or an open critical or high finding, and lists each reason. `pan-tools phase gate <N>` runs the check alone
368
+
369
+ After each wave it also reports the phase's spend once it nears or reaches the phase budget (`cost.phase_budget_usd`, $20 by default; a warning, never a stop).
367
370
 
368
371
  Walk away, come back to completed work with clean git history.
369
372
 
@@ -415,7 +418,7 @@ Automated verification checks that code exists and tests pass. `/pan:verify-phas
415
418
 
416
419
  The system:
417
420
 
418
- 1. **Gates on the test suite** — a failing (or non-running) suite forces the verdict to `gaps_found`; the must-have checks still run so the report is complete
421
+ 1. **Gates on the test suite** — the engine runs the project's tests (`pan-tools test run`) and the verifier copies the result into `test_gate` rather than judging it; the must-have checks still run so the report is complete. A failed gate, in the verification or in the engine's test-run record, lowers a `passed` status to `gaps_found` when the verdict is recorded (`test_gate_failed_under_pass` names the first case); reconcile flags a `test_gate` that disagrees with the record, and the phase gate reports a failed test run as `test_failed`
419
422
  2. **Checks every must-have** — each phase promise is verified against the code, not the task list
420
423
  3. **Reports the gaps** — a verification report with a per-truth status and the recommended fix plans
421
424
  4. **Hands the gaps to the planner** — `/pan:plan-phase N --gaps` writes the fix plans (`gap_closure: true`); `/pan:exec-phase N --gaps-only` runs just those
@@ -528,14 +531,15 @@ Every stage uses the same pattern: a thin orchestrator spawns specialized agents
528
531
 
529
532
  The orchestrator never does heavy lifting. It spawns agents, waits, integrates results.
530
533
 
531
- **The result:** You can run an entire phase — deep research, multiple plans created and verified, thousands of lines of code written across parallel executors, automated verification against goals — and your main context window stays at 30-40%. The work happens in fresh subagent contexts. Your session stays fast and responsive.
534
+ **The result:** You can run an entire phase — deep research, multiple plans created and verified, thousands of lines of code written across parallel executors, automated verification against goals — and your main context window stays small, because the work happens in fresh subagent contexts. Your session stays fast and responsive.
532
535
 
533
536
  ### Reasoning-Trace Handoff
534
537
 
535
538
  When agents hand work off via files, only OUTPUTS get passed by default — not the reasoning that produced them. Per Cognition's "Don't build multi-agents" research (June 2025), silent decisions force downstream agents to reconcile contradictions blindly. PAN passes the reasoning explicitly:
536
539
 
537
540
  - Plans carry a `## Plan Decisions` section (Locked / Open / Considered+rejected buckets) — the executor reads it before coding so it doesn't re-argue settled choices.
538
- - Summaries carry an `## Implementation Decisions` section — the verifier reads it to understand WHY the executor deviated from the plan, not just THAT it did.
541
+ - Summaries carry an `## Implementation Decisions` section — the verifier reads it to understand WHY the executor deviated from the plan, not just THAT it did. An executor unsure of something it finished returns `## DONE_WITH_CONCERNS`, each concern with its cost if wrong, and the reviewer is told to check them.
542
+ - Plans carry a `## Review Focus` section (the untested inputs and failure modes their requirements imply) and cite the design's `DD-N` decisions; `pan-tools verify review-focus` and `pan-tools verify decisions` check both in code, and the reviewer reads the phase's actual diff (`pan-tools review scope`) with that intent beside it.
539
543
 
540
544
  The plan-checker enforces this with dedicated dimensions for Spec Sufficiency for Handoff and Decision Trace Completeness. Schema lives in `pan-wizard-core/references/handoff-decisions.md`.
541
545
 
@@ -582,7 +586,7 @@ You're never locked in. The system adapts.
582
586
  | **Context rot prevention** | Phase-scoped fresh context windows (native sub-agents on Claude Code) | No — context degrades over time | No (Cline: condensing) | No |
583
587
  | **Multi-agent** | Specialized agents, parallel waves | Parallel agents in worktrees (Cursor) | Single agent (Cline: subagents) | Custom agents as subagents |
584
588
  | **Plan → Verify loop** | Research → plan → verify with iteration | Agent generates plan | Plan mode (Cline) | Plan step |
585
- | **Post-execution verification** | Auto verifier + human UAT | Iterative error-fix | Manual test runs | Auto-fix loop |
589
+ | **Post-execution verification** | Auto verifier with a test-suite gate (UAT is a template no command runs) | Iterative error-fix | Manual test runs | Auto-fix loop |
586
590
  | **Session persistence** | state.md + pause/resume + handoff | Memory tool / transcripts | None / checkpoints (Cline) | Copilot Memory, CLI session recovery |
587
591
  | **Runtime support** | Claude Code, OpenCode, Gemini CLI, Codex, Copilot CLI | IDE-locked | Terminal / VS Code | VS Code + CLI |
588
592
  | **Zero dependencies** | Yes (Node builtins only) | No (Electron) | No (Python / Node) | No |
@@ -630,7 +634,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
630
634
 
631
635
  | Command | What it does |
632
636
  |---------|--------------|
633
- | `/pan:army "<goal>"` | Campaign-scale delivery: Mission Control delegates a whole-project goal to architecture/build/quality/release squads with branch-per-agent worktrees, behind CI + a human merge gate; `--schedule`/`--continue` run it over time |
637
+ | `/pan:army "<goal>"` | Campaign-scale delivery: Mission Control delegates a whole-project goal to architecture/build/quality/release squads with branch-per-agent worktrees, behind CI + a human merge gate (prompt-enforced on `/pan:army`; enforced in code on the MCP path); `--schedule`/`--continue` run it over time |
634
638
 
635
639
  ### Phase Management
636
640
 
@@ -653,7 +657,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
653
657
 
654
658
  | Command | What it does |
655
659
  |---------|--------------|
656
- | `/pan:settings` | Configure model profile and workflow agents |
660
+ | `/pan:settings` | Configure model profile, workflow agents, branching and the phase budget |
657
661
  | `/pan:profile <profile>` | Switch model profile (quality/balanced/budget) |
658
662
  | `/pan:todo-add [desc]` | Capture idea for later |
659
663
  | `/pan:todo-check` | List pending todos |
@@ -662,7 +666,7 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
662
666
  | `/pan:health [--repair]` | Validate `.planning/` directory integrity; `--repair` fixes the issues it marks repairable |
663
667
  | `/pan:hygiene [--apply] [--trace-age-days N] [--all-tracks]` | Scan for PAN version drift and stale project artifacts (legacy filenames, .tmp orphans, memory bloat and stale or expired memory entries, poisoned cost ledgers, trace and report debris, cached-context bloat, fragment planning dirs) and Claude Code's own memory index (reported, never edited); `--apply` executes the safe fixes — poisoned ledgers are quarantined by rename (only the newest quarantine copy is kept), and settled `state.md` history, shipped roadmap phases and stale memory entries are archived rather than dropped |
664
668
  | `/pan:links [--strict] [--doc-root <dir>] [--source-root <dir>]` | Validate the doc-code link graph: inline `[[<id>]]` refs, `// @pan:` source anchors, `require-code-mention` contracts (ADR-0027). The default roots are PAN's own source layout, so pass your project's roots |
665
- | `/pan:phase-tests <N> [instructions]` | Generate tests for a completed phase based on UAT criteria |
669
+ | `/pan:phase-tests <N> [instructions]` | Generate tests for a completed phase from its summaries, context decisions and verification report |
666
670
  | `/pan:milestone-cleanup` | Archive accumulated phase directories from completed milestones |
667
671
  | `/pan:retro` | Milestone retrospective — estimation accuracy, verification patterns, gap analysis |
668
672
  | `/pan:patches` | Restore local modifications after a PAN update |
@@ -700,8 +704,8 @@ PAN is not a replacement for your IDE or AI agent — it's the orchestration lay
700
704
 
701
705
  | Command | What it does |
702
706
  |---------|--------------|
703
- | `/pan:cost` | Token usage + estimated cost across PAN invocations (json/table/chart) |
704
- | `/pan:preview phase <N>\|phases\|milestone` | Read-only foresight: blast radius, dependency graph, milestone ETA |
707
+ | `/pan:cost` | Token usage + estimated cost across PAN invocations (json/table/chart), and `budget`: a phase's spend against its budget (`cost.phase_budget_usd`, $20 by default, warn only; change it with `/pan:settings`); `pan-tools usage` is a local census of which installed commands and agents this project has used |
708
+ | `/pan:preview phase <N>\|phases\|milestone` | Read-only foresight: blast radius, a p10/p50/p90 cost forecast from the project's own cost ledger, dependency graph, milestone ETA |
705
709
  | `/pan:review-deep <phase>` | Security audit (OWASP + STRIDE) + cross-check by meta-reviewer |
706
710
  | `/pan:knowledge {ask\|discuss\|playbook}` | Grounded Q&A, multi-turn discussion, or aggregate memory into playbook |
707
711
  | `/pan:what-if <phase> "scenario"` | Counterfactual phase replay in isolated git worktree |
@@ -730,6 +734,8 @@ PAN stores project settings in `.planning/config.json`. Configure during `/pan:n
730
734
  |---------|---------|---------|------------------|
731
735
  | `mode` | `yolo`, `interactive` | chosen at `/pan:new-project` (`yolo` is the recommended answer; `--auto` always sets it) | Auto-approve vs confirm at each step |
732
736
  | `depth` | `quick`, `standard`, `comprehensive` | chosen at `/pan:new-project` (`--auto` uses `quick` unless the idea document's frontmatter sets `planning_depth`) | Planning thoroughness (phases × plans) |
737
+ | `cost.phase_budget_usd` | dollars, `0` = off | `20` | Spend per phase PAN warns about (API-equivalent dollars): at 80% and once a phase reaches it. Warns only; never stops a run |
738
+ | `workflow.phase_gate` | `enforce`, `warn` | `enforce` (also when the key is absent) | Whether `phase complete` refuses a phase that fails its gate. Override once with `phase complete <N> --force --reason "<why>"`; `warn` completes and reports the reasons |
733
739
 
734
740
  ### Model Profiles
735
741
 
@@ -51,7 +51,7 @@ Given a phase plan, decompose into **sub-tasks** that correspond to sub-agents:
51
51
  - **Executor sub-agents (up to 6):** one per `-plan.md` file that's marked `autonomous: true` in frontmatter. Non-autonomous plans need user checkpoints, which you cannot pause for: do not run them, and list them under "Skipped" in your summary with the instruction to run them with `/pan:exec-phase <N>` (no `--hierarchical`) — nothing runs them after you return.
52
52
  - **Reviewer (1):** spawn a `pan-reviewer` after all executors complete, unless `--skip-review` or `--fast` was passed.
53
53
  - **Verifier (1):** spawn a `pan-verifier` after the reviewer, unless `workflow.verifier` is false.
54
- - Optional hardener + meta-reviewer (2): only if `--deep-review` was also passed.
54
+ - Optional hardener + meta-reviewer (2): only if `--deep-review` was also passed and the reviewer ran — like exec-phase, skip the deep review under `--skip-review` or `--fast`, since its merge needs the reviewer's report.
55
55
 
56
56
  3. **Wave grouping:** executors with no cross-plan dependencies can be grouped (within the 12-spawn cap). Sequential executors when `depends_on:` frontmatter indicates.
57
57
 
@@ -108,7 +108,7 @@ For each phase execution:
108
108
  a. Spawn pan-reviewer (always, unless --skip-review or --fast)
109
109
  b. Save its returned report verbatim to {phase_dir}/{phase_number}-review.md (the reviewer is read-only; exec-phase's code_review step saves it the same way), then: pan-tools findings record --phase <N> --agent pan-reviewer --file {phase_dir}/{phase_number}-review.md
110
110
  5. After reviewer:
111
- a. If --deep-review: spawn pan-hardener (<output_path> .planning/reviews/<N>/hardener.md), then pan-meta-reviewer (<output_path> .planning/reviews/<N>/meta.md)
111
+ a. If --deep-review and the reviewer ran (not --skip-review/--fast): spawn pan-hardener (<output_path> .planning/reviews/<N>/hardener.md), then pan-meta-reviewer (<output_path> .planning/reviews/<N>/meta.md)
112
112
  b. Merge: pan-tools review-deep merge <N> --reviewer-file {phase_dir}/{phase_number}-review.md --hardener-file .planning/reviews/<N>/hardener.md --meta-file .planning/reviews/<N>/meta.md
113
113
  6. Spawn pan-verifier — unless `workflow.verifier` is false: then report "verification skipped (workflow.verifier is off)", as exec-phase does
114
114
  7. Emit final orchestration summary
@@ -830,6 +830,8 @@ gathering -> investigating -> fixing -> verifying -> awaiting_human_verify -> re
830
830
  ^ | | |
831
831
  |____________|___________|_________________|
832
832
  (if verification fails or user reports issue)
833
+
834
+ goal: find_root_cause_only → gathering -> investigating -> diagnosed (stops there)
833
835
  ```
834
836
 
835
837
  ## Resume Behavior
@@ -1060,7 +1062,7 @@ mv .planning/debug/{slug}.md .planning/debug/resolved/
1060
1062
 
1061
1063
  ```bash
1062
1064
  INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state load)
1063
- # commit_docs is in the JSON output
1065
+ # commit_docs is at .config.commit_docs in the JSON output
1064
1066
  ```
1065
1067
 
1066
1068
  **Commit the fix:**
@@ -90,6 +90,7 @@ contract is in `~/.claude/pan-wizard-core/references/verdict-contract.md`. How t
90
90
  `unrequested`, every other dimension → `partial`.
91
91
  - Each gap is `high`. A gap you report as a caveat on the final iteration is `medium`.
92
92
  - `where` is the design section.
93
+ - **On a re-check you are given `<open_findings>`:** your earlier open findings on this phase, each with its `id`. Answer every one in a `resolutions` list in the block: `{"id":"f_…","status":"resolved","evidence":"what you checked and saw"}` when it is fixed, `still_present` when it is not, `cannot_tell` when you could not check it. A finding you leave out stays open: silence never closes a finding, and `resolved` without evidence closes nothing.
93
94
 
94
95
  The orchestrator records the block, so it must say what your verdict says.
95
96
 
@@ -55,7 +55,7 @@ Produce `{phase}-design.md` from the template at the `phase` tier:
55
55
 
56
56
  1. **Problem & scope** — the phase's problem and its fixed boundary.
57
57
  2. **Success criteria** — 3–7, **at least 2 machine-checkable**, each naming its automated check.
58
- 3. **Architecture & synthesis** — discovered conventions (cited), components/boundaries (no layer violations), a concrete interface contract, filesystem scope, and a design-decisions table (chosen vs rejected + rationale).
58
+ 3. **Architecture & synthesis** — discovered conventions (cited), components/boundaries (no layer violations), a concrete interface contract, filesystem scope, and a design-decisions table (chosen vs rejected + rationale). Record a decision only when it passes the three-question test: hard to reverse once code depends on it, a reasonable engineer could have chosen otherwise, and more than one task or plan depends on it. Give each one an id in the table's first column (`DD-1`, `DD-2` …); plans cite these ids, and `pan-tools verify decisions` flags a citation of an unrecorded id and a recorded decision no plan cites. Leave the rest to the planner.
59
59
  4. **Phase-scoped ADR** — context (problem, forces, current state, requirements traceability), decision (numbered sub-decisions with rationale), consequences (positive AND negative, every negative mitigated or explicitly accepted). No placeholder/skeleton sections.
60
60
  5. **Threat-lite** — the change's own attack surface (input validation, path traversal, injection, privilege): each threat mitigated or explicitly accepted.
61
61
  6. **Test hooks** — how each success criterion is verified; seed inputs for the machine-checkable ones.
@@ -183,6 +183,23 @@ Only auto-fix issues DIRECTLY caused by the current task's changes. Pre-existing
183
183
  - Do NOT fix them
184
184
  - Do NOT re-run builds hoping they resolve themselves
185
185
 
186
+ **TESTS ARE THE SPEC, NOT AN OBSTACLE:**
187
+ Test files your plan does not list in `files_modified` are read-only. In any test file, never delete or rename a test, add a skip or only marker (`.skip`, `.only`, `xit`, `{ skip: true }`, `@pytest.mark.skip`, `t.Skip`, `#[ignore]`, `@Disabled`), remove an assertion, rewrite an expectation or a snapshot to match what the code now does, or add an assertion that cannot fail. `pan-tools verify test-integrity <phase>` checks the phase's commits for these, and a violation fails the phase gate: exec-phase will not auto-advance, and under `workflow.phase_gate: enforce` the phase cannot be completed without an override.
188
+
189
+ When a test and your task cannot both be satisfied (the test asserts behaviour the plan changes, or the task is impossible as specified), stop. Do not edit the test. Return:
190
+
191
+ ```markdown
192
+ ## BLOCKED_SPEC_CONFLICT
193
+
194
+ **Plan:** {phase}-{plan}
195
+ **Test:** {file}:{line} — what it asserts
196
+ **Requirement:** the task or requirement it conflicts with
197
+ **Why both cannot hold:** one or two sentences
198
+ **Options:** change the test (needs a plan that declares it) · change the requirement · something else
199
+ ```
200
+
201
+ A person rules on it. Commit the work you finished before stopping.
202
+
186
203
  **FIX ATTEMPT LIMIT:**
187
204
  Track auto-fix attempts per task. After 3 auto-fix attempts on a single task:
188
205
  - STOP fixing — document remaining issues in summary.md under "Deferred Issues"
@@ -386,10 +403,15 @@ Write these into the summary's `## Implementation Decisions` section per the sch
386
403
  - **Fix:** [what was done]
387
404
  - **Files modified:** [files]
388
405
  - **Commit:** [hash]
406
+ - **Cost if wrong:** [low | medium | high] — [what breaks, and for whom, if this call was the wrong one]
389
407
  ```
390
408
 
391
409
  Or: "None - plan executed exactly as written."
392
410
 
411
+ Every deviation records why you made it and its cost if wrong, including the `DV-N` lines under `## Implementation Decisions`. A reviewer reads the high-cost ones first.
412
+
413
+ **Concerns:** what you finished but are not sure of, such as an assumption you could not check, a path no test reaches, a deviation whose cost if wrong is high, or a requirement you met only in part. List each under the summary's `## Concerns` as `- C-1: <concern>. Why: <what makes you unsure>. Cost if wrong: <low | medium | high> — <what breaks>.`, or write "None". Do not hide a concern to return a clean result: a concern stated now costs a review, and one found later costs a fix round.
414
+
393
415
  **Auth gates section** (if any occurred): Document which task, what was needed, outcome.
394
416
  </summary_creation>
395
417
 
@@ -453,7 +475,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs requirements mark-complete ${RE
453
475
  **State command behaviors:**
454
476
  - `state advance-plan`: Increments Current Plan, detects last-plan edge case, sets status
455
477
  - `state update-progress`: Recalculates progress bar from summary.md counts on disk
456
- - `state record-metric`: Appends to Performance Metrics table
478
+ - `state record-metric`: Appends a per-plan row to the Performance Metrics table
457
479
  - `state add-decision`: Adds to Decisions section, removes placeholders
458
480
  - `state record-session`: Updates Last session timestamp and Stopped At fields
459
481
  - `roadmap update-plan-progress`: Updates roadmap.md progress table row with PLAN vs SUMMARY counts
@@ -491,6 +513,26 @@ Separate from per-task commits — captures execution results only.
491
513
  ```
492
514
 
493
515
  Include ALL commits (previous + new if continuation agent).
516
+
517
+ When every task is done but the summary's `## Concerns` lists at least one concern, return `## DONE_WITH_CONCERNS` instead of `## PLAN COMPLETE`. The plan is complete either way; this tells the orchestrator what to look at:
518
+
519
+ ```markdown
520
+ ## DONE_WITH_CONCERNS
521
+
522
+ **Plan:** {phase}-{plan}
523
+ **Tasks:** {completed}/{total}
524
+ **SUMMARY:** {path to summary.md}
525
+
526
+ **Commits:**
527
+ - {hash}: {message}
528
+
529
+ **Concerns:**
530
+ - C-1: {concern}. Why: {what makes you unsure}. Cost if wrong: {low | medium | high} — {what breaks}
531
+
532
+ **Duration:** {time}
533
+ ```
534
+
535
+ A plan you could not finish is not this: return `## CHECKPOINT REACHED` or `## BLOCKED_SPEC_CONFLICT`.
494
536
  </completion_format>
495
537
 
496
538
  <success_criteria>
@@ -105,7 +105,7 @@ After the run completes, produce a concise structured summary:
105
105
  - <e.g., "External session ran a tight 14-cycle focus-auto loop">
106
106
 
107
107
  ### Recommendation for /pan:learn
108
- - Run `/pan:learn --experiment <slug>` to extract patterns from the trace.
108
+ - Run `/pan:experiment harvest <slug>`, then `/pan:learn --experiment <slug>` to extract patterns from the trace (learn reads the harvest folder, not the experiment folder).
109
109
  - Especially check: <areas of high event density / repeated failures>
110
110
  ```
111
111
 
@@ -12,7 +12,7 @@ You are the PAN hardener. You perform focused security review on files changed d
12
12
 
13
13
  This is **authorized, defensive** secure-coding review of the user's own codebase — the goal is to find and fix weaknesses before shipping. You report findings for the user to remediate; you never write exploit code, attack tooling, or step-by-step intrusion instructions.
14
14
 
15
- You are spawned by `/pan:review-deep <phase>` or `/pan:exec-phase --deep-review`. Your output is read by `pan-meta-reviewer` (cross-checks you) and merged by `review-deep.cjs` into `.planning/reviews/<phase>/deep-review.md`.
15
+ You are spawned by `/pan:review-deep <phase>`, `/pan:exec-phase --deep-review`, `/pan:focus-exec --deep-review` (per item, output under `.planning/reviews/<item-id>/`) or `/pan:focus-auto` Pass 3. Your output is read by `pan-meta-reviewer` (cross-checks you) and merged by `review-deep.cjs` into `.planning/reviews/<phase>/deep-review.md`.
16
16
 
17
17
  **You NEVER modify source files.** Your one write is the report at the output path your prompt gives. You report findings; the user fixes them.
18
18
 
@@ -93,6 +93,8 @@ generated: <ISO timestamp>
93
93
  <optional: what you explicitly did NOT audit and why>
94
94
  ```
95
95
 
96
+ Report every security finding, including ones the project dismissed before. The findings ledger never suppresses a security finding, whoever raised it, so a dismissal never excuses leaving one out.
97
+
96
98
  **Severity scale:**
97
99
  - `critical` — remotely reachable with no prerequisites; use sparingly, only when one misuse leads to data loss or remote code execution.
98
100
  - `high` — exploitable with typical user privileges; blocks merge by default.
@@ -15,7 +15,7 @@ You are the PAN meta-reviewer. Your job is to check the first-pass reviewers (`p
15
15
  3. **Redundant findings** — the same issue reported by both reviewers; mark one as duplicate.
16
16
  4. **Category errors** — convention issues miscategorized as security, or vice versa.
17
17
 
18
- You are spawned by `/pan:review-deep <phase>` after both the reviewer and hardener have written their reports. Your output is merged with theirs by `review-deep.cjs`.
18
+ You are spawned by `/pan:review-deep <phase>` after both the reviewer and hardener have written their reports, or by `/pan:focus-exec --deep-review` with the hardener's report alone (an item has no first-pass review: check the hardener against the diff, and skip the reviewer-side coverage and duplicate checks). Your output is merged with theirs by `review-deep.cjs`.
19
19
 
20
20
  **You NEVER modify source code.** You produce one findings file. This is authorized, defensive review of the user's own codebase — you adjudicate security findings for remediation; never produce exploit code.
21
21
 
@@ -142,7 +142,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs websearch "your query" --limit
142
142
 
143
143
  **Options:**
144
144
  - `--limit N` — Number of results (default: 10)
145
- - `--freshness day|week|month` — Restrict to recent content
145
+ - `--freshness day|week|month|year` — Restrict to recent content
146
146
 
147
147
  If `brave_search: false` (or not set), use built-in WebSearch tool instead.
148
148
 
@@ -342,6 +342,12 @@ Verified patterns from official sources:
342
342
 
343
343
  *(If no gaps: "None — existing test infrastructure covers all phase requirements")*
344
344
 
345
+ ## Claims
346
+
347
+ | Claim | Type | Source | Checked |
348
+ |-------|------|--------|---------|
349
+ | [what is true] | [version / api / pricing / security / practice / general] | [URL, doc section or Context7 id] | [YYYY-MM-DD] |
350
+
345
351
  ## Sources
346
352
 
347
353
  ### Primary (HIGH confidence)
@@ -411,7 +417,7 @@ Also read `.planning/config.json` — if `workflow.nyquist_validation` is `true`
411
417
 
412
418
  Then read context.md if exists:
413
419
  ```bash
414
- cat "$phase_dir"/*-context.md 2>/dev/null
420
+ cat "$PHASE_DIR"/*-context.md 2>/dev/null
415
421
  ```
416
422
 
417
423
  **If context.md exists**, it constrains research:
@@ -501,6 +507,14 @@ Write to: `$PHASE_DIR/$PADDED_PHASE-research.md`
501
507
 
502
508
  ⚠️ `commit_docs` controls git only, NOT file writing. Always write first.
503
509
 
510
+ **Claims with provenance.** Every fact a plan will rest on (a version, an API's behaviour, a price, a security advisory, a practice) gets a row in `## Claims` with its type, its source and the day you checked it. A claim you could not source is an open question, not a claim. Then lint the file:
511
+
512
+ ```bash
513
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs research lint "$PHASE_DIR/$PADDED_PHASE-research.md"
514
+ ```
515
+
516
+ Exit 1 lists claims with no source or no date: fix them before you return. `stale` lists claims older than their type's window (30 days for versions, prices and security, 90 for APIs, 365 for practices): check them again, or say in Open Questions that they were not rechecked.
517
+
504
518
  ## Step 7: Commit Research (optional)
505
519
 
506
520
  ```bash
@@ -61,7 +61,7 @@ If context.md exists, add verification dimension: **Context Compliance**
61
61
  | Section | How You Use It |
62
62
  |---------|----------------|
63
63
  | Architecture & interface contract | Plans MUST implement this architecture. Flag if a plan invents a different one or contradicts the interface contract. |
64
- | Design decisions / ADR | LOCKED — plans must realize these decisions, not re-open them. |
64
+ | Design decisions / ADR | LOCKED — plans must realize these decisions, not re-open them. Decisions carry ids (`DD-N`) that plans cite (Dimension 14). |
65
65
  | Success criteria (machine-checkable) | Every machine-checkable criterion must have a task that satisfies it, with its named check. |
66
66
 
67
67
  If design.md exists, add verification dimension: **Design Conformance**
@@ -246,8 +246,8 @@ issue:
246
246
  ```yaml
247
247
  issue:
248
248
  dimension: scope_sanity
249
- severity: warning
250
- description: "Plan 01 has 5 tasks - split recommended"
249
+ severity: blocker
250
+ description: "Plan 01 has 5 tasks - split required"
251
251
  plan: "01"
252
252
  metrics:
253
253
  tasks: 5
@@ -525,6 +525,33 @@ issue:
525
525
  fix_hint: "Either fill at least one bucket OR replace with the single line 'No decisions worth documenting — plan is mechanical implementation of must_haves.'"
526
526
  ```
527
527
 
528
+ ## Dimension 13: Review Focus
529
+
530
+ **Question:** Does each plan's `## Review Focus` name the inputs and failure modes its requirements imply that no test covers yet?
531
+
532
+ The workflow ran `pan-tools verify review-focus` before spawning you, so the structure is already checked: the section exists, it has at most five items (or one `None — <reason>` line), and each item names an existing task and a test. Judge the content:
533
+
534
+ - Is each item a real input or failure mode the requirements or must_haves imply (an empty list, a duplicate key, a timeout, a malformed file), not a restated task?
535
+ - Does the named task own the code that input reaches, and would the named test fail if that input were mishandled?
536
+ - Did the plan miss an obvious one, such as an error path a requirement names that no task's tests reach? → WARNING
537
+ - Is `None — <reason>` credible for this plan? A plan that parses user input and claims none → WARNING
538
+
539
+ ## Dimension 14: Decision Spine (if design.md exists)
540
+
541
+ **Question:** Does each plan rely only on decisions the design records?
542
+
543
+ The workflow ran `pan-tools verify decisions` before spawning you. It already flags a plan citing a `DD-N` id the design does not record, and a recorded decision no plan cites. Judge what code cannot read: a plan that makes a design-level choice (a storage engine, a protocol, a public interface, a dependency) that is neither a recorded `DD-N` nor in context.md's locked decisions relies on an unrecorded decision → BLOCKER, with a fix_hint to cite the decision that covers it, or to send the choice back to `/pan:design-phase`. A choice local to one task is the planner's to make, not a design decision.
544
+
545
+ ## Dimension 15: Research Freshness
546
+
547
+ **Question:** Do the plans rest on research claims that are unsourced or out of date?
548
+
549
+ The prompt's `<research_claims>` block is `pan-tools research lint` over the phase's research: `errors` are claims with no source or no checked date, and `stale` lists claims older than their type's window (a version, price or security advisory after 30 days, an API after 90, a practice after 365). For each one a plan relies on (a pinned version, an API call, a price in a budget, a security setting):
550
+
551
+ - unsourced or undated → WARNING, fix_hint: source it, or move it to Open Questions
552
+ - stale, and the plan's correctness depends on it (a version pinned in a task, an API's behaviour a task assumes) → WARNING, fix_hint: recheck it before execution, or add a task that verifies it
553
+ - stale but incidental to the plans → no issue
554
+
528
555
  </verification_dimensions>
529
556
 
530
557
  <verification_process>
@@ -541,11 +568,11 @@ Extract from init JSON: `phase_dir`, `phase_number`, `has_plans`, `plan_count`.
541
568
  Orchestrator provides context.md content in the verification prompt. If provided, parse for locked decisions, discretion areas, deferred ideas.
542
569
 
543
570
  ```bash
544
- ls "$phase_dir"/*-plan.md 2>/dev/null
571
+ ls "$PHASE_DIR"/*-plan.md 2>/dev/null
545
572
  # Read research for Nyquist validation data
546
- cat "$phase_dir"/*-research.md 2>/dev/null
547
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase "$phase_number"
548
- cat "$phase_dir"/*-design.md 2>/dev/null # approved design from /pan:design-phase (Design Conformance)
573
+ cat "$PHASE_DIR"/*-research.md 2>/dev/null
574
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase "$PHASE"
575
+ cat "$PHASE_DIR"/*-design.md 2>/dev/null # approved design from /pan:design-phase (Design Conformance)
549
576
  ```
550
577
 
551
578
  **Extract:** Phase goal, requirements (decompose goal), locked decisions, deferred ideas.
@@ -660,7 +687,7 @@ Missing: No mention of fetch/API call → Issue: Key link not planned
660
687
  ## Step 8: Assess Scope
661
688
 
662
689
  ```bash
663
- for plan in "$phase_dir"/*-plan.md; do
690
+ for plan in "$PHASE_DIR"/*-plan.md; do
664
691
  grep -cE "<task[ >]" "$plan" # "<task" alone also counts the <tasks> wrapper; Step 2's task_count is the same number
665
692
  grep "files_modified:" "$plan"
666
693
  done
@@ -766,6 +793,7 @@ Return all issues as a structured `issues:` YAML list (see dimension examples fo
766
793
  - `verdict` is `passed` or `issues_found` (the status from Step 10), and `outcome` is `pass` or `fail`.
767
794
  - Add one finding per issue you list. Blocker → `high`, warning → `medium`, info → `info`. The class follows the dimension, as mapped in the reference.
768
795
  - `where` is the plan file, plus `#task-N` when the issue is about one task.
796
+ - **On a re-check you are given `<open_findings>`:** your earlier open findings on this phase, each with its `id`. Answer every one in a `resolutions` list in the block: `{"id":"f_…","status":"resolved","evidence":"what you checked and saw"}` when it is fixed, `still_present` when it is not, `cannot_tell` when you could not check it. A finding you leave out stays open: silence never closes a finding, and `resolved` without evidence closes nothing.
769
797
 
770
798
  The orchestrator records the block, and the record is what it branches on. The block must say the same thing as your heading.
771
799
 
@@ -838,7 +866,7 @@ End it with one finding per listed issue:
838
866
 
839
867
  ````markdown
840
868
  ```pan-verdict
841
- {"contract":"1.0","agent":"pan-plan-checker","phase":"{phase}","verdict":"issues_found","outcome":"fail","findings":[{"class":"missing","severity":"high","where":"{phase}-01-plan.md","summary":"requirement AUTH-02 (password reset) has no covering task"},{"class":"risk","severity":"medium","where":"{phase}-02-plan.md","summary":"plan 02 modifies 12 files across 5 tasks; split it"}]}
869
+ {"contract":"1.0","agent":"pan-plan-checker","phase":"{phase}","verdict":"issues_found","outcome":"fail","findings":[{"class":"missing","severity":"high","where":"{phase}-01-plan.md","summary":"requirement AUTH-02 (password reset) has no covering task"},{"class":"risk","severity":"high","where":"{phase}-02-plan.md","summary":"plan 02 modifies 12 files across 5 tasks; split it"}]}
842
870
  ```
843
871
  ````
844
872
 
@@ -22,7 +22,9 @@ If the prompt contains a `<files_to_read>` block, you MUST use the `Read` tool t
22
22
 
23
23
  **Read also:** `~/.claude/pan-wizard-core/references/guardrails.md` — anti-patterns (no silent model swaps, no scope creep, no skipping verification) and the Code Preservation Principle. Plans must enforce these rules in their tasks and verification gates (the executor applies its own deviation rules; a plan has no `<deviation_rules>` block).
24
24
 
25
- **Design input (if present):** If `{phase}-design.md` exists (produced by `/pan:design-phase` and verified by `pan-design-checker`, ADR-0042), it is an authoritative upstream input alongside `context.md`. Its architecture, interface contract, design decisions, and phase-scoped ADR are the APPROVED design — plans MUST implement it, not re-derive or contradict it. Turn its design decisions and success criteria into tasks; do not redesign what it settled. If no design.md exists, plan as before (it is optional, not a gate).
25
+ **Design input (if present):** If `{phase}-design.md` exists (produced by `/pan:design-phase` and verified by `pan-design-checker`, ADR-0042), it is an authoritative upstream input alongside `context.md`. Its architecture, interface contract, design decisions, and phase-scoped ADR are the APPROVED design — plans MUST implement it, not re-derive or contradict it. Turn its design decisions and success criteria into tasks; do not redesign what it settled. Its decisions carry ids (`DD-1`, `DD-2` …): cite the id in each plan that implements one (in `## Plan Decisions`, "Source: design DD-2"). Every recorded decision must be cited by some plan, and a plan must not cite an id the design does not record; `pan-tools verify decisions` checks both. A design-level choice the design does not record (a storage engine, a protocol, a public interface, a new dependency) is not yours to make inside a plan: raise it as a checkpoint or send it back to `/pan:design-phase`. If no design.md exists, plan as before (it is optional, not a gate).
26
+
27
+ **Review Focus (every plan).** Under `## Review Focus`, name at most five inputs or failure modes the requirements and must_haves imply that no test exercises yet (an empty list, a duplicate key, a timeout, a malformed file), each pinned to the task that owns the code and the test that task adds: `- RF-1: <input>. Test: Task 2 adds <test>.` A plan with none writes one line, `None — <why>`. `pan-tools verify review-focus` refuses a plan without the section, with more than five items, or with an item that names no task or no test. The reviewer reads this section as part of the plan's intent.
26
28
 
27
29
  **Core responsibilities:**
28
30
  - **FIRST: Parse and honor user decisions from context.md** (locked decisions are NON-NEGOTIABLE) and the approved architecture from `{phase}-design.md` if it exists
@@ -422,6 +424,7 @@ files_modified: []
422
424
  autonomous: true
423
425
  requirements: []
424
426
  user_setup: []
427
+ planned_commit: <sha>
425
428
 
426
429
  # Goal-backward verification; the Frontmatter Fields table below explains each field
427
430
  must_haves:
@@ -452,6 +455,14 @@ Output: [Artifacts created]
452
455
 
453
456
  <!-- If genuinely none: replace ALL three buckets with the single line:
454
457
  "No decisions worth documenting — plan is mechanical implementation of must_haves." -->
458
+ <!-- A Locked decision that implements a design decision cites its id: "Source: design DD-2". -->
459
+
460
+ ## Review Focus
461
+
462
+ - RF-1: [an input or failure mode the requirements imply that no test exercises yet]. Test: Task [N] adds [the test that would fail if it were mishandled].
463
+
464
+ <!-- At most five items, each pinned to the task that owns the code. If genuinely none:
465
+ "None — [why every implied input already has a test]". -->
455
466
 
456
467
  <execution_context>
457
468
  @~/.claude/pan-wizard-core/workflows/execute-plan.md
@@ -505,10 +516,11 @@ After completion, create `.planning/phases/XX-name/{phase}-{plan}-summary.md`
505
516
  | `files_modified` | Yes | Files this plan touches |
506
517
  | `autonomous` | Yes | `true` if no checkpoints |
507
518
  | `requirements` | Yes | **MUST** list requirement IDs from ROADMAP. Every roadmap requirement ID MUST appear in at least one plan. |
519
+ | `planned_commit` | Yes | The output of `git rev-parse HEAD` when you write the plan (omit it outside a git repository) |
508
520
  | `user_setup` | No | Human-required setup items |
509
521
  | `must_haves` | Yes | Goal-backward verification criteria |
510
522
 
511
- Wave numbers are pre-computed during planning. Execute-phase reads `wave` directly from frontmatter.
523
+ Wave numbers are pre-computed during planning. Execute-phase reads `wave` directly from frontmatter. `pan-tools verify plan-set <phase>` checks the arithmetic before the plan checker runs: every roadmap requirement covered, no two plans in one wave modifying the same file, every `depends_on` naming a plan of this phase in an earlier wave, and no cycles.
512
524
 
513
525
  ## Interface Context for Executors
514
526
 
@@ -25,6 +25,7 @@ Your mode is declared in the `<preview_input>` block's `mode` field:
25
25
  - `test_files_mentioned` — test files likely to run
26
26
  - `risk_signals` — boolean flags for destructive keywords (drop, delete, migrate, rename, breaking, auth)
27
27
  - `risk_score` — heuristic 1-10
28
+ - `cost_forecast` — p10/p50/p90 dollars per plan (`per_plan`) and for the whole phase (`phase`), from this project's own cost ledger. Either can be `status: insufficient` with `n`: fewer than five past runs, so there is no forecast
28
29
 
29
30
  Your output should answer: *"If I run this phase today, what's the blast radius?"* Cover files touched, tests likely to break, migration steps needed, external deps that might need bumping, and a narrative risk assessment.
30
31
 
@@ -65,6 +66,7 @@ Write exactly one file at the path provided in your prompt. Use the template at
65
66
  - `## Migration steps` (if `risk_signals.migrate`)
66
67
  - `## External deps` (if any imports would need version bumps)
67
68
  - `## Risk assessment` (narrative — cite specific signals)
69
+ - `## Cost` (the phase's p50 and p10–p90 range in dollars, and per plan; when `insufficient`, say how many runs it has and that five are needed. Never estimate a figure the forecast does not give)
68
70
  - `## Bottom line` (**bold one-sentence verdict**)
69
71
 
70
72
  **For `phases` mode**, output path is `.planning/architecture/dependency-graph.md`. Required sections:
@@ -111,7 +111,7 @@ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs websearch "your query" --limit
111
111
 
112
112
  **Options:**
113
113
  - `--limit N` — Number of results (default: 10)
114
- - `--freshness day|week|month` — Restrict to recent content
114
+ - `--freshness day|week|month|year` — Restrict to recent content
115
115
 
116
116
  If `brave_search: false` (or not set), use built-in WebSearch tool instead.
117
117
 
@@ -506,6 +506,14 @@ In `.planning/research/`, write only the file your prompt's `<output>` block nam
506
506
 
507
507
  The other researchers write the other dimensions in parallel, and pan-research-synthesizer writes `summary.md` after they all finish. Writing either would overwrite their work.
508
508
 
509
+ **Claims with provenance.** Every fact the roadmap or a plan will rest on (a version, an API's behaviour, a price, a security advisory, a practice) gets a row in the file's `## Claims` table with its type, its source and the day you checked it (YYYY-MM-DD). A claim you could not source is an open question, not a claim. Then lint the file you wrote:
510
+
511
+ ```bash
512
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs research lint .planning/research/{file}.md
513
+ ```
514
+
515
+ Exit 1 lists claims with no source or no date: fix them before you return. `stale` lists claims older than their type's window: check them again, or name them in your return as not rechecked.
516
+
509
517
  ## Step 6: Return Structured Result
510
518
 
511
519
  **DO NOT commit.** Spawned in parallel with other researchers. pan-research-synthesizer commits `.planning/research/` after all complete.
@@ -59,7 +59,7 @@ cat .planning/research/features.md
59
59
  cat .planning/research/architecture.md
60
60
  cat .planning/research/pitfalls.md
61
61
 
62
- # Planning config loaded via pan-tools.cjs in commit step
62
+ # The commit step loads the planning config through pan-tools
63
63
  ```
64
64
 
65
65
  Parse each file to extract:
@@ -72,7 +72,7 @@ If a changed file path starts with any of these prefixes, **skip it silently**.
72
72
  ## Design smells (baseline)
73
73
 
74
74
  A fixed baseline that applies even when the project documents no standards (Fowler, *Refactoring*, ch. 3). Rules:
75
- - Each is a judgement call: always **INFO**, written as "possible <smell>", never a reason for a non-PASS verdict on its own.
75
+ - Each is a judgement call: always **INFO**, written as "possible <smell>", never a reason for a non-PASS verdict on its own; its Category is `Design smell`.
76
76
  - **The project wins.** Where a documented project standard, or an established pattern in the code, endorses what a smell would flag, do not report it. Skip anything a linter or formatter already enforces.
77
77
  - Only for code this phase changed, and only with a file:line and the hunk that shows it.
78
78
 
@@ -93,6 +93,10 @@ A fixed baseline that applies even when the project documents no standards (Fowl
93
93
 
94
94
  ## Scope (unrequested work)
95
95
 
96
+ When the prompt carries an `<intent>` block (the `review scope` JSON), it is what you judge the change against: each plan's `objective`, `must_haves` and `review_focus` (the risk the planner asked a reviewer to check, so check it first and say what you found), and the text of the requirements the plans claim. Its `unlisted` array names changed files no summary's key-files lists: review them as closely as the rest, and say in the report that the summary did not list them.
97
+
98
+ When the prompt carries an `<executor_concerns>` block, each entry is something an executor finished but was not sure of, with its cost if wrong. Check the high-cost ones against the code and report what you found: a concern that holds is a finding; one that does not, say so in a sentence.
99
+
96
100
  Compare what the changed code does with what the phase's plans asked for (their tasks and `must_haves`). Code that adds behaviour no plan task or requirement mentions is a finding: a feature nobody asked for, an unrelated refactor folded into the change, or an option no requirement needs. Use category `Unrequested` at WARNING, or at ERROR when it changes existing behaviour without a plan saying so. Its class in the `pan-verdict` block is `unrequested`. Supporting code the tasks need (tests, types, wiring) is not a finding.
97
101
 
98
102
  </review_checks>
@@ -136,9 +140,11 @@ Return a structured review report:
136
140
  **Machine verdict (required).** End the report with a `pan-verdict` block. The contract is in `~/.claude/pan-wizard-core/references/verdict-contract.md`. How to fill it:
137
141
  - `verdict` is the word under `### Verdict`; `outcome` is `fail` for NEEDS_FIXES and `pass` otherwise.
138
142
  - Add one finding per table row. ERROR → `high`, WARNING → `medium`, INFO → `info`.
139
- - Category maps to class: Convention → `quality`, Security → `risk`, Code Quality → `defect`, Unrequested → `unrequested`.
143
+ - Category maps to class: Convention → `quality`, Security → `risk`, Code Quality → `defect`, Design smell → `quality`, Unrequested → `unrequested`.
140
144
  - `where` is `file:line`.
141
145
  - A clean review has `"findings": []`.
146
+ - **Dismissed findings are filtered by the recorder, not by you.** When the project dismissed a finding with a reason, recording filters the same finding again for as long as its file is unchanged, and lets it back in once the file changes. Security and logic findings are never filtered. So report everything you find; do not leave out a finding because you think it was dismissed before. To see what is being filtered: `node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings suppressions --phase {phase_number} --agent pan-reviewer`.
147
+ - **On a re-check you are given `<open_findings>`:** your earlier open findings on this phase, each with its `id`. Answer every one in a `resolutions` list in the block: `{"id":"f_…","status":"resolved","evidence":"what you checked and saw"}` when it is fixed, `still_present` when it is not, `cannot_tell` when you could not check it. A finding you leave out stays open: silence never closes a finding, and `resolved` without evidence closes nothing.
142
148
 
143
149
  The orchestrator records this block. It is how your findings reach the phase's findings ledger and `/pan:review-deep`.
144
150
 
@@ -59,7 +59,7 @@ cat "$PHASE_DIR"/*-verification.md 2>/dev/null
59
59
  1. Parse previous verification.md frontmatter
60
60
  2. Take `must_haves` (truths, artifacts, key_links) from the plans' frontmatter (Step 2, Option A): the verification frontmatter does not store them
61
61
  3. Extract `gaps` (items that failed)
62
- 4. Set `is_re_verification = true`
62
+ 4. Set `is_re_verification = true`. In the frontmatter's `re_verification` block, list every earlier gap you re-checked and found closed under `gaps_closed`, by its truth (add `evidence:` under a truth when one line says what you saw), and every gap still failing under `gaps_remaining`. A gap you leave out of both stays open in the findings ledger: silence never closes a gap
63
63
  5. **Skip to Step 3** with optimization:
64
64
  - **Failed items:** Full 3-level verification (exists, substantive, wired)
65
65
  - **Passed items:** Quick regression check (existence + basic sanity only)
@@ -486,9 +486,9 @@ Unrequested work never changes the status on its own; a phase can pass with it.
486
486
 
487
487
  ## Step 8b: Run the Test Gate
488
488
 
489
- Run the project's test suite exactly as the verify-phase protocol's `run_test_suite` step says (`~/.claude/pan-wizard-core/workflows/verify-phase.md`): detect a test script first, then run it and judge the exit code before any count. Record the result in the frontmatter as `test_gate: passed | failed | skipped`. `skipped` is only for a project with no test script; a suite that exists and did not run is `failed`.
489
+ Run the test suite through the engine, as the verify-phase protocol's `run_test_suite` step says (`~/.claude/pan-wizard-core/workflows/verify-phase.md`): `pan-tools test run --phase <N>` detects the project's test command in any language, runs it, compares it with the phase's baseline and writes the record. Copy its `status` into the frontmatter as `test_gate: passed | failed | skipped`; do not run the suite yourself and do not re-judge the result. A failed record lowers a `passed` verification whatever you write, and reconcile refuses a `test_gate` that disagrees with it.
490
490
 
491
- A gate you could not run goes in `not_checked` with the reason, e.g. `- check: "tests"` / `reason: "no test script in package.json"`. If the orchestrator already ran the suite and gave you the result, record that result rather than running it again.
491
+ A `skipped` record goes in `not_checked` with the record's reason, e.g. `- check: "tests"` / `reason: "no test command: …"`. If the orchestrator already ran `test run` for this phase and gave you the result, record that result rather than running it again.
492
492
 
493
493
  ## Step 9: Determine Overall Status
494
494