pan-wizard 3.32.0 → 3.34.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 (209) hide show
  1. package/README.md +23 -20
  2. package/agents/pan-conductor.md +18 -17
  3. package/agents/pan-counterfactual.md +2 -2
  4. package/agents/pan-debugger.md +27 -8
  5. package/agents/pan-design-checker.md +1 -1
  6. package/agents/pan-designer.md +2 -2
  7. package/agents/pan-distiller.md +3 -3
  8. package/agents/pan-document_code.md +16 -16
  9. package/agents/pan-executor.md +15 -11
  10. package/agents/pan-experiment-runner.md +15 -17
  11. package/agents/pan-hardener.md +15 -15
  12. package/agents/pan-integration-checker.md +2 -2
  13. package/agents/pan-knowledge.md +2 -2
  14. package/agents/pan-meta-reviewer.md +5 -5
  15. package/agents/pan-optimizer.md +40 -44
  16. package/agents/pan-phase-researcher.md +10 -10
  17. package/agents/pan-plan-checker.md +36 -30
  18. package/agents/pan-planner.md +77 -53
  19. package/agents/pan-previewer.md +1 -1
  20. package/agents/pan-project-researcher.md +21 -78
  21. package/agents/pan-release.md +1 -1
  22. package/agents/pan-research-synthesizer.md +2 -2
  23. package/agents/pan-reviewer.md +24 -2
  24. package/agents/pan-roadmapper.md +20 -62
  25. package/agents/pan-verifier.md +53 -30
  26. package/bin/install-lib.cjs +228 -38
  27. package/bin/install.js +86 -15
  28. package/commands/pan/army.md +16 -12
  29. package/commands/pan/assumptions.md +2 -2
  30. package/commands/pan/audit-deployment.md +11 -12
  31. package/commands/pan/cost.md +8 -4
  32. package/commands/pan/debug.md +10 -7
  33. package/commands/pan/design-phase.md +3 -3
  34. package/commands/pan/discuss-phase.md +2 -0
  35. package/commands/pan/exec-phase.md +21 -37
  36. package/commands/pan/experiment.md +11 -10
  37. package/commands/pan/focus-auto.md +33 -27
  38. package/commands/pan/focus-design.md +9 -6
  39. package/commands/pan/focus-doc-audit.md +4 -3
  40. package/commands/pan/focus-drift-walking.md +4 -3
  41. package/commands/pan/focus-exec.md +7 -7
  42. package/commands/pan/focus-plan.md +12 -11
  43. package/commands/pan/focus-scan.md +7 -10
  44. package/commands/pan/focus-sync.md +3 -2
  45. package/commands/pan/git.md +8 -8
  46. package/commands/pan/health.md +2 -2
  47. package/commands/pan/hud.md +3 -2
  48. package/commands/pan/hygiene.md +14 -7
  49. package/commands/pan/knowledge.md +9 -9
  50. package/commands/pan/learn.md +10 -7
  51. package/commands/pan/links.md +4 -1
  52. package/commands/pan/map-codebase.md +5 -5
  53. package/commands/pan/mcp-bridge.md +18 -18
  54. package/commands/pan/milestone-done.md +7 -5
  55. package/commands/pan/milestone-new.md +1 -1
  56. package/commands/pan/new-project.md +10 -10
  57. package/commands/pan/optimize.md +16 -14
  58. package/commands/pan/patches.md +2 -6
  59. package/commands/pan/pause.md +1 -1
  60. package/commands/pan/phase-tests.md +4 -3
  61. package/commands/pan/plan-phase.md +9 -19
  62. package/commands/pan/preview.md +1 -1
  63. package/commands/pan/profile.md +4 -4
  64. package/commands/pan/quick.md +1 -1
  65. package/commands/pan/remove-phase.md +1 -1
  66. package/commands/pan/report.md +2 -2
  67. package/commands/pan/research-phase.md +14 -15
  68. package/commands/pan/resume.md +9 -11
  69. package/commands/pan/retro.md +5 -3
  70. package/commands/pan/review-deep.md +10 -10
  71. package/commands/pan/settings.md +1 -1
  72. package/commands/pan/todo-add.md +2 -2
  73. package/commands/pan/todo-check.md +2 -2
  74. package/commands/pan/verify-phase.md +0 -11
  75. package/commands/pan/what-if.md +2 -2
  76. package/hooks/dist/pan-context-monitor.js +343 -44
  77. package/hooks/dist/pan-cost-logger.js +30 -0
  78. package/hooks/dist/pan-state-reinject.js +140 -15
  79. package/hooks/dist/pan-statusline.js +68 -22
  80. package/hooks/dist/pan-stop-guard.js +7 -2
  81. package/package.json +1 -1
  82. package/pan-wizard-core/bin/lib/agents-md.cjs +48 -7
  83. package/pan-wizard-core/bin/lib/bridge.cjs +6 -5
  84. package/pan-wizard-core/bin/lib/campaign.cjs +4 -2
  85. package/pan-wizard-core/bin/lib/commands-learnings.cjs +19 -2
  86. package/pan-wizard-core/bin/lib/commands.cjs +126 -5
  87. package/pan-wizard-core/bin/lib/config.cjs +112 -1
  88. package/pan-wizard-core/bin/lib/constants.cjs +29 -15
  89. package/pan-wizard-core/bin/lib/context-budget.cjs +12 -9
  90. package/pan-wizard-core/bin/lib/core.cjs +77 -23
  91. package/pan-wizard-core/bin/lib/cost-rebuild.cjs +13 -1
  92. package/pan-wizard-core/bin/lib/cost.cjs +149 -10
  93. package/pan-wizard-core/bin/lib/distill.cjs +6 -3
  94. package/pan-wizard-core/bin/lib/doc-lint.cjs +30 -11
  95. package/pan-wizard-core/bin/lib/findings.cjs +15 -4
  96. package/pan-wizard-core/bin/lib/focus.cjs +13 -4
  97. package/pan-wizard-core/bin/lib/frontmatter.cjs +105 -26
  98. package/pan-wizard-core/bin/lib/hygiene.cjs +178 -17
  99. package/pan-wizard-core/bin/lib/init.cjs +12 -5
  100. package/pan-wizard-core/bin/lib/knowledge.cjs +17 -1
  101. package/pan-wizard-core/bin/lib/learn-index.cjs +111 -10
  102. package/pan-wizard-core/bin/lib/learn-lint.cjs +30 -3
  103. package/pan-wizard-core/bin/lib/memory-optimize.cjs +8 -4
  104. package/pan-wizard-core/bin/lib/memory.cjs +508 -54
  105. package/pan-wizard-core/bin/lib/milestone.cjs +8 -3
  106. package/pan-wizard-core/bin/lib/optimize.cjs +84 -16
  107. package/pan-wizard-core/bin/lib/phase-remove.cjs +85 -21
  108. package/pan-wizard-core/bin/lib/phase-report.cjs +8 -2
  109. package/pan-wizard-core/bin/lib/phase.cjs +67 -15
  110. package/pan-wizard-core/bin/lib/preview.cjs +3 -1
  111. package/pan-wizard-core/bin/lib/review-deep.cjs +2 -2
  112. package/pan-wizard-core/bin/lib/roadmap-compact.cjs +267 -0
  113. package/pan-wizard-core/bin/lib/roadmap.cjs +243 -9
  114. package/pan-wizard-core/bin/lib/runner.cjs +2 -1
  115. package/pan-wizard-core/bin/lib/state-compact.cjs +11 -6
  116. package/pan-wizard-core/bin/lib/state.cjs +47 -31
  117. package/pan-wizard-core/bin/lib/template.cjs +11 -4
  118. package/pan-wizard-core/bin/lib/verdict.cjs +54 -4
  119. package/pan-wizard-core/bin/lib/verify-drift.cjs +14 -5
  120. package/pan-wizard-core/bin/lib/verify-preflight.cjs +4 -13
  121. package/pan-wizard-core/bin/lib/verify-retro.cjs +5 -3
  122. package/pan-wizard-core/bin/lib/verify-scope.cjs +74 -4
  123. package/pan-wizard-core/bin/lib/verify.cjs +117 -35
  124. package/pan-wizard-core/bin/lib/whatif.cjs +5 -3
  125. package/pan-wizard-core/bin/pan-tools.cjs +111 -17
  126. package/pan-wizard-core/learnings/index.json +5 -5
  127. package/pan-wizard-core/mcp/server.cjs +18 -9
  128. package/pan-wizard-core/opencode/pan-wizard.js +111 -0
  129. package/pan-wizard-core/references/checkpoints.md +7 -5
  130. package/pan-wizard-core/references/continuation-format.md +3 -3
  131. package/pan-wizard-core/references/decimal-phase-calculation.md +2 -3
  132. package/pan-wizard-core/references/design-methodology.md +1 -1
  133. package/pan-wizard-core/references/git-integration.md +4 -6
  134. package/pan-wizard-core/references/git-planning-commit.md +2 -2
  135. package/pan-wizard-core/references/guardrails.md +2 -2
  136. package/pan-wizard-core/references/handoff-decisions.md +3 -3
  137. package/pan-wizard-core/references/model-profile-resolution.md +5 -5
  138. package/pan-wizard-core/references/model-profiles.md +14 -9
  139. package/pan-wizard-core/references/phase-argument-parsing.md +7 -7
  140. package/pan-wizard-core/references/planning-config.md +4 -4
  141. package/pan-wizard-core/references/tdd.md +10 -1
  142. package/pan-wizard-core/references/verdict-contract.md +2 -1
  143. package/pan-wizard-core/references/verification-patterns.md +5 -5
  144. package/pan-wizard-core/templates/codebase/architecture.md +2 -2
  145. package/pan-wizard-core/templates/codebase/best-practices.md +2 -2
  146. package/pan-wizard-core/templates/codebase/concerns.md +3 -3
  147. package/pan-wizard-core/templates/codebase/integrations.md +6 -6
  148. package/pan-wizard-core/templates/codebase/relationships.md +2 -2
  149. package/pan-wizard-core/templates/codebase/stack.md +2 -2
  150. package/pan-wizard-core/templates/codebase/structure.md +4 -4
  151. package/pan-wizard-core/templates/codebase/testing.md +4 -4
  152. package/pan-wizard-core/templates/continue-here.md +1 -1
  153. package/pan-wizard-core/templates/debug-subagent-prompt.md +3 -2
  154. package/pan-wizard-core/templates/debug.md +15 -1
  155. package/pan-wizard-core/templates/discovery.md +1 -1
  156. package/pan-wizard-core/templates/milestone-archive.md +6 -6
  157. package/pan-wizard-core/templates/milestone.md +1 -1
  158. package/pan-wizard-core/templates/phase-prompt.md +31 -18
  159. package/pan-wizard-core/templates/planner-subagent-prompt.md +3 -5
  160. package/pan-wizard-core/templates/research-project/architecture.md +3 -3
  161. package/pan-wizard-core/templates/research-project/features.md +1 -1
  162. package/pan-wizard-core/templates/research-project/pitfalls.md +1 -1
  163. package/pan-wizard-core/templates/research-project/stack.md +3 -3
  164. package/pan-wizard-core/templates/research.md +5 -5
  165. package/pan-wizard-core/templates/retrospective.md +1 -1
  166. package/pan-wizard-core/templates/roadmap.md +15 -15
  167. package/pan-wizard-core/templates/summary-complex.md +1 -0
  168. package/pan-wizard-core/templates/summary-minimal.md +1 -0
  169. package/pan-wizard-core/templates/summary-standard.md +2 -1
  170. package/pan-wizard-core/templates/summary.md +18 -2
  171. package/pan-wizard-core/templates/uat.md +3 -3
  172. package/pan-wizard-core/templates/user-setup.md +8 -8
  173. package/pan-wizard-core/templates/verification-report.md +54 -4
  174. package/pan-wizard-core/workflows/add-phase.md +1 -1
  175. package/pan-wizard-core/workflows/assumptions.md +1 -1
  176. package/pan-wizard-core/workflows/discuss-phase.md +9 -8
  177. package/pan-wizard-core/workflows/exec-phase.md +34 -60
  178. package/pan-wizard-core/workflows/execute-plan.md +8 -7
  179. package/pan-wizard-core/workflows/health.md +13 -11
  180. package/pan-wizard-core/workflows/help.md +8 -9
  181. package/pan-wizard-core/workflows/learn.md +13 -11
  182. package/pan-wizard-core/workflows/map-codebase.md +10 -10
  183. package/pan-wizard-core/workflows/milestone-audit.md +10 -10
  184. package/pan-wizard-core/workflows/milestone-gaps.md +17 -24
  185. package/pan-wizard-core/workflows/milestone-new.md +7 -6
  186. package/pan-wizard-core/workflows/new-project.md +10 -10
  187. package/pan-wizard-core/workflows/optimize.md +11 -9
  188. package/pan-wizard-core/workflows/pause.md +6 -1
  189. package/pan-wizard-core/workflows/phase-tests.md +4 -4
  190. package/pan-wizard-core/workflows/plan-phase.md +31 -34
  191. package/pan-wizard-core/workflows/profile.md +2 -2
  192. package/pan-wizard-core/workflows/progress.md +5 -7
  193. package/pan-wizard-core/workflows/quick.md +10 -8
  194. package/pan-wizard-core/workflows/remove-phase.md +1 -1
  195. package/pan-wizard-core/workflows/research-phase.md +9 -5
  196. package/pan-wizard-core/workflows/resume-project.md +4 -6
  197. package/pan-wizard-core/workflows/retro.md +3 -1
  198. package/pan-wizard-core/workflows/settings.md +16 -24
  199. package/pan-wizard-core/workflows/todo-check.md +1 -1
  200. package/pan-wizard-core/workflows/transition.md +12 -12
  201. package/pan-wizard-core/workflows/update.md +25 -17
  202. package/pan-wizard-core/workflows/verify-phase.md +24 -17
  203. package/pan-zcode/KNOWN-BETA-RISKS.md +2 -2
  204. package/pan-zcode/README.md +7 -7
  205. package/pan-zcode/bin/install-zcode.js +1 -1
  206. package/scripts/build-agent-plugin.js +19 -5
  207. package/scripts/build-plugin.js +3 -1
  208. package/scripts/generate-skills-docs.py +13 -4
  209. package/scripts/test-surface.cjs +4 -0
