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,80 @@
1
+ # ADR-0008: Enhance map-codebase with Mermaid Diagrams and TOGAF Structure
2
+
3
+ ## Status
4
+ Superseded by [ADR-0021](ADR-0021-codebase-mapper-v2.md) — the mapper-v2 redesign folded in and replaced this proposal.
5
+
6
+ ## Context
7
+ `/pan:map-codebase` produces 7 text-only markdown files describing a codebase.
8
+ Developers and AI agents struggle to quickly understand system structure from
9
+ prose alone. Visual diagrams communicate architecture 10x faster than text.
10
+ The current 7-file structure (STACK, INTEGRATIONS, ARCHITECTURE, STRUCTURE,
11
+ CONVENTIONS, TESTING, CONCERNS) was designed pragmatically without mapping to
12
+ any standard architecture framework.
13
+
14
+ TOGAF's Architecture Development Method provides a proven taxonomy (Business,
15
+ Application, Data, Technology architecture domains) that would give the codebase
16
+ map principled coverage. Mermaid diagrams (text-based, renders natively in GitHub,
17
+ VS Code, GitLab, and Obsidian) would add visual communication without introducing
18
+ any runtime dependency.
19
+
20
+ ## Decision
21
+ 1. Add Mermaid diagram blocks to 5 of 7 codebase document templates
22
+ 2. Restructure document sections to align with TOGAF architecture domains
23
+ 3. Keep all 7 existing filenames unchanged (backward compatibility)
24
+ 4. Update mapper agent prompts to generate diagrams as part of exploration
25
+ 5. Never use Mermaid `click` directives (security)
26
+ 6. Never include credentials or tokens in diagram labels (security)
27
+
28
+ ### Diagram Types Per Document
29
+ - ARCHITECTURE.md: Flowchart (component relationships) + Sequence diagram (request lifecycle)
30
+ - STRUCTURE.md: Flowchart TD (directory hierarchy)
31
+ - INTEGRATIONS.md: Flowchart (external services) + ER diagram (data entities, if DB detected)
32
+ - STACK.md: Flowchart (deployment topology)
33
+ - CONCERNS.md: Quadrant chart (risk assessment)
34
+
35
+ ### TOGAF Domain Mapping (without renaming files)
36
+ - Business Architecture → ARCHITECTURE.md (new section)
37
+ - Application Architecture → ARCHITECTURE.md + STRUCTURE.md (existing, restructured)
38
+ - Data Architecture → INTEGRATIONS.md (new section)
39
+ - Technology Architecture → STACK.md (new header)
40
+ - Cross-Cutting → CONVENTIONS.md, TESTING.md, CONCERNS.md (unchanged)
41
+
42
+ Mermaid was chosen over PlantUML (requires Java runtime), D2 (fewer renderers),
43
+ and PNG/SVG generation (adds runtime dependency via mmdc CLI).
44
+
45
+ ## Consequences
46
+
47
+ ### Positive
48
+ - Visual architecture diagrams generated automatically by mapper agents
49
+ - TOGAF alignment ensures no architecture layer is accidentally omitted
50
+ - Renders in GitHub markdown preview with zero additional tooling
51
+ - AI agents can parse Mermaid syntax for better planning context
52
+ - Zero new runtime dependencies (Mermaid is text, not a dependency)
53
+ - Graceful degradation in terminals (Mermaid blocks display as readable text)
54
+
55
+ ### Negative
56
+ - Mapper agents use slightly more tokens generating diagrams (~10-15% more)
57
+ - Templates become longer (more examples for agents to follow)
58
+ - Users on plain terminals see raw Mermaid syntax instead of diagrams
59
+
60
+ ### Neutral
61
+ - Existing consumers (plan-phase, exec-phase) continue working unchanged
62
+ - Same 4 mapper agents, same workflow orchestration, same 7 filenames
63
+ - Same init.cjs cmdInitMapCodebase() output — no JSON schema changes
64
+
65
+ ## Options Considered
66
+ 1. **PNG/SVG generation with mmdc CLI** — rejected (adds runtime dependency, violates zero-dep constraint)
67
+ 2. **Separate .mmd diagram files** — rejected (consumers load .md files by name, extra files = confusion)
68
+ 3. **PlantUML** — rejected (requires Java runtime)
69
+ 4. **D2 (Terrastruct)** — rejected (fewer rendering targets, less AI familiarity)
70
+ 5. **Mermaid in existing markdown** — chosen (zero deps, native rendering, AI-friendly)
71
+ 6. **Full TOGAF ADM process** — rejected (too heavyweight for codebase mapping)
72
+ 7. **TOGAF sections in existing files** — chosen (lightweight, backward-compatible)
73
+ 8. **Rename files to TOGAF domains** — rejected (breaks consumer filename mapping)
74
+
75
+ ## Links
76
+ - Spec: docs/specs/map_codebase_mermaid_togaf_featureai.md
77
+ - Current workflow: pan-wizard-core/workflows/map-codebase.md
78
+ - Current agent: .claude/agents/pan-document_code.md
79
+ - Current templates: pan-wizard-core/templates/codebase/*.md
80
+ - Related: ADR-0006 (focus commands — also uses .planning/ output)
@@ -0,0 +1,68 @@
1
+ # ADR-0009: Production Deployment Checklist
2
+
3
+ ## Status
4
+ Accepted (shipped in v1.0.0 — 2026-03-01)
5
+
6
+ ## Context
7
+
8
+ PAN Wizard v1.0.0 is feature-complete with 37 commands, 15 modules, 11 agents, and 1065 passing tests across 5 runtimes (Claude Code, OpenCode, Gemini CLI, Codex, Copilot CLI). The codebase has undergone 21 sessions of systematic hardening, testing, and documentation work.
9
+
10
+ Before publishing to npm as a stable v1.0.0 release, a production deployment audit was conducted to verify all non-code artifacts meet professional standards. The audit examined: LICENSE, SECURITY.md, .gitignore, CI pipeline, documentation accuracy, npm package configuration, installer robustness, and security posture.
11
+
12
+ ### Forces at Play
13
+ - **First impressions matter:** New users evaluate quality from README, LICENSE, and install experience before reading code
14
+ - **Security trust:** SECURITY.md with stale version (0.1.x) undermines confidence in a 1.0.0 release
15
+ - **Contributor friction:** Minimal .gitignore risks accidental commits of sensitive files in PRs
16
+ - **Documentation accuracy:** Stale counts (33 workflows when 30 exist) create confusion for contributors
17
+
18
+ ## Decision
19
+
20
+ Execute a focused deployment preparation sprint addressing 9 items in priority order:
21
+
22
+ ### P0 (Must fix before publish)
23
+ 1. **SECURITY.md** — Update version table from `0.1.x` to `1.0.0`
24
+ 2. **.gitignore** — Expand from 3 entries to comprehensive Node/OS coverage
25
+ 3. **ARCHITECTURE.md** — Fix workflow count from 33 to 31
26
+
27
+ ### P1 (Should fix before publish)
28
+ 4. **npm publish --dry-run** — Verify package size and contents
29
+ 5. **Orphaned verify-work.md** — Remove or document as alias
30
+
31
+ ### P2+ (Polish, non-blocking)
32
+ 6. **Dependabot** — Add `.github/dependabot.yml` for esbuild updates
33
+ 7. **FUNDING.yml** — Populate or remove empty placeholder
34
+ 8. **Internal command files** — Fix stale "123 tests" references
35
+ 9. **isGitIgnored()** — Migrate from `execSync` string to `execFileSync` array (defense-in-depth)
36
+
37
+ ### What We Decided NOT to Do
38
+ - **ESLint/Prettier:** Not blocking for v1.0.0. The codebase maintains consistent style without formal linting. Adding linting tools introduces devDependencies and CI complexity that doesn't match the "zero ceremony" philosophy. Consider for v1.1.0.
39
+ - **TypeScript/JSDoc validation:** Pure CJS project with 1483 tests provides better guarantees than type annotations. Not worth the migration effort.
40
+ - **npm publish workflow:** Manual publish via `npm publish` is appropriate for a solo-maintained tool. Automated publishing adds attack surface.
41
+ - **Coverage thresholds:** The project has 1483 tests across 52 files. Threshold enforcement would add CI complexity without improving actual coverage.
42
+
43
+ ## Consequences
44
+
45
+ ### Positive
46
+ - Clean, professional npm package on first publish
47
+ - Accurate security policy builds trust with evaluators
48
+ - Comprehensive .gitignore prevents contributor accidents
49
+ - Documentation accuracy reduces confusion for new users
50
+
51
+ ### Negative
52
+ - Small time investment (estimated 1 focus-exec session / ~30 minutes)
53
+ - No automated code quality gates (ESLint/Prettier deferred)
54
+
55
+ ### Neutral
56
+ - Dependabot will create PRs for esbuild updates (only devDependency)
57
+ - FUNDING.yml decision depends on whether GitHub Sponsors is set up
58
+
59
+ ## Options Considered
60
+
61
+ 1. **Ship as-is** — All issues are non-blocking, but first impression suffers
62
+ 2. **Fix HIGH priority only** — SECURITY.md + .gitignore + ARCHITECTURE.md (chosen minimum)
63
+ 3. **Full polish sprint** — All 9 items including ESLint, Prettier, coverage (rejected: over-engineering for v1.0.0)
64
+
65
+ ## Links
66
+ - Spec: `docs/specs/production_deployment_readiness_featureai.md`
67
+ - Previous ADR: ADR-0007 (Ship v1.0.0 decision)
68
+ - Previous spec: `docs/specs/production_readiness_ship_v1_featureai.md`
@@ -0,0 +1,79 @@
1
+ # ADR-0010: Standards Integration
2
+
3
+ ## Status
4
+ Accepted (shipped in v2.1.0 — 2026-03-02)
5
+
6
+ ## Context
7
+
8
+ PAN Wizard orchestrates AI-assisted development across 5 runtimes but has no systematic way for users to select and enforce industry standards (OWASP, NIST, WCAG, ISO 25010, etc.) throughout their workflow. Research shows 25-45% of AI-generated code contains security vulnerabilities (2025-2026 studies). The industry has responded with new standards (OWASP LLM Top 10 2025, OWASP Agentic Top 10 2026, NIST SP 800-218A, OpenSSF AI Code Assistant Guide), but no AI workflow tool integrates standards selection with planning and verification.
9
+
10
+ PAN already has the infrastructure: health checks (verify.cjs), 4-level verification (pan-verifier), 8-dimension plan checking (pan-plan-checker), config system (config.cjs), and STRIDE-lite in focus-design. What's missing is the connection — a way for users to declare which standards apply and have that declaration flow through every agent interaction.
11
+
12
+ Forces at play:
13
+ - AI-generated code vulnerability rates are high and well-documented
14
+ - No AI coding tool provides standards selection + verification integration
15
+ - PAN's existing architecture supports context injection via .planning/ files
16
+ - Users want "set once, enforced everywhere" — not manual reminders
17
+ - Standards should guide, not block (advisory model aligns with PAN's philosophy)
18
+ - Zero runtime dependencies must be maintained
19
+
20
+ ## Decision
21
+
22
+ Add a standards integration system with:
23
+
24
+ 1. **Built-in catalog** of 12 well-known standards (OWASP Top 10, ASVS L1, LLM Top 10, WCAG 2.2, NIST SSDF, ISO 25010, STRIDE, CWE Top 25, OWASP Agentic, SOC 2 Dev, TOGAF ADM, Conventional Commits)
25
+
26
+ 2. **`.planning/standards.md`** as the persistent registry — a Markdown file in .planning/ that agents naturally read as context
27
+
28
+ 3. **5 subcommands** under `pan-tools standards`: `list`, `select`, `remove`, `status`, `recommend`
29
+
30
+ 4. **Project-type recommendations** based on project.md analysis (web app → OWASP, UI → WCAG, etc.)
31
+
32
+ 5. **Agent context injection** — verifier and plan-checker gain standards-aware dimensions when standards.md exists
33
+
34
+ 6. **Advisory model** — standards violations are reported as warnings, not blocking errors
35
+
36
+ Key design choices:
37
+ - Markdown file (not JSON config) because agents read .planning/ files naturally
38
+ - Built-in catalog (not user-defined rules) for quality control and zero-friction adoption
39
+ - Advisory (not blocking) to match PAN's health check philosophy
40
+ - No scanning (SonarQube/Semgrep do that) — PAN guides, external tools scan
41
+
42
+ ## Consequences
43
+
44
+ ### Positive
45
+ - PAN becomes the first AI workflow tool with standards-aware planning and verification
46
+ - Standards selection reduces to a menu choice during project setup
47
+ - Verifier catches standards gaps automatically
48
+ - Zero new runtime dependencies
49
+ - Existing workflows unchanged if no standards selected (fully additive)
50
+
51
+ ### Negative
52
+ - Catalog maintenance burden — standards evolve, catalog needs periodic updates
53
+ - Advisory-only model may not satisfy compliance-heavy organizations
54
+ - Checklist items are necessarily high-level (10 items per standard, not CWE-granular)
55
+
56
+ ### Neutral
57
+ - No new commands — extends existing settings, health, and agent prompts
58
+ - config.json gains optional `standards` section
59
+ - ADR count increases to 10
60
+
61
+ ## Options Considered
62
+
63
+ 1. **Static instruction files** (Cursor approach) — User writes security rules manually
64
+ - Rejected: Too much friction, rules are forgotten, no verification loop
65
+
66
+ 2. **Built-in SAST scanning** — PAN scans code for vulnerabilities
67
+ - Rejected: Wrong tool for the job; SonarQube/Semgrep are specialized for this
68
+
69
+ 3. **Standards as workflow context** (chosen) — Select from catalog, inject into agents, report in health
70
+ - Chosen: Leverages PAN's architecture, minimal code, maximum impact
71
+
72
+ 4. **External standards plugin system** — Users install standard packs
73
+ - Rejected: Adds complexity, dependency management, breaks zero-dep promise
74
+
75
+ ## Links
76
+ - Feature spec: `docs/specs/standards_integration_featureai.md`
77
+ - Related: ADR-0006 (Focus Commands — STRIDE-lite in focus-design)
78
+ - Related: ADR-0008 (Map Codebase — TOGAF alignment)
79
+ - Related: ADR-0003 (Smart Execution — commit safety checks)
@@ -0,0 +1,64 @@
1
+ # ADR-0011: Help Document & Command Descriptions End-to-End Rewrite
2
+
3
+ ## Status
4
+ Accepted (shipped in v2.2.0 — 2026-03-02)
5
+
6
+ ## Context
7
+
8
+ PAN Wizard v2.2.0 ships 37 user-facing slash commands across 5 AI coding runtimes (Claude Code, GitHub Copilot CLI, Gemini CLI, Codex, OpenCode). The `/pan:help` command outputs a 380-line static markdown reference that is the first thing every user sees when they try to learn PAN.
9
+
10
+ The current help has several problems:
11
+ 1. **No progressive disclosure** — 380 lines dumped at once, mixing quick-reference tables with full flag documentation
12
+ 2. **Jargon-heavy descriptions** — "wave-based parallelization", "conversational UAT", "Reality Score filtering" mean nothing to new users
13
+ 3. **No entry point** — 37 commands presented with equal weight, no "start here" guidance
14
+ 4. **Inconsistent frontmatter** — 5 Focus commands missing `pan:` prefix, `patches.md` missing `name` and `group` fields entirely
15
+ 5. **8 groups with unbalanced sizes** — "Getting Started" (2 commands) and "Community" (2 commands) are too small to justify separate groups
16
+
17
+ Competitive research shows that GitHub Copilot CLI (GA Feb 2026) ships with 4 functional groups and clear progressive disclosure, while clig.dev CLI guidelines explicitly recommend categorical grouping and outcome-oriented descriptions — patterns PAN currently violates.
18
+
19
+ ## Decision
20
+
21
+ Rewrite the help document and all 37 command descriptions using these principles:
22
+
23
+ 1. **Progressive disclosure** — 3-tier structure: Quick Start decision tree (10 lines) → Grouped command tables (50 lines) → Detail sections (on demand)
24
+ 2. **Outcome-oriented descriptions** — max 10 words, plain English, describe what the USER gets, not how the tool works internally
25
+ 3. **5 groups** (from 8): Start & Plan, Build & Verify, Focus Pipeline, Milestones & Phases, Session & System
26
+ 4. **Common Recipes section placed early** — the 8 most common workflows as copy-paste patterns, before the full command listing
27
+ 5. **Fix all frontmatter inconsistencies** — add `pan:` prefix to 5 Focus commands, add missing fields to `patches.md`, standardize verbose argument-hints
28
+
29
+ Target: 175 lines (from 380), 54% reduction.
30
+
31
+ ## Consequences
32
+
33
+ ### Positive
34
+ - New users find the right command within 10 seconds
35
+ - Every description answers "what does this DO for me?" in plain English
36
+ - Consistent frontmatter across all 37 commands
37
+ - Competitive parity with Copilot CLI's help organization
38
+ - Reduced cognitive load (6 highlighted starter commands vs 37 equal-weight)
39
+
40
+ ### Negative
41
+ - Existing users accustomed to 8-group structure must relearn the 5-group layout
42
+ - Condensing Focus Pipeline detail from 98 to 30 lines means users must consult USER-GUIDE for full flag documentation
43
+ - Some precision lost in shorter descriptions (mitigated by detail sections below the tables)
44
+
45
+ ### Neutral
46
+ - No code changes — purely content work
47
+ - No test regressions — static markdown content
48
+ - Must propagate to 5 runtime directories (standard process)
49
+
50
+ ## Options Considered
51
+
52
+ 1. **Keep 8 groups, only rewrite descriptions** — Preserves familiar structure but doesn't address the core structural problem (no progressive disclosure, no entry point). Rejected: half-measure.
53
+
54
+ 2. **Reduce to 5 groups + progressive disclosure + outcome descriptions (chosen)** — Addresses all identified problems. Best balance of comprehensiveness and scannability. Competitive with Copilot CLI's 4-group approach while accommodating PAN's 2-workflow model.
55
+
56
+ 3. **Reduce to 3 groups (minimal)** — Too aggressive: would force unrelated commands together (milestones + debug + settings in one group). Rejected: loses semantic clarity.
57
+
58
+ 4. **Add AI-powered interactive help** — Would require new module, runtime dependency on LLM call, significant implementation. Rejected: over-engineering for the current problem. Can be v3 enhancement.
59
+
60
+ ## Links
61
+ - Spec: `docs/specs/help_commands_rewrite_featureai.md`
62
+ - Related: ADR-0005 (command naming), ADR-0006 (focus commands)
63
+ - Competitive research: Aider, Cursor, Continue.dev, Cline, Claude Code, GitHub Copilot CLI
64
+ - Industry guidelines: clig.dev CLI Interface Guidelines
@@ -0,0 +1,42 @@
1
+ # ADR-0012: Contributors List & Attribution Index
2
+
3
+ ## Status
4
+ Accepted
5
+
6
+ ## Context
7
+ PAN Wizard is a public open-source project on npm and GitHub with 37 commands, 11 agents, 15 core modules, 11 ADRs, and 11 feature specs. The project references 6 strategic methodologies (Blue Ocean, Wardley, STRIDE, TOGAF, Spec-Driven Dev, ADRs), 12 industry standards (OWASP, NIST, ISO, WCAG, etc.), 8 competing tools (Aider, Cursor, Cline, etc.), and multiple research findings — but has no centralized attribution.
8
+
9
+ The LICENSE and package.json say "PAN Wizard Contributors" without naming anyone. Git history shows a single human author (oharms), an AI co-author (Claude Opus 4.6), and a bot (dependabot). No CONTRIBUTORS.md or AUTHORS file exists.
10
+
11
+ Open-source norms expect transparent attribution. New contributors cannot easily discover who built the project or where design ideas originated.
12
+
13
+ ## Decision
14
+ Create two new documentation files:
15
+
16
+ 1. **CONTRIBUTORS.md** — Names every contributor (human, AI, bot) with role and contribution type
17
+ 2. **ATTRIBUTION.md** — Indexes every methodology, standard, tool, and research source that influenced the project, cross-referenced to the specific ADR/spec/file where each is used
18
+
19
+ Additionally update package.json with a contributors array and link both files from README.md.
20
+
21
+ ## Consequences
22
+
23
+ ### Positive
24
+ - Transparent attribution for all contributors including AI co-authors
25
+ - Centralized influence index eliminates tribal knowledge
26
+ - New contributors can understand design lineage without reading 11 ADRs
27
+ - Follows open-source community norms
28
+
29
+ ### Negative
30
+ - Two more files to maintain manually (low burden for a small contributor base)
31
+
32
+ ### Neutral
33
+ - No code changes, no runtime impact, no test impact
34
+
35
+ ## Options Considered
36
+ 1. **Single CREDITS.md** — Mixes people and ideas in one file. Rejected: different audiences.
37
+ 2. **CONTRIBUTORS.md + ATTRIBUTION.md (chosen)** — Clean separation of people vs. ideas.
38
+ 3. **Auto-generated from git + CI** — Over-engineering for 1 human contributor. Deferred to v2.
39
+
40
+ ## Links
41
+ - Related spec: `docs/specs/contributors_attribution_index_featureai.md`
42
+ - Related files: CONTRIBUTORS.md, ATTRIBUTION.md, package.json, README.md
@@ -0,0 +1,53 @@
1
+ # ADR-0013: Strategic Feature Additions (Industry Analysis)
2
+
3
+ ## Status
4
+ Accepted
5
+
6
+ ## Context
7
+ PAN Wizard v2.2.0 is a mature CLI workflow automation tool with 37 commands, 15 modules, and 5-runtime support. A competitive analysis of 6 AI coding tools (Aider, Cursor, Continue.dev, Cline, Windsurf, GitHub Copilot Workspace) identified that PAN is 18-24 months ahead on structured workflow orchestration but should deepen existing moats rather than expand surface area.
8
+
9
+ Key industry findings:
10
+ - #1 user pain point across all tools: context loss between sessions ("AI amnesia")
11
+ - Planning-before-coding is now table-stakes (4/6 competitors have it)
12
+ - Zero competitors have formal milestone lifecycle or cross-session verification
13
+ - Context engineering identified as strategic priority (Anthropic 2026 report)
14
+ - AI coding agent market growing from $7.8B to $52B by 2030
15
+
16
+ ## Decision
17
+ Add 4 practical features that strengthen existing differentiators without over-engineering:
18
+
19
+ 1. **Pre-Flight Checks** (`preflight`) -- Validate execution prerequisites before spending tokens
20
+ 2. **Project Dashboard** (`dashboard`) -- Single-command aggregated project overview
21
+ 3. **Session Intelligence** (`learnings extract/list/prune`) -- Auto-extract patterns from sessions
22
+ 4. **Dependency Validation** (`deps validate`) -- Cross-reference roadmap vs reality
23
+
24
+ All features: zero runtime dependencies, CommonJS, works across all 5 runtimes.
25
+
26
+ ## Consequences
27
+
28
+ ### Positive
29
+ - Raises moat score from 25/30 to 29/30
30
+ - Addresses #1 industry pain point (session learning)
31
+ - Pre-flight checks prevent the most common execution failure (broken baseline)
32
+ - Dashboard makes .planning/ state immediately actionable
33
+ - All features build on existing architecture (verify.cjs, state.cjs, commands.cjs)
34
+
35
+ ### Negative
36
+ - +4 new commands increases cognitive load slightly
37
+ - Session learning requires structured session data (appendSessionSummary, appendErrorPattern)
38
+ - Dashboard aggregates multiple files, so performance depends on .planning/ size
39
+
40
+ ### Neutral
41
+ - Command count increases from 37 to 41
42
+ - No new modules needed (features fit into existing verify.cjs, state.cjs, commands.cjs)
43
+
44
+ ## Options Considered
45
+ 1. **IDE integration** -- Rejected. PAN is CLI-first; competing with Cursor/Windsurf on IDE is losing strategy.
46
+ 2. **Parallel agent orchestration** -- Rejected. PAN's value is execution quality, not speed.
47
+ 3. **Auto-iteration loops** -- Rejected. Windsurf's approach is opaque; PAN values transparency.
48
+ 4. **Deepen existing moats (chosen)** -- Build practical features that strengthen PAN's unique workflow management position.
49
+
50
+ ## Links
51
+ - Spec: docs/specs/industry_analysis_strategic_additions_featureai.md
52
+ - Batch: .planning/focus/batch-2026-03-03.json
53
+ - Related: ADR-0006 (focus commands), ADR-0003 (smart execution)
@@ -0,0 +1,53 @@
1
+ # ADR-0014: Internal Cleanup & Code Quality Hardening
2
+
3
+ ## Status
4
+ Accepted (shipped in v2.3.0 — 2026-03-03)
5
+
6
+ ## Context
7
+ PAN Wizard v2.3.0 has 15 core modules (4,770+ LOC), a CLI dispatcher (735+ LOC), and an installer (2,636 LOC) that have accumulated technical debt across 23 development sessions. A comprehensive 5-agent parallel audit identified ~170 issues:
8
+
9
+ - 12 functions exceed the project's own 50-line complexity budget
10
+ - 3 functions are duplicated across modules
11
+ - 11 dispatcher argument accesses lack bounds validation
12
+ - 15+ magic numbers are scattered instead of centralized in constants
13
+ - 5 dead imports/re-requires waste module surface area
14
+
15
+ The codebase is functionally correct (1,180 tests, 0 failures) and architecturally sound (clean DAG, no circular deps). This is maintenance debt, not architectural debt.
16
+
17
+ ## Decision
18
+ Perform a 4-wave internal cleanup:
19
+
20
+ 1. **Dead code removal** — Remove duplicate imports, unused params, redundant re-requires
21
+ 2. **Duplication consolidation** — Merge `getArchivedPhaseDirs`/`listArchivedPhaseDirs`, extract shared standards parser, centralize magic numbers in constants.cjs, add `getArgValue()` dispatcher helper
22
+ 3. **Complexity reduction** — Split 12 functions exceeding 50 lines by extracting focused helpers
23
+ 4. **Dispatcher hardening** — Add argument validation to 11 unguarded `args[N]` accesses
24
+
25
+ All changes are behavioral no-ops — identical input produces identical output. Zero breaking changes.
26
+
27
+ ## Consequences
28
+
29
+ ### Positive
30
+ - All core functions comply with 50-line/3-nesting/4-param complexity budget
31
+ - Single source of truth for archive phase search, standards parsing, magic numbers
32
+ - Dispatcher rejects missing arguments with actionable errors instead of passing `undefined`
33
+ - Reduced maintenance cost for future development sessions
34
+ - Cleaner codebase for potential contributors
35
+
36
+ ### Negative
37
+ - ~45 points of effort with zero user-facing feature delivery
38
+ - Risk of subtle behavior changes in extracted helpers (mitigated by 1,180 existing tests)
39
+ - Constants.cjs grows by ~15 new exports
40
+
41
+ ### Neutral
42
+ - Installer is out of scope (its 22 issues warrant a separate ADR)
43
+ - Test style inconsistencies (test vs it, assert vs assert/strict) are cosmetic and deferred
44
+
45
+ ## Options Considered
46
+ 1. **Do nothing** — Functional but accumulates debt; next session compounds issues
47
+ 2. **Full rewrite** — Unnecessary; architecture is sound, only implementation details need work
48
+ 3. **Incremental 4-wave cleanup (chosen)** — Lowest risk, independently testable per wave
49
+
50
+ ## Links
51
+ - Feature spec: `docs/specs/internal_cleanup_code_quality_featureai.md`
52
+ - Related: ADR-0003 (smart execution), ADR-0006 (focus commands)
53
+ - Audit methodology: 5 parallel Explore agents scanning all 15 modules + dispatcher + installer