pan-wizard 3.35.0 → 3.37.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 (339) hide show
  1. package/CHANGELOG.md +3645 -0
  2. package/README.md +46 -52
  3. package/agents/pan-conductor.md +2 -3
  4. package/agents/pan-counterfactual.md +1 -2
  5. package/agents/pan-debugger.md +14 -3
  6. package/agents/pan-design-checker.md +1 -2
  7. package/agents/pan-designer.md +2 -3
  8. package/agents/pan-document_code.md +1 -2
  9. package/agents/pan-executor.md +25 -0
  10. package/agents/pan-hardener.md +4 -3
  11. package/agents/pan-integration-checker.md +1 -2
  12. package/agents/pan-knowledge.md +1 -2
  13. package/agents/pan-meta-reviewer.md +3 -3
  14. package/agents/pan-optimizer.md +4 -4
  15. package/agents/pan-phase-researcher.md +80 -475
  16. package/agents/pan-plan-checker.md +40 -3
  17. package/agents/pan-planner.md +21 -7
  18. package/agents/pan-previewer.md +3 -2
  19. package/agents/pan-project-researcher.md +72 -493
  20. package/agents/pan-release.md +1 -1
  21. package/agents/pan-reviewer.md +14 -3
  22. package/agents/pan-roadmapper.md +12 -7
  23. package/agents/pan-verifier.md +9 -4
  24. package/bin/install-lib.cjs +134 -14
  25. package/bin/install.js +59 -12
  26. package/commands/pan/army.md +1 -1
  27. package/commands/pan/autodev.md +76 -0
  28. package/commands/pan/cost.md +21 -1
  29. package/commands/pan/exec-phase.md +3 -4
  30. package/commands/pan/focus-auto.md +14 -7
  31. package/commands/pan/focus-design.md +4 -5
  32. package/commands/pan/focus-docs.md +24 -0
  33. package/commands/pan/learn.md +13 -6
  34. package/commands/pan/milestone-audit.md +8 -1
  35. package/commands/pan/milestone-done.md +10 -5
  36. package/commands/pan/milestone-new.md +2 -2
  37. package/commands/pan/new-project.md +15 -12
  38. package/commands/pan/plan-phase.md +15 -9
  39. package/commands/pan/preview.md +1 -1
  40. package/commands/pan/quick.md +1 -1
  41. package/commands/pan/review-deep.md +11 -5
  42. package/commands/pan/settings.md +6 -0
  43. package/commands/pan/verify-phase.md +6 -2
  44. package/docs/AGENTS.md +917 -0
  45. package/docs/ARCHITECTURE.md +1054 -0
  46. package/docs/CLI-REFERENCE.md +4582 -0
  47. package/docs/COMPARISON.md +116 -0
  48. package/docs/DEVELOPMENT.md +490 -0
  49. package/docs/ECOSYSTEM-REVIEW-2026-06.md +107 -0
  50. package/docs/ECOSYSTEM-REVIEW-2026-08.md +349 -0
  51. package/docs/EXAMPLES.md +584 -0
  52. package/docs/FAQ.md +254 -0
  53. package/docs/FIELD-HARVEST-2026-07.md +88 -0
  54. package/docs/FIELD-REPORT-army-2026-06.md +121 -0
  55. package/docs/HOOKS.md +638 -0
  56. package/docs/IMPROVEMENT-TODO.md +246 -0
  57. package/docs/INTERNALS.md +485 -0
  58. package/docs/MIGRATION-v2-to-v3.md +258 -0
  59. package/docs/SECURITY-HARDENING.md +230 -0
  60. package/docs/SKILLS-ENHANCEMENT-PLAN-V2.md +122 -0
  61. package/docs/SKILLS-FULL-TEXT.md +9685 -0
  62. package/docs/SKILLS-REFERENCE.md +1037 -0
  63. package/docs/TROUBLESHOOTING.md +1084 -0
  64. package/docs/USER-GUIDE.md +1437 -0
  65. package/docs/archive/SKILLS-ENHANCEMENT-PLAN.md +230 -0
  66. package/docs/audits/AUDIT-2026-08-e2e-ROADMAP.md +117 -0
  67. package/docs/audits/AUDIT-2026-08-e2e-VERIFICATION.md +693 -0
  68. package/docs/audits/AUDIT-2026-08-e2e.md +1546 -0
  69. package/docs/audits/OUTSTANDING-2026-08.md +275 -0
  70. package/docs/audits/STABILITY-TEST-2026-08.md +640 -0
  71. package/docs/branding/README-brand-draft.md +119 -0
  72. package/docs/branding/handoff/IMPLEMENTATION.md +205 -0
  73. package/docs/branding/handoff/README-brand-draft.md +119 -0
  74. package/docs/branding/handoff/image-prompts.md +46 -0
  75. package/docs/branding/image-prompts.md +46 -0
  76. package/docs/branding/nano-banana-prompts.txt +60 -0
  77. package/docs/context-monitor.md +13 -0
  78. package/docs/decisions/ADR-0001-strategic-feature-prioritization.md +83 -0
  79. package/docs/decisions/ADR-0002-copilot-cli-runtime.md +71 -0
  80. package/docs/decisions/ADR-0003-smart-execution.md +84 -0
  81. package/docs/decisions/ADR-0004-copilot-cli-interaction.md +89 -0
  82. package/docs/decisions/ADR-0005-command-naming.md +80 -0
  83. package/docs/decisions/ADR-0006-focus-commands.md +101 -0
  84. package/docs/decisions/ADR-0007-ship-v1.md +73 -0
  85. package/docs/decisions/ADR-0008-map-codebase-mermaid-togaf.md +80 -0
  86. package/docs/decisions/ADR-0009-production-deployment-checklist.md +68 -0
  87. package/docs/decisions/ADR-0010-standards-integration.md +79 -0
  88. package/docs/decisions/ADR-0011-help-commands-rewrite.md +64 -0
  89. package/docs/decisions/ADR-0012-contributors-attribution-index.md +42 -0
  90. package/docs/decisions/ADR-0013-strategic-feature-additions.md +53 -0
  91. package/docs/decisions/ADR-0014-internal-cleanup-code-quality.md +53 -0
  92. package/docs/decisions/ADR-0015-focus-auto-runner.md +296 -0
  93. package/docs/decisions/ADR-0016-enhanced-doc-sync.md +54 -0
  94. package/docs/decisions/ADR-0017-enhanced-focus-design.md +69 -0
  95. package/docs/decisions/ADR-0018-user-reality-testing.md +84 -0
  96. package/docs/decisions/ADR-0019-end-to-end-user-acceptance-testing.md +113 -0
  97. package/docs/decisions/ADR-0020-ai-drift-prevention.md +55 -0
  98. package/docs/decisions/ADR-0021-codebase-mapper-v2.md +76 -0
  99. package/docs/decisions/ADR-0022-lifecycle-completeness.md +63 -0
  100. package/docs/decisions/ADR-0023-opus-4-7-adoption.md +89 -0
  101. package/docs/decisions/ADR-0024-spec-b-v2-completion.md +137 -0
  102. package/docs/decisions/ADR-0025-behavioral-guardrails-layer.md +129 -0
  103. package/docs/decisions/ADR-0026-self-improvement-loop.md +171 -0
  104. package/docs/decisions/ADR-0027-doc-code-link-graph.md +164 -0
  105. package/docs/decisions/ADR-0028-unified-agents-skills-target.md +46 -0
  106. package/docs/decisions/ADR-0029-experiment-evaluator.md +76 -0
  107. package/docs/decisions/ADR-0030-planning-concurrency.md +37 -0
  108. package/docs/decisions/ADR-0031-focus-auto-backlog-source.md +47 -0
  109. package/docs/decisions/ADR-0032-squad-model.md +64 -0
  110. package/docs/decisions/ADR-0033-army-campaign.md +40 -0
  111. package/docs/decisions/ADR-0034-scheduled-campaigns.md +57 -0
  112. package/docs/decisions/ADR-0035-army-hud-dashboard.md +40 -0
  113. package/docs/decisions/ADR-0036-agentic-memory-architecture.md +106 -0
  114. package/docs/decisions/ADR-0037-pin-security-agents-to-opus.md +51 -0
  115. package/docs/decisions/ADR-0038-skill-aligned-decomposition.md +41 -0
  116. package/docs/decisions/ADR-0039-worktree-as-project-variant.md +37 -0
  117. package/docs/decisions/ADR-0040-memory-injection-defense.md +55 -0
  118. package/docs/decisions/ADR-0041-mcp-dual-era-bridge.md +47 -0
  119. package/docs/decisions/ADR-0042-design-parity-both-flows.md +45 -0
  120. package/docs/decisions/ADR-0043-addressable-planning-roots.md +56 -0
  121. package/docs/decisions/ADR-0044-bound-the-cached-context.md +104 -0
  122. package/docs/decisions/ADR-0045-agent-plugins-bundle.md +76 -0
  123. package/docs/decisions/ADR-0046-subagent-frontmatter-decisions.md +39 -0
  124. package/docs/decisions/ADR-0047-pan-harness.md +76 -0
  125. package/docs/decisions/ADR-0048-one-core-per-project.md +43 -0
  126. package/docs/decisions/ADR-0049-machine-verdicts-and-findings-ledger.md +116 -0
  127. package/docs/specs/ai_drift_prevention_featureai.md +286 -0
  128. package/docs/specs/codebase_mapper_v2_featureai.md +930 -0
  129. package/docs/specs/command_naming_optimization_featureai.md +930 -0
  130. package/docs/specs/comp_analysis_markdown_v1.md +149 -0
  131. package/docs/specs/continuous_autonomous_execution_featureai.md +304 -0
  132. package/docs/specs/contributors_attribution_index_featureai.md +476 -0
  133. package/docs/specs/copilot_cli_interaction_featureai.md +868 -0
  134. package/docs/specs/copilot_cli_runtime_featureai.md +647 -0
  135. package/docs/specs/custom-skills-assessment.md +461 -0
  136. package/docs/specs/deployment_audit_findings_featureai.md +243 -0
  137. package/docs/specs/doc_code_link_graph_featureai.md +253 -0
  138. package/docs/specs/documentation_alignment_cleanup_featureai.md +69 -0
  139. package/docs/specs/e2e_visual_testing_featureai.md +615 -0
  140. package/docs/specs/end_to_end_user_acceptance_testing_featureai.md +810 -0
  141. package/docs/specs/evidence-loop-plan.md +76 -0
  142. package/docs/specs/evidence_loop_featureai.md +497 -0
  143. package/docs/specs/focus-auto-optimize-category.md +449 -0
  144. package/docs/specs/focus-auto-optimize-superplan.md +188 -0
  145. package/docs/specs/focus_auto_runner_featureai.md +1102 -0
  146. package/docs/specs/focus_design_v2_featureai.md +197 -0
  147. package/docs/specs/focus_sync_v2_featureai.md +202 -0
  148. package/docs/specs/git_integration_overhaul_featureai.md +326 -0
  149. package/docs/specs/glm_zai_provider_featureai.md +200 -0
  150. package/docs/specs/googlecli_adoption_featureai.md +661 -0
  151. package/docs/specs/help_commands_rewrite_featureai.md +860 -0
  152. package/docs/specs/industry_analysis_strategic_additions_featureai.md +231 -0
  153. package/docs/specs/industry_comparison_and_feature_gaps_featureai.md +674 -0
  154. package/docs/specs/internal_cleanup_code_quality_featureai.md +486 -0
  155. package/docs/specs/investigations/README.md +31 -0
  156. package/docs/specs/investigations/digests/2026-09-28.md +47 -0
  157. package/docs/specs/investigations/digests/2026-10-08.md +62 -0
  158. package/docs/specs/investigations/digests/2026-10-10.md +61 -0
  159. package/docs/specs/investigations/features/debugger-red-loop-first.md +55 -0
  160. package/docs/specs/investigations/features/harness-cross-host-behaviour.md +93 -0
  161. package/docs/specs/investigations/features/optimize-apply-regression-gate.md +66 -0
  162. package/docs/specs/investigations/features/reviewer-smell-baseline.md +57 -0
  163. package/docs/specs/investigations/features/trace-failure-capture.md +69 -0
  164. package/docs/specs/lifecycle_completeness_featureai.md +754 -0
  165. package/docs/specs/local-first-ci.md +42 -0
  166. package/docs/specs/map_codebase_mermaid_togaf_featureai.md +805 -0
  167. package/docs/specs/market-delta-2026-09-superplan.md +310 -0
  168. package/docs/specs/market-ideas-2026-09.md +131 -0
  169. package/docs/specs/market-ideas-2026-10.md +428 -0
  170. package/docs/specs/market-ideas-ledger.md +177 -0
  171. package/docs/specs/memory-optimization-2026-10.md +285 -0
  172. package/docs/specs/multi-track-planning-roots.md +143 -0
  173. package/docs/specs/multi_model_routing_featureai.md +687 -0
  174. package/docs/specs/multi_model_routing_superplan.md +197 -0
  175. package/docs/specs/opus_47_existing_enhancements_featureai.md +247 -0
  176. package/docs/specs/opus_47_extended_features_featureai.md +363 -0
  177. package/docs/specs/opus_47_extended_features_v2_featureai.md +397 -0
  178. package/docs/specs/pan_focus_commands_featureai.md +2336 -0
  179. package/docs/specs/pan_zcode_mcp_bridge_featureai.md +120 -0
  180. package/docs/specs/product-excellence-superplan.md +315 -0
  181. package/docs/specs/product_excellence_program_2026_q4_featureai.md +365 -0
  182. package/docs/specs/production_deployment_readiness_featureai.md +433 -0
  183. package/docs/specs/production_readiness_ship_v1_featureai.md +698 -0
  184. package/docs/specs/real_test_enforcement_featureai.md +213 -0
  185. package/docs/specs/reality-check-2026-09-superplan.md +362 -0
  186. package/docs/specs/right-sized-ceremony.md +74 -0
  187. package/docs/specs/roadmap_and_competition_2026_q4_featureai.md +390 -0
  188. package/docs/specs/self_improvement_loop_featureai.md +875 -0
  189. package/docs/specs/skill-aligned-decomposition.md +155 -0
  190. package/docs/specs/standards_integration_featureai.md +833 -0
  191. package/docs/specs/testing-system-redesign-2026-09.md +267 -0
  192. package/docs/specs/user_reality_testing_system_featureai.md +788 -0
  193. package/docs/specs/watch-triggers.json +22 -0
  194. package/docs/specs/workflow-integration-redesign.md +742 -0
  195. package/docs/specs/workflow_state_consistency_featureai.md +183 -0
  196. package/hooks/dist/pan-context-monitor.js +9 -2
  197. package/hooks/dist/pan-cost-logger.js +5 -0
  198. package/hooks/dist/pan-guard.js +28 -5
  199. package/hooks/dist/pan-stop-guard.js +9 -9
  200. package/hooks/dist/pan-trace-logger.js +5 -0
  201. package/package.json +10 -2
  202. package/pan-wizard-core/bin/lib/agents-md.cjs +57 -8
  203. package/pan-wizard-core/bin/lib/autodev-report.cjs +180 -0
  204. package/pan-wizard-core/bin/lib/autodev.cjs +642 -0
  205. package/pan-wizard-core/bin/lib/ci.cjs +143 -0
  206. package/pan-wizard-core/bin/lib/commands.cjs +1 -1
  207. package/pan-wizard-core/bin/lib/config.cjs +41 -5
  208. package/pan-wizard-core/bin/lib/constants.cjs +27 -1
  209. package/pan-wizard-core/bin/lib/core.cjs +31 -14
  210. package/pan-wizard-core/bin/lib/cost.cjs +160 -4
  211. package/pan-wizard-core/bin/lib/cross-family.cjs +164 -0
  212. package/pan-wizard-core/bin/lib/debug-cases.cjs +104 -0
  213. package/pan-wizard-core/bin/lib/doc-lint.cjs +5 -3
  214. package/pan-wizard-core/bin/lib/failure-class.cjs +81 -0
  215. package/pan-wizard-core/bin/lib/findings.cjs +148 -9
  216. package/pan-wizard-core/bin/lib/focus.cjs +1 -1
  217. package/pan-wizard-core/bin/lib/git.cjs +1 -1
  218. package/pan-wizard-core/bin/lib/hosts.cjs +88 -0
  219. package/pan-wizard-core/bin/lib/init.cjs +7 -2
  220. package/pan-wizard-core/bin/lib/knowledge.cjs +2 -0
  221. package/pan-wizard-core/bin/lib/merge.cjs +50 -0
  222. package/pan-wizard-core/bin/lib/mutate.cjs +268 -0
  223. package/pan-wizard-core/bin/lib/next-action.cjs +112 -0
  224. package/pan-wizard-core/bin/lib/optimize.cjs +2 -2
  225. package/pan-wizard-core/bin/lib/phase-gate.cjs +15 -9
  226. package/pan-wizard-core/bin/lib/phase-remove.cjs +91 -11
  227. package/pan-wizard-core/bin/lib/phase.cjs +85 -13
  228. package/pan-wizard-core/bin/lib/plan-lint.cjs +310 -0
  229. package/pan-wizard-core/bin/lib/preview.cjs +26 -4
  230. package/pan-wizard-core/bin/lib/requirements-lint.cjs +130 -0
  231. package/pan-wizard-core/bin/lib/research-lint.cjs +268 -0
  232. package/pan-wizard-core/bin/lib/review-deep.cjs +14 -22
  233. package/pan-wizard-core/bin/lib/review-vote.cjs +105 -0
  234. package/pan-wizard-core/bin/lib/roadmap.cjs +1 -0
  235. package/pan-wizard-core/bin/lib/runner.cjs +2 -16
  236. package/pan-wizard-core/bin/lib/sizing.cjs +356 -0
  237. package/pan-wizard-core/bin/lib/squads.cjs +1 -1
  238. package/pan-wizard-core/bin/lib/state-write.cjs +247 -0
  239. package/pan-wizard-core/bin/lib/test-gate.cjs +433 -0
  240. package/pan-wizard-core/bin/lib/uat.cjs +149 -0
  241. package/pan-wizard-core/bin/lib/usage.cjs +104 -0
  242. package/pan-wizard-core/bin/lib/verdict.cjs +26 -3
  243. package/pan-wizard-core/bin/lib/verify-plan-set.cjs +30 -1
  244. package/pan-wizard-core/bin/lib/verify-preflight.cjs +2 -2
  245. package/pan-wizard-core/bin/lib/verify-red.cjs +174 -0
  246. package/pan-wizard-core/bin/lib/verify-retro.cjs +3 -2
  247. package/pan-wizard-core/bin/lib/verify-scope.cjs +143 -2
  248. package/pan-wizard-core/bin/lib/verify.cjs +86 -31
  249. package/pan-wizard-core/bin/lib/worktree.cjs +70 -0
  250. package/pan-wizard-core/bin/pan-tools.cjs +257 -28
  251. package/pan-wizard-core/learnings/universal/autonomous-loop.md +2 -2
  252. package/pan-wizard-core/mcp/orchestrator.cjs +4 -1
  253. package/pan-wizard-core/references/continuation-format.md +3 -3
  254. package/pan-wizard-core/references/design-methodology.md +1 -1
  255. package/pan-wizard-core/references/guardrails.md +1 -1
  256. package/pan-wizard-core/references/handoff-decisions.md +1 -1
  257. package/pan-wizard-core/references/model-profiles.md +2 -3
  258. package/pan-wizard-core/references/questioning.md +24 -0
  259. package/pan-wizard-core/references/ui-brand.md +4 -6
  260. package/pan-wizard-core/references/verdict-contract.md +2 -1
  261. package/pan-wizard-core/templates/config.json +10 -2
  262. package/pan-wizard-core/templates/debug.md +1 -0
  263. package/pan-wizard-core/templates/design.md +5 -4
  264. package/pan-wizard-core/templates/discovery.md +2 -2
  265. package/pan-wizard-core/templates/phase-prompt.md +7 -0
  266. package/pan-wizard-core/templates/requirements.md +9 -0
  267. package/pan-wizard-core/templates/research.md +10 -0
  268. package/pan-wizard-core/templates/summary-complex.md +5 -1
  269. package/pan-wizard-core/templates/summary-minimal.md +4 -0
  270. package/pan-wizard-core/templates/summary-standard.md +5 -1
  271. package/pan-wizard-core/templates/summary.md +8 -1
  272. package/pan-wizard-core/workflows/add-phase.md +4 -6
  273. package/pan-wizard-core/workflows/assumptions.md +19 -1
  274. package/pan-wizard-core/workflows/diagnose-issues.md +2 -0
  275. package/pan-wizard-core/workflows/discuss-phase.md +4 -2
  276. package/pan-wizard-core/workflows/exec-lean.md +69 -0
  277. package/pan-wizard-core/workflows/exec-phase.md +79 -15
  278. package/pan-wizard-core/workflows/execute-plan.md +3 -1
  279. package/{commands/pan → pan-wizard-core/workflows}/focus-doc-audit.md +13 -29
  280. package/{commands/pan → pan-wizard-core/workflows}/focus-drift-walking.md +3 -18
  281. package/{commands/pan → pan-wizard-core/workflows}/focus-exec.md +8 -23
  282. package/{commands/pan → pan-wizard-core/workflows}/focus-plan.md +6 -20
  283. package/{commands/pan → pan-wizard-core/workflows}/focus-scan.md +3 -16
  284. package/{commands/pan → pan-wizard-core/workflows}/focus-sync.md +7 -21
  285. package/pan-wizard-core/workflows/health.md +6 -0
  286. package/pan-wizard-core/workflows/help.md +114 -77
  287. package/pan-wizard-core/workflows/insert-phase.md +4 -6
  288. package/pan-wizard-core/workflows/learn.md +3 -3
  289. package/pan-wizard-core/workflows/milestone-audit.md +2 -2
  290. package/pan-wizard-core/workflows/milestone-new.md +38 -95
  291. package/pan-wizard-core/workflows/new-project.md +96 -258
  292. package/pan-wizard-core/workflows/optimize.md +107 -5
  293. package/pan-wizard-core/workflows/phase-tests.md +10 -0
  294. package/pan-wizard-core/workflows/plan-phase.md +106 -45
  295. package/pan-wizard-core/workflows/profile.md +50 -0
  296. package/pan-wizard-core/workflows/progress.md +10 -0
  297. package/pan-wizard-core/workflows/quick.md +34 -43
  298. package/pan-wizard-core/workflows/remove-phase.md +11 -1
  299. package/pan-wizard-core/workflows/research-phase.md +118 -40
  300. package/pan-wizard-core/workflows/resume-project.md +18 -2
  301. package/pan-wizard-core/workflows/settings.md +33 -19
  302. package/pan-wizard-core/workflows/todo-check.md +6 -2
  303. package/pan-wizard-core/workflows/transition.md +22 -4
  304. package/pan-wizard-core/workflows/uat-walkthrough.md +90 -0
  305. package/pan-wizard-core/workflows/update.md +1 -1
  306. package/pan-wizard-core/workflows/verify-phase.md +39 -46
  307. package/scripts/build-agent-plugin.js +35 -15
  308. package/scripts/build-help.cjs +106 -0
  309. package/scripts/build-plugin.js +10 -1
  310. package/scripts/deprecate-old-versions.js +70 -3
  311. package/scripts/generate-skills-docs.py +1 -1
  312. package/scripts/git-hooks/pre-push +27 -0
  313. package/scripts/install-git-hooks.js +7 -5
  314. package/scripts/install-pre-push.cjs +38 -0
  315. package/scripts/land.cjs +151 -0
  316. package/scripts/local-ci.cjs +501 -0
  317. package/scripts/local-schedule.cjs +277 -0
  318. package/scripts/mutation-probe.cjs +7 -80
  319. package/scripts/prompt-lint.cjs +32 -0
  320. package/scripts/prompt-rules.cjs +156 -0
  321. package/scripts/run-tests.cjs +7 -1
  322. package/scripts/test-quality-lint.cjs +3 -3
  323. package/scripts/test-surface.cjs +175 -6
  324. package/agents/pan-research-synthesizer.md +0 -246
  325. package/commands/pan/audit-deployment.md +0 -386
  326. package/commands/pan/dashboard.md +0 -22
  327. package/commands/pan/discord.md +0 -19
  328. package/commands/pan/mcp-bridge.md +0 -143
  329. package/commands/pan/milestone-cleanup.md +0 -19
  330. package/commands/pan/milestone-gaps.md +0 -35
  331. package/commands/pan/optimize.md +0 -115
  332. package/commands/pan/profile.md +0 -76
  333. package/commands/pan/research-phase.md +0 -189
  334. package/pan-wizard-core/bin/lib/bridge.cjs +0 -269
  335. package/pan-wizard-core/templates/research-project/architecture.md +0 -204
  336. package/pan-wizard-core/templates/research-project/features.md +0 -147
  337. package/pan-wizard-core/templates/research-project/pitfalls.md +0 -200
  338. package/pan-wizard-core/templates/research-project/stack.md +0 -120
  339. package/pan-wizard-core/templates/research-project/summary.md +0 -170
