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,485 @@
1
+ # PAN Internals
2
+
3
+ Under-the-hood concepts for power users and contributors. This guide distills PAN's internal reference system into actionable knowledge.
4
+
5
+ For user-facing documentation, see the [User Guide](USER-GUIDE.md). For development guidance, see the [Development Guide](DEVELOPMENT.md).
6
+
7
+ ## Table of Contents
8
+
9
+ - [Checkpoint System](#checkpoint-system)
10
+ - [Test-Driven Development](#test-driven-development)
11
+ - [Verification Patterns](#verification-patterns)
12
+ - [Commit Strategy](#commit-strategy)
13
+ - [Model Profiles](#model-profiles)
14
+ - [Branching Strategies](#branching-strategies)
15
+ - [UI Conventions](#ui-conventions)
16
+ - [Discussion Philosophy](#discussion-philosophy)
17
+ - [Continuation Format](#continuation-format)
18
+ - [Reference File Index](#reference-file-index)
19
+
20
+ ---
21
+
22
+ ## Checkpoint System
23
+
24
+ *Source: `references/checkpoints.md`*
25
+
26
+ PAN uses three checkpoint types to handle moments where human input is needed during automated execution.
27
+
28
+ ### Checkpoint Types
29
+
30
+ | Type | Frequency | Purpose | Example |
31
+ |------|-----------|---------|---------|
32
+ | `checkpoint:human-verify` | ~90% | Verify automated work visually | "Check the login page renders correctly" |
33
+ | `checkpoint:decision` | ~9% | Choose between approaches | "Use SQLite or PostgreSQL?" |
34
+ | `checkpoint:human-action` | ~1% | Perform an action Claude can't | "Log into Stripe dashboard and copy API key" |
35
+
36
+ ### Automation-First Philosophy
37
+
38
+ The golden rule: **Claude automates everything possible, checkpoints verify outcomes.**
39
+
40
+ Before presenting a `human-verify` checkpoint, the executor:
41
+ 1. Starts the dev server automatically
42
+ 2. Runs build/compile steps
43
+ 3. Checks the URL it will hand you responds (`curl`)
44
+ 4. Checks for runtime errors
45
+ 5. THEN asks you to verify visually
46
+
47
+ ### Auth Gates
48
+
49
+ When the executor hits an authentication error (not a code bug), it creates a dynamic `human-action` checkpoint:
50
+ 1. Executor detects auth/permission error
51
+ 2. Presents checkpoint with exact steps to authenticate
52
+ 3. You complete the auth action
53
+ 4. Executor retries the original command
54
+
55
+ ### Auto-Advance Behavior
56
+
57
+ With `workflow.auto_advance: true` in config.json:
58
+ - `human-verify` -- Auto-approved (assumes pass)
59
+ - `decision` -- Takes the option the plan's `auto_select` names; with no `auto_select`, stops for a human (never the first option by position)
60
+ - `human-action` -- Still requires human (cannot be automated)
61
+
62
+ ---
63
+
64
+ ## Test-Driven Development
65
+
66
+ *Source: `references/tdd.md`*
67
+
68
+ PAN's executor follows RED-GREEN-REFACTOR discipline for a plan of `type: tdd` (the planner gives TDD work its own plan, with a `<feature>` block) or a task marked `tdd="true"`.
69
+
70
+ ### When TDD Applies
71
+
72
+ **Use TDD for:**
73
+ - Business logic with defined inputs and outputs
74
+ - Data transformations, calculations, validation rules
75
+ - API endpoints with clear request/response contracts
76
+
77
+ **Skip TDD for:**
78
+ - UI components and layouts
79
+ - Configuration files
80
+ - Glue code and wiring
81
+ - One-off scripts
82
+
83
+ **Heuristic:** Can you write `expect(fn(input)).toBe(output)` before writing `fn`? If yes, use TDD.
84
+
85
+ ### The Cycle
86
+
87
+ 1. **RED** -- Write a failing test that defines expected behavior
88
+ 2. **GREEN** -- Write the minimum code to make the test pass
89
+ 3. **REFACTOR** -- Clean up while keeping tests green
90
+
91
+ **Context budget:** TDD plans target ~40% context usage (against ~50% for standard plans) so the three-phase cycle has headroom; PAN gives each TDD feature its own plan.
92
+
93
+ ### Commit Pattern
94
+
95
+ Each TDD cycle produces 2-3 commits:
96
+ - `test({phase}-{plan}): add failing test for {feature}`
97
+ - `feat({phase}-{plan}): implement {feature}`
98
+ - `refactor({phase}-{plan}): clean up {feature}` (optional, only when the refactor changed something)
99
+
100
+ ---
101
+
102
+ ## Verification Patterns
103
+
104
+ *Source: `references/verification-patterns.md`*
105
+
106
+ After execution, PAN's verifier checks that artifacts are real implementations -- not stubs or placeholders.
107
+
108
+ ### Stub Detection
109
+
110
+ **Universal red flags:**
111
+ - Comment stubs: `// TODO`, `// FIXME`, `// placeholder`
112
+ - Placeholder text: "Lorem ipsum", "Not implemented", "Coming soon"
113
+ - Empty returns: `return null`, `return []`, `return {}`
114
+ - Trivial implementations: Single-line components, empty handlers
115
+
116
+ **Component stubs:**
117
+ - `<div>ComponentName</div>` with no real content
118
+ - `onClick={() => {}}` empty event handlers
119
+ - Props accepted but never used in render
120
+
121
+ **API route stubs:**
122
+ - `Response.json({ message: "Not implemented" })`, `Response.json([])` with no database query, or an empty `new Response()`
123
+ - A handler that only logs the request body and returns `{ ok: true }`
124
+ - No input validation or error handling
125
+
126
+ **Schema stubs:**
127
+ - Only an `id` field (or a single real field) defined
128
+ - Critical fields missing (e.g. an order with no user, items, total or status)
129
+ - Expected relationships absent, or every field typed `String`
130
+
131
+ ### Wiring Verification
132
+
133
+ Each layer must connect to the next:
134
+
135
+ ```text
136
+ Component -> API call (fetch/axios/tRPC)
137
+ -> API route -> Database query (Prisma/Drizzle/SQL)
138
+ -> Schema -> Migrations applied + client generated
139
+ ```
140
+
141
+ **What the verifier checks:**
142
+ 1. Component renders data from state/props (not hardcoded)
143
+ 2. Component calls API on user action
144
+ 3. API route queries database with parameters
145
+ 4. Database schema has correct types and relations, with migrations applied
146
+
147
+ ### Verification Report Structure
148
+
149
+ `{phase_num}-verification.md` in the phase directory (layout from `templates/verification-report.md`) carries frontmatter `phase`, `verified`, `verified_commit` (the HEAD `pan-tools verify stale` compares against), `status` (`passed` | `gaps_found` | `human_needed`), `score` and `test_gate`, plus `not_checked`, `gaps`, `human_verification` and `unrequested` lists when they apply. The body includes:
150
+ - Observable truths, required artifacts and requirements coverage, each with a pass/fail status
151
+ - Anti-patterns found (stubs and placeholders)
152
+ - Key link verification (the wiring chain)
153
+ - Gaps summary with suggested fixes
154
+ - Unrequested work: changes no plan asked for, found with `pan-tools verify scope` (recorded, never blocking)
155
+ - Test gate: `test_gate` (`passed` | `failed` | `skipped`) in the frontmatter, copied from the record `pan-tools test run --phase N` writes rather than judged by the verifier
156
+ - Test strength: the `verify mutate` survivors on the phase's changed lines, when the test gate passed (reported, never changing the status). The section comes from the `verify-phase` workflow's `mutation_report` step, not from the template
157
+ - Overall score (N/M must-haves verified)
158
+
159
+ ---
160
+
161
+ ## Commit Strategy
162
+
163
+ *Source: `references/git-integration.md`*
164
+
165
+ PAN creates granular, per-task commits during execution -- not bulk commits per phase.
166
+
167
+ ### Commit Points
168
+
169
+ | Event | Commit? | Type |
170
+ |-------|---------|------|
171
+ | Project initialization (project.md, roadmap.md) | Yes | planning-docs commit (`pan-tools commit`) |
172
+ | Plan creation (plan.md files, roadmap.md) | Yes | `docs({phase}): create phase plan`, by pan-planner |
173
+ | Phase research / discovery creation | Optional | the phase researcher may commit research.md (`docs({phase}): research phase domain`); nothing commits discovery.md |
174
+ | Task completion | Yes | `feat/fix/test(phase-plan)` |
175
+ | Plan completion (summary.md metadata) | Yes | `docs(phase-plan)` |
176
+ | Handoff created (`/pan:pause`) | Yes | planning-docs commit (WIP state preserved) |
177
+ | Phase completion (verification, roadmap, state) | Yes | `docs(phase-X): complete phase execution` |
178
+
179
+ ### Commit Message Format
180
+
181
+ ```text
182
+ {type}({phase}-{plan}): {description}
183
+ ```
184
+
185
+ **Types:** task commits use `feat`, `fix`, `test`, `refactor`, `perf`, `chore` (`references/git-integration.md`); planning-doc commits go through `pan-tools commit`, whose `--type` accepts only `feat`, `fix`, `docs`, `test`, `refactor`, `perf`, `chore`
186
+
187
+ **Examples:**
188
+ ```text
189
+ feat(04-01): Add user authentication middleware
190
+ test(04-01): Add auth middleware test suite
191
+ fix(04-02): Handle expired JWT tokens in refresh flow
192
+ docs(04-02): complete refresh-token plan
193
+ ```
194
+
195
+ ### Why Per-Task Commits?
196
+
197
+ - **Failure recovery:** If task 3 fails, tasks 1-2 are already committed
198
+ - **Observability:** `git log --grep="04-01"` shows all work for a specific plan
199
+ - **Granularity:** Each commit represents a single, logical change
200
+ - **Rollback:** Can revert individual tasks without losing the whole plan
201
+
202
+ ---
203
+
204
+ ## Model Profiles
205
+
206
+ *Source: `references/model-profiles.md`*
207
+
208
+ PAN uses three profiles to control which model tier each agent type uses. Tiers are provider-agnostic: `reasoning`, `mid`, `fast`.
209
+
210
+ ### Tier Mapping
211
+
212
+ | Tier | Resolves to |
213
+ |------|-------------|
214
+ | `reasoning` | `inherit` on every provider: the model the session was launched with |
215
+ | `mid` | the provider's mid-size model (Anthropic and the default: the `sonnet` alias) |
216
+ | `fast` | the provider's smallest, fastest model (Anthropic and the default: the `haiku` alias) |
217
+
218
+ The OpenAI and Google model ids live in `PROVIDER_MODELS` in `core.cjs`; read them there rather than from a copy here.
219
+
220
+ Legacy names (`opus` → `reasoning`, `sonnet` → `mid`, `haiku` → `fast`) are supported for backward compatibility. On an OpenCode install the mid and fast tiers resolve to provider-qualified `provider/model` ids (`OPENCODE_MODELS` in `core.cjs`), the only form OpenCode accepts.
221
+
222
+ ### Profile Comparison
223
+
224
+ | Agent Role | Quality | Balanced | Budget |
225
+ |-----------|---------|----------|--------|
226
+ | Planner | reasoning | reasoning | mid |
227
+ | Researcher | reasoning | mid | fast |
228
+ | Executor | reasoning | reasoning | mid |
229
+ | Verifier | reasoning | reasoning | fast |
230
+ | Plan Checker | reasoning | mid | fast |
231
+ | Codebase Mapper (`pan-document_code`) | reasoning | reasoning | fast |
232
+
233
+ The full per-agent matrix is `MODEL_PROFILES` in `core.cjs` (mirrored in [AGENTS.md](AGENTS.md#model-profiles)). Since right-sized ceremony (`docs/specs/right-sized-ceremony.md`, 2026-10-24) `balanced` runs the researchers and the plan checker on the mid tier; `quality` keeps every agent on the reasoning tier.
234
+
235
+ ### Routing Pipeline
236
+
237
+ Model resolution follows a priority chain:
238
+
239
+ ```text
240
+ 1. Per-agent override → config.model_overrides[agentType]
241
+ 2. Per-phase override → <!-- model_tier: X --> in roadmap phase
242
+ 3. Profile lookup → MODEL_PROFILES[agentType][profile]
243
+ 4. Complexity routing → adjusts that tier ±1 from task metadata (if strategy = "complexity")
244
+ 5. Capability hints → adjustTierForCapabilities(): context_estimate / needs_thinking / cache_warm
245
+ 6. Failure escalation → escalateTier(): a retry (attempt > 1) climbs toward the agent's quality tier, capped by routing.max_escalations (pins from 1–2 are never escalated)
246
+ 7. Provider resolution → resolveTierToModel(tier, provider)
247
+ ```
248
+
249
+ **Provider detection:** Explicit `routing.provider` in config → `PAN_PROVIDER` env var → on an OpenCode install, the provider prefix of OpenCode's configured `model` (`opencode.json` or `.opencode/opencode.json`) → runtime directory presence (`.claude/` = Anthropic, `.codex/` and `.opencode/` = OpenAI, `.gemini/` = Google, `.github/` = default) → default.
250
+
251
+ ### Routing Strategies
252
+
253
+ - **static** (default): Profile assigns the tiers; no complexity scoring. Capability hints and failure escalation (steps 5–6 above) still apply when the caller passes them.
254
+ - **complexity**: Scores task metadata (fileCount, waveCount, requirementCount, isArchitectural) and adjusts tier ±1 level. Configurable thresholds: `downgrade_max` (default 2), `upgrade_min` (default 6).
255
+
256
+ ### Cost Multipliers
257
+
258
+ Relative cost per tier: reasoning = 15×, mid = 3×, fast = 1×. The `estimate-cost` command shows total and average multipliers per profile.
259
+
260
+ ### When to Use Each
261
+
262
+ - **Quality:** Complex architectural work, critical production code, unfamiliar domains
263
+ - **Balanced (default):** Most projects -- the writing agents (planner, executor, verifier, reviewer, …) at the reasoning tier, the researchers and the plan checker at the mid tier, and the lean path (right-sized ceremony) for precisely specified work
264
+ - **Budget:** Prototyping, familiar patterns, cost-sensitive work
265
+
266
+ ### Design Rationale
267
+
268
+ The quality profile runs every agent at the reasoning tier and keeps the full ceremony on every piece of work. Balanced keeps the reasoning tier for the agents that plan, write and judge code, and since right-sized ceremony (2026-10-24) steps the researchers and the plan checker down to the mid tier, where the brief showed no quality loss; it also takes the lean path for a phase or quick task whose requirements already say precisely what to build (`sizing.cjs`). The opt-in `budget` profile steps agents down further, to mid/fast tiers, for prototyping, familiar patterns, and cost-sensitive work.
269
+
270
+ ### Per-Agent Overrides
271
+
272
+ Override specific agents in config:
273
+ ```json
274
+ {
275
+ "model_overrides": {
276
+ "pan-executor": "reasoning",
277
+ "pan-phase-researcher": "mid"
278
+ }
279
+ }
280
+ ```
281
+
282
+ Values are tiers (`reasoning`, `mid`, `fast`; the legacy names are accepted). Overrides take precedence over profile defaults, per-phase overrides, and routing strategy, and are never escalated on retry.
283
+
284
+ ---
285
+
286
+ ## Branching Strategies
287
+
288
+ *Source: `references/planning-config.md`*
289
+
290
+ PAN supports three git branching strategies for project organization.
291
+
292
+ ### Strategy Options
293
+
294
+ | Strategy | When branches are created | Branch template |
295
+ |----------|--------------------------|-----------------|
296
+ | `none` (default) | No branches -- all work on current branch | -- |
297
+ | `phase` | New branch per phase | `pan/phase-{phase}-{slug}` |
298
+ | `milestone` | New branch per milestone | `pan/{milestone}-{slug}` |
299
+
300
+ ### Template Variables
301
+
302
+ | Variable | Resolves to | Example |
303
+ |----------|------------|---------|
304
+ | `{phase}` | Zero-padded phase number | `01`, `02.1` |
305
+ | `{slug}` | Phase name as slug (in the milestone template, the milestone name) | `setup-auth` |
306
+ | `{milestone}` | Milestone version | `v0.2.0` |
307
+
308
+ ### Merge at Completion
309
+
310
+ PAN does not merge these branches itself: exec-phase leaves merging to you, and `/pan:milestone-done` tags the release without merging. Your options when a phase or milestone completes:
311
+ - **Squash:** Clean single commit on target branch
312
+ - **Merge:** Preserve full commit history
313
+ - **Delete without merging:** `git branch -D` — the branch work is discarded
314
+ - **Keep branches:** leave them for manual handling
315
+
316
+ ### Config Example
317
+
318
+ ```json
319
+ {
320
+ "branching_strategy": "phase",
321
+ "phase_branch_template": "pan/phase-{phase}-{slug}",
322
+ "milestone_branch_template": "pan/{milestone}-{slug}"
323
+ }
324
+ ```
325
+
326
+ These are top-level keys of `config.json`, the form `config-ensure-section` writes. A nested `git` form is read only when the top-level key is absent, so it is ignored in any config `config-ensure-section` created.
327
+
328
+ ---
329
+
330
+ ## UI Conventions
331
+
332
+ *Source: `references/ui-brand.md`*
333
+
334
+ PAN uses consistent visual patterns for all output.
335
+
336
+ ### Stage Banners
337
+
338
+ Major workflow stages use a `PAN ►` banner between two rules (stage name in caps, e.g. `PLANNING PHASE 3`, `PHASE 3 COMPLETE ✓`):
339
+ ```text
340
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
341
+ PAN ► {STAGE NAME}
342
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
343
+ ```
344
+
345
+ ### Status Symbols
346
+
347
+ | Symbol | Meaning |
348
+ |--------|---------|
349
+ | `✓` | Complete / Passed / Verified |
350
+ | `✗` | Failed / Missing / Blocked |
351
+ | `◆` | In progress |
352
+ | `○` | Pending |
353
+ | `⚡` | Auto-approved |
354
+ | `⚠` | Warning |
355
+ | `🎉` | Milestone complete (banner only) |
356
+
357
+ ### Checkpoint Boxes
358
+
359
+ ```text
360
+ ╔══════════════════════════════════════════════════════════════╗
361
+ ║ CHECKPOINT: Verification Required ║
362
+ ╚══════════════════════════════════════════════════════════════╝
363
+
364
+ Check that the login page renders correctly at http://localhost:3000/login
365
+
366
+ ──────────────────────────────────────────────────────────────
367
+ → Type "approved" or describe issues
368
+ ──────────────────────────────────────────────────────────────
369
+ ```
370
+
371
+ 62-character width. The action prompt varies by type: `→ Type "approved" or describe issues` (Verification Required), `→ Select: option-a / option-b` (Decision Required), `→ Type "done" when complete` (Action Required).
372
+
373
+ ### UI Anti-Patterns
374
+
375
+ - Don't vary box widths within the same workflow
376
+ - Don't use random symbols -- stick to the defined symbol set
377
+ - Don't mix banner styles
378
+ - Don't drop the `PAN ►` prefix from stage banners
379
+ - Don't omit the "Next Up" block after major completions
380
+
381
+ ---
382
+
383
+ ## Discussion Philosophy
384
+
385
+ *Source: `references/questioning.md`*
386
+
387
+ PAN's project initialization uses a collaborative discussion model, not a requirements interview.
388
+
389
+ ### Core Principle
390
+
391
+ **You are a thinking partner, not an interviewer.** The goal is to extract the user's vision, not fill out a checklist.
392
+
393
+ ### Question Flow
394
+
395
+ 1. **Start open:** Let them dump everything -- what they're building, why, for whom
396
+ 2. **Follow energy:** What excited them? Dig deeper there
397
+ 3. **Challenge vagueness:** "What does 'fast' mean?" turns into "Sub-200ms API response"
398
+ 4. **Confirm scope:** "So the MVP is X, Y, Z -- does that capture it?"
399
+
400
+ ### Question Types
401
+
402
+ | Type | Purpose | Example |
403
+ |------|---------|---------|
404
+ | Motivation | Why build this? | "What problem does this solve for your users?" |
405
+ | Concreteness | Turn abstract to specific | "When you say 'dashboard', what data is shown?" |
406
+ | Clarification | Resolve ambiguity | "Should users upload files or just paste text?" |
407
+ | Success | Define done | "How will you know Phase 1 succeeded?" |
408
+
409
+ ### Discussion Anti-Patterns
410
+
411
+ - **Checklist walking:** Don't ask generic questions in order
412
+ - **Interrogation:** Don't fire questions without building on the answers
413
+ - **Shallow acceptance:** Don't take vague answers without probing
414
+ - **Premature constraints:** Don't ask about the tech stack before understanding the idea
415
+ - **User skills:** Never ask about the user's technical experience
416
+
417
+ ---
418
+
419
+ ## Continuation Format
420
+
421
+ *Source: `references/continuation-format.md`*
422
+
423
+ After completing a workflow step, PAN always presents a "Next Up" block telling you what to do next.
424
+
425
+ ### Structure
426
+
427
+ ```text
428
+ ---
429
+
430
+ ## ▶ Next Up
431
+
432
+ **Phase 02: Authentication** — Set up user login, registration, and session management.
433
+
434
+ `/pan:plan-phase 2`
435
+
436
+ <sub>`/clear` first → fresh context window</sub>
437
+
438
+ ---
439
+
440
+ **Also available:**
441
+ - `/pan:progress` — Review overall status
442
+ - `/pan:verify-phase 1` — Re-verify Phase 1
443
+
444
+ ---
445
+ ```
446
+
447
+ ### Key Rules
448
+
449
+ - Always show the recommended next action first
450
+ - Include the phase name and description (pulled from roadmap.md)
451
+ - Commands in backtick format for easy copy-paste
452
+ - "Also available" for alternatives (not "Other options")
453
+ - Visual separator (`---`) to make it stand out
454
+
455
+ ---
456
+
457
+ ## Reference File Index
458
+
459
+ PAN's agents and workflows load knowledge from reference files at runtime, by path and mostly with `@`-syntax. These files live in `pan-wizard-core/references/`.
460
+
461
+ | File | Topic | Relevance |
462
+ |------|-------|-----------|
463
+ | `checkpoints.md` | Checkpoint types, automation philosophy, auth gates | High |
464
+ | `guardrails.md` | Behavioral guardrails — anti-patterns, Code Preservation, Stop-the-Line | High |
465
+ | `tdd.md` | Test-driven development cycle, when to apply | High |
466
+ | `verification-patterns.md` | Stub detection, wiring checks, verification scripts | High |
467
+ | `handoff-decisions.md` | Decisions-trace schema for planner/executor/verifier handoff | High |
468
+ | `verdict-contract.md` | The `pan-verdict` block that ends every plan-checker, reviewer and design-checker report | High |
469
+ | `design-methodology.md` | Design-phase methodology (architecture, ADR, threat-lite), shared by pan-designer and focus-design | Medium |
470
+ | `git-integration.md` | Commit strategy, per-task commits, recovery | High |
471
+ | `model-profiles.md` | Agent model selection by profile | High |
472
+ | `questioning.md` | Discussion philosophy, question techniques | High |
473
+ | `planning-config.md` | Config schema, branching strategies, commit settings | Medium |
474
+ | `ui-brand.md` | Visual patterns, symbols, banner formats | Medium |
475
+ | `continuation-format.md` | "Next Up" block format and variants | Medium |
476
+ | `model-profile-resolution.md` | How orchestrators resolve model at startup | Low |
477
+ | `git-planning-commit.md` | pan-tools commit CLI for planning docs | Low |
478
+ | `decimal-phase-calculation.md` | Emergency phase insertion numbering | Low |
479
+ | `phase-argument-parsing.md` | Phase argument normalization | Low |
480
+
481
+ Agents reference these files by path in their markdown definitions, some with `@`-syntax and some as a plain path they are told to read. For example, the executor agent references `references/checkpoints.md` in its checkpoint protocol and `references/handoff-decisions.md` when writing its implementation decisions.
482
+
483
+ ---
484
+
485
+ *For writing new reference files, see [How to Write a Reference](DEVELOPMENT.md#how-to-write-a-reference) in the Development Guide.*