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
@@ -0,0 +1,754 @@
1
+ # /featureAI — Lifecycle Completeness: Closing the V-Model Gap
2
+
3
+ **Generated:** 2026-03-08
4
+ **Feature:** Wire test generation, code review, test suite gates, and retrospective into PAN's main lifecycle
5
+ **Scope:** 4 new capabilities (P0-P3), 2 new agents, 3 workflow modifications, 1 new command
6
+
7
+ ---
8
+
9
+ ## Phase 0: Problem Framing & Demand Validation
10
+
11
+ ### 0.1 Problem Statement
12
+
13
+ PAN Wizard's lifecycle has a critical structural gap: the stages between code execution and goal verification are hollow. Industry-standard SDLCs (V-Model, Agile, DevOps) all include dedicated test generation, code review, and full test suite gates as mandatory stages. PAN has `/pan:phase-tests` for test generation but it's orphaned — no orchestrator calls it. `pan-verifier` checks goals but never runs the actual test suite. There's no code review stage at all. This means PAN ships code that passes per-task `<automated>` checks but has never been reviewed for quality, tested as an integrated suite, or validated against generated test cases. For a tool whose value proposition is "verify-before-ship," this is a significant credibility gap.
14
+
15
+ ### 0.2 Demand Evidence
16
+
17
+ | Evidence Type | Source | Finding |
18
+ |--------------|--------|---------|
19
+ | User pain (stated) | This conversation | User discovered `/pan:phase-tests` is orphaned and asked "where in the main processes does it define test cases?" |
20
+ | Gap analysis | `link_system_temp.md` | Systematic comparison against 8 industry frameworks identified 6 gaps, 4 in the testing/review lifecycle |
21
+ | V-Model violation | Architecture analysis | PAN implements left-side of V (requirements → design → code) but skips right-side (unit → integration → system → UAT) |
22
+ | Competitor gap | Devin comparison | Devin runs tests in sandbox and self-reviews code — PAN does neither automatically |
23
+
24
+ ### 0.3 Scope Definition
25
+
26
+ | In Scope | Out of Scope (and why) |
27
+ |----------|------------------------|
28
+ | Wire `/pan:phase-tests` into exec-phase → verify-phase chain | CI/CD pipeline integration (separate feature, different domain) |
29
+ | Add `pan-reviewer` agent for code review gate | Security scanning / SAST (L effort, separate feature) |
30
+ | Add test suite gate to `pan-verifier` | Performance testing (specialized tooling needed) |
31
+ | Add `/pan:retro` milestone retrospective | Deployment/release workflow (out of PAN's core domain) |
32
+ | Enhance exec-phase workflow to call tests + review | Monitoring/SRE (out of scope by design) |
33
+
34
+ ### 0.4 Success Criteria
35
+
36
+ ```
37
+ SC-1: After /pan:exec-phase completes, /pan:phase-tests is auto-invoked (not orphaned)
38
+ SC-2: pan-reviewer agent exists and is spawned between execution and verification
39
+ SC-3: pan-verifier runs the project's test suite and compares before/after counts
40
+ SC-4: /pan:retro generates estimation accuracy and failure pattern analysis
41
+ SC-5: No regression in existing 1604+ tests
42
+ SC-6: Works identically on Windows, Mac, and Linux
43
+ SC-7: All new agents registered in model-profiles.md and settings.json
44
+ ```
45
+
46
+ ### 0.5 User Stories
47
+
48
+ ```
49
+ As a developer using PAN Wizard, I want test generation to happen automatically after execution,
50
+ so that I don't have to remember to manually run /pan:phase-tests after every phase.
51
+
52
+ As a developer, I want an AI code review before verification,
53
+ so that quality issues, convention violations, and security anti-patterns are caught
54
+ before I consider the phase "done."
55
+
56
+ As a developer, I want the verifier to actually run my test suite,
57
+ so that I know tests pass — not just that goals were theoretically met.
58
+
59
+ As a project lead, I want a retrospective after each milestone,
60
+ so that I can learn from estimation errors, common gap patterns, and process friction.
61
+ ```
62
+
63
+ ### 0.6 Cannibalization Check
64
+
65
+ | Existing Command/Agent | Overlap? | Impact |
66
+ |-----------------------|----------|--------|
67
+ | `/pan:phase-tests` | Partial — exists but orphaned | Wire into lifecycle (enhance, don't replace) |
68
+ | `/pan:verify-phase` + `pan-verifier` | Partial — add test suite gate | Extend verification workflow |
69
+ | `/pan:milestone-audit` + `pan-integration-checker` | None | Retro is process-focused, audit is artifact-focused |
70
+ | `/pan:focus-sync` | None | Sync is docs, retro is process |
71
+
72
+ No full overlap. This enhances existing commands and adds 1 new command + 1 new agent.
73
+
74
+ ### 0.7 Cognitive Load Assessment
75
+
76
+ | Metric | Before | After | Delta |
77
+ |--------|--------|-------|-------|
78
+ | Commands a new user must learn | 38 | 39 (+retro) | +1 |
79
+ | New concepts introduced | 0 | 1 (review gate) | +1 |
80
+ | Score | — | — | neutral (0) — review/test are automatic, retro is optional |
81
+
82
+ ---
83
+
84
+ ## Phase 1: Internal Reconnaissance
85
+
86
+ ### 1.1 Existing Capabilities Inventory
87
+
88
+ | Capability | Status | Location | Relevance |
89
+ |------------|--------|----------|-----------|
90
+ | Per-task test execution | Working | pan-executor `<verify>` + `<automated>` blocks | Foundation for test stage |
91
+ | Phase-level test generation | Orphaned | `/pan:phase-tests`, `phase-tests.md` workflow | Must wire into lifecycle |
92
+ | Goal-backward verification | Working | `pan-verifier`, `verify-phase.md` | Add test suite gate |
93
+ | Artifact verification | Working | `verify.cjs` — cmdVerifyArtifacts, cmdVerifyKeyLinks | Unchanged |
94
+ | Drift checking | Working | `verify.cjs` — cmdDriftCheck | Could feed into review |
95
+ | Milestone audit | Working | `/pan:milestone-audit`, `pan-integration-checker` | Unchanged — retro is additive |
96
+ | Health validation | Working | `verify.cjs` — cmdValidateHealth --full (runs npm test) | Pattern to reuse for test gate |
97
+
98
+ ### 1.2 Architecture Scan — Current Lifecycle Flow
99
+
100
+ ```
101
+ exec-phase.md workflow steps:
102
+ 1. initialize
103
+ 2. handle_branching
104
+ 3. validate_phase
105
+ 4. discover_and_group_plans
106
+ 5. execute_waves (spawns pan-executor ×N)
107
+ 6. aggregate_results
108
+ 7. close_parent_artifacts (decimal phases only)
109
+ 8. verify_phase_goal (spawns pan-verifier) ◄── GAP: no tests, no review before this
110
+ 9. update_roadmap
111
+ 10. offer_next
112
+ ```
113
+
114
+ **Insertion points for new stages:**
115
+ - After step 6 (aggregate_results): INSERT test generation + code review
116
+ - Enhance step 8 (verify_phase_goal): ADD test suite gate to verifier prompt
117
+
118
+ ### 1.3 Convention Enforcement Checklist
119
+
120
+ - [x] Functions named `cmd<Module><Action>(cwd, raw, ...args)`
121
+ - [x] File reads use `safeReadFile()` pattern
122
+ - [x] File writes wrapped in try-catch
123
+ - [x] JSON output via `output(data, raw, humanLabel)`
124
+ - [x] Errors via `error(message)`
125
+ - [x] Paths through `toPosix()`
126
+ - [x] Module exports at bottom
127
+ - [x] CommonJS only (`.cjs`)
128
+ - [x] Zero runtime dependencies
129
+
130
+ ### 1.4 Dependency & Integration Map
131
+
132
+ ```
133
+ [Lifecycle Completeness]
134
+ ├── extends: exec-phase.md (add test + review steps)
135
+ ├── extends: verify-phase.md (add test suite gate)
136
+ ├── wires: phase-tests.md (already exists, connect to exec-phase)
137
+ ├── creates: pan-reviewer agent (new)
138
+ ├── creates: /pan:retro command + workflow (new)
139
+ ├── depends on: verify.cjs (cmdValidateHealth pattern for test running)
140
+ ├── depends on: core.cjs (model profiles for new agent)
141
+ ├── depends on: constants.cjs (agent registration)
142
+ └── enables: future security scanning, performance gates
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Phase 2: Competitive Intelligence
148
+
149
+ ### 2.1 AI Tool Post-Execution Lifecycle Comparison
150
+
151
+ | Stage | Devin | Copilot WS | Cursor | Cline | PAN (Current) | PAN (Proposed) |
152
+ |-------|-------|------------|--------|-------|---------------|----------------|
153
+ | **Test Generation** | Auto (writes tests) | Auto (generates) | On request | On request | ORPHANED | Auto after exec |
154
+ | **Test Execution** | Auto (runs in sandbox) | No | No | Partial (retry) | Per-task only | Full suite gate |
155
+ | **Code Review** | Self-review | PR review | Inline | No | MISSING | pan-reviewer agent |
156
+ | **Goal Verification** | No | No | No | No | pan-verifier | Enhanced verifier |
157
+ | **Gap Closure** | Retry loop | No | No | Error retry | plan --gaps loop | Unchanged |
158
+ | **Retrospective** | No | No | No | No | MISSING | /pan:retro |
159
+
160
+ ### 2.2 Key Insights from Competitors
161
+
162
+ **Devin's approach:** Runs tests after every code change in its sandbox. If tests fail, it debugs autonomously. This tight loop catches regressions immediately but doesn't have strategic verification (did we achieve the GOAL?).
163
+
164
+ **Copilot Workspace:** Generates tests alongside code in the PR. Review happens via GitHub's native PR review. No verification of goals.
165
+
166
+ **What nobody does:** Goal-backward verification + gap closure. PAN is unique here. The opportunity is to ADD the testing/review stages that competitors have WITHOUT losing PAN's unique verification advantage.
167
+
168
+ ### 2.3 Strategic Differentiation
169
+
170
+ PAN's proposed lifecycle would be the ONLY AI coding tool with ALL of:
171
+ 1. Parallel research → planning → plan validation
172
+ 2. Wave-parallel execution with TDD
173
+ 3. **NEW: Auto test generation**
174
+ 4. **NEW: AI code review gate**
175
+ 5. **NEW: Full test suite verification gate**
176
+ 6. Goal-backward verification (unique to PAN)
177
+ 7. Gap closure loop
178
+ 8. **NEW: Process retrospective**
179
+
180
+ This makes PAN the most complete SDLC coverage of any AI coding tool.
181
+
182
+ ---
183
+
184
+ ## Phase 3: Strategic Analysis
185
+
186
+ ### 3.1 Blue Ocean Four Actions Framework
187
+
188
+ | Action | Decision |
189
+ |--------|----------|
190
+ | **ELIMINATE** | Manual invocation of `/pan:phase-tests` — make it automatic |
191
+ | **REDUCE** | Cognitive load of "what do I run next after exec?" — the lifecycle auto-chains |
192
+ | **RAISE** | Verification quality — from goal-check-only to goal + test suite + code review |
193
+ | **CREATE** | Process learning loop (retro) — no AI coding tool has this |
194
+
195
+ ### 3.2 Wardley Evolution
196
+
197
+ ```
198
+ Genesis ──── Custom-Built ──── Product ──── Commodity
199
+ ↑ ↑
200
+ │ └── Test execution (well understood)
201
+ └── AI code review (emerging), Process retrospective (novel)
202
+ ```
203
+
204
+ - Test suite gates: Commodity practice — PAN should just have this
205
+ - AI code review: Product stage — emerging in Copilot/Devin, PAN can do better
206
+ - Process retrospective: Genesis — no AI tool does this, PAN creates category
207
+
208
+ ### 3.3 Strategic Moat Analysis
209
+
210
+ | Moat Type | Contribution | Score (0-5) |
211
+ |-----------|-------------|-------------|
212
+ | Context Engineering | Review agent has full phase context, not just diff | 5 |
213
+ | Cross-Platform | All changes are .md workflows — works everywhere | 5 |
214
+ | Developer Experience | Auto-chain reduces manual steps from 4 to 1 | 4 |
215
+ | Zero Dependencies | No new deps — review is agent-based, tests use project's runner | 5 |
216
+ | State Persistence | Retro reads historical state.md + verification.md | 4 |
217
+ | Verification Quality | Three-layer verification (tests + review + goals) | 5 |
218
+ | **Total** | | **28/30** |
219
+
220
+ ### 3.4 Strategic Recommendation
221
+
222
+ **Build — Full scope.** This closes the most embarrassing gap in PAN's lifecycle (an orphaned test command the user literally discovered during review). The implementation is mostly wiring changes to existing workflows plus one new agent and one new command. The competitive differentiation is strong: PAN would become the only AI tool with a complete V-Model right-side (test generation → review → test execution → goal verification). The `/pan:retro` command creates an entirely new category that no competitor offers.
223
+
224
+ ---
225
+
226
+ ## Phase 3.5: Architecture & Implementation Pattern Assessment
227
+
228
+ ### 3.5.1 Feature Type Classification
229
+
230
+ | Component | Type | Template |
231
+ |-----------|------|----------|
232
+ | exec-phase.md test/review steps | Workflow enhancement | Edit existing workflow |
233
+ | pan-reviewer agent | New Agent | New .md in agents/ |
234
+ | verify-phase.md test gate | Workflow enhancement | Edit existing workflow |
235
+ | /pan:retro command + workflow | New Command + Workflow | New .md in commands/pan/ + workflows/ |
236
+
237
+ ### 3.5.2 Layer Violation Check
238
+
239
+ - [x] Workflows invoke agents via Task tool (not direct function calls)
240
+ - [x] pan-reviewer reads files via Read/Grep tools (agent-level, not lib-level)
241
+ - [x] Test suite execution via Bash `npm test` (not importing test framework)
242
+ - [x] Retro reads .planning/ files (Layer 5 access from Layer 2 workflow)
243
+ - [x] No upward dependencies
244
+
245
+ ### 3.5.3 Output Contract — `/pan:retro`
246
+
247
+ ```json
248
+ {
249
+ "milestone": "string — milestone identifier",
250
+ "phases_completed": "number",
251
+ "phases_with_gaps": "number",
252
+ "gap_closure_phases": "number",
253
+ "estimation_accuracy": {
254
+ "planned_phases": "number",
255
+ "actual_phases": "number — including gap closures",
256
+ "accuracy_percent": "number"
257
+ },
258
+ "common_gap_patterns": [
259
+ { "pattern": "string", "frequency": "number", "phases": ["string"] }
260
+ ],
261
+ "verification_stats": {
262
+ "passed_first_try": "number",
263
+ "required_gaps": "number",
264
+ "required_human": "number"
265
+ },
266
+ "recommendations": ["string — process improvement suggestions"]
267
+ }
268
+ ```
269
+
270
+ ### 3.5.4 State Transition Modeling
271
+
272
+ No state mutations — all changes are to workflow orchestration. `/pan:retro` is read-only (reads historical files, produces report).
273
+
274
+ ### 3.5.5 Breaking Change Assessment
275
+
276
+ | Question | Answer |
277
+ |----------|--------|
278
+ | Changes existing command JSON output? | No |
279
+ | Changes file formats? | No |
280
+ | Changes directory structure? | No |
281
+ | Changes installer? | Yes — new agent + command must be installed |
282
+
283
+ ### 3.5.6 Performance Budget
284
+
285
+ | Operation | Cost | Notes |
286
+ |-----------|------|-------|
287
+ | Test generation (phase-tests) | ~30s-2min | Agent-based, already exists |
288
+ | Code review (pan-reviewer) | ~30s-1min | New agent, reads changed files |
289
+ | Test suite execution | ~5-30s | Project-dependent, `npm test` equivalent |
290
+ | Retro analysis | < 500ms | CLI, reads .planning/ files |
291
+
292
+ ---
293
+
294
+ ## Phase 4: Design Synthesis
295
+
296
+ ### 4.1 Guide-Level Explanation
297
+
298
+ **Lifecycle Completeness** closes the gap between execution and verification in PAN's workflow.
299
+
300
+ **Before:** After `/pan:exec-phase`, the verifier checks goals but never runs your tests or reviews the code. You had to manually run `/pan:phase-tests` (and most users didn't know it existed).
301
+
302
+ **After:** The lifecycle auto-chains:
303
+ ```
304
+ exec-phase → phase-tests (auto) → review (auto) → verify (with test gate)
305
+ ```
306
+
307
+ **Example 1 — Normal phase execution:**
308
+ ```
309
+ /pan:exec-phase 3
310
+
311
+ ## Wave 1 Complete
312
+ Built authentication module — JWT tokens, login endpoint, middleware.
313
+
314
+ ## Test Generation
315
+ Generated 12 tests for phase 3 (unit: 8, integration: 4).
316
+ Tests: 145/145 passing (+12 new).
317
+
318
+ ## Code Review
319
+ pan-reviewer checked 6 files:
320
+ ✓ Convention compliance
321
+ ✓ Error handling patterns
322
+ ⚠ auth.ts:42 — password compared without constant-time comparison (security)
323
+ ⚠ auth.ts:78 — missing input validation on email format
324
+
325
+ ## Verification
326
+ ✓ Goals: 5/5 success criteria met
327
+ ✓ Tests: 145/145 passing (was 133)
328
+ ✓ Artifacts: all present and wired
329
+ → Phase 3 PASSED
330
+ ```
331
+
332
+ **Example 2 — Milestone retrospective:**
333
+ ```
334
+ /pan:retro
335
+
336
+ ## Milestone 1.0 Retrospective
337
+
338
+ Estimation Accuracy: 85% (planned 8 phases, needed 9 including 1 gap closure)
339
+
340
+ Common Gap Patterns:
341
+ 1. "Missing error handling" — appeared in 3/8 phases
342
+ 2. "Integration wiring incomplete" — appeared in 2/8 phases
343
+
344
+ Verification Stats:
345
+ - Passed first try: 6/8 (75%)
346
+ - Required gap closure: 1/8
347
+ - Required human verification: 1/8
348
+
349
+ Recommendations:
350
+ 1. Add error handling checklist to pan-planner must_haves
351
+ 2. Consider integration tests in plan <verify> blocks
352
+ ```
353
+
354
+ ### 4.2 Reference-Level Explanation
355
+
356
+ #### 4.2.1 New Lifecycle (exec-phase.md changes)
357
+
358
+ Insert two new steps between `aggregate_results` and `verify_phase_goal`:
359
+
360
+ **Step 6.5: generate_tests**
361
+ ```
362
+ After aggregate_results, auto-invoke phase-tests:
363
+
364
+ 1. Record baseline test count: `npm test 2>&1 | tail -5` (or project-specific)
365
+ 2. Invoke phase-tests workflow with phase number
366
+ 3. Record new test count
367
+ 4. Report delta: "Generated N tests (+M from baseline)"
368
+
369
+ Skip if: --skip-tests flag, or no test runner detected
370
+ ```
371
+
372
+ **Step 6.7: code_review**
373
+ ```
374
+ After test generation, spawn pan-reviewer:
375
+
376
+ 1. Collect changed files from executor summaries
377
+ 2. Spawn pan-reviewer with file list + phase context
378
+ 3. Reviewer checks: conventions, error handling, security patterns, duplication
379
+ 4. Report findings with severity levels (error/warning/info)
380
+
381
+ If ERROR-level findings: present to user, ask "Fix before verification?" or "Continue?"
382
+ Skip if: --skip-review flag
383
+ ```
384
+
385
+ #### 4.2.2 verify-phase.md changes
386
+
387
+ Add test suite gate to verifier prompt:
388
+
389
+ ```
390
+ Before checking goals, run the project's test suite:
391
+ 1. Execute: `npm test` (or detected test command from package.json)
392
+ 2. Parse: total tests, passing, failing
393
+ 3. Compare against pre-execution baseline (from exec-phase)
394
+ 4. If tests REGRESS: verification status = gaps_found (test regression)
395
+ 5. If tests PASS: continue to goal-backward verification
396
+ ```
397
+
398
+ #### 4.2.3 pan-reviewer Agent
399
+
400
+ **Role:** Post-execution code review. Reads changed files from executor summaries, checks quality patterns, reports findings.
401
+
402
+ **Tools:** Read, Grep, Glob, Bash (read-only — no Edit/Write)
403
+
404
+ **Checks:**
405
+ 1. Convention compliance (naming, exports, error handling patterns)
406
+ 2. Security anti-patterns (eval, unsanitized input, hardcoded secrets)
407
+ 3. Dead code / unused imports
408
+ 4. Duplication across changed files
409
+ 5. Missing error handling (try-catch on fs/network operations)
410
+ 6. Path safety (toPosix usage, no hardcoded separators)
411
+
412
+ **Output:** Structured findings with severity levels.
413
+
414
+ #### 4.2.4 `/pan:retro` Command
415
+
416
+ **Reads:** `.planning/roadmap.md`, `.planning/state.md`, all `*-verification.md`, all `*-summary.md`
417
+
418
+ **Analyzes:**
419
+ - Phase count (planned vs actual, including gap closures)
420
+ - Verification outcomes (passed/gaps/human per phase)
421
+ - Common gap patterns (text similarity across gap descriptions)
422
+ - Estimation accuracy (planned effort vs actual)
423
+ - Time between phases (if timestamps available)
424
+
425
+ **Output:** Structured JSON report + human-readable summary
426
+
427
+ ### 4.3 Design Decisions
428
+
429
+ | Decision | Rationale | What We Did NOT Copy |
430
+ |----------|-----------|---------------------|
431
+ | Auto-chain tests + review | Reduces lifecycle friction from 4 manual commands to 1 | Devin's tight loop (too aggressive — PAN batches at phase level) |
432
+ | Review as separate agent | Fresh 200K context, focused on quality | Cursor's inline suggestions (too granular for phase-level review) |
433
+ | Test gate in verifier | Single verification pass, not separate command | Copilot WS's PR-based review (PAN isn't PR-centric) |
434
+ | --skip-tests/--skip-review flags | User control for small phases or quick iterations | Mandatory gates (too rigid for exploratory work) |
435
+
436
+ ### 4.4 Feature Ladder
437
+
438
+ | Version | Scope | Value | Effort |
439
+ |---------|-------|-------|--------|
440
+ | **v0 (MVP)** | Wire phase-tests into exec-phase + test gate in verifier | Tests are no longer orphaned | S (8 pts) |
441
+ | **v1 (Complete)** | Add pan-reviewer agent + review step in exec-phase | Full test + review + verify chain | M (16 pts) |
442
+ | **v2 (Enhanced)** | Add /pan:retro command + workflow | Process learning loop | M (12 pts) |
443
+
444
+ ---
445
+
446
+ ## Phase 5: Architecture Decision Record
447
+
448
+ See: `docs/decisions/ADR-0022-lifecycle-completeness.md`
449
+
450
+ ---
451
+
452
+ ## Phase 6: Error Handling & Diagnostics
453
+
454
+ ### 6.1 Failure Mode Analysis
455
+
456
+ | Failure Mode | Detection | Recovery | User Sees |
457
+ |-------------|-----------|----------|-----------|
458
+ | No test runner detected | Check package.json scripts | Skip test generation, warn | "No test runner found — skipping test generation" |
459
+ | Test generation fails | Agent error/timeout | Continue to verify without tests | "Test generation failed — proceeding to verification" |
460
+ | Reviewer finds ERROR-level issues | Structured findings | Pause, present to user | "Code review found N issues — fix before verify?" |
461
+ | Test suite regresses | Compare before/after counts | verification status = gaps_found | "Tests regressed: N failing (was 0)" |
462
+ | Retro has no historical data | Check for verification.md files | Graceful empty report | "No completed phases found for retrospective" |
463
+
464
+ ### 6.2 Skip Flags
465
+
466
+ | Flag | Effect | When to Use |
467
+ |------|--------|-------------|
468
+ | `--skip-tests` | Skip test generation + test gate | Quick iterations, non-code phases |
469
+ | `--skip-review` | Skip code review | Trusted/small changes |
470
+ | `--fast` | Skip both tests and review | Rapid prototyping |
471
+
472
+ ---
473
+
474
+ ## Phase 7: Security & Threat Model
475
+
476
+ ### 7.1 Attack Surface
477
+
478
+ | Asset | Access | Trust |
479
+ |-------|--------|-------|
480
+ | Changed source files | Read (reviewer) | User-controlled |
481
+ | Test output | Read (verifier) | System-generated |
482
+ | .planning/ files | Read (retro) | System-generated |
483
+
484
+ Minimal attack surface — all new components are READ-ONLY against existing files. No new file writes except reviewer findings (written to verification.md by verifier).
485
+
486
+ ### 7.2 Reviewer Security
487
+
488
+ The pan-reviewer agent has **no Edit or Write tools** — it can only read and report. This prevents a compromised agent from modifying source code during "review."
489
+
490
+ ---
491
+
492
+ ## Phase 8: Implementation Roadmap
493
+
494
+ ### 8.1 pan-reviewer Agent Definition (DRAFT)
495
+
496
+ ```markdown
497
+ ---
498
+ name: pan-reviewer
499
+ description: Post-execution code review — checks quality, conventions, security patterns
500
+ tools: [Read, Grep, Glob, Bash]
501
+ color: yellow
502
+ ---
503
+
504
+ <purpose>
505
+ Review code changes from a completed phase execution. Check for quality issues,
506
+ convention violations, security anti-patterns, and duplication. Report findings
507
+ with severity levels. Do NOT modify any files — read-only review.
508
+ </purpose>
509
+
510
+ <process>
511
+ 1. Read executor summary.md files to identify changed/created files
512
+ 2. Read each changed file
513
+ 3. Check against quality criteria (below)
514
+ 4. Produce structured findings report
515
+
516
+ <quality_checks>
517
+ ## Convention Compliance
518
+ - Functions follow cmd<Module><Action> naming (for core modules)
519
+ - Error handling uses error() not console.error/throw
520
+ - JSON output uses output() not console.log
521
+ - Paths use toPosix() in output
522
+ - File reads use safeReadFile/readStateSafe pattern
523
+ - File writes wrapped in try-catch
524
+ - CommonJS exports at bottom of file
525
+
526
+ ## Security Patterns
527
+ - No eval(), Function(), or template string injection
528
+ - No hardcoded secrets/tokens/keys
529
+ - Input validation on user-provided values
530
+ - Path traversal protection (no raw .. in paths)
531
+ - No shell injection (execFileSync, not execSync with string)
532
+
533
+ ## Code Quality
534
+ - Functions under 50 lines
535
+ - Nesting depth under 3 levels
536
+ - No unused imports/variables
537
+ - No duplicated blocks (>10 lines identical across files)
538
+ - Consistent error message style ("X not found" format)
539
+
540
+ ## Missing Patterns
541
+ - Async operations without error handling
542
+ - File operations without try-catch
543
+ - Missing null checks after safeReadFile()
544
+ </quality_checks>
545
+
546
+ <output_format>
547
+ ## Code Review Report
548
+
549
+ **Phase:** {phase_number} - {phase_name}
550
+ **Files Reviewed:** {count}
551
+ **Findings:** {error_count} errors, {warning_count} warnings, {info_count} info
552
+
553
+ ### Errors (must fix)
554
+ - `{file}:{line}` — {description}
555
+
556
+ ### Warnings (should fix)
557
+ - `{file}:{line}` — {description}
558
+
559
+ ### Info (consider)
560
+ - `{file}:{line}` — {description}
561
+
562
+ ### Summary
563
+ {1-2 sentence overall assessment}
564
+ </output_format>
565
+ </process>
566
+ ```
567
+
568
+ ### 8.2 Implementation Tasks
569
+
570
+ #### Task 1: Wire phase-tests into exec-phase workflow
571
+ **Files:** `pan-wizard-core/workflows/exec-phase.md`
572
+ **What:** Add step 6.5 `generate_tests` between `aggregate_results` and `verify_phase_goal`
573
+ **Test:** Run exec-phase → verify phase-tests was invoked
574
+ **Effort:** S (2 pts)
575
+ **Priority:** P0
576
+
577
+ #### Task 2: Add test suite gate to verify-phase workflow
578
+ **Files:** `pan-wizard-core/workflows/verify-phase.md`
579
+ **What:** Before goal-backward verification, run test suite and compare counts
580
+ **Test:** Verifier reports test counts in verification.md
581
+ **Effort:** S (2 pts)
582
+ **Priority:** P0
583
+
584
+ #### Task 3: Add --skip-tests and --skip-review flags to exec-phase
585
+ **Files:** `pan-wizard-core/workflows/exec-phase.md`, `commands/pan/exec-phase.md`
586
+ **What:** Parse flags, skip steps when set
587
+ **Test:** exec-phase --skip-tests skips test generation
588
+ **Effort:** XS (1 pt)
589
+ **Priority:** P1
590
+
591
+ #### Task 4: Create pan-reviewer agent
592
+ **Files:** `agents/pan-reviewer.md`
593
+ **What:** New agent with quality check instructions (see 8.1 draft)
594
+ **Test:** Agent exists, registered in model-profiles
595
+ **Effort:** S (2 pts)
596
+ **Priority:** P1
597
+
598
+ #### Task 5: Add review step to exec-phase workflow
599
+ **Files:** `pan-wizard-core/workflows/exec-phase.md`
600
+ **What:** Add step 6.7 `code_review` — spawn pan-reviewer, present findings
601
+ **Test:** Review findings appear in exec-phase output
602
+ **Effort:** S (2 pts)
603
+ **Priority:** P1
604
+
605
+ #### Task 6: Register pan-reviewer in model profiles + core.cjs
606
+ **Files:** `pan-wizard-core/bin/lib/core.cjs`, `pan-wizard-core/references/model-profiles.md`
607
+ **What:** Add `'pan-reviewer': { quality: 'sonnet', balanced: 'haiku', budget: 'haiku' }`
608
+ **Test:** Model profile resolves correctly
609
+ **Effort:** XS (1 pt)
610
+ **Priority:** P1
611
+
612
+ #### Task 7: Create /pan:retro command and workflow
613
+ **Files:** `commands/pan/retro.md`, `pan-wizard-core/workflows/retro.md`
614
+ **What:** Read historical .planning/ data, analyze patterns, produce report
615
+ **Test:** /pan:retro produces structured JSON output
616
+ **Effort:** M (4 pts)
617
+ **Priority:** P2
618
+
619
+ #### Task 8: Add retro CLI subcommand to pan-tools.cjs
620
+ **Files:** `pan-wizard-core/bin/pan-tools.cjs`, `pan-wizard-core/bin/lib/verify.cjs` (or new module)
621
+ **What:** `retro` command that reads roadmap, verification files, produces JSON analysis
622
+ **Test:** `pan-tools retro` returns valid JSON
623
+ **Effort:** M (4 pts)
624
+ **Priority:** P2
625
+
626
+ #### Task 9: Update installer for new agent + command
627
+ **Files:** `bin/install.js`
628
+ **What:** Include pan-reviewer.md and retro.md in installation
629
+ **Test:** Scenario test verifies files installed
630
+ **Effort:** XS (1 pt)
631
+ **Priority:** P2
632
+
633
+ #### Task 10: Tests for new functionality
634
+ **Files:** `tests/verify.test.cjs` (test gate), `tests/retro.test.cjs` (new)
635
+ **What:** Unit tests for retro analysis, integration tests for test gate
636
+ **Test:** All new tests pass, no regressions
637
+ **Effort:** S (2 pts)
638
+ **Priority:** P2
639
+
640
+ #### Task 11: Update documentation
641
+ **Files:** `README.md`, `docs/USER-GUIDE.md`, `docs/AGENTS.md`, `docs/ARCHITECTURE.md`, `CHANGELOG.md`, `docs/CLI-REFERENCE.md`
642
+ **What:** Document new agent, new command, updated lifecycle
643
+ **Test:** Doc references match reality
644
+ **Effort:** S (2 pts)
645
+ **Priority:** P3
646
+
647
+ #### Task 12: Update link_system_temp.md with final lifecycle
648
+ **Files:** `link_system_temp.md`
649
+ **What:** Replace "MISSING" annotations with actual commands
650
+ **Test:** No gaps remain in lifecycle matrix
651
+ **Effort:** XS (1 pt)
652
+ **Priority:** P3
653
+
654
+ ### 8.3 Dependency Graph
655
+
656
+ ```
657
+ Task 1 (wire phase-tests) ─────────────────────┐
658
+ Task 2 (test suite gate) ──────────────────────┤
659
+ Task 3 (skip flags) ── depends on 1,5 ─────────┤
660
+ Task 4 (pan-reviewer agent) ───────────┐ │
661
+ Task 5 (review step) ── depends on 4 ──┤ │
662
+ Task 6 (model profiles) ── depends on 4 ┤ │
663
+ ├──────┤
664
+ Task 7 (retro command) ────────────────┐│ │
665
+ Task 8 (retro CLI) ── depends on 7 ───┤│ │
666
+ Task 9 (installer) ── depends on 4,7 ─┤│ │
667
+ Task 10 (tests) ── depends on 1-8 ────┤│ │
668
+ Task 11 (docs) ── depends on 1-10 ────┘│ │
669
+ Task 12 (link_system) ── depends on 11 ┘ │
670
+ ```
671
+
672
+ ### 8.4 Risk Register
673
+
674
+ | Risk | Probability | Impact | Mitigation |
675
+ |------|------------|--------|------------|
676
+ | Phase-tests fails on project without test runner | Medium | Low | Detect test runner first, skip gracefully |
677
+ | Review agent too noisy (many false warnings) | Medium | Medium | Start conservative, tune thresholds |
678
+ | Test suite takes too long in verifier | Low | Medium | Add timeout, --skip-tests for large suites |
679
+ | Retro analysis on small projects is useless | Low | Low | Require minimum 3 phases for meaningful retro |
680
+
681
+ ---
682
+
683
+ ## Phase 9: Test Plan
684
+
685
+ ### 9.1 Test Pyramid
686
+
687
+ | Level | Count | What |
688
+ |-------|-------|------|
689
+ | Unit | 8+ | Retro analysis functions, test count parsing, finding classification |
690
+ | Integration | 6+ | exec-phase with test/review steps, verifier test gate, retro command |
691
+ | E2E | 2+ | Full lifecycle with auto-test + review, retro after milestone |
692
+
693
+ ### 9.2 Key Test Cases
694
+
695
+ 1. exec-phase auto-invokes phase-tests after execution
696
+ 2. exec-phase --skip-tests bypasses test generation
697
+ 3. exec-phase --skip-review bypasses code review
698
+ 4. exec-phase --fast bypasses both
699
+ 5. verifier reports test counts in verification.md
700
+ 6. verifier sets gaps_found when tests regress
701
+ 7. pan-reviewer produces structured findings
702
+ 8. pan-reviewer ERROR findings pause for user
703
+ 9. /pan:retro with 0 phases returns empty report
704
+ 10. /pan:retro with 5+ phases produces accuracy stats
705
+ 11. /pan:retro identifies common gap patterns
706
+ 12. Full lifecycle: exec → tests → review → verify → passed
707
+
708
+ ---
709
+
710
+ ## Phase 10: Output Artifacts
711
+
712
+ ### 10.1 Documents Created
713
+
714
+ - **Spec:** `docs/specs/lifecycle_completeness_featureai.md` (this file)
715
+ - **ADR:** `docs/decisions/ADR-0022-lifecycle-completeness.md`
716
+
717
+ ### 10.2 Summary
718
+
719
+ ```
720
+ ## /featureAI Complete — Lifecycle Completeness
721
+
722
+ ### Problem & Evidence
723
+ PAN's lifecycle has a V-Model gap: test generation is orphaned, no code review, verifier
724
+ doesn't run tests, no retrospective. Evidence: user discovered gap in live session +
725
+ systematic gap analysis against 8 industry frameworks.
726
+
727
+ ### Strategic Assessment
728
+ - Blue Ocean: ELIMINATE manual test invocation, CREATE review gate + retrospective
729
+ - Wardley: Test gates (commodity), AI review (product), retrospective (genesis)
730
+ - Moat Score: 28/30 — strongest in verification quality + context engineering
731
+ - Cognitive Load: neutral (0) — new stages are automatic
732
+ - Recommendation: Build — Full scope
733
+
734
+ ### Design Summary
735
+ - Feature Type: 2 workflow enhancements + 1 new agent + 1 new command
736
+ - Modules Affected: exec-phase.md, verify-phase.md, core.cjs, pan-tools.cjs
737
+ - New: pan-reviewer agent, /pan:retro command
738
+ - Breaking Changes: none
739
+
740
+ ### Feature Ladder
741
+ - v0 (MVP): Wire phase-tests + test gate — 4 pts
742
+ - v1 (Complete): Add pan-reviewer + review step — 6 pts
743
+ - v2 (Enhanced): Add /pan:retro — 10 pts
744
+
745
+ ### Implementation
746
+ - Tasks: 12 tasks across 4 priority tiers
747
+ - Total points: 24 pts
748
+ - New files: 4 (agent, command, workflow, tests)
749
+ - Modified files: 8 (workflows, core, installer, docs)
750
+ - Tests planned: 16+ (unit: 8, integration: 6, e2e: 2)
751
+
752
+ ### Next Step
753
+ /superplan → /execplan
754
+ ```