@@ -23,10 +23,10 @@ Before verifying, discover project context:
23
23
  **Project instructions:** Read `./CLAUDE.md` if it exists in the working directory. Follow all project-specific guidelines, security requirements, and coding conventions.
24
24
 
25
25
  **Project skills:** Check `.agents/skills/` directory if it exists:
26
- 1. List available skills (subdirectories)
26
+ 1. List available skills (subdirectories), skipping PAN's own `pan-*` skills (a Codex or `--unified-skills` install puts one per PAN command there)
27
27
  2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
28
28
  3. Load specific `rules/*.md` files as needed during verification
29
- 4. Do NOT load full `AGENTS.md` files (100KB+ context cost)
29
+ 4. Skip the full `AGENTS.md` inside a skill directory (100KB+ context cost). The project's own `AGENTS.md`, which `./CLAUDE.md` may import, is project instructions — read it.
30
30
  5. Apply skill rules when scanning for anti-patterns and verifying quality
31
31
 
32
32
  This ensures project-specific patterns, conventions, and best practices are applied during verification.
@@ -57,7 +57,7 @@ cat "$PHASE_DIR"/*-verification.md 2>/dev/null
57
57
  **If previous verification exists with `gaps:` section → RE-VERIFICATION MODE:**
58
58
 
59
59
  1. Parse previous verification.md frontmatter
60
- 2. Extract `must_haves` (truths, artifacts, key_links)
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
62
  4. Set `is_re_verification = true`
63
63
  5. **Skip to Step 3** with optimization:
@@ -73,8 +73,11 @@ Set `is_re_verification = false`, proceed with Step 0b.
73
73
  If the current phase number > 1, check that the previous phase was verified:
74
74
 
75
75
  ```bash
76
- PREV_PHASE=$((PHASE_NUM - 1))
77
- ls .planning/phase-${PREV_PHASE}*/*-verification.md 2>/dev/null
76
+ # The previous phase: 2.1 → 2, 12A → 12, otherwise N-1 (10# reads a zero-padded 08 as
77
+ # decimal; bash would read it as octal). verify-phase computes it the same way.
78
+ case "$PHASE_NUM" in *.*) PREV_PHASE="${PHASE_NUM%%.*}" ;; *[A-Za-z]) PREV_PHASE="${PHASE_NUM%[A-Za-z]}" ;; *) PREV_PHASE=$((10#$PHASE_NUM - 1)) ;; esac
79
+ PREV_DIR=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs find-phase "$PREV_PHASE" --raw 2>/dev/null)
80
+ [ -n "$PREV_DIR" ] && ls "$PREV_DIR"/*-verification.md 2>/dev/null
78
81
  ```
79
82
 
80
83
  **If previous phase has no verification.md:**
@@ -94,19 +97,19 @@ Proceed to Step 1.
94
97
  ls "$PHASE_DIR"/*-plan.md 2>/dev/null
95
98
  ls "$PHASE_DIR"/*-summary.md 2>/dev/null
96
99
  node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase "$PHASE_NUM"
97
- grep -E "^\|[^|]*\| *Phase +$PHASE_NUM " .planning/requirements.md 2>/dev/null
100
+ grep -E "^\|[^|]*\| *Phase +0*${PHASE_NUM#0} " .planning/requirements.md 2>/dev/null
98
101
  ```
99
102
 
100
- Extract phase goal from roadmap.md — this is the outcome to verify, not the tasks.
103
+ Extract the phase goal from the `get-phase` output — this is the outcome to verify, not the tasks. If your prompt names a roadmap slice, read it for the phase's requirement lines. Do not read roadmap.md or requirements.md whole: `get-phase`, the slice and the greps here carry what verification needs.
101
104
 
102
105
  ## Step 1c: Repo-Norms-First Verification (P-RES-005)
103
106
 
104
- If `.planning/codebase/CONVENTIONS.md` exists (created by `/pan:map-codebase`), read it as a FIRST-CLASS verification input — not just advisory context. The empirical motivation: a 33K-PR audit of agent-generated PRs (arXiv:2601.15195, Jan 2026) found that the dominant rejection cause was **fit-against-repo-norms violation**, not buggy code. Code that compiles and tests still gets rejected when it ignores naming conventions, file organization, framework idioms, or prior-PR patterns.
107
+ If `.planning/codebase/conventions.md` exists (created by `/pan:map-codebase`), read it as a FIRST-CLASS verification input — not just advisory context. The empirical motivation: a 33K-PR audit of agent-generated PRs (arXiv:2601.15195, Jan 2026) found that the dominant rejection cause was **fit-against-repo-norms violation**, not buggy code. Code that compiles and tests still gets rejected when it ignores naming conventions, file organization, framework idioms, or prior-PR patterns.
105
108
 
106
109
  ```bash
107
110
  # Read codebase conventions and structure if available
108
- [ -f .planning/codebase/CONVENTIONS.md ] && cat .planning/codebase/CONVENTIONS.md
109
- [ -f .planning/codebase/STRUCTURE.md ] && cat .planning/codebase/STRUCTURE.md
111
+ [ -f .planning/codebase/conventions.md ] && cat .planning/codebase/conventions.md
112
+ [ -f .planning/codebase/structure.md ] && cat .planning/codebase/structure.md
110
113
  ```
111
114
 
112
115
  **How to use this in verification:**
@@ -115,11 +118,11 @@ If `.planning/codebase/CONVENTIONS.md` exists (created by `/pan:map-codebase`),
115
118
 
116
119
  2. **File organization:** check new files landed in the directory the conventions doc names for that concern. Auth code in `lib/auth/` not `src/auth/` if conventions said `lib/`.
117
120
 
118
- 3. **Framework idioms:** if CONVENTIONS.md names "we use X over Y because Z", check the executor didn't import Y. Generic correctness isn't enough — local idiom-fit matters.
121
+ 3. **Framework idioms:** if conventions.md names "we use X over Y because Z", check the executor didn't import Y. Generic correctness isn't enough — local idiom-fit matters.
119
122
 
120
- 4. **Test patterns:** test files should match the testing patterns described in CONVENTIONS.md (test file naming, fixture organization, assertion style).
123
+ 4. **Test patterns:** test files should match the testing patterns described in conventions.md (test file naming, fixture organization, assertion style).
121
124
 
122
- If CONVENTIONS.md does not exist, skip this step silently. This is brownfield-only signal. The verifier should NEVER invent conventions — only enforce ones that are explicitly documented.
125
+ If conventions.md does not exist, skip this step silently. This is brownfield-only signal. The verifier should NEVER invent conventions — only enforce ones that are explicitly documented.
123
126
 
124
127
  ## Step 1b: Read the Reasoning Trace (P-RES-003)
125
128
 
@@ -171,7 +174,7 @@ must_haves:
171
174
  If no must_haves in frontmatter, check for Success Criteria:
172
175
 
173
176
  ```bash
174
- PHASE_DATA=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase "$PHASE_NUM" --raw)
177
+ PHASE_DATA=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap get-phase "$PHASE_NUM")
175
178
  ```
176
179
 
177
180
  Parse the `success_criteria` array from the JSON output. If non-empty:
@@ -270,8 +273,8 @@ Parse JSON result: `{ all_verified, verified, total, links: [{from, to, via, ver
270
273
 
271
274
  For each link:
272
275
  - `verified=true` → WIRED
273
- - `verified=false` with "not found" in detail → NOT_WIRED
274
- - `verified=false` with "Pattern not found" → PARTIAL
276
+ - `verified=false` with detail "Source file not found" or "Target not referenced in source" → NOT_WIRED
277
+ - `verified=false` with detail `Pattern "…" not found in source or target` → PARTIAL
275
278
 
276
279
  **Fallback patterns** (if must_haves.key_links not defined in PLAN):
277
280
 
@@ -325,7 +328,7 @@ Extract the tier table rows (T1/T2/T3/T4) and their expected coverage areas.
325
328
 
326
329
  | Check | Action | Status |
327
330
  |-------|--------|--------|
328
- | T1 declared | Scan for unit test files matching plan `test_pattern` | COVERED / GAP |
331
+ | T1 declared | Scan for the unit test files the plan's `<verify>` commands run | COVERED / GAP |
329
332
  | T2 declared | Verify integration test + infrastructure (Docker/testcontainers) present | COVERED / GAP |
330
333
  | T3 declared | Verify E2E/CLI tests exist with setup instructions | COVERED / GAP |
331
334
  | T4 declared | Verify visual/Playwright tests with snapshot baseline | COVERED / GAP |
@@ -352,7 +355,7 @@ Collect ALL requirement IDs declared across plans for this phase.
352
355
  **6b. Cross-reference against requirements.md:**
353
356
 
354
357
  For each requirement ID from plans:
355
- 1. Find its full description in requirements.md (`**REQ-ID**: description`)
358
+ 1. Find its full description (`**REQ-ID**: description`) in the slice's `## Its requirements`, or with `grep -n "REQ-ID" .planning/requirements.md` when there is no slice or the ID is missing from it
356
359
  2. Map to supporting truths/artifacts verified in Steps 3-5
357
360
  3. Determine status:
358
361
  - ✓ SATISFIED: Implementation evidence found that fulfills the requirement
@@ -362,7 +365,7 @@ For each requirement ID from plans:
362
365
  **6c. Check for orphaned requirements:**
363
366
 
364
367
  ```bash
365
- grep -E "Phase $PHASE_NUM" .planning/requirements.md 2>/dev/null
368
+ grep -E "^\|[^|]*\| *Phase +0*${PHASE_NUM#0} " .planning/requirements.md 2>/dev/null
366
369
  ```
367
370
 
368
371
  If requirements.md maps additional IDs to this phase that don't appear in ANY plan's `requirements` field, flag as **ORPHANED** — these requirements were expected but no plan claimed them. ORPHANED requirements MUST appear in the verification report.
@@ -373,10 +376,10 @@ Identify files modified in this phase from summary.md key-files section, or extr
373
376
 
374
377
  ```bash
375
378
  # Option 1: Extract from SUMMARY frontmatter
376
- SUMMARY_FILES=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs summary-extract "$PHASE_DIR"/*-summary.md --fields key-files)
379
+ SUMMARY_FILES=$(for s in "$PHASE_DIR"/*-summary.md; do node ~/.claude/pan-wizard-core/bin/pan-tools.cjs summary-extract "$s" --fields key_files; done)
377
380
 
378
381
  # Option 2: Verify commits exist (if commit hashes documented)
379
- COMMIT_HASHES=$(grep -oE "[a-f0-9]{7,40}" "$PHASE_DIR"/*-summary.md | head -10)
382
+ COMMIT_HASHES=$(grep -ohE "[a-f0-9]{7,40}" "$PHASE_DIR"/*-summary.md | head -10)
380
383
  if [ -n "$COMMIT_HASHES" ]; then
381
384
  COMMITS_VALID=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify commits $COMMIT_HASHES)
382
385
  fi
@@ -481,11 +484,17 @@ Unrequested work never changes the status on its own; a phase can pass with it.
481
484
  **Why human:** {Why can't verify programmatically}
482
485
  ```
483
486
 
487
+ ## Step 8b: Run the Test Gate
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`.
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.
492
+
484
493
  ## Step 9: Determine Overall Status
485
494
 
486
- **Status: passed** — All truths VERIFIED, all artifacts pass levels 1-3, all key links WIRED, no blocker anti-patterns.
495
+ **Status: passed** — All truths VERIFIED, all artifacts pass levels 1-3, all key links WIRED, no blocker anti-patterns, and the test gate passed or was skipped. A skipped gate stays visible: it is listed in `not_checked`, so the pass says what it did not check.
487
496
 
488
- **Status: gaps_found** — One or more truths FAILED, artifacts MISSING/STUB, key links NOT_WIRED, or blocker anti-patterns found.
497
+ **Status: gaps_found** — One or more truths FAILED, artifacts MISSING/STUB, key links NOT_WIRED, blocker anti-patterns found, or the test gate FAILED.
489
498
 
490
499
  **Status: human_needed** — All automated checks pass but items flagged for human verification.
491
500
 
@@ -523,22 +532,34 @@ gaps:
523
532
 
524
533
  **ALWAYS use the Write tool to create files** — never use `Bash(cat << 'EOF')` or heredoc commands for file creation.
525
534
 
526
- Create `.planning/phases/{phase_dir}/{phase_num}-verification.md`:
535
+ Record `verified_commit` from `git rev-parse HEAD` before you write the file. It ties the verdict to the code you checked: `pan-tools verify stale <phase>` and `pan-tools progress` compare the phase's files against it, and a file changed since then marks this verification stale.
536
+
537
+ Create `{phase_dir}/{phase_number}-verification.md` (`{phase_dir}` is already the full path from the project root, e.g. `.planning/phases/05-auth` or `.planning/tracks/<name>/phases/05-auth`: do not prefix it):
527
538
 
528
539
  ```markdown
529
540
  ---
530
541
  phase: XX-name
531
542
  verified: YYYY-MM-DDTHH:MM:SSZ
543
+ # verified_commit: `git rev-parse HEAD` before you write this file: the code you verified
544
+ verified_commit: <sha>
532
545
  status: passed | gaps_found | human_needed
533
546
  score: N/M must-haves verified
534
- re_verification: # Only if previous verification.md existed
547
+ # test_gate: Step 8b
548
+ test_gate: passed | failed | skipped
549
+ # not_checked: only for checks that could not run — never count them as passed
550
+ not_checked:
551
+ - check: "tests"
552
+ reason: "no test script in package.json"
553
+ # re_verification: only if a previous verification.md existed
554
+ re_verification:
535
555
  previous_status: gaps_found
536
556
  previous_score: 2/5
537
557
  gaps_closed:
538
558
  - "Truth that was fixed"
539
559
  gaps_remaining: []
540
560
  regressions: []
541
- gaps: # Only if status: gaps_found
561
+ # gaps: only if status: gaps_found
562
+ gaps:
542
563
  - truth: "Observable truth that failed"
543
564
  status: failed
544
565
  reason: "Why it failed"
@@ -547,11 +568,13 @@ gaps: # Only if status: gaps_found
547
568
  issue: "What's wrong"
548
569
  missing:
549
570
  - "Specific thing to add/fix"
550
- human_verification: # Only if status: human_needed
571
+ # human_verification: only if status: human_needed
572
+ human_verification:
551
573
  - test: "What to do"
552
574
  expected: "What should happen"
553
575
  why_human: "Why can't verify programmatically"
554
- unrequested: # Only if Step 7c found work no plan asked for
576
+ # unrequested: only if Step 7c found work no plan asked for
577
+ unrequested:
555
578
  - path: "src/path/to/file.tsx"
556
579
  what: "What it adds that no plan or requirement asked for"
557
580
  ---
@@ -624,7 +647,7 @@ Return with:
624
647
 
625
648
  **Status:** {passed | gaps_found | human_needed}
626
649
  **Score:** {N}/{M} must-haves verified
627
- **Report:** .planning/phases/{phase_dir}/{phase_num}-verification.md
650
+ **Report:** {phase_dir}/{phase_number}-verification.md
628
651
 
629
652
  {If passed:}
630
653
  All must-haves verified. Phase goal achieved. Ready to proceed.
@@ -720,7 +743,7 @@ return <div>No messages</div> // Always shows "no messages"
720
743
  <success_criteria>
721
744
 
722
745
  - [ ] Previous verification.md checked (Step 0)
723
- - [ ] If re-verification: must-haves loaded from previous, focus on failed items
746
+ - [ ] If re-verification: must-haves taken from the plans' frontmatter, focus on the previous gaps
724
747
  - [ ] If initial: must-haves established (from frontmatter or derived)
725
748
  - [ ] All truths verified with status and evidence
726
749
  - [ ] All artifacts checked at all three levels (exists, substantive, wired)