@@ -66,10 +66,11 @@ tier may omit them.
66
66
  - Writes to: [paths — within .planning/ or project root]
67
67
  - Side effects: [git ops, dir creation, etc.]
68
68
 
69
- **Design decisions:**
70
- | Decision | Chosen | Alternative rejected | Rationale |
71
- |----------|--------|----------------------|-----------|
72
- | [point] | [what] | [alt] | [why] |
69
+ **Design decisions:** record a decision here only when it passes all three questions: (1) is it hard to reverse once code depends on it? (2) could a reasonable engineer have chosen otherwise? (3) does more than one task or plan depend on it? A choice that fails any of them is the planner's to make, not a design decision. Each recorded decision gets an id (`DD-1`, `DD-2` …) that the plans implementing it cite; `pan-tools verify decisions` flags a plan citing an id not recorded here and a decision no plan cites.
70
+
71
+ | ID | Decision | Chosen | Alternative rejected | Rationale |
72
+ |----|----------|--------|----------------------|-----------|
73
+ | DD-1 | [point] | [what] | [alt] | [why] |
73
74
  </architecture>
74
75
 
75
76
  <adr>
@@ -4,7 +4,7 @@ Template for `.planning/phases/XX-name/discovery.md` - shallow research for libr
4
4
 
5
5
  **Purpose:** Answer "which library/option should we use" questions when a phase needs a quick option comparison before planning.
6
6
 
7
- For deep ecosystem research ("how do experts build this"), use `/pan:research-phase` which produces research.md.
7
+ For deep ecosystem research ("how do experts build this"), use `/pan:plan-phase --research-only` which produces research.md.
8
8
 
9
9
  ---
10
10
 
@@ -142,5 +142,5 @@ Create `.planning/phases/XX-name/discovery.md`:
142
142
  - Niche/complex domains (3D, games, audio, shaders)
143
143
  - Need ecosystem knowledge, not just library choice
144
144
  - "How do experts build this" questions
145
- - Use `/pan:research-phase` for these
145
+ - Use `/pan:plan-phase --research-only` for these
146
146
  </guidelines>
@@ -71,6 +71,13 @@ Output: [What artifacts will be created]
71
71
  ### Considered and rejected
72
72
  - R-1: [alternative]. Rejected because: [reason].
73
73
 
74
+ <!-- A Locked decision that implements a design decision cites its id: "Source: design DD-2". -->
75
+
76
+ ## Review Focus
77
+ <!-- At most five inputs or failure modes the requirements imply that no test exercises yet,
78
+ each pinned to the task that owns the code. If genuinely none: "None — [why]". -->
79
+ - RF-1: [input or failure mode]. Test: Task [N] adds [test that fails if it is mishandled].
80
+
74
81
  <tasks>
75
82
 
76
83
  <task type="auto">
@@ -17,6 +17,9 @@ Requirements for initial release. Each maps to roadmap phases.
17
17
  ### Authentication
18
18
 
19
19
  - [ ] **AUTH-01**: User can sign up with email and password
20
+ - WHEN a visitor submits a new email and a valid password THE SYSTEM SHALL create the account
21
+ - IF the email is already registered THEN THE SYSTEM SHALL refuse the sign-up without revealing the account
22
+ - Test: tests/auth/signup.test.ts
20
23
  - [ ] **AUTH-02**: User receives email verification after signup
21
24
  - [ ] **AUTH-03**: User can reset password via email link
22
25
  - [ ] **AUTH-04**: User session persists across browser refresh
@@ -74,6 +77,12 @@ Which phases cover which requirements. Updated during roadmap creation.
74
77
 
75
78
  </template>
76
79
 
80
+ <ears_criteria>
81
+ Each v1 requirement carries at least one acceptance criterion as an indented sub-bullet in an EARS form: `WHEN <trigger> THE SYSTEM SHALL <response>`, `WHILE <state> …`, `WHERE <feature> …`, `IF <unwanted condition> THEN THE SYSTEM SHALL …`, or `THE SYSTEM SHALL …`. `pan-tools verify requirements` fails a v1 requirement with none.
82
+
83
+ The tests that check a requirement go in `Test:` sub-bullets as the plans add them. `pan-tools verify traceability` runs them. A criterion with no mapped test reads `not_checked`, never met, and `phase complete` ticks a requirement only when its mapped tests pass. A requirement with no criteria at all is treated as legacy and keeps the old tick.
84
+ </ears_criteria>
85
+
77
86
  <guidelines>
78
87
 
79
88
  **Requirement Format:**
@@ -204,6 +204,16 @@ Things that couldn't be fully resolved:
204
204
  - Recommendation: [how to handle]
205
205
  </open_questions>
206
206
 
207
+ <claims>
208
+ ## Claims
209
+
210
+ Every claim a plan will rest on: a version, an API's behaviour, a price, a security advisory, a practice. One row each, with where it came from and the day it was checked (YYYY-MM-DD). `pan-tools research lint` refuses a claim with no source or no date, and lists as stale a claim older than its type's window (version, pricing, security: 30 days; api: 90; general: 180; practice: 365).
211
+
212
+ | Claim | Type | Source | Checked |
213
+ |-------|------|--------|---------|
214
+ | [what is true] | [version / api / pricing / security / practice / general] | [URL, doc section or Context7 id] | [YYYY-MM-DD] |
215
+ </claims>
216
+
207
217
  <sources>
208
218
  ## Sources
209
219
 
@@ -53,7 +53,7 @@ completed: YYYY-MM-DD
53
53
  - DT-1: Chose [option] for O-N. Reason: [rationale].
54
54
 
55
55
  ### Deviations (from plan; must explain)
56
- - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable].
56
+ - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable]. Cost if wrong: [low | medium | high] — [what breaks].
57
57
 
58
58
  ### Open questions for verifier
59
59
  - Q-1: [question]. Why it matters: [stake].
@@ -64,6 +64,10 @@ completed: YYYY-MM-DD
64
64
  [Problems during planned work and resolutions — distinct from Deviations above:
65
65
  Issues = bugs/blockers fixed; Deviations = intentional departures from plan]
66
66
 
67
+ ## Concerns
68
+ [What was finished but is not certain, or "None"]
69
+ - C-1: [concern]. Why: [what makes it uncertain]. Cost if wrong: [low | medium | high] — [what breaks].
70
+
67
71
  ## Next Phase Readiness
68
72
  [What's ready for next phase]
69
73
  [Blockers or concerns]
@@ -44,5 +44,9 @@ completed: YYYY-MM-DD
44
44
  [One line each, or this single line if none:
45
45
  "No deviations or open questions — implementation followed plan exactly."]
46
46
 
47
+ ## Concerns
48
+ [What was finished but is not certain, or "None"]
49
+ - C-1: [concern]. Why: [what makes it uncertain]. Cost if wrong: [low | medium | high] — [what breaks].
50
+
47
51
  ## Next Phase Readiness
48
52
  [Ready for next phase]
@@ -49,7 +49,7 @@ completed: YYYY-MM-DD
49
49
  - DT-1: Chose [option] for O-N. Reason: [rationale].
50
50
 
51
51
  ### Deviations (from plan; must explain)
52
- - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable].
52
+ - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable]. Cost if wrong: [low | medium | high] — [what breaks].
53
53
 
54
54
  ### Open questions for verifier
55
55
  - Q-1: [question]. Why it matters: [stake].
@@ -57,5 +57,9 @@ completed: YYYY-MM-DD
57
57
  <!-- If none: replace ALL three buckets with:
58
58
  "No deviations or open questions — implementation followed plan exactly." -->
59
59
 
60
+ ## Concerns
61
+ [What was finished but is not certain, or "None"]
62
+ - C-1: [concern]. Why: [what makes it uncertain]. Cost if wrong: [low | medium | high] — [what breaks].
63
+
60
64
  ## Next Phase Readiness
61
65
  [What's ready for next phase]
@@ -88,7 +88,7 @@ _Note: TDD tasks may have multiple commits (test → feat → refactor)_
88
88
  - DT-1: Chose [option] for O-N. Reason: [rationale].
89
89
 
90
90
  ### Deviations (from plan; must explain)
91
- - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable].
91
+ - DV-1: Plan said [X]; I did [Y]. Reason: [rationale]. Verification: [how I confirmed Y is acceptable]. Cost if wrong: [low | medium | high] — [what breaks].
92
92
 
93
93
  ### Open questions for verifier
94
94
  - Q-1: [question]. Why it matters: [stake].
@@ -112,6 +112,7 @@ _Note: TDD tasks may have multiple commits (test → feat → refactor)_
112
112
  - **Fix:** [What was done]
113
113
  - **Files modified:** [file paths]
114
114
  - **Verification:** [How it was verified]
115
+ - **Cost if wrong:** [low | medium | high] — [what breaks, and for whom, if this call was wrong]
115
116
  - **Committed in:** [hash] (part of task commit)
116
117
 
117
118
  [... repeat for each auto-fix ...]
@@ -124,6 +125,12 @@ _Note: TDD tasks may have multiple commits (test → feat → refactor)_
124
125
  ## Issues Encountered
125
126
  [Problems and how they were resolved, or "None"]
126
127
 
128
+ ## Concerns
129
+
130
+ [What was finished but is not certain, or "None". Any entry here means the executor returned DONE_WITH_CONCERNS.]
131
+
132
+ - C-1: [concern]. Why: [what makes it uncertain]. Cost if wrong: [low | medium | high] — [what breaks].
133
+
127
134
  [Note: "Deviations from Plan" documents unplanned work that was handled automatically via deviation rules. "Issues Encountered" documents problems during planned work that required problem-solving.]
128
135
 
129
136
  ## User Setup Required
@@ -60,13 +60,11 @@ Extract from result: `phase_number`, `padded`, `name`, `slug`, `directory`.
60
60
  <step name="update_project_state">
61
61
  Update state.md to reflect the new phase:
62
62
 
63
- 1. Read `.planning/state.md`
64
- 2. Under "## Accumulated Context" → "### Roadmap Evolution" add entry:
65
- ```
66
- - Phase {N} added: {description}
67
- ```
63
+ Append the entry under "## Accumulated Context" → "### Roadmap Evolution" (the engine creates the section when it is missing):
68
64
 
69
- If "Roadmap Evolution" section doesn't exist, create it.
65
+ ```bash
66
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state section "Roadmap Evolution" --append "- Phase {N} added: {description}"
67
+ ```
70
68
  </step>
71
69
 
72
70
  <step name="completion">
@@ -1,7 +1,7 @@
1
1
  <purpose>
2
2
  Surface Claude's assumptions about a phase before planning, enabling users to correct misconceptions early.
3
3
 
4
- Key difference from discuss-phase: This is ANALYSIS of what Claude thinks, not INTAKE of what user knows. No file output - purely conversational to prompt discussion.
4
+ Key difference from discuss-phase: This is ANALYSIS of what Claude thinks, not INTAKE of what user knows. The conversation ends with one file, `{phase_dir}/{phase_num}-assumptions.md`, holding the assumptions and the user's corrections, so discuss-phase and plan-phase start from them instead of losing them with the session.
5
5
  </purpose>
6
6
 
7
7
  <process>
@@ -145,6 +145,24 @@ This changes my understanding significantly. [Summarize new understanding]
145
145
  Assumptions validated.
146
146
  ```
147
147
 
148
+ **Either way, save them.** Write `{phase_dir}/{phase_num}-assumptions.md` once, in full:
149
+
150
+ ```markdown
151
+ # Phase {phase_num}: Assumptions
152
+
153
+ **Reviewed:** {date}
154
+
155
+ ## Assumptions
156
+
157
+ - {each assumption, as presented}
158
+
159
+ ## Corrections
160
+
161
+ - {each correction, in the user's words; "None: the user confirmed the assumptions" when there were none}
162
+ ```
163
+
164
+ `init phase-op` reports it as `assumptions_path`; discuss-phase and plan-phase read it. Commit it with the phase's docs when `commit_docs` is on.
165
+
148
166
  Continue to offer_next.
149
167
  </step>
150
168
 
@@ -98,6 +98,8 @@ Template placeholders (see `debug-subagent-prompt.md`):
98
98
  - `{timeline}`: "Discovered during UAT"
99
99
  - `{true_or_false}`: `true` (symptoms are prefilled from the UAT gap)
100
100
  - `{goal}`: `find_root_cause_only` (UAT flow - plan-phase --gaps handles fixes)
101
+
102
+ Each gap gets its own reproduction, one per requirement or UAT truth it breaks (the debugger records `requirement:` beside the command). That command is the gap's closing check: the fix plan from `/pan:plan-phase --gaps` is done only when `node ~/.claude/pan-wizard-core/bin/pan-tools.cjs debug repro <slug>` turns green.
101
103
  - `{slug}`: Generated from the issue summary
102
104
  </step>
103
105
 
@@ -116,7 +116,9 @@ Phase number from argument (required).
116
116
  INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init phase-op "${PHASE}")
117
117
  ```
118
118
 
119
- Parse JSON for: `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `has_verification`, `plan_count`, `roadmap_exists`, `planning_exists`.
119
+ Parse JSON for: `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `has_verification`, `plan_count`, `roadmap_exists`, `planning_exists`, `assumptions_path`.
120
+
121
+ **If `assumptions_path` is set**, read it first: it holds the assumptions `/pan:assumptions` surfaced and the user's corrections to them. Treat each correction as already decided; do not ask it again.
120
122
 
121
123
  **If `phase_found` is false:**
122
124
  ```
@@ -283,7 +285,7 @@ Analyze the phase to identify gray areas worth discussing.
283
285
 
284
286
  1. **Domain boundary** — What capability is this phase delivering? State it clearly.
285
287
 
286
- 2. **Gray areas by category** — For each relevant category (UI, UX, Behavior, Empty States, Content), identify 1-2 specific ambiguities that would change implementation.
288
+ 2. **Gray areas by category**: scan the phase against the `<clarification_taxonomy>` in `references/questioning.md` (scope, users, behaviour, data, interfaces, errors and edge cases, non-functional, constraints, done), plus UI, UX, empty states and content for a user-facing phase. Identify the specific ambiguities that would change implementation, then keep to the `<question_budget>`: at most five questions, ranked by impact × uncertainty, and every ambiguity you do not ask about written into context.md as an `Assumed:` line the user can correct.
287
289
 
288
290
  3. **Skip assessment** — If no meaningful gray areas exist (pure infrastructure, clear-cut implementation), the phase may not need discussion.
289
291
 
@@ -0,0 +1,69 @@
1
+ <purpose>
2
+ Execute a lean phase in this one session: you do the work the executor agent would do, then one reviewer pass and a verifier check it. Autodev runs this for a phase the engine sized lean (its requirements say precisely what to build, and the engine wrote and checked its plan), so the full exec-phase orchestration (an orchestrating session, a separate executor, test generation) is not needed. The reviewer stays: on the brief test (2026-10-25) a lean build and a bare host's build each carried one high-severity defect the hidden checks could not see, and the reviewer found both. The phase gate still decides when autodev runs `phase complete`.
3
+ </purpose>
4
+
5
+ <rules>
6
+ - **The plan is the specification.** Do what each task's `<action>` says, nothing more. Do not widen scope; log anything else to `{phase_dir}/deferred-items.md`.
7
+ - **Tests are the spec.** Test files the plan does not list in `files_modified` are read-only. Never delete, rename or skip a test, remove an assertion, or add one that cannot fail. A plan's `supersedes_tests` are the exception it declares: update their expectations to what the named requirements now require, and record each change as a deviation. A test you cannot satisfy without weakening it means stop and reply `## BLOCKED_SPEC_CONFLICT` with the test, the requirement and why both cannot hold.
8
+ - **Commit each task** when its verify command passes: `node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "feat({padded}-{plan}): <what the task did>" --files <the files it changed>`.
9
+ - **Unattended:** do not ask questions; take the recommended default and record what you assumed in the summary. Do not start another phase or command.
10
+ </rules>
11
+
12
+ <process>
13
+ 1. **Load the phase:**
14
+ ```bash
15
+ INIT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs init execute-phase "{phase}")
16
+ ```
17
+ Read `phase_dir`, `phase_number`, `incomplete_plans`, `plan_check` and `verifier_enabled`. When `plan_check.status` is not `ok` or `disabled`, stop and reply `EXECUTION HALTED: plan check {status}`.
18
+
19
+ 2. **Record the test baseline** (what the suite does before this phase):
20
+ ```bash
21
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs test run --phase "{phase_number}" --baseline > /dev/null
22
+ ```
23
+
24
+ 3. **Execute each incomplete plan, in order.** Read the plan. For each task: make the change, write or update the tests its action names, run its `<verify>` command until it passes (at most three fix attempts, then record the task as an issue and continue), and commit it. Then write `{phase_dir}/{padded}-{plan}-summary.md` from `~/.claude/pan-wizard-core/templates/summary.md`: what was built, the files, every deviation (including each superseded test expectation: file, what it asserted, what it asserts now, which requirement) and every assumption. Then record progress and commit the summary:
25
+ ```bash
26
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state advance-plan
27
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs state update-progress
28
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs roadmap update-plan-progress "{phase_number}"
29
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs requirements mark-complete {the plan's requirements}
30
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs commit "docs({padded}-{plan}): complete plan" --files {phase_dir}/{padded}-{plan}-summary.md .planning/state.md .planning/roadmap.md .planning/requirements.md
31
+ ```
32
+
33
+ 4. **Review.** One pass of the code reviewer over what the phase changed; it looks for what the tests and the verifier do not (a save that is not crash-safe, unchecked arithmetic, state left wrong after an error). Collect the scope, then spawn it:
34
+ ```bash
35
+ REVIEW_SCOPE=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs review scope "{phase_number}")
36
+ CHANGED_FILES_LIST=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs review scope "{phase_number}" --raw)
37
+ ```
38
+ ```
39
+ Task(
40
+ subagent_type="pan-reviewer",
41
+ model="{reviewer_model from: node ~/.claude/pan-wizard-core/bin/pan-tools.cjs resolve-model pan-reviewer --raw}",
42
+ prompt="<objective>Review the code changed in phase {phase_number} for defects: behaviour that contradicts the requirements, data loss or corruption (including a crash mid-write), inputs that must throw and do not, state left wrong after an error, security problems. Real defects only, each with a concrete input that shows it.</objective> <files_to_read>./CLAUDE.md (if it exists); changed files: ${CHANGED_FILES_LIST}</files_to_read> <intent>${REVIEW_SCOPE}</intent> <executor_concerns>{what you finished but were not sure of, with why; empty when none}</executor_concerns>"
43
+ )
44
+ ```
45
+ Write its returned text, verbatim and in full with its `pan-verdict` block, to `{phase_dir}/{phase_number}-review.md` (the reviewer is read-only), then record it:
46
+ ```bash
47
+ REVIEW_VERDICT=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings record --phase "{phase_number}" --agent pan-reviewer --file "{phase_dir}/{phase_number}-review.md" --raw)
48
+ ```
49
+ `PASS`: go on. `PASS_WITH_WARNINGS`: go on, recording that the phase continues past them:
50
+ ```bash
51
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings dispose --phase "{phase_number}" --agent pan-reviewer --open --as deferred --reason "accepted at review: PASS_WITH_WARNINGS"
52
+ ```
53
+ `NEEDS_FIXES`: fix each ERROR finding (the tests stay the spec: a fix adds a test for the defect, never weakens one), commit the fixes as `fix({padded}): review findings`, and run the review once more. A second `NEEDS_FIXES` does not loop: record what stays open with `findings dispose ... --as deferred --reason "open after one fix round (unattended)"`, go on to verification, and name those findings in the reply. Never continue past findings silently: an open finding without a recorded reason is what the milestone audit cannot see.
54
+
55
+ 5. **Verify** (skip only when `verifier_enabled` is false, and say so). Spawn the verifier; it is a second pair of eyes, so give it paths, not your conclusions:
56
+ ```
57
+ Task(
58
+ subagent_type="pan-verifier",
59
+ model="{verifier_model from: node ~/.claude/pan-wizard-core/bin/pan-tools.cjs resolve-model pan-verifier --raw}",
60
+ prompt="Verify phase {phase_number} goal achievement. Phase directory: {phase_dir}. Check the plans' must_haves and requirement IDs against the code. Run the project's test suite as the test gate and record test_gate in the frontmatter. Create verification.md."
61
+ )
62
+ ```
63
+ Then record its verdict:
64
+ ```bash
65
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs findings record --phase "{phase_number}" --file "$(ls {phase_dir}/*-verification.md | head -1)" --raw
66
+ ```
67
+
68
+ 6. **Reply** in a few lines: the plans executed, the commits, the review verdict and any finding left open, the verification status, and any deviation, assumption or issue. Do not run `phase complete`: autodev runs it next and the phase gate decides.
69
+ </process>
@@ -52,6 +52,14 @@ Parse JSON for: `executor_model`, `verifier_model`, `reviewer_model`, `commit_do
52
52
 
53
53
  **Drift.** For each `plan_drift` entry, tell the executor of that plan, in its prompt, which of its `files_modified` changed since it was planned (`files`), so it re-reads them before editing. An entry with `error` means its `planned_commit` is unknown: say so and continue.
54
54
 
55
+ **Size the ceremony** (pass `--quality` or `--full` through when `$ARGUMENTS` has them):
56
+
57
+ ```bash
58
+ SIZING=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs size phase "${PHASE_ARG}" [--quality] [--full])
59
+ ```
60
+
61
+ Show `Ceremony: {path} ({reasons joined by "; "})`. When `SIZING.path` is `lean`, the phase runs without the test-generation agent (`generate_tests`); the executor's own tests, the engine's test gate, one code review pass (`code_review`) and the verifier (`verify_phase_goal`) still run, and the phase gate still decides.
62
+
55
63
  When `parallelization` is false, plans within a wave execute sequentially.
56
64
 
57
65
  **Circular optimization — start trace session for this exec:**
@@ -96,6 +104,8 @@ PLAN_INDEX=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs phase-plan-index "
96
104
 
97
105
  Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`.
98
106
 
107
+ **One plan (`--plan <id>`).** Execute only that plan: skip every other plan, then stop after its summary and commits, with no code review, verification or phase routing. `pan-tools autodev run --worktrees` runs each plan this way in its own git worktree and merges the plans back behind a shadow-merge preflight; the phase-level steps run later on the merged result. If the plan already has a summary, say so and stop.
108
+
99
109
  **Filtering:** Skip plans where `has_summary: true`. If `--gaps-only`: also skip plans whose frontmatter lacks `gap_closure: true` (`phase-plan-index` does not report it; `frontmatter get <plan> --field gap_closure` exits 1 when it is absent). If all filtered: "No matching incomplete plans" → exit.
100
110
 
101
111
  **If `--gaps-only`:** this run is the fix round after a verification found gaps — a second attempt at work that failed once. Resolve the executor for that attempt and use it in place of `executor_model` for every spawn in this run:
@@ -117,6 +127,14 @@ Report:
117
127
  | 1 | 01-01, 01-02 | {from plan objectives, 3-8 words} |
118
128
  | 2 | 01-03 | ... |
119
129
  ```
130
+
131
+ **Test baseline.** Before the first wave, record what the test suite does now, so the verifier can tell a failure this phase caused from one it inherited:
132
+
133
+ ```bash
134
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs test run --phase "${PHASE_NUMBER}" --baseline > /dev/null
135
+ ```
136
+
137
+ A phase that already has a baseline keeps it (a resumed run or a `--gaps-only` round compares against the phase's start, not its half-built state); the command says `kept_existing: true` and runs nothing. A failing or empty baseline is not a reason to stop: it is what the phase starts from.
120
138
  </step>
121
139
 
122
140
  <step name="execute_waves">
@@ -178,6 +196,11 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
178
196
  - .agents/skills/ (Project skills, if exists — list skills, read SKILL.md for each, follow relevant rules during implementation)
179
197
  </files_to_read>
180
198
 
199
+ {Only when the plan's frontmatter has `supersedes_tests`, include:}
200
+ <superseded_tests>
201
+ This plan changes behaviour earlier phases built ({supersedes_requirements}). These test files assert the old behaviour and the plan declares them: {supersedes_tests}. Updating their expectations to what those requirements now require is part of the task, not a spec conflict. Record each changed expectation as a deviation in the summary (file, what it asserted, what it asserts now, which requirement). Deleting, skipping or weakening a test is still forbidden, and `verify test-integrity` still checks it.
202
+ </superseded_tests>
203
+
181
204
  If the plan's `<context>` names `@.planning/roadmap.md`, read `{slice_path}` in its place: it carries this phase's section, its dependencies' goals and its requirements, and the whole roadmap is the largest file in `.planning/` on a long project. Open the whole file only for something the slice leaves out.
182
205
 
183
206
  <success_criteria>
@@ -202,6 +225,8 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
202
225
 
203
226
  If ANY spot-check fails: report which plan failed, route to failure handler — ask "Retry plan?" or "Continue with remaining waves?"
204
227
 
228
+ **An executor that returned `## DONE_WITH_CONCERNS`** finished its plan: run the same spot-checks and treat it as complete. Keep its concerns (each with why and cost if wrong, also under `## Concerns` in its summary) for the wave report and the phase report. Do not stop the wave for them; a high-cost concern is something the review and the verifier should look at, and the phase report puts it in front of the user.
229
+
205
230
  **An executor that returned `## BLOCKED_SPEC_CONFLICT`** found a test it cannot satisfy without weakening it. It is not a failure to retry: show the user its Test, Requirement and Options and ask for a ruling. "Change the test" means a revised plan that declares the test file in `files_modified` (`/pan:plan-phase {N} --gaps` or an edit to the plan), then re-run that plan; "change the requirement" means updating the requirement and the plan. Never re-run the same plan unchanged: it would meet the same test. Declaring the file permits rewriting its expectations; deleting the test, skipping it or dropping assertions still fails `verify test-integrity`, so a ruling to do that also needs `phase complete --force --reason`.
206
231
 
207
232
  If pass:
@@ -211,7 +236,8 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
211
236
 
212
237
  **{Plan ID}: {Plan Name}**
213
238
  {What was built — from summary.md}
214
- {Notable deviations, if any}
239
+ {Notable deviations, if any, with their cost if wrong}
240
+ {Concerns, if it returned DONE_WITH_CONCERNS}
215
241
 
216
242
  {If more waves: what this enables for next wave}
217
243
  ---
@@ -229,6 +255,12 @@ Execute each wave in sequence. Within a wave: parallel if `PARALLELIZATION=true`
229
255
  2>/dev/null || true
230
256
  ```
231
257
 
258
+ Check the phase's spend against its budget (`cost.phase_budget_usd`, default $20; it only warns):
259
+ ```bash
260
+ BUDGET=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs cost budget --phase "${PHASE_NUMBER}" 2>/dev/null)
261
+ ```
262
+ When its `status` is `near` or `over`, add one line to the wave report: "Spend: ${spent_usd} of the ${budget_usd} phase budget (${pct}%)", and for `over`, "over budget: the phase keeps running; change the budget with /pan:settings". Do not stop, pause or ask: the budget warns, it never blocks. `ok` and `off` add nothing.
263
+
232
264
  - Bad: "Wave 2 complete. Proceeding to Wave 3."
233
265
  - Good: "Terrain system complete — 3 biome types, height-based texturing, physics collision meshes. Vehicle physics (Wave 3) can now reference ground surfaces."
234
266
 
@@ -323,13 +355,20 @@ After all waves:
323
355
 
324
356
  ### Issues Encountered
325
357
  [Aggregate from SUMMARYs, or "None"]
358
+
359
+ ### Concerns
360
+ [Every concern from the plans that returned DONE_WITH_CONCERNS (and any `## Concerns` entry in a summary), high cost if wrong first:]
361
+ - **03-02** C-1: [concern]. Why: [...]. Cost if wrong: high — [what breaks]
362
+ [Or "None"]
326
363
  ```
364
+
365
+ Concerns go into the review too: the code_review step passes them to the reviewer as `${EXECUTOR_CONCERNS}`, so a high-cost concern is checked rather than only reported.
327
366
  </step>
328
367
 
329
368
  <step name="generate_tests">
330
369
  **Auto-invoke test generation after execution completes.**
331
370
 
332
- **Skip if** `--skip-tests` or `--fast` flag is present in $ARGUMENTS.
371
+ **Skip if** `--skip-tests` or `--fast` flag is present in $ARGUMENTS, or `SIZING.path` is `lean`.
333
372
 
334
373
  1. Record baseline test count:
335
374
  ```bash
@@ -339,12 +378,9 @@ TEST_BASELINE=$(npm test 2>&1 | grep -E "^(ℹ|#) tests" | awk '{print $NF}')
339
378
  2. Invoke phase-tests workflow for the completed phase:
340
379
  ```
341
380
  Task(
342
- prompt="Generate tests for phase ${PHASE_NUMBER}.
381
+ prompt="Follow the phase-tests workflow (~/.claude/pan-wizard-core/workflows/phase-tests.md) for phase ${PHASE_NUMBER}.
343
382
  Phase directory: ${phase_dir}
344
- Read each summary.md to understand what was built.
345
- Generate unit and integration tests for the new code.
346
- Discover the project's existing test patterns, directories, frameworks, and helpers before writing tests.
347
- Follow whatever conventions the project already uses.",
383
+ It classifies each changed file, discovers the project's test patterns, writes the tests the plan approves, and commits them.",
348
384
  subagent_type="general-purpose",
349
385
  model="{executor_model}",
350
386
  )
@@ -355,7 +391,13 @@ Alternatively, if the user's AI tool supports it, invoke the command directly:
355
391
  /pan:phase-tests ${PHASE_NUMBER}
356
392
  ```
357
393
 
358
- 3. Record new test count:
394
+ 3. Prove the new tests catch something (V4). A test that passes without the phase's code is tautological:
395
+ ```bash
396
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs verify red "${PHASE_NUMBER}"
397
+ ```
398
+ Rewrite or drop each test it reports as `not_red`; `not_checked` names a runner that cannot run one file and is reported, not failed.
399
+
400
+ 4. Record new test count:
359
401
  ```bash
360
402
  TEST_AFTER=$(npm test 2>&1 | grep -E "^(ℹ|#) tests" | awk '{print $NF}')
361
403
  ```
@@ -376,15 +418,14 @@ TEST_AFTER=$(npm test 2>&1 | grep -E "^(ℹ|#) tests" | awk '{print $NF}')
376
418
  <step name="code_review">
377
419
  **Spawn pan-reviewer agent to review changed files.**
378
420
 
379
- **Skip if** `--skip-review` or `--fast` flag is present in $ARGUMENTS.
421
+ **Skip if** `--skip-review` or `--fast` flag is present in $ARGUMENTS. A lean phase (`SIZING.path`) keeps this step: the review finds what the tests and the verifier do not.
380
422
 
381
- 1. Collect changed files from executor summaries:
423
+ 1. Collect the review scope: the files the phase's commits changed plus any uncommitted or untracked work, whether or not a summary lists them, and the intent to judge them against:
382
424
  ```bash
383
- # Read each summary.md and extract key-files.created + key-files.modified
384
- for summary in "$PHASE_DIR"/*-summary.md; do
385
- node ~/.claude/pan-wizard-core/bin/pan-tools.cjs summary-extract "$summary" --fields key_files | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{const k=JSON.parse(s).key_files||{};for(const f of [...(k.created||[]),...(k.modified||[])])console.log(f)})"
386
- done | sort -u > /tmp/review-files.txt
425
+ REVIEW_SCOPE=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs review scope "${PHASE_NUMBER}")
426
+ CHANGED_FILES_LIST=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs review scope "${PHASE_NUMBER}" --raw)
387
427
  ```
428
+ `REVIEW_SCOPE` is JSON. Its `unlisted` array holds the changed files no summary's key-files names. Review them like the others: an executor that changed a file without listing it is exactly what a review must not miss. Its `intent` holds each plan's objective, `must_haves` and Review Focus, and the text of the requirements the plans claim.
388
429
 
389
430
  2. Collect the reviewer's earlier open findings on this phase (empty on a first review), then spawn pan-reviewer:
390
431
  ```bash
@@ -412,6 +453,19 @@ Task(
412
453
  Phase directory: ${phase_dir}
413
454
  </context>
414
455
 
456
+ <intent>
457
+ The plans' objectives, must_haves and Review Focus, the requirements they claim,
458
+ and the changed files no summary listed (review scope JSON):
459
+ ${REVIEW_SCOPE}
460
+ </intent>
461
+
462
+ <executor_concerns>
463
+ What the executors finished but were not sure of, each with why and its cost if
464
+ wrong (from DONE_WITH_CONCERNS returns and the summaries' ## Concerns). Check the
465
+ high-cost ones first. Empty when there were none:
466
+ ${EXECUTOR_CONCERNS}
467
+ </executor_concerns>
468
+
415
469
  <open_findings>
416
470
  ${OPEN_REVIEW_FINDINGS}
417
471
  </open_findings>
@@ -421,6 +475,16 @@ Task(
421
475
 
422
476
  3. **Save the report.** Use the Write tool to write the reviewer's returned text, verbatim and in full (including its closing `pan-verdict` block), to `{phase_dir}/{phase_number}-review.md`. The reviewer is read-only by design, so the orchestrator saves the report. `/pan:review-deep` and the findings ledger read this file.
423
477
 
478
+ **Lenses (opt-in).** Check the review mode first:
479
+ ```bash
480
+ REVIEW_MODE=$(node ~/.claude/pan-wizard-core/bin/pan-tools.cjs config-get workflow.review_mode 2>/dev/null || echo single)
481
+ ```
482
+ When it is `lenses`, run step 2 three times instead of once. Each spawn's prompt carries one `<lens>` (`correctness`, `security`, `maintainability`), and each report is saved to `{phase_dir}/{phase_number}-review-{lens}.md`. Then merge them in code. A finding survives only when at least two of the three passes reported it, and the verdict is recomputed from what survives:
483
+ ```bash
484
+ node ~/.claude/pan-wizard-core/bin/pan-tools.cjs review vote --phase "${PHASE_NUMBER}" --out "{phase_dir}/{phase_number}-review.md" "{phase_dir}/{phase_number}-review-correctness.md" "{phase_dir}/{phase_number}-review-security.md" "{phase_dir}/{phase_number}-review-maintainability.md"
485
+ ```
486
+ Step 4 records the merged `{phase_number}-review.md` as usual. `single`, the default, is the one pass above.
487
+
424
488
  4. **Record the verdict, then act on it.** The record is what this step branches on. It also adds the findings to the ledger (`.planning/findings.jsonl`) and logs the verdict to the trace, so no separate trace call is needed:
425
489
  ```bash
426
490
  REVIEW_FILE="{phase_dir}/{phase_number}-review.md"
@@ -633,7 +697,7 @@ COMPLETION_EXIT=$?
633
697
  | Result | Action |
634
698
  |---|---|
635
699
  | exit 1, `error: phase_gate_refused` (`workflow.phase_gate: enforce`) | The phase was NOT marked complete. Show each `gate.reasons` entry (`code`: `detail`) with its fix, and stop: no commit, no auto-advance. The user may complete anyway with a reason (below) |
636
- | exit 0, `gate.ok` false (`warn`, the default) | The phase was marked complete. Show the reasons as warnings, run the rest of this step, and do NOT auto-advance (`offer_next` reads `GATE_OK`) |
700
+ | exit 0, `gate.ok` false (`workflow.phase_gate: warn`) | The phase was marked complete. Show the reasons as warnings, run the rest of this step, and do NOT auto-advance (`offer_next` reads `GATE_OK`) |
637
701
  | exit 0, `gate.ok` true | Continue |
638
702
 
639
703
  **Completing past a refusal** is the user's decision, never yours, and needs their reason. It records a `decision` for every open finding the gate counted:
@@ -218,10 +218,12 @@ Proceed with proposed change? (yes / different approach / defer)
218
218
 
219
219
  Summary MUST include deviations section. None? → `## Deviations from Plan\n\nNone - plan executed exactly as written.`
220
220
 
221
- Per deviation: **[Rule N - Category] Title** — Found during: Task X | Issue | Fix | Files modified | Verification | Commit hash
221
+ Per deviation: **[Rule N - Category] Title** — Found during: Task X | Issue | Fix | Files modified | Verification | Cost if wrong (low, medium or high, and what breaks) | Commit hash
222
222
 
223
223
  End with: **Total deviations:** N auto-fixed (breakdown). **Impact:** assessment.
224
224
 
225
+ Then `## Concerns`: what was finished but is not certain, each as `- C-1: <concern>. Why: <…>. Cost if wrong: <…>.`, or "None". A plan with concerns returns `## DONE_WITH_CONCERNS` (see the executor's completion format).
226
+
225
227
  </deviation_documentation>
226
228
 
227
229
  <tdd_plan_execution>
@@ -1,20 +1,4 @@
1
- ---
2
- name: focus-doc-audit
3
- group: Focus
4
- description: Multi-dimensional document audit — accuracy, freshness, links, cross-consistency, and structural quality
5
- argument-hint: "[file|directory] [--deep] [--links] [--fix] [--all] [--score-only] [--min-score N] [--format markdown|json|checklist]"
6
- allowed-tools:
7
- - Read
8
- - Write
9
- - Edit
10
- - Bash
11
- - Grep
12
- - Glob
13
- - Agent
14
- - WebFetch
15
- ---
16
-
17
- # /pan:focus-doc-audit — Deep Document Audit & Quality Assessment
1
+ # /pan:focus-docs — Deep Document Audit & Quality Assessment
18
2
 
19
3
  Audit project documentation for accuracy, freshness, broken links, structural quality, cross-document consistency, and code alignment. $ARGUMENTS
20
4
 
@@ -24,7 +8,7 @@ Audit project documentation for accuracy, freshness, broken links, structural qu
24
8
 
25
9
  ---
26
10
 
27
- ## CRITICAL: Project Scope Boundary
11
+ ## Project Scope Boundary
28
12
 
29
13
  This command audits the **host project's documentation** — NOT PAN Wizard's own infrastructure files.
30
14
 
@@ -41,20 +25,20 @@ If you find yourself auditing a PAN command file — STOP. Refocus on the projec
41
25
 
42
26
  ## MANDATORY: Execute ALL Phases Automatically
43
27
 
44
- When `/pan:focus-doc-audit` is invoked, execute ALL phases for the selected mode without stopping. Do NOT ask questions between phases. Do NOT skip phases beyond what the mode specifies. Produce a complete audit report at the end.
28
+ When `/pan:focus-docs` is invoked, execute ALL phases for the selected mode without stopping. Do NOT ask questions between phases. Do NOT skip phases beyond what the mode specifies. Produce a complete audit report at the end.
45
29
 
46
30
  **Usage:**
47
31
  ```
48
- /pan:focus-doc-audit # Audit core docs (README, main docs)
49
- /pan:focus-doc-audit <file> # Audit a specific file
50
- /pan:focus-doc-audit <directory> # Audit all markdown files in directory
51
- /pan:focus-doc-audit --deep # Deep audit: verify every claim against code
52
- /pan:focus-doc-audit --links # Link validation pass only
53
- /pan:focus-doc-audit --fix # Auto-fix simple issues (counts, versions, dates, links)
54
- /pan:focus-doc-audit --all # Audit ALL documentation files project-wide
55
- /pan:focus-doc-audit --score-only # Skip fix suggestions, just output scores
56
- /pan:focus-doc-audit --min-score <N> # Only report files scoring below N% (default: 100 = report all)
57
- /pan:focus-doc-audit --format <type> # Output: markdown (default), json, checklist
32
+ /pan:focus-docs # Audit core docs (README, main docs)
33
+ /pan:focus-docs <file> # Audit a specific file
34
+ /pan:focus-docs <directory> # Audit all markdown files in directory
35
+ /pan:focus-docs --deep # Deep audit: verify every claim against code
36
+ /pan:focus-docs --links # Link validation pass only
37
+ /pan:focus-docs --fix # Auto-fix simple issues (counts, versions, dates, links)
38
+ /pan:focus-docs --all # Audit ALL documentation files project-wide
39
+ /pan:focus-docs --score-only # Skip fix suggestions, just output scores
40
+ /pan:focus-docs --min-score <N> # Only report files scoring below N% (default: 100 = report all)
41
+ /pan:focus-docs --format <type> # Output: markdown (default), json, checklist
58
42
  ```
59
43
 
60
44
  ---