pan-wizard 3.36.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 (314) hide show
  1. package/CHANGELOG.md +3645 -0
  2. package/README.md +36 -48
  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 +1 -2
  8. package/agents/pan-document_code.md +1 -2
  9. package/agents/pan-hardener.md +2 -3
  10. package/agents/pan-integration-checker.md +1 -2
  11. package/agents/pan-knowledge.md +1 -2
  12. package/agents/pan-meta-reviewer.md +3 -3
  13. package/agents/pan-optimizer.md +4 -4
  14. package/agents/pan-phase-researcher.md +79 -488
  15. package/agents/pan-plan-checker.md +12 -2
  16. package/agents/pan-planner.md +10 -6
  17. package/agents/pan-previewer.md +1 -2
  18. package/agents/pan-project-researcher.md +70 -499
  19. package/agents/pan-release.md +1 -1
  20. package/agents/pan-reviewer.md +9 -3
  21. package/agents/pan-roadmapper.md +12 -7
  22. package/agents/pan-verifier.md +7 -2
  23. package/bin/install-lib.cjs +134 -14
  24. package/bin/install.js +59 -12
  25. package/commands/pan/army.md +1 -1
  26. package/commands/pan/autodev.md +76 -0
  27. package/commands/pan/exec-phase.md +3 -4
  28. package/commands/pan/focus-auto.md +14 -7
  29. package/commands/pan/focus-design.md +4 -5
  30. package/commands/pan/focus-docs.md +24 -0
  31. package/commands/pan/learn.md +13 -6
  32. package/commands/pan/milestone-audit.md +8 -1
  33. package/commands/pan/milestone-done.md +10 -5
  34. package/commands/pan/milestone-new.md +2 -2
  35. package/commands/pan/new-project.md +15 -12
  36. package/commands/pan/plan-phase.md +15 -9
  37. package/commands/pan/quick.md +1 -1
  38. package/commands/pan/review-deep.md +11 -5
  39. package/commands/pan/settings.md +6 -0
  40. package/commands/pan/verify-phase.md +6 -2
  41. package/docs/AGENTS.md +917 -0
  42. package/docs/ARCHITECTURE.md +1054 -0
  43. package/docs/CLI-REFERENCE.md +4582 -0
  44. package/docs/COMPARISON.md +116 -0
  45. package/docs/DEVELOPMENT.md +490 -0
  46. package/docs/ECOSYSTEM-REVIEW-2026-06.md +107 -0
  47. package/docs/ECOSYSTEM-REVIEW-2026-08.md +349 -0
  48. package/docs/EXAMPLES.md +584 -0
  49. package/docs/FAQ.md +254 -0
  50. package/docs/FIELD-HARVEST-2026-07.md +88 -0
  51. package/docs/FIELD-REPORT-army-2026-06.md +121 -0
  52. package/docs/HOOKS.md +638 -0
  53. package/docs/IMPROVEMENT-TODO.md +246 -0
  54. package/docs/INTERNALS.md +485 -0
  55. package/docs/MIGRATION-v2-to-v3.md +258 -0
  56. package/docs/SECURITY-HARDENING.md +230 -0
  57. package/docs/SKILLS-ENHANCEMENT-PLAN-V2.md +122 -0
  58. package/docs/SKILLS-FULL-TEXT.md +9685 -0
  59. package/docs/SKILLS-REFERENCE.md +1037 -0
  60. package/docs/TROUBLESHOOTING.md +1084 -0
  61. package/docs/USER-GUIDE.md +1437 -0
  62. package/docs/archive/SKILLS-ENHANCEMENT-PLAN.md +230 -0
  63. package/docs/audits/AUDIT-2026-08-e2e-ROADMAP.md +117 -0
  64. package/docs/audits/AUDIT-2026-08-e2e-VERIFICATION.md +693 -0
  65. package/docs/audits/AUDIT-2026-08-e2e.md +1546 -0
  66. package/docs/audits/OUTSTANDING-2026-08.md +275 -0
  67. package/docs/audits/STABILITY-TEST-2026-08.md +640 -0
  68. package/docs/branding/README-brand-draft.md +119 -0
  69. package/docs/branding/handoff/IMPLEMENTATION.md +205 -0
  70. package/docs/branding/handoff/README-brand-draft.md +119 -0
  71. package/docs/branding/handoff/image-prompts.md +46 -0
  72. package/docs/branding/image-prompts.md +46 -0
  73. package/docs/branding/nano-banana-prompts.txt +60 -0
  74. package/docs/context-monitor.md +13 -0
  75. package/docs/decisions/ADR-0001-strategic-feature-prioritization.md +83 -0
  76. package/docs/decisions/ADR-0002-copilot-cli-runtime.md +71 -0
  77. package/docs/decisions/ADR-0003-smart-execution.md +84 -0
  78. package/docs/decisions/ADR-0004-copilot-cli-interaction.md +89 -0
  79. package/docs/decisions/ADR-0005-command-naming.md +80 -0
  80. package/docs/decisions/ADR-0006-focus-commands.md +101 -0
  81. package/docs/decisions/ADR-0007-ship-v1.md +73 -0
  82. package/docs/decisions/ADR-0008-map-codebase-mermaid-togaf.md +80 -0
  83. package/docs/decisions/ADR-0009-production-deployment-checklist.md +68 -0
  84. package/docs/decisions/ADR-0010-standards-integration.md +79 -0
  85. package/docs/decisions/ADR-0011-help-commands-rewrite.md +64 -0
  86. package/docs/decisions/ADR-0012-contributors-attribution-index.md +42 -0
  87. package/docs/decisions/ADR-0013-strategic-feature-additions.md +53 -0
  88. package/docs/decisions/ADR-0014-internal-cleanup-code-quality.md +53 -0
  89. package/docs/decisions/ADR-0015-focus-auto-runner.md +296 -0
  90. package/docs/decisions/ADR-0016-enhanced-doc-sync.md +54 -0
  91. package/docs/decisions/ADR-0017-enhanced-focus-design.md +69 -0
  92. package/docs/decisions/ADR-0018-user-reality-testing.md +84 -0
  93. package/docs/decisions/ADR-0019-end-to-end-user-acceptance-testing.md +113 -0
  94. package/docs/decisions/ADR-0020-ai-drift-prevention.md +55 -0
  95. package/docs/decisions/ADR-0021-codebase-mapper-v2.md +76 -0
  96. package/docs/decisions/ADR-0022-lifecycle-completeness.md +63 -0
  97. package/docs/decisions/ADR-0023-opus-4-7-adoption.md +89 -0
  98. package/docs/decisions/ADR-0024-spec-b-v2-completion.md +137 -0
  99. package/docs/decisions/ADR-0025-behavioral-guardrails-layer.md +129 -0
  100. package/docs/decisions/ADR-0026-self-improvement-loop.md +171 -0
  101. package/docs/decisions/ADR-0027-doc-code-link-graph.md +164 -0
  102. package/docs/decisions/ADR-0028-unified-agents-skills-target.md +46 -0
  103. package/docs/decisions/ADR-0029-experiment-evaluator.md +76 -0
  104. package/docs/decisions/ADR-0030-planning-concurrency.md +37 -0
  105. package/docs/decisions/ADR-0031-focus-auto-backlog-source.md +47 -0
  106. package/docs/decisions/ADR-0032-squad-model.md +64 -0
  107. package/docs/decisions/ADR-0033-army-campaign.md +40 -0
  108. package/docs/decisions/ADR-0034-scheduled-campaigns.md +57 -0
  109. package/docs/decisions/ADR-0035-army-hud-dashboard.md +40 -0
  110. package/docs/decisions/ADR-0036-agentic-memory-architecture.md +106 -0
  111. package/docs/decisions/ADR-0037-pin-security-agents-to-opus.md +51 -0
  112. package/docs/decisions/ADR-0038-skill-aligned-decomposition.md +41 -0
  113. package/docs/decisions/ADR-0039-worktree-as-project-variant.md +37 -0
  114. package/docs/decisions/ADR-0040-memory-injection-defense.md +55 -0
  115. package/docs/decisions/ADR-0041-mcp-dual-era-bridge.md +47 -0
  116. package/docs/decisions/ADR-0042-design-parity-both-flows.md +45 -0
  117. package/docs/decisions/ADR-0043-addressable-planning-roots.md +56 -0
  118. package/docs/decisions/ADR-0044-bound-the-cached-context.md +104 -0
  119. package/docs/decisions/ADR-0045-agent-plugins-bundle.md +76 -0
  120. package/docs/decisions/ADR-0046-subagent-frontmatter-decisions.md +39 -0
  121. package/docs/decisions/ADR-0047-pan-harness.md +76 -0
  122. package/docs/decisions/ADR-0048-one-core-per-project.md +43 -0
  123. package/docs/decisions/ADR-0049-machine-verdicts-and-findings-ledger.md +116 -0
  124. package/docs/specs/ai_drift_prevention_featureai.md +286 -0
  125. package/docs/specs/codebase_mapper_v2_featureai.md +930 -0
  126. package/docs/specs/command_naming_optimization_featureai.md +930 -0
  127. package/docs/specs/comp_analysis_markdown_v1.md +149 -0
  128. package/docs/specs/continuous_autonomous_execution_featureai.md +304 -0
  129. package/docs/specs/contributors_attribution_index_featureai.md +476 -0
  130. package/docs/specs/copilot_cli_interaction_featureai.md +868 -0
  131. package/docs/specs/copilot_cli_runtime_featureai.md +647 -0
  132. package/docs/specs/custom-skills-assessment.md +461 -0
  133. package/docs/specs/deployment_audit_findings_featureai.md +243 -0
  134. package/docs/specs/doc_code_link_graph_featureai.md +253 -0
  135. package/docs/specs/documentation_alignment_cleanup_featureai.md +69 -0
  136. package/docs/specs/e2e_visual_testing_featureai.md +615 -0
  137. package/docs/specs/end_to_end_user_acceptance_testing_featureai.md +810 -0
  138. package/docs/specs/evidence-loop-plan.md +76 -0
  139. package/docs/specs/evidence_loop_featureai.md +497 -0
  140. package/docs/specs/focus-auto-optimize-category.md +449 -0
  141. package/docs/specs/focus-auto-optimize-superplan.md +188 -0
  142. package/docs/specs/focus_auto_runner_featureai.md +1102 -0
  143. package/docs/specs/focus_design_v2_featureai.md +197 -0
  144. package/docs/specs/focus_sync_v2_featureai.md +202 -0
  145. package/docs/specs/git_integration_overhaul_featureai.md +326 -0
  146. package/docs/specs/glm_zai_provider_featureai.md +200 -0
  147. package/docs/specs/googlecli_adoption_featureai.md +661 -0
  148. package/docs/specs/help_commands_rewrite_featureai.md +860 -0
  149. package/docs/specs/industry_analysis_strategic_additions_featureai.md +231 -0
  150. package/docs/specs/industry_comparison_and_feature_gaps_featureai.md +674 -0
  151. package/docs/specs/internal_cleanup_code_quality_featureai.md +486 -0
  152. package/docs/specs/investigations/README.md +31 -0
  153. package/docs/specs/investigations/digests/2026-09-28.md +47 -0
  154. package/docs/specs/investigations/digests/2026-10-08.md +62 -0
  155. package/docs/specs/investigations/digests/2026-10-10.md +61 -0
  156. package/docs/specs/investigations/features/debugger-red-loop-first.md +55 -0
  157. package/docs/specs/investigations/features/harness-cross-host-behaviour.md +93 -0
  158. package/docs/specs/investigations/features/optimize-apply-regression-gate.md +66 -0
  159. package/docs/specs/investigations/features/reviewer-smell-baseline.md +57 -0
  160. package/docs/specs/investigations/features/trace-failure-capture.md +69 -0
  161. package/docs/specs/lifecycle_completeness_featureai.md +754 -0
  162. package/docs/specs/local-first-ci.md +42 -0
  163. package/docs/specs/map_codebase_mermaid_togaf_featureai.md +805 -0
  164. package/docs/specs/market-delta-2026-09-superplan.md +310 -0
  165. package/docs/specs/market-ideas-2026-09.md +131 -0
  166. package/docs/specs/market-ideas-2026-10.md +428 -0
  167. package/docs/specs/market-ideas-ledger.md +177 -0
  168. package/docs/specs/memory-optimization-2026-10.md +285 -0
  169. package/docs/specs/multi-track-planning-roots.md +143 -0
  170. package/docs/specs/multi_model_routing_featureai.md +687 -0
  171. package/docs/specs/multi_model_routing_superplan.md +197 -0
  172. package/docs/specs/opus_47_existing_enhancements_featureai.md +247 -0
  173. package/docs/specs/opus_47_extended_features_featureai.md +363 -0
  174. package/docs/specs/opus_47_extended_features_v2_featureai.md +397 -0
  175. package/docs/specs/pan_focus_commands_featureai.md +2336 -0
  176. package/docs/specs/pan_zcode_mcp_bridge_featureai.md +120 -0
  177. package/docs/specs/product-excellence-superplan.md +315 -0
  178. package/docs/specs/product_excellence_program_2026_q4_featureai.md +365 -0
  179. package/docs/specs/production_deployment_readiness_featureai.md +433 -0
  180. package/docs/specs/production_readiness_ship_v1_featureai.md +698 -0
  181. package/docs/specs/real_test_enforcement_featureai.md +213 -0
  182. package/docs/specs/reality-check-2026-09-superplan.md +362 -0
  183. package/docs/specs/right-sized-ceremony.md +74 -0
  184. package/docs/specs/roadmap_and_competition_2026_q4_featureai.md +390 -0
  185. package/docs/specs/self_improvement_loop_featureai.md +875 -0
  186. package/docs/specs/skill-aligned-decomposition.md +155 -0
  187. package/docs/specs/standards_integration_featureai.md +833 -0
  188. package/docs/specs/testing-system-redesign-2026-09.md +267 -0
  189. package/docs/specs/user_reality_testing_system_featureai.md +788 -0
  190. package/docs/specs/watch-triggers.json +22 -0
  191. package/docs/specs/workflow-integration-redesign.md +742 -0
  192. package/docs/specs/workflow_state_consistency_featureai.md +183 -0
  193. package/hooks/dist/pan-context-monitor.js +9 -2
  194. package/hooks/dist/pan-cost-logger.js +5 -0
  195. package/hooks/dist/pan-guard.js +28 -5
  196. package/hooks/dist/pan-stop-guard.js +9 -9
  197. package/hooks/dist/pan-trace-logger.js +5 -0
  198. package/package.json +10 -2
  199. package/pan-wizard-core/bin/lib/agents-md.cjs +57 -8
  200. package/pan-wizard-core/bin/lib/autodev-report.cjs +180 -0
  201. package/pan-wizard-core/bin/lib/autodev.cjs +642 -0
  202. package/pan-wizard-core/bin/lib/ci.cjs +143 -0
  203. package/pan-wizard-core/bin/lib/commands.cjs +1 -1
  204. package/pan-wizard-core/bin/lib/config.cjs +31 -2
  205. package/pan-wizard-core/bin/lib/constants.cjs +27 -1
  206. package/pan-wizard-core/bin/lib/core.cjs +22 -10
  207. package/pan-wizard-core/bin/lib/cost.cjs +14 -4
  208. package/pan-wizard-core/bin/lib/cross-family.cjs +164 -0
  209. package/pan-wizard-core/bin/lib/debug-cases.cjs +104 -0
  210. package/pan-wizard-core/bin/lib/failure-class.cjs +81 -0
  211. package/pan-wizard-core/bin/lib/findings.cjs +34 -4
  212. package/pan-wizard-core/bin/lib/focus.cjs +1 -1
  213. package/pan-wizard-core/bin/lib/hosts.cjs +88 -0
  214. package/pan-wizard-core/bin/lib/init.cjs +7 -2
  215. package/pan-wizard-core/bin/lib/knowledge.cjs +2 -0
  216. package/pan-wizard-core/bin/lib/merge.cjs +50 -0
  217. package/pan-wizard-core/bin/lib/mutate.cjs +16 -5
  218. package/pan-wizard-core/bin/lib/next-action.cjs +112 -0
  219. package/pan-wizard-core/bin/lib/optimize.cjs +2 -2
  220. package/pan-wizard-core/bin/lib/phase.cjs +48 -4
  221. package/pan-wizard-core/bin/lib/plan-lint.cjs +150 -1
  222. package/pan-wizard-core/bin/lib/preview.cjs +23 -4
  223. package/pan-wizard-core/bin/lib/requirements-lint.cjs +130 -0
  224. package/pan-wizard-core/bin/lib/research-lint.cjs +150 -3
  225. package/pan-wizard-core/bin/lib/review-deep.cjs +14 -22
  226. package/pan-wizard-core/bin/lib/review-vote.cjs +105 -0
  227. package/pan-wizard-core/bin/lib/runner.cjs +2 -16
  228. package/pan-wizard-core/bin/lib/sizing.cjs +356 -0
  229. package/pan-wizard-core/bin/lib/squads.cjs +1 -1
  230. package/pan-wizard-core/bin/lib/state-write.cjs +247 -0
  231. package/pan-wizard-core/bin/lib/uat.cjs +149 -0
  232. package/pan-wizard-core/bin/lib/verdict.cjs +26 -3
  233. package/pan-wizard-core/bin/lib/verify-plan-set.cjs +30 -1
  234. package/pan-wizard-core/bin/lib/verify-preflight.cjs +2 -2
  235. package/pan-wizard-core/bin/lib/verify-red.cjs +37 -1
  236. package/pan-wizard-core/bin/lib/verify-retro.cjs +3 -2
  237. package/pan-wizard-core/bin/lib/verify.cjs +59 -4
  238. package/pan-wizard-core/bin/lib/worktree.cjs +70 -0
  239. package/pan-wizard-core/bin/pan-tools.cjs +168 -27
  240. package/pan-wizard-core/learnings/universal/autonomous-loop.md +2 -2
  241. package/pan-wizard-core/references/continuation-format.md +3 -3
  242. package/pan-wizard-core/references/guardrails.md +1 -1
  243. package/pan-wizard-core/references/model-profiles.md +2 -3
  244. package/pan-wizard-core/references/questioning.md +24 -0
  245. package/pan-wizard-core/references/ui-brand.md +4 -6
  246. package/pan-wizard-core/references/verdict-contract.md +2 -1
  247. package/pan-wizard-core/templates/config.json +5 -1
  248. package/pan-wizard-core/templates/debug.md +1 -0
  249. package/pan-wizard-core/templates/discovery.md +2 -2
  250. package/pan-wizard-core/templates/requirements.md +9 -0
  251. package/pan-wizard-core/workflows/add-phase.md +4 -6
  252. package/pan-wizard-core/workflows/assumptions.md +19 -1
  253. package/pan-wizard-core/workflows/diagnose-issues.md +2 -0
  254. package/pan-wizard-core/workflows/discuss-phase.md +4 -2
  255. package/pan-wizard-core/workflows/exec-lean.md +69 -0
  256. package/pan-wizard-core/workflows/exec-phase.md +36 -8
  257. package/{commands/pan → pan-wizard-core/workflows}/focus-doc-audit.md +13 -29
  258. package/{commands/pan → pan-wizard-core/workflows}/focus-drift-walking.md +3 -18
  259. package/{commands/pan → pan-wizard-core/workflows}/focus-exec.md +8 -23
  260. package/{commands/pan → pan-wizard-core/workflows}/focus-plan.md +6 -20
  261. package/{commands/pan → pan-wizard-core/workflows}/focus-scan.md +3 -16
  262. package/{commands/pan → pan-wizard-core/workflows}/focus-sync.md +7 -21
  263. package/pan-wizard-core/workflows/health.md +6 -0
  264. package/pan-wizard-core/workflows/help.md +31 -53
  265. package/pan-wizard-core/workflows/insert-phase.md +4 -6
  266. package/pan-wizard-core/workflows/learn.md +3 -3
  267. package/pan-wizard-core/workflows/milestone-audit.md +2 -2
  268. package/pan-wizard-core/workflows/milestone-new.md +38 -95
  269. package/pan-wizard-core/workflows/new-project.md +96 -258
  270. package/pan-wizard-core/workflows/optimize.md +107 -5
  271. package/pan-wizard-core/workflows/phase-tests.md +10 -0
  272. package/pan-wizard-core/workflows/plan-phase.md +86 -43
  273. package/pan-wizard-core/workflows/profile.md +50 -0
  274. package/pan-wizard-core/workflows/progress.md +10 -0
  275. package/pan-wizard-core/workflows/quick.md +34 -43
  276. package/pan-wizard-core/workflows/research-phase.md +118 -40
  277. package/pan-wizard-core/workflows/resume-project.md +18 -2
  278. package/pan-wizard-core/workflows/settings.md +21 -24
  279. package/pan-wizard-core/workflows/todo-check.md +6 -2
  280. package/pan-wizard-core/workflows/transition.md +22 -4
  281. package/pan-wizard-core/workflows/uat-walkthrough.md +90 -0
  282. package/pan-wizard-core/workflows/update.md +1 -1
  283. package/pan-wizard-core/workflows/verify-phase.md +2 -2
  284. package/scripts/build-agent-plugin.js +35 -15
  285. package/scripts/build-plugin.js +10 -1
  286. package/scripts/deprecate-old-versions.js +70 -3
  287. package/scripts/generate-skills-docs.py +1 -1
  288. package/scripts/git-hooks/pre-push +27 -0
  289. package/scripts/install-git-hooks.js +7 -5
  290. package/scripts/install-pre-push.cjs +38 -0
  291. package/scripts/land.cjs +151 -0
  292. package/scripts/local-ci.cjs +501 -0
  293. package/scripts/local-schedule.cjs +277 -0
  294. package/scripts/prompt-lint.cjs +32 -0
  295. package/scripts/prompt-rules.cjs +156 -0
  296. package/scripts/run-tests.cjs +7 -1
  297. package/scripts/test-quality-lint.cjs +3 -3
  298. package/scripts/test-surface.cjs +9 -2
  299. package/agents/pan-research-synthesizer.md +0 -246
  300. package/commands/pan/audit-deployment.md +0 -386
  301. package/commands/pan/dashboard.md +0 -22
  302. package/commands/pan/discord.md +0 -19
  303. package/commands/pan/mcp-bridge.md +0 -143
  304. package/commands/pan/milestone-cleanup.md +0 -19
  305. package/commands/pan/milestone-gaps.md +0 -35
  306. package/commands/pan/optimize.md +0 -115
  307. package/commands/pan/profile.md +0 -76
  308. package/commands/pan/research-phase.md +0 -189
  309. package/pan-wizard-core/bin/lib/bridge.cjs +0 -269
  310. package/pan-wizard-core/templates/research-project/architecture.md +0 -210
  311. package/pan-wizard-core/templates/research-project/features.md +0 -153
  312. package/pan-wizard-core/templates/research-project/pitfalls.md +0 -206
  313. package/pan-wizard-core/templates/research-project/stack.md +0 -126
  314. package/pan-wizard-core/templates/research-project/summary.md +0 -170
package/docs/AGENTS.md ADDED
@@ -0,0 +1,917 @@
1
+ # PAN Agent System
2
+
3
+ PAN uses specialized agents, each running as a subagent in a fresh context window. Agents are spawned by workflow orchestrators via the `Task` tool (on Claude Code, also by the native workflow scripts in `.claude/workflows/` through their `agent()` calls) and communicate exclusively through `.planning/` files (and, since v3.0, `.planning/bus/<channel>.jsonl` for hierarchical coordination). They never communicate directly with each other.
4
+
5
+ **Other docs:** [Architecture](ARCHITECTURE.md) · [Hooks](HOOKS.md) · [CLI Reference](CLI-REFERENCE.md) · [Development](DEVELOPMENT.md)
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ - [Agent Inventory](#agent-inventory)
12
+ - [Squad model](#squad-model-adr-0032)
13
+ - [Agent Lifecycle](#agent-lifecycle)
14
+ - [Agent Architecture](#agent-architecture)
15
+ - [Agent Deep Dives](#agent-deep-dives)
16
+ - [pan-project-researcher](#pan-project-researcher)
17
+ - [pan-roadmapper](#pan-roadmapper)
18
+ - [pan-document_code](#pan-document_code)
19
+ - [pan-phase-researcher](#pan-phase-researcher)
20
+ - [pan-planner](#pan-planner)
21
+ - [pan-plan-checker](#pan-plan-checker)
22
+ - [pan-executor](#pan-executor)
23
+ - [pan-verifier](#pan-verifier)
24
+ - [pan-reviewer](#pan-reviewer)
25
+ - [pan-integration-checker](#pan-integration-checker)
26
+ - [pan-debugger](#pan-debugger)
27
+ - [Model Profiles](#model-profiles)
28
+ - [Cross-Phase Agent Memory](#cross-phase-agent-memory-e-4)
29
+ - [Hierarchical Orchestration](#hierarchical-orchestration)
30
+ - [Per-agent profile override](#per-agent-profile-override)
31
+ - [How Agents Collaborate](#how-agents-collaborate)
32
+ - [Parallel Execution Patterns](#parallel-execution-patterns)
33
+ - [Agent Design Principles](#agent-design-principles)
34
+ - [Customizing Agents](#customizing-agents)
35
+
36
+ ---
37
+
38
+ ## Agent Inventory
39
+
40
+ | Agent | Role | Spawned By | Tools | Color |
41
+ |-------|------|-----------|-------|-------|
42
+ | `pan-project-researcher` | Answers at most five open questions a brief leaves unanswered and that block building (only when research is asked for) | `/pan:new-project`, `/pan:milestone-new` | Read, Write, Bash, Grep, Glob, WebSearch, WebFetch, Context7 | cyan |
43
+ | `pan-roadmapper` | Creates phased roadmaps from requirements | `/pan:new-project`, `/pan:milestone-new` | Read, Write, Bash, Glob, Grep | purple |
44
+ | `pan-document_code` | Analyzes existing codebase (6 focus areas, or the whole repo in one single-shot pass) | `/pan:map-codebase` (x6 parallel, or one agent in single-shot mode); native `/pan-map-codebase` script on Claude Code (one per discovered area) | Read, Bash, Grep, Glob, Write | cyan |
45
+ | `pan-designer` | Designs a phase before planning — architecture, ADR, threat-lite; records only decisions that pass its three-question test, each with a `DD-N` id plans cite | `/pan:design-phase` | Read, Write, Bash, Glob, Grep, WebFetch, Context7 | green |
46
+ | `pan-design-checker` | Independently verifies a design before planning; spawned by /pan:design-phase and /pan:focus-design | `/pan:design-phase`, `/pan:focus-design` | Read, Bash, Glob, Grep | green |
47
+ | `pan-phase-researcher` | Answers at most five open questions that block planning a phase (only when research is asked for) | `/pan:plan-phase`, `/pan:plan-phase --research-only` | Read, Write, Bash, Grep, Glob, WebSearch, WebFetch, Context7 | cyan |
48
+ | `pan-planner` | Creates executable plan.md files with task breakdown | `/pan:plan-phase`, `/pan:quick` | Read, Write, Edit, Bash, Glob, Grep, WebFetch, Context7 | green |
49
+ | `pan-plan-checker` | Validates plans against phase goals across multiple dimensions | `/pan:plan-phase`, `/pan:quick --full` | Read, Bash, Glob, Grep | green |
50
+ | `pan-executor` | Executes plans with atomic commits and deviation handling | `/pan:exec-phase`, `/pan:quick`, `/pan:army`, native `/pan-exec-waves` script (Claude Code) | Read, Write, Edit, Bash, Grep, Glob | yellow |
51
+ | `pan-verifier` | Verifies phase delivered what it promised | `/pan:exec-phase` and the native `/pan-exec-waves` script on Claude Code (both skip it when `workflow.verifier` is false), autodev's `exec-lean` workflow (lean phase), `/pan:quick --full` | Read, Write, Bash, Grep, Glob | green |
52
+ | `pan-reviewer` | Read-only code review (conventions, security, quality) | `/pan:exec-phase`, autodev's `exec-lean` workflow (lean phase), native `/pan-review-pipeline` script (Claude Code) | Read, Grep, Glob, Bash | yellow |
53
+ | `pan-integration-checker` | Verifies cross-phase wiring and E2E flows | `/pan:milestone-audit` | Read, Bash, Grep, Glob | blue |
54
+ | `pan-debugger` | Systematic bug investigation with persistent state | `/pan:debug`, `/pan:verify-phase --uat` (the `diagnose-issues` workflow), native `/pan-diagnose-issues` script (Claude Code) | Read, Write, Edit, Bash, Grep, Glob, WebSearch | orange |
55
+
56
+ ### Spec B v2 agents
57
+
58
+ | Agent | Purpose | Spawned by | Tools | Color |
59
+ |-------|---------|-----------|-------|-------|
60
+ | `pan-previewer` | Foresight — blast radius / dependency graph / milestone ETA in one agent (3 modes); a phase preview carries a `## Cost` section (p50 and p10–p90 per phase and per plan) taken only from the cost forecast, which reports `insufficient` below five past runs | `/pan:preview` | Read, Bash, Glob, Grep, Write | cyan |
61
+ | `pan-hardener` | OWASP Top 10 + STRIDE security audit on files changed in a phase; reports every security finding, since the findings ledger never suppresses one | `/pan:review-deep` (also `--deep-review` on exec-phase and `/pan:focus-auto --step exec`), `/pan:focus-auto` Pass 3, native `/pan-review-pipeline` script (Claude Code) | Read, Grep, Glob, Bash, Write | red |
62
+ | `pan-meta-reviewer` | Reviews the reviewer + hardener output; flags missed issues, disputes overstated severities | `/pan:review-deep` (also `--deep-review` on exec-phase and `/pan:focus-auto --step exec`, where it reviews the hardener's report alone), native `/pan-review-pipeline` script (Claude Code) | Read, Grep, Glob, Bash, Write | pink |
63
+ | `pan-knowledge` | Grounded Q&A / multi-turn discussion / playbook generation (3 modes) | `/pan:knowledge` | Read, Grep, Glob, Bash, Write | cyan |
64
+ | `pan-counterfactual` | Explores alternative phase approaches in isolated git worktree | `/pan:what-if` | Read, Write, Edit, Bash, Grep, Glob | purple |
65
+ | `pan-conductor` | Top-level orchestrator for hierarchical exec — decomposes a phase, spawns sub-agents in waves, enforces safety harness | `/pan:exec-phase --hierarchical`, `/pan:army` | Read, Write, Bash, Glob, Grep, Task | orange |
66
+
67
+ ### Optimization agents
68
+
69
+ | Agent | Purpose | Spawned by | Tools | Color |
70
+ |-------|---------|-----------|-------|-------|
71
+ | `pan-optimizer` | Reads trace events; identifies error/gap/redundancy patterns; writes a ranked optimization report whose suggestions each name where a person should make the fix | `/pan:learn` (`/pan:learn --optimize apply` records its suggestions) | Read, Glob, Grep, Write | cyan |
72
+ | `pan-distiller` | Read-only LLM judgment on AI code-bloat findings — receives only flagged spans (max 50 lines context per finding); validates pattern, refines safety tier (safe/review_required/risky), proposes minimal diff rewrite | `/pan:focus-auto --category distill` | Read, Grep, Glob | cyan |
73
+
74
+ ### Self-Improvement Loop agents
75
+
76
+ | Agent | Purpose | Spawned by | Tools | Color |
77
+ |-------|---------|-----------|-------|-------|
78
+ | `pan-experiment-runner` | Drives an external AI coding session against an experiment folder. Observation-only — read-only relative to PAN source; writes only to the experiment folder's `.planning/`. Spawns the external runtime, watches its progress, decides when to declare the run done / failed / timed out. | — (no shipped command spawns it directly; `/pan:experiment run` drives the runtime through `runner.cjs`; listed among the tier-2 `workers` Mission Control may delegate to under `/pan:army`) | Read, Bash, Glob, Grep | orange |
79
+
80
+ ### Bot-army agents (ADR-0032/0033)
81
+
82
+ | Agent | Purpose | Spawned by | Tools | Color |
83
+ |-------|---------|-----------|-------|-------|
84
+ | `pan-release` | Release squad. Ships approved, green work behind a human gate — prepares the squash-merge, runs the configured verification, surfaces an `always-ask` approval request, tags the release, and rolls back via `git revert` / previous tag. Instructed not to write code and not to merge to a protected branch itself — with `Bash` in the grant beside this cell, that is prompt discipline rather than a runtime block, so read it as the behaviour PAN asks for and branch protection as the rail that holds. | `/pan:army` (release phase) | Read, Grep, Glob, Bash | orange |
85
+
86
+ ---
87
+
88
+ ## Squad model (ADR-0032)
89
+
90
+ For a bot-army campaign (`/pan:army`), the agents are organized into role-scoped **squads** under the `pan-conductor` coordinator. A squad is a named grouping with an `access` label and a model tier; resolve it at runtime with `pan-tools squad list` / `squad show <name>` rather than hardcoding rosters.
91
+
92
+ | Squad | Role | Tier | `access` | Agents |
93
+ |-------|------|------|--------|--------|
94
+ | Architecture | Design before code, contract-first | reasoning | `read-only` | roadmapper, planner, designer, plan-checker, design-checker, project/phase researchers |
95
+ | Build | Turn design into committed code | reasoning | `read-write-bash` | executor (one `army/<task>` branch + worktree per agent) |
96
+ | Quality | Adversarially break what Build makes | mid | `read-only` | reviewer, hardener, meta-reviewer, verifier, integration-checker, debugger |
97
+ | Release | Ship safely behind a human gate | mid | `always-ask` | `pan-release` |
98
+
99
+ **The `access` column is advisory, and does not always match the tool grant.** `squads.cjs` describes itself as "a registry + resolver only — it modifies no agent and changes no execution path", so these values are the contract the conductor's prompt is written around, not a sandbox the runtime imposes. Compare them against the real grants with `grep '^tools:' agents/*.md` and expect divergence: several agents in a `read-only` squad hold `Write` because they emit planning or verification artifacts. What the grants *do* enforce is delegation depth — `grep -l '^tools:.*Task' agents/*.md` names every agent able to spawn another, so squad members cannot fan out further.
100
+
101
+ **Squad tier is not profile tier.** The tier column above is a `squads.cjs` grouping attribute — what `pan-tools squad list` reports — and it is not an agent's profile tier, which is what `resolve-model` reports from the active `model_profile` (`quality` is `reasoning` for every agent; `balanced` runs the researchers and the plan checker on `mid`; `budget` down-tiers further). `/pan:army` applies neither: its spawns pass no model, so a squad agent runs on its own `model:` pin, else the session model, under every profile. So the `mid` on the Quality and Release rows does not describe what those agents run. See [Model Profiles](#model-profiles) for the per-agent matrix.
102
+
103
+ Outside the squads sit the coordinator (`pan-conductor`, Tier 0) and the worker/utility agents — `pan-document_code`, `pan-distiller` (narrow, high-volume jobs — the `budget` profile is the only one that drops them to the fast tier), plus `pan-optimizer`, `pan-knowledge`, `pan-counterfactual`, `pan-previewer` (invoked directly by their own commands, not delegated through a squad) and `pan-experiment-runner` (no shipped command spawns it — see its row above). A drift test pins squad roster ⇄ agent files ⇄ `AGENT_BASE_EFFORT`, so every shipped agent is accounted for in exactly one place.
104
+
105
+ ---
106
+
107
+ ## Agent Lifecycle
108
+
109
+ ```text
110
+ Orchestrator (command/workflow)
111
+ │
112
+ ├── 1. Loads context (project.md, roadmap.md, plan.md, etc.)
113
+ ├── 2. Resolves model via pan-tools.cjs resolve-model <agent-type>
114
+ ├── 3. Spawns agent via Task tool with:
115
+ │ - Agent type (maps to agents/*.md)
116
+ │ - Prompt with <files_to_read> block
117
+ │ - Model parameter (`inherit`/`sonnet`/`haiku` as `resolve-model` emits on Anthropic, provider equivalents elsewhere; `opus`/`sonnet`/`haiku` are accepted as legacy tier aliases, and the reviewer-class agents pin `model: opus` in frontmatter, honoured on Claude Code only)
118
+ │
119
+ Agent (fresh context)
120
+ │
121
+ ├── 4. Reads all files listed in <files_to_read>
122
+ ├── 5. Executes its specialized task
123
+ ├── 6. Writes output (plan.md, summary.md, verification.md, etc.)
124
+ └── 7. Returns result to orchestrator
125
+ ```
126
+
127
+ Every agent starts with zero context and receives only what it needs. This is the key to PAN's quality — agents never suffer from context degradation.
128
+
129
+ ---
130
+
131
+ ## Agent Architecture
132
+
133
+ Each agent `.md` file is YAML frontmatter followed by XML-tagged sections. Every agent opens with `<role>`; the sections after it vary by agent — `pan-planner`, for example:
134
+
135
+ ```markdown
136
+ ---
137
+ name: pan-planner
138
+ description: Creates executable phase plans with task breakdown...
139
+ tools: Read, Write, Edit, Bash, Glob, Grep, WebFetch, mcp__context7__*
140
+ color: green
141
+ effort: xhigh
142
+ ---
143
+
144
+ <role>
145
+ What the agent does, when it's spawned, and critical behavioral constraints.
146
+ </role>
147
+
148
+ <project_context>
149
+ How to discover project context on startup — which files to read first,
150
+ how to detect project type, framework, conventions.
151
+ </project_context>
152
+
153
+ <plan_format>
154
+ What files to create, their structure, and where to write them.
155
+ Frontmatter schemas, section templates, validation requirements.
156
+ </plan_format>
157
+
158
+ <execution_flow>
159
+ Step-by-step procedure with XML-structured steps.
160
+ The core logic of the agent lives here.
161
+ </execution_flow>
162
+ ```
163
+
164
+ The `tools` field in frontmatter controls which tools the agent can access when it is spawned under its own type — which every shipped spawn of a PAN agent now does. The `general-purpose` spawns that remain (`grep -n 'subagent_type="general-purpose"' pan-wizard-core/workflows/*.md`) hand a whole orchestrator to a fresh session — `/pan:plan-phase --auto` to the exec-phase orchestrator, `/pan:exec-phase` to the phase-tests workflow, and the auto-advance chain in `discuss-phase.md` and `transition.md` to the next phase's discuss or plan orchestrator — and spawn no PAN agent themselves. Read-only agents (plan-checker, design-checker, reviewer, integration-checker) don't get Write/Edit access; the verifier holds Write to emit verification.md. Research agents get WebSearch/WebFetch and Context7 for external knowledge.
165
+
166
+ ---
167
+
168
+ ## Agent Deep Dives
169
+
170
+ Agents are ordered by workflow stage: project init → brownfield → phase planning → execution → verification → utility.
171
+
172
+ ---
173
+
174
+ ### pan-project-researcher
175
+
176
+ **Purpose:** Answers the open questions a project brief leaves unanswered and that block building, at most five, which the orchestrator writes to `.planning/research/questions.md`. Research is opt-in (`/pan:new-project --research`, or idea frontmatter `research_enabled: true`); it settles decisions and never adds scope. It replaced a four-way parallel survey (stack, features, architecture, pitfalls) and the `pan-research-synthesizer` that merged it, whose catalogue never finished and grew v1 (2026-10-25).
177
+
178
+ **Spawned by:** `/pan:new-project` (step 6) and `/pan:milestone-new` (step 8), one researcher, only when research was asked for
179
+
180
+ **Tools:** Read, Write, Bash, Grep, Glob, WebSearch, WebFetch, Context7
181
+
182
+ **Inputs:** `.planning/research/questions.md`, `.planning/project.md`
183
+
184
+ **Outputs:** `.planning/research/research-summary.md` — a table `| # | Question | Answer | Source | Confidence | Decision it settles |`, one row per question (or `unknown — assume: …`), and a separate `## Ideas (v2 candidates)` list. In market mode (`--research market`) also a `| Product | What users get | What the brief does not cover |` table of at most five comparable products, whose gaps become v2 candidates for the user to accept.
185
+
186
+ **Key Behaviors:**
187
+ - At most 4 searches or fetches per question, then stop: an unsettled question is marked `unknown` with the assumption the plan should use
188
+ - Done means every listed question has a row; no surveys, no catalogues, no questions of its own
189
+ - Runs `pan-tools research check` before returning; the orchestrator runs it again, sends the errors back once, then proceeds with the unknowns recorded
190
+ - Findings settle decisions only: no idea moves into v1 by itself
191
+ - Tool order per question: Context7 → official docs → WebSearch; confidence HIGH, MEDIUM or LOW by source
192
+
193
+ ---
194
+
195
+ ### pan-roadmapper
196
+
197
+ **Purpose:** Transforms requirements into a phased delivery plan. Every v1 requirement maps to exactly one phase. Every phase has observable success criteria.
198
+
199
+ **Spawned by:** `/pan:new-project`, `/pan:milestone-new`
200
+
201
+ **Tools:** Read, Write, Bash, Glob, Grep
202
+
203
+ **Inputs:**
204
+ - `project.md` — Project vision and constraints
205
+ - `requirements.md` — Scoped requirements with REQ-IDs
206
+ - `.planning/research/research-summary.md` — Research findings and phase suggestions
207
+
208
+ **Outputs:**
209
+ | File | Contents |
210
+ |------|----------|
211
+ | `roadmap.md` | Phase checklist + detail sections with success criteria, progress table |
212
+ | `state.md` | Initialized project memory (decisions, blockers, position) |
213
+ | `requirements.md` | Updated traceability section (requirement → phase mapping) |
214
+
215
+ **Key Behaviors:**
216
+ - Derives phases from requirements (not template imposition) — "the requirements tell us what phases are needed"
217
+ - Validates 100% requirement coverage — no orphaned requirements
218
+ - Goal-backward success criteria: observable user behaviors, not implementation tasks
219
+ - Calibrates depth from `config.json`: Quick (3-5 phases), Standard (5-8), Comprehensive (8-12)
220
+ - Prefers vertical slices over horizontal layers (better parallelization during execution)
221
+ - Writes roadmap.md, state.md and requirements.md first (one Write per file, P-1808); the orchestrator then presents the written roadmap for approval before committing, and re-spawns the roadmapper in revision mode if changes are requested; it rewrites each changed file with one Write (it has no Edit tool)
222
+
223
+ **Phase Numbering:** Integers (1, 2, 3) for planned work. Decimals (2.1, 2.2) reserved for urgent insertions via `/pan:insert-phase`.
224
+
225
+ ---
226
+
227
+ ### pan-document_code
228
+
229
+ **Purpose:** Explores an existing codebase and writes structured analysis documents. `/pan:map-codebase` first sizes the repo (`pan-tools codebase estimate-size`): at or below the threshold one agent maps the whole repo in a single pass (`single-shot`); above it six run in parallel, one focus area each (`sharded`).
230
+
231
+ **Spawned by:** `/pan:map-codebase` (x6 parallel instances in sharded mode, one in single-shot mode)
232
+
233
+ **Tools:** Read, Bash, Grep, Glob, Write
234
+
235
+ **Inputs:**
236
+ - Focus area assignment from orchestrator: `tech`, `arch`, `quality`, `concerns`, `relationships`, or `practices`
237
+ - The project's source files
238
+
239
+ **Outputs** (written directly to `.planning/codebase/`):
240
+
241
+ | Focus | Documents Created |
242
+ |-------|------------------|
243
+ | `tech` | `stack.md` (languages, frameworks, versions), `integrations.md` (external services, APIs, auth) |
244
+ | `arch` | `architecture.md` (system design, patterns), `structure.md` (directory layout, "where do I put this?") |
245
+ | `quality` | `conventions.md` (coding patterns, naming, style), `testing.md` (test infrastructure, patterns, examples) |
246
+ | `concerns` | `concerns.md` (tech debt, risks, improvement opportunities) |
247
+ | `relationships` | `relationships.md` (module dependency graph, circular dependencies, coupling analysis) |
248
+ | `practices` | `best-practices.md` (scored assessment across error handling, testing, naming, security, performance) |
249
+
250
+ **Key Behaviors:**
251
+ - Prescriptive, not descriptive: "Use camelCase" not "some functions use camelCase"
252
+ - Always includes backticked file paths (`src/services/user.ts`) as evidence
253
+ - Documents current state only — never what was considered or what might change
254
+ - Never reads sensitive files (`.env`, credentials, secrets, private keys)
255
+ - Writes documents directly to disk (minimal return to orchestrator, reducing context load)
256
+
257
+ ---
258
+
259
+ ### pan-phase-researcher
260
+
261
+ **Purpose:** Answers the open questions a phase's requirements leave unanswered and that block planning, at most five, which the plan-phase orchestrator writes to `{phase_dir}/{padded_phase}-research-questions.md`. Research is opt-in: `/pan:plan-phase N --research`, `workflow.research: true` (false by default), or `/pan:plan-phase --research-only`.
262
+
263
+ **Spawned by:** `/pan:plan-phase` (one researcher, only when research was asked for) or `/pan:plan-phase --research-only`
264
+
265
+ **Tools:** Read, Write, Bash, Grep, Glob, WebSearch, WebFetch, Context7
266
+
267
+ **Inputs:**
268
+ - The questions file, the phase's roadmap slice and `context.md` (if it exists: locked decisions are not open questions)
269
+ - `.planning/research/research-summary.md` (if it exists: a question it already answers is copied, not searched again)
270
+
271
+ **Outputs:**
272
+ - `.planning/phases/XX-name/{phase_num}-research.md` — `<user_constraints>` (when context.md exists), the answers table `| # | Question | Answer | Source | Confidence | Decision it settles |`, `## Ideas (v2 candidates)`, and `## Validation Architecture` only when `nyquist_validation` is on (the plan-phase orchestrator, step 5.5, then writes `{padded_phase}-validation.md` from `templates/validation.md`)
273
+
274
+ **Key Behaviors:**
275
+ - At most 4 searches or fetches per question, then stop: an unsettled question is `unknown` with the assumption the plan uses
276
+ - Done means every listed question has a row; no standard-stack survey, pitfall catalogue or code-example collection
277
+ - Runs `pan-tools research check <questions> <research>`; the orchestrator sends its errors back once, then plans with the unknowns recorded
278
+ - `pan-tools research lint` reads the answered rows as claims (the date in the source cell), so `/pan:plan-phase` still hands the plan-checker stale or undated claims
279
+ - The planner uses the answers to settle decisions and never plans an item from the Ideas list
280
+
281
+ ---
282
+
283
+ ### pan-planner
284
+
285
+ **Purpose:** Creates executable plan.md files with task breakdown, dependency analysis, and goal-backward verification. Plans are small enough for a single executor to implement in a fresh context window.
286
+
287
+ **Spawned by:** `/pan:plan-phase` (standard, gap closure, or revision mode), `/pan:quick` (quick mode)
288
+
289
+ **Tools:** Read, Write, Edit, Bash, Glob, Grep, WebFetch, Context7
290
+
291
+ **Inputs:**
292
+ - `state.md` and the phase's roadmap slice (`{phase}-roadmap-slice.md`); the whole roadmap.md or requirements.md only for something the slice leaves out
293
+ - `context.md` (locked user decisions)
294
+ - `{phase}-design.md` when `/pan:design-phase` produced one — the approved design the plans implement
295
+ - `research.md` (phase-specific findings)
296
+ - research.md's `## Validation Architecture` section (if Nyquist enabled)
297
+ - Previous verification.md (in gap closure mode)
298
+
299
+ **Outputs:**
300
+ - `.planning/phases/XX-name/{phase}-{plan}-plan.md` — One per plan (the planning depth suggests 1-3, 3-5 or 5-10 plans per phase)
301
+
302
+ **Plan Structure:**
303
+ ```yaml
304
+ # Frontmatter (templates/phase-prompt.md)
305
+ phase: 01-name
306
+ plan: 01
307
+ type: execute
308
+ wave: 1
309
+ depends_on: []
310
+ files_modified: []
311
+ autonomous: true
312
+ requirements: [REQ-01, REQ-02] # must not be empty
313
+ user_setup: []
314
+ must_haves:
315
+ truths: [] # derived from goal-backward analysis
316
+ artifacts: []
317
+ key_links: []
318
+ ```
319
+ Each plan contains 2-3 XML-structured tasks with: `<name>`, `<files>`, `<action>`, `<verify>` (automated command + success criteria), `<done>` criteria.
320
+
321
+ **Key Behaviors:**
322
+ - Goal-backward planning: "What must be TRUE for this phase to succeed?" → derive must-haves → derive tasks
323
+ - Honors locked decisions from context.md (non-negotiable)
324
+ - Cites the design's `DD-N` id in `## Plan Decisions` for each design decision a plan implements (`pan-tools verify decisions` checks the citations)
325
+ - Writes a `## Review Focus` section in every plan: at most five inputs or failure modes no test covers yet, each pinned to a task and its test, or `None — <why>` (`pan-tools verify review-focus` checks the structure)
326
+ - Optimizes for parallel execution through wave assignment and dependency graphs
327
+ - Task types: `auto` (fully automated) and `checkpoint` (pauses for user input)
328
+ - TDD support via dedicated `type: tdd` plans (RED → GREEN → REFACTOR)
329
+ - Gap closure mode: reads verification.md, creates fix plans for identified gaps
330
+ - Revision mode: incorporates plan-checker feedback and revises (one revision on the sized ceremony, two under full ceremony — `MAX_CHECKS` in `plan-phase.md`)
331
+
332
+ ---
333
+
334
+ ### pan-plan-checker
335
+
336
+ **Purpose:** Validates that plans WILL achieve the phase goal before execution begins. Catches structural issues that would waste executor context windows.
337
+
338
+ **Spawned by:** `/pan:plan-phase` (after planner creates plan.md; `MAX_CHECKS`: 2 checks, one revision, on the sized ceremony, 3 checks, two revisions, under `quality`, `workflow.ceremony: full` or `--quality`) and `/pan:quick --full` (on the quick task's plan, 2 checks, one revision)
339
+
340
+ **Tools:** Read, Bash, Glob, Grep (read-only — cannot modify plans)
341
+
342
+ **Inputs:**
343
+ - plan.md files created by planner
344
+ - The phase's roadmap slice (phase goal, success criteria and requirement lines); the whole roadmap.md only if the slice is missing
345
+ - context.md (locked decisions)
346
+ - research.md's `## Validation Architecture` section (if Nyquist enabled)
347
+ - A `<research_claims>` block: `pan-tools research lint` over the phase's research
348
+
349
+ **Outputs:**
350
+ - Structured issues report returned to orchestrator, ending with a `pan-verdict` block (`references/verdict-contract.md`); `/pan:plan-phase` saves it to `{phase_dir}/{padded_phase}-plan-check.md` and branches on `pan-tools findings record`, which also adds the issues to the findings ledger
351
+ - Issues categorized by severity: **blocker** (must fix), **warning** (should fix), **info** (suggestion)
352
+
353
+ **Verification Dimensions** (the agent file is the canonical source — `agents/pan-plan-checker.md`):
354
+
355
+ | # | Dimension | What It Checks |
356
+ |---|-----------|---------------|
357
+ | 1 | Requirement Coverage | Every requirement has task(s) addressing it |
358
+ | 2 | Task Completeness | Every task has Files, Action, Verify, Done fields |
359
+ | 3 | Dependency Correctness | Valid DAG, no circular refs, proper wave numbering |
360
+ | 4 | Key Links Planned | Artifacts wired end-to-end (Component → API → DB → Response) |
361
+ | 5 | Scope Sanity | 2-3 tasks per plan target; 4 → warning, 5+ → blocker |
362
+ | 6 | Verification Derivation | must_haves trace back to phase goal |
363
+ | 7 | Context Compliance | Plans honor all locked decisions from context.md |
364
+ | 8 | Test Coverage Alignment | Planned test tier matches each must-have's behavioral level |
365
+ | 9 | Nyquist Compliance | Automated verify commands present, test coverage mapped |
366
+ | 10 | Standards Awareness | Plans address selected industry standards (advisory) |
367
+ | 11 | Spec Sufficiency for Handoff | Plan complete enough that the executor cannot diverge in the implicit space (P-RES-004 — Specification Gap; arXiv:2603.24284) |
368
+ | (cond.) | Design Conformance | Plans conform to the phase `design.md` when one exists |
369
+ | 12 | Decision Trace Completeness | Plan's `## Plan Decisions` section is well-formed — Locked / Open / Considered+rejected buckets present, locked items unambiguous, downstream agents have enough reasoning context to act without re-deriving the upstream choices (P-RES-003 — Cognition's "Don't build multi-agents" anti-multi-agent argument: silent decisions force blind reconciliation) |
370
+ | 13 | Review Focus | Each plan's `## Review Focus` names real untested inputs or failure modes, owned by the named task and caught by the named test (structure already checked by `pan-tools verify review-focus`) |
371
+ | 14 | Decision Spine | When design.md exists, plans make no design-level choice that is neither a recorded `DD-N` nor a locked decision (citation checks already run by `pan-tools verify decisions`) |
372
+ | 15 | Research Freshness | Plans do not rest on research claims that `pan-tools research lint` reports as unsourced, undated or stale |
373
+
374
+ **Reasoning-trace handoff (P-RES-003):** plan-checker, planner, executor, and verifier exchange decisions explicitly via the `## Plan Decisions` section in plan.md and `## Implementation Decisions` in summary.md. Schema lives in `references/handoff-decisions.md`. Three buckets: Locked (binding, executor must obey), Open (executor's discretion), Considered+rejected (paths the planner already weighed and dismissed — saves the executor from re-arguing them).
375
+
376
+ **Key Behaviors:**
377
+ - Plans can describe intent while missing delivery — the checker catches the gap
378
+ - Context compliance is strict: locked decisions are non-negotiable, "Claude's Discretion" items are flexible, deferred ideas must be excluded
379
+ - Returns issues to planner for revision (once on the sized ceremony, twice under full ceremony; issues left after the last check go to the user)
380
+
381
+ ---
382
+
383
+ ### pan-executor
384
+
385
+ **Purpose:** Executes plan.md files atomically — one task at a time, one commit per task (consecutive trivial tasks may share one), with automatic deviation handling and checkpoint protocols.
386
+
387
+ **Spawned by:** `/pan:exec-phase` (wave-based), `/pan:quick`, `/pan:army` (Build squad, one per worktree)
388
+
389
+ **Tools:** Read, Write, Edit, Bash, Grep, Glob
390
+
391
+ **Inputs:**
392
+ - plan.md (the plan to execute)
393
+ - `## Plan Decisions` section in plan.md — read first (P-RES-003 reasoning-trace handoff). Locked items are binding; Open items are executor's discretion; Considered+rejected items must NOT be re-argued.
394
+ - `project.md`, the phase's roadmap slice and `state.md` (project context); a plan that still names `roadmap.md` gets the slice in its place
395
+ - `CLAUDE.md` and project-specific skills/conventions
396
+
397
+ **Outputs:**
398
+ | Output | Location |
399
+ |--------|----------|
400
+ | summary.md | `.planning/phases/XX-name/{phase}-{plan}-summary.md` (carries `## Implementation Decisions` section per P-RES-003 — records every deviation from the plan and why) |
401
+ | Git commits | One per task, except that consecutive trivial tasks of one type may share a commit (P-1605; never `feat`/`fix`): `{type}({phase}-{plan}): {description}` |
402
+ | state.md updates | Via pan-tools CLI (advance-plan, update-progress, record-metric) |
403
+ | roadmap.md updates | Progress table updated |
404
+
405
+ **Deviation Rules:**
406
+
407
+ | Rule | Trigger | Action | Example |
408
+ |------|---------|--------|---------|
409
+ | Rule 1 | Bug in code | Auto-fix (Rules 1-3 share a per-task cap of 3 attempts; leftovers go to summary.md "Deferred Issues") | Logic errors, null pointers, type errors |
410
+ | Rule 2 | Missing critical functionality | Auto-add | Missing validation, error handling |
411
+ | Rule 3 | Blocking issue | Auto-fix | Missing dependency, broken imports |
412
+ | Rule 4 | Architectural change needed | **STOP and ask** | New DB table, schema change, library switch |
413
+
414
+ **Checkpoint Types:**
415
+ - `human-verify` — Needs visual/functional confirmation ("Does the login page look right?")
416
+ - `decision` — Needs user choice between options
417
+ - `human-action` — Unavoidable manual step (e.g., create API key, configure OAuth)
418
+
419
+ **Key Behaviors:**
420
+ - Reads project context and conventions before starting any work
421
+ - Per-task atomic commits with conventional commit format
422
+ - TDD execution when flagged: RED (write failing test) → GREEN (minimal implementation) → REFACTOR
423
+ - Self-check verification before updating state.md
424
+ - Documents all deviations in summary.md (what changed, why, and its cost if wrong: low / medium / high)
425
+ - Lists what it finished but is unsure of under the summary's `## Concerns` (each with a cost if wrong), and then returns `## DONE_WITH_CONCERNS` instead of `## PLAN COMPLETE`
426
+ - Authentication gates recognized as normal flow, not failures
427
+ - Never edits a test to make it pass: when a test and the task cannot both hold, it stops and returns `## BLOCKED_SPEC_CONFLICT`
428
+
429
+ **Return statuses:** `## PLAN COMPLETE`, `## DONE_WITH_CONCERNS` (complete, with concerns listed), `## CHECKPOINT REACHED` (checkpoint or auth gate, with its type) and `## BLOCKED_SPEC_CONFLICT` (a test conflicts with the task).
430
+
431
+ ---
432
+
433
+ ### pan-verifier
434
+
435
+ **Purpose:** Verifies that a phase achieved its GOAL, not just completed its TASKS. Works backwards from what the phase should deliver and checks that it actually exists, is substantive, and is wired correctly.
436
+
437
+ **Spawned by:** Verification workflow after `/pan:exec-phase` (skipped, and said so, when `workflow.verifier` is false); also `/pan:quick --full`, and the `exec-lean` workflow autodev runs for a lean phase (one session does the executor's work, then one reviewer pass, then this verifier)
438
+
439
+ **Tools:** Read, Write, Bash, Grep, Glob
440
+
441
+ **Inputs:**
442
+ - plan.md files (must_haves, requirements)
443
+ - The phase's goal and success criteria (from `roadmap get-phase`) and its requirement lines (from the roadmap slice), not the whole roadmap.md
444
+ - summary.md files (claimed completions)
445
+ - The actual codebase
446
+
447
+ **Outputs:**
448
+ - `.planning/phases/XX-name/{phase_num}-verification.md` — Observable Truths table, Required Artifacts, Key Links, Requirements Coverage, Anti-Patterns, Human Verification items, Unrequested Work, Gaps Summary
449
+
450
+ **Three-Level Artifact Verification:**
451
+
452
+ | Level | Question | Failure Example |
453
+ |-------|----------|-----------------|
454
+ | **Exists** | Is the file/function there? | Component file missing entirely |
455
+ | **Substantive** | Is it real code, not a stub? | Empty `return <div/>`, `TODO: implement` |
456
+ | **Wired** | Is it connected and used? | Component exists but never imported/rendered |
457
+
458
+ **Stub Detection Patterns:** Empty React returns, API handlers returning empty arrays, event handlers with only `preventDefault()`, functions with only `console.log`.
459
+
460
+ **Key Behaviors:**
461
+ - Does NOT trust summary.md claims — verifies actual code
462
+ - Goal-backward: starts from what must be TRUE, not what was DONE
463
+ - Re-verification mode: if previous verification.md exists, focuses on previously failed items
464
+ - Runs the project's test suite as a gate (verify-phase's `run_test_suite`) and records `test_gate: passed | failed | skipped`; a gate it could not run goes in `not_checked` with the reason, so a pass never hides missing tests
465
+ - Structures `gaps`, `human_verification` and `unrequested` (work no plan asked for, found with `pan-tools verify scope`) in YAML frontmatter; `/pan:plan-phase --gaps` consumes the gaps, and `pan-tools findings record` reads those keys and `status` into the findings ledger — the verifier's machine contract, in place of a `pan-verdict` block
466
+ - Identifies items requiring human verification (visual appearance, UX, real-time behavior, external services)
467
+ - Scans for anti-patterns: TODOs, FIXMEs, empty implementations, dead code
468
+
469
+ **Per-check statuses:** VERIFIED (all checks pass), FAILED (missing/stub/unwired artifacts), UNCERTAIN (needs human judgment). The report-level `status:` is `passed`, `gaps_found` or `human_needed`.
470
+
471
+ ---
472
+
473
+ ### pan-reviewer
474
+
475
+ **Purpose:** Performs read-only code review on files changed during phase execution. Checks convention compliance, security patterns, and code quality before verification begins.
476
+
477
+ **Spawned by:** `/pan:exec-phase` (after test generation, before verification — skippable via `--skip-review` or `--fast`; a lean phase skips only the test-generation agent and keeps this pass), and the `exec-lean` workflow autodev runs for a lean phase (one pass, one fix round)
478
+
479
+ **Tools:** Read, Grep, Glob, Bash (read-only — cannot modify files)
480
+
481
+ **Inputs:**
482
+ - Changed file list from executor summary.md files (key-files.created + key-files.modified)
483
+ - Phase context from orchestrator
484
+ - Project conventions from CLAUDE.md and `.agents/skills/`
485
+ - An `<intent>` block (the `review scope` JSON): each plan's objective, must_haves and `review_focus`, the claimed requirements' text, and `unlisted` changed files no summary lists
486
+ - An `<executor_concerns>` block when executors returned concerns, each with its cost if wrong
487
+ - On a re-check, an `<open_findings>` block: its earlier open findings on the phase, each of which it must answer in the verdict's `resolutions` list (`resolved` with evidence, `still_present` or `cannot_tell`)
488
+
489
+ **Outputs:**
490
+ - Structured review report returned to orchestrator, ending with a `pan-verdict` block (`references/verdict-contract.md`); `/pan:exec-phase` saves it to `{phase_dir}/{phase_number}-review.md`, which `/pan:review-deep` reads, and branches on `pan-tools findings record`, which also adds the findings to the findings ledger
491
+ - Findings categorized by severity: **error** (must fix), **warning** (should fix), **info** (suggestion)
492
+
493
+ **Review Dimensions:**
494
+
495
+ | Category | What It Checks |
496
+ |----------|---------------|
497
+ | Convention Compliance | Consistency with the conventions the reviewer discovers from `./CLAUDE.md`, `.agents/skills/` and existing code — no fixed rule set |
498
+ | Security Patterns | No `eval`/`Function`, no shell injection, no hardcoded secrets, path traversal prevention, no absolute paths in output, no stack traces or internal names in user-facing errors |
499
+ | Code Quality | Function length (>50 lines flagged), nesting depth (>3 levels flagged), dead imports, duplicate code (>10 identical lines), new TODO/FIXME/HACK instances |
500
+ | Scope (Unrequested) | Behaviour no plan task or requirement asked for — WARNING, or ERROR when it changes existing behaviour without a plan saying so; supporting code the tasks need is not a finding |
501
+ | Design smells (baseline) | A fixed list of twelve smells from Fowler's *Refactoring* (Feature Envy, Shotgun Surgery, Speculative Generality and others), each INFO and phrased "possible …"; a project standard or established pattern that endorses one suppresses it, and none changes the verdict on its own |
502
+
503
+ **Verdict Options:**
504
+ - **PASS**: Zero errors, zero warnings
505
+ - **PASS_WITH_WARNINGS**: Zero errors, warnings present
506
+ - **NEEDS_FIXES**: Any errors present — orchestrator presents findings to user
507
+
508
+ **Key Behaviors:**
509
+ - Strictly read-only — inspects but never modifies code
510
+ - Only reviews files changed in the current phase (scoped via summary.md), plus any `unlisted` file the intent block names
511
+ - Checks each plan's Review Focus items first, and the high-cost executor concerns against the code
512
+ - Reports every finding, including ones dismissed before: the recorder filters a dismissed finding while its file is unchanged (learned suppressions, `pan-tools findings suppressions`), and never filters security or logic findings
513
+ - Reports every finding with its file path and line number, style-only ones included at INFO; the severity tiers, the verdict and `/pan:review-deep`'s meta-reviewer do the filtering
514
+ - Skips pure documentation files (.md) unless they contain code blocks
515
+
516
+ ---
517
+
518
+ ### pan-integration-checker
519
+
520
+ **Purpose:** Verifies that phases work together as a system — not just individually. Checks cross-phase wiring (exports used, APIs called, data flows) and traces end-to-end user flows.
521
+
522
+ **Spawned by:** Milestone auditor (during `/pan:milestone-audit`)
523
+
524
+ **Tools:** Read, Bash, Grep, Glob (read-only)
525
+
526
+ **Inputs:**
527
+ - summary.md files from all completed phases
528
+ - The actual codebase
529
+ - The milestone's requirement IDs, with descriptions and assigned phases, which the auditor takes from requirements.md's traceability table and passes in the prompt
530
+
531
+ **Outputs:**
532
+ - Structured report returned to milestone auditor (not a file on disk)
533
+ - Wiring status: connected exports, orphaned exports, missing connections
534
+ - Flow status: complete flows, broken flows with specific break points
535
+
536
+ **E2E Flow Verification:**
537
+ - **Auth Flow:** form → API → session/token → redirect
538
+ - **Data Display:** component → fetch → state → render
539
+ - **Form Submission:** form → handler → API → response → feedback
540
+
541
+ **Key Behaviors:**
542
+ - Existence ≠ Integration: files can exist without being connected
543
+ - Checks both directions: export exists AND import exists AND the import is actually used
544
+ - Traces full paths: Component → API → DB → Response → Display
545
+ - Identifies specific break points: "Component renders but never calls the API at line X"
546
+ - Maps requirements to cross-phase wiring paths (identifies requirements with no cross-phase touchpoints)
547
+
548
+ ---
549
+
550
+ ### pan-debugger
551
+
552
+ **Purpose:** Investigates bugs using systematic scientific method with persistent state that survives context resets. The user is the reporter (knows symptoms); Claude is the investigator (finds root cause).
553
+
554
+ **Spawned by:** `/pan:debug`; `/pan:verify-phase --uat`, whose `uat-walkthrough` workflow follows the `diagnose-issues` workflow for the gaps it records (one debugger per failed UAT truth, root cause only); on Claude Code also the native `/pan-diagnose-issues` script, which ports that workflow
555
+
556
+ **Tools:** Read, Write, Edit, Bash, Grep, Glob, WebSearch
557
+
558
+ **Inputs:**
559
+ - Bug description from user
560
+ - Existing debug session file (if resuming)
561
+ - The codebase
562
+
563
+ **Outputs:**
564
+ - `.planning/debug/{slug}.md` — Persistent debug session file with structured sections
565
+
566
+ **Debug File Structure (State Machine):**
567
+ | Section | Behavior | Contents |
568
+ |---------|----------|----------|
569
+ | Current Focus | Overwritten on updates | Active hypothesis, test, expected result, next action |
570
+ | Symptoms | Immutable after gathering | Expected vs actual, errors, reproduction steps |
571
+ | Reproduction | Written before the first hypothesis; overwritten only to shrink it | A command the debugger ran that fails on the symptom (or `none`, with what was tried); the fix is verified when it passes |
572
+ | Eliminated | Append-only | Disproven hypotheses with evidence and timestamp |
573
+ | Evidence | Append-only | Observations with implications |
574
+ | Resolution | Overwritten as understanding evolves | Root cause, fix, verification, files changed |
575
+
576
+ **Status Progression:** `gathering` → `investigating` → `fixing` → `verifying` → `awaiting_human_verify` → `resolved` (a `find_root_cause_only` session stops at `diagnosed` after `investigating`)
577
+
578
+ **Investigation Techniques:**
579
+ - Binary Search — narrow the problem space by halving
580
+ - Rubber Duck — explain the system to find assumptions
581
+ - Minimal Reproduction — strip to smallest failing case
582
+ - Working Backwards — start from error, trace to cause
583
+ - Differential Debugging — compare working vs broken state
584
+ - Git Bisect — find the commit that introduced the bug
585
+
586
+ **Key Behaviors:**
587
+ - Never asks the user to diagnose — asks about symptoms, investigates causes
588
+ - Treats own code as foreign (meta-debugging discipline)
589
+ - Actively avoids cognitive biases: confirmation, anchoring, availability, sunk cost
590
+ - Changes one variable at a time — no shotgun debugging
591
+ - When to restart: 2+ hours no progress, 3+ failed fixes, can't explain behavior
592
+ - Persistent debug file survives `/clear` — full context restoration on resume
593
+
594
+ **Modes:**
595
+ - `symptoms_prefilled` — Skip gathering, go straight to investigation
596
+ - `find_root_cause_only` — Diagnose but don't fix
597
+ - `find_and_fix` — Complete cycle (default)
598
+
599
+ ---
600
+
601
+ ## Model Profiles
602
+
603
+ Each agent is assigned a model tier based on the active profile in `.planning/config.json`. PAN uses abstract tiers (`reasoning`, `mid`, `fast`) that map to provider-specific models:
604
+
605
+ **Source of truth:** `MODEL_PROFILES` in `pan-wizard-core/bin/lib/core.cjs`. Since right-sized ceremony (`docs/specs/right-sized-ceremony.md`), `balanced` runs the plan-checker and the researchers on the mid tier and `quality` keeps every agent on the reasoning tier, with the full ceremony on every piece of work. The table below mirrors that source by hand — no script or test regenerates it — so when in doubt, `core.cjs` wins.
606
+
607
+ | Agent | `quality` | `balanced` | `budget` |
608
+ |-------|-----------|------------|----------|
609
+ | pan-planner | reasoning | reasoning | mid |
610
+ | pan-roadmapper | reasoning | reasoning | mid |
611
+ | pan-executor | reasoning | reasoning | mid |
612
+ | pan-designer | reasoning | reasoning | mid |
613
+ | pan-design-checker | reasoning | reasoning | fast |
614
+ | pan-phase-researcher | reasoning | mid | fast |
615
+ | pan-project-researcher | reasoning | mid | fast |
616
+ | pan-debugger | reasoning | reasoning | mid |
617
+ | pan-document_code | reasoning | reasoning | fast |
618
+ | pan-verifier | reasoning | reasoning | fast |
619
+ | pan-plan-checker | reasoning | mid | fast |
620
+ | pan-integration-checker | reasoning | reasoning | fast |
621
+ | pan-reviewer | reasoning | reasoning | fast |
622
+ | pan-conductor | reasoning | reasoning | mid |
623
+ | pan-counterfactual | reasoning | reasoning | mid |
624
+ | pan-hardener | reasoning | reasoning | fast |
625
+ | pan-meta-reviewer | reasoning | reasoning | fast |
626
+ | pan-knowledge | reasoning | reasoning | fast |
627
+ | pan-previewer | reasoning | reasoning | fast |
628
+ | pan-optimizer | reasoning | reasoning | fast |
629
+ | pan-distiller | reasoning | reasoning | fast |
630
+ | pan-experiment-runner | reasoning | reasoning | fast |
631
+ | pan-release | reasoning | reasoning | fast |
632
+
633
+ **Resolution order** (`resolveModelDetailed()` in `core.cjs`): a `model_overrides` entry for the agent wins, then a per-phase tier from the roadmap, then the profile column above (an agent missing from the table gets `mid`, unadjusted). Only a profile-derived tier is then adjusted — by `routing.strategy: complexity`, by the capability hints below, and on a retry (`attempt > 1`) by escalation toward the agent's `quality` tier; a pinned tier is never adjusted.
634
+
635
+ **Tier mapping by provider:** Anthropic: reasoning → `inherit` (the model your session runs on), mid → Sonnet, fast → Haiku. OpenAI/Google: reasoning → inherit, mid/fast → provider equivalents. Legacy names (`opus`, `sonnet`, `haiku`) still work as aliases.
636
+
637
+ **Design rationale (cost reset 2026-07, right-sized ceremony 2026-10-24):**
638
+ - **quality inherits everywhere; balanced inherits for the agents that plan, write and judge code** — those run on the model you launched with, and since right-sized ceremony `balanced` runs only the researchers and the plan checker on the mid tier. The other exceptions are `pan-reviewer`, `pan-hardener` and `pan-meta-reviewer`, which pin `model: opus` in their own frontmatter. On Claude Code the pin holds where a spawn passes no model (`/pan:review-deep`, `/pan:focus-auto`); `/pan:exec-phase` passes the resolved tier, so under `budget` its review spawns run on the fast tier. The installer drops the pin from the other runtimes' agent files, so there these agents inherit the session model like the rest. Context isolation, not a weaker model, keeps the main conversation clean.
639
+ - **budget is the opt-in cheap mode** — mid for the planning, orchestration and code-writing agents, fast for research, review, verification and the utility agents; choose it explicitly for high-volume work.
640
+ - Tiering takes effect where a PAN workflow passes the resolved tier as a Task spawn's `model` (from `init` or `resolve-model`), and it is what `pan-tools estimate-cost` (shown by `/pan:settings --profile`) prices — `/pan:cost` does not use it, since the hooks take each record's tier from the model id they record; a spawn that passes no model uses the agent file's static `model:` (unset → `inherit`).
641
+
642
+ ### Reasoning effort (adaptive-thinking era)
643
+
644
+ Agents declare `effort:` in frontmatter (`low`/`medium`/`high`/`xhigh`) — the within-model reasoning-depth dial on current models, consumed natively by Claude Code. Codex maps it to its native `model_reasoning_effort` field (`convertClaudeAgentToCodexToml`); OpenCode, Gemini CLI and Copilot CLI get an effort-scaled prose preamble injected by the installer (`stripThinkingFrontmatter`; legacy `thinking_budget` directives still translate via a budget→effort mapping). `pan-tools resolve-model` reports a profile-adjusted effort: `budget` steps each agent down one level (floor `low`), and `.planning/config.json → effort_overrides` wins (`resolveEffortInternal()`). No spawn applies it: an agent spawned under its own type (every shipped spawn of a PAN agent) runs at the `effort:` in its own file.
645
+
646
+ | Agent | effort | Rationale |
647
+ |-------|--------|-----------|
648
+ | `pan-plan-checker` | xhigh | Highest — catching logic gaps before execution avoids the most rework |
649
+ | `pan-debugger` | xhigh | Hypothesis-tree generation and Bayesian prior ranking |
650
+ | `pan-conductor` | xhigh | Decomposition + safety-harness enforcement decisions |
651
+ | `pan-designer` | xhigh | Architecture, ADR, and threat-lite design before planning |
652
+ | `pan-design-checker` | xhigh | Independent design verification before planning |
653
+ | `pan-verifier` | high | Goal-backward analysis across phase artifacts |
654
+ | `pan-integration-checker` | high | Cross-phase wiring verification |
655
+ | `pan-previewer` | high | Multi-mode synthesis of structured foresight inputs |
656
+ | `pan-hardener` | high | Threat-model reasoning across OWASP + STRIDE frameworks |
657
+ | `pan-counterfactual` | high | Comparison reasoning in isolated worktree |
658
+ | `pan-release` | high | Release-safety judgment: merge readiness, rollback targets |
659
+ | `pan-reviewer` | medium | Convention + security review on changed files |
660
+ | `pan-meta-reviewer` | medium | Cross-check of reviewer + hardener output |
661
+ | `pan-knowledge` | medium | Retrieval ranking + citation synthesis |
662
+ | `pan-planner` | xhigh | Task decomposition, wave assignment and decision traces |
663
+ | `pan-executor` | high | Thorough but bounded implementation of one plan |
664
+ | `pan-roadmapper` | high | Phase breakdown against requirements |
665
+ | `pan-experiment-runner` | high | Observing and judging an external run |
666
+ | `pan-optimizer` | high | Clustering trace events into patterns |
667
+ | `pan-phase-researcher` | medium | At most five bounded questions for one phase |
668
+ | `pan-project-researcher` | medium | At most five bounded questions for a project or milestone |
669
+ | `pan-distiller` | medium | Judging flagged bloat spans only |
670
+ | `pan-document_code` | low | Mechanical, scoped documentation pass |
671
+
672
+ The table mirrors `AGENT_BASE_EFFORT` in `core.cjs`; an agent absent from it resolves to `medium` (`resolveEffortInternal`). The older `THINKING_BUDGETS` table in `constants.cjs` is no longer consumed by any code path.
673
+
674
+ ### Capability-aware routing (E-7)
675
+
676
+ The tier resolved by profile can be adjusted by capability hints passed as `pan-tools resolve-model <agent> --metadata '{"context_estimate":…,"needs_thinking":…,"cache_warm":…}'` (applied by `adjustTierForCapabilities` in `core.cjs`):
677
+
678
+ - `context_estimate > 700000` (`LARGE_CONTEXT_TOKEN_THRESHOLD`) → force the reasoning tier, i.e. refuse to down-tier and let the agent run on the session model. PAN doesn't verify that model's real window — it just stops nominating a cheaper one for work this large.
679
+ - `needs_thinking` on a fast-tier agent → upgrade fast → mid
680
+ - `cache_warm + !needs_thinking + context_estimate < 50000` on a mid-tier agent → downgrade mid → fast (cheap, cached, simple)
681
+
682
+ See `/pan:settings --profile` for the full decision tree.
683
+
684
+ ---
685
+
686
+ ## Cross-Phase Agent Memory (E-4)
687
+
688
+ Since v2.10.0, each agent has an append-only memory log at `.planning/memory/<agent>.md` managed by the `memory.cjs` core module.
689
+
690
+ **PAN's workflows do not load it into agents** (ADR-0036, amended `2026-10-04`). exec-phase and plan-phase stopped injecting it, and nothing writes it automatically, after harness runs found that a recorded lesson changed no phase's work beyond what `state.md`, the summaries and the code already carried. The store and its commands remain for lessons recorded by hand, and `/pan:knowledge` reads it. A lesson an agent must see belongs in the project's instructions (`CLAUDE.md` or `AGENTS.md`, outside PAN's section).
691
+
692
+ **Files:** one per agent, stable frontmatter (`agent`, `created`) + `## Entries` section with dated bullets.
693
+
694
+ **CLI:**
695
+ - `pan-tools memory read <agent>` — list entries
696
+ - `pan-tools memory append <agent> <text> [--cites <path[#symbol]>,...]` — append a lesson (auto-dated); each citation must hold in the working tree
697
+ - `pan-tools memory list` — the agent logs with entry counts, the files in `.planning/memory/` that are not read as memory (`not_loaded`), and usage: entries with evidence, cited, used and never used
698
+ - `pan-tools memory compact <agent> [max]` — trim to last N (default 500); the dropped entries go to `.planning/memory/archive/<agent>.md`
699
+ - `pan-tools memory select <agent> [--cue <text>] [--token-budget N] [--recency-floor N] [--all] [--mark-used] [--days N]` — budget-aware, cue-ranked subset; leaves out entries whose cited code is gone or that went unused for N days (default 60); `--mark-used` records today as each selected entry's last use
700
+ - `pan-tools memory record <agent> --lesson <text> (--finding <id> | --trace <session>) --cites <path[#symbol]>` — the gated write: a corrected failure with a citation that holds
701
+ - `pan-tools memory budget` — what the whole store would add to an agent's prompt
702
+ - `pan-tools memory prune [<agent>] [--apply] [--days N]` — archive the entries `memory select` leaves out (cited code gone, or unused for N days, default 60) to `.planning/memory/archive/<agent>.md`; a dry run without `--apply`
703
+ - `pan-tools memory optimize [--apply] [--keep N]` — reconcile the always-loaded project memory
704
+ - `pan-tools memory rebuild [--apply]` — regenerate the derived tools-memory (AGENTS.md section, CLAUDE.md bridge) and state.md's frontmatter
705
+
706
+ **On request:** `/pan:retro --write-memory` extracts top-N gap patterns as lessons for `pan-planner`, and writes a verifier lesson when first-try rate drops below 60% over ≥3 runs. `/pan:retro` passes the flag on to `pan-tools retro` only when you give it; no workflow passes it on its own.
707
+
708
+ **Safety:** agent names validated against `^[a-zA-Z0-9_-]+$` to block path traversal. Compaction is bounded by `DEFAULT_MAX_ENTRIES=500`; `memory append` auto-compacts back to that cap once a file reaches twice it (`MEMORY_SOFT_CAP_MULT`, ADR-0036).
709
+
710
+ ---
711
+
712
+ ## Hierarchical Orchestration
713
+
714
+ Since v3.4.0, `/pan:exec-phase <N> --hierarchical` spawns `pan-conductor` as a top-level orchestrator that decomposes the phase and spawns sub-agents (executors, reviewers, verifiers) in waves. **This is opt-in behind a flag, not the default.** Flat exec remains the standard path.
715
+
716
+ **Safety harness (hard caps, enforced before every spawn):**
717
+
718
+ | Cap | Value | Behavior at limit |
719
+ |-----|-------|-------------------|
720
+ | Nesting depth | 2 levels (conductor → sub-agent) | Sub-agents may NOT spawn further agents |
721
+ | Spawns per phase | 12 total | Continue without further spawning; document skipped work |
722
+ | Points budget | `total_budget_points` from `pan-tools init execute-phase <N>` (config `budget.default_points`, default 50) | Stop when remaining < next spawn's estimate |
723
+ | Abort file | `.planning/orchestration/abort` | Immediate stop, no graceful rollback |
724
+
725
+ **Audit trail:** every spawn and completion is logged to `.planning/orchestration/trace.json` (authoritative) and published to the `orchestrator` bus channel (`.planning/bus/orchestrator.jsonl`) for observability.
726
+
727
+ **Runtime gating:** Claude Code only — agents-spawn-agents needs native sub-agent spawning, which the other runtimes don't support cleanly. There they fall back to flat exec with a warning. The gate is purely the runtime: `pan-conductor` ships no `model:` frontmatter, so it inherits your session model, and no model check exists anywhere in the path. [ADR-0024](decisions/ADR-0024-spec-b-v2-completion.md) records the original decision; its note that the flag needs a particular model and falls back silently predates the 3.23.0 correction (CHANGELOG), which found no model gate in the code.
728
+
729
+ **When to use:**
730
+ - Phases with ≥4 autonomous plans that genuinely parallelize
731
+ - Phases large enough that orchestration overhead is amortized
732
+ - Accept ~20-30% higher total cost vs flat exec in exchange for wall-clock reduction
733
+
734
+ **When to skip:**
735
+ - Single-plan phases (pointless orchestration tax)
736
+ - Phases with many checkpoints
737
+ - First-time runs in a new codebase (flat exec telemetry more informative)
738
+
739
+ See [commands/pan/exec-phase.md](../commands/pan/exec-phase.md) for the flag documentation, and [agents/pan-conductor.md](../agents/pan-conductor.md) for the agent's full contract including decomposition strategy.
740
+
741
+ ### Campaign mode (the army coordinator, ADR-0033)
742
+
743
+ When invoked by `/pan:army`, `pan-conductor` runs as **Mission Control** for a whole-project campaign rather than a single phase — same safety harness, wider scope. In this mode it delegates to **squads, not bare agents**, resolving the roster at runtime via `pan-tools squad list` / `squad show <name>`. Each mission is routed to the squad that owns its lifecycle role: Architecture (design), Build (code, read/write/bash), Quality (adversarial review), Release (`pan-release`, always-ask). Those role labels are the contract the conductor's prompt assigns — `squads.cjs` publishes them as advisory metadata and "changes no execution path", so the binding grant stays each agent's own `tools:` frontmatter.
744
+
745
+ - **Build parallelizes by worktree — and Mission Control tears the worktrees down.** Each concurrent `pan-executor` gets its own `army/<slug>` branch and isolated worktree (`pan-tools worktree create "<task>"` slugifies the task name) so builders never share a tree or file. After a task's squash-merge lands, the conductor removes its worktree *and* branch (`pan-tools worktree remove <worktree_path> --branch <branch>`, the two values `worktree create` returned); at campaign end or on any abort, `pan-tools worktree cleanup` sweeps the strays. Leftover `pan-army-*` sibling directories are a campaign defect.
746
+ - **Integration is human-gated** — the conductor is instructed never to merge to a protected branch; the Release squad prepares the merge and surfaces an `always-ask` approval. Branch protection on the repo is what makes that unbypassable rather than merely instructed. Recovery is `git revert` / previous tag, never force-push.
747
+ - **The loop carries learnings** — after each mission, squad summaries return to the conductor, `/pan:retro` reports the recurring patterns (the "Dreaming" step), and the conductor carries them into the next mission's plan. Agent memory is not loaded into agents, so the conductor hands them on itself.
748
+
749
+ Every Tier-0 safety cap (nesting depth 2, spawn/budget ceiling, `.planning/orchestration/abort` kill-switch) still applies, unchanged. See [agents/pan-conductor.md](../agents/pan-conductor.md) `<campaign_mode>` and [ADR-0033](decisions/ADR-0033-army-campaign.md).
750
+
751
+ ---
752
+
753
+ ## Per-agent profile override
754
+
755
+ Override specific agents without changing the profile. Values are tiers (`reasoning`, `mid`, `fast`) or their legacy aliases (`opus`, `sonnet`, `haiku`), so `opus` below means the reasoning tier — `inherit` — and an unrecognised value falls back to `mid`:
756
+ ```json
757
+ {
758
+ "model_profile": "budget",
759
+ "model_overrides": {
760
+ "pan-executor": "opus"
761
+ }
762
+ }
763
+ ```
764
+
765
+ ---
766
+
767
+ ## How Agents Collaborate
768
+
769
+ Agents never communicate directly. The orchestrator mediates all data flow through `.planning/` files:
770
+
771
+ ```text
772
+ Writes research.md
773
+ Researcher ──────────────────────────┐
774
+ │
775
+ Reads research.md ▼
776
+ Planner ──────────────────────── .planning/
777
+ │
778
+ Reads plan.md │
779
+ Executor ──────────────────────────┤
780
+ │
781
+ Reads codebase │
782
+ Verifier ──────────────────────────┘
783
+ Writes verification.md
784
+ ```
785
+
786
+ ### Full Workflow Sequence
787
+
788
+ ```text
789
+ /pan:new-project
790
+ │
791
+ ├── pan-project-researcher (one, only with --research: at most 5 questions)
792
+ └── pan-roadmapper
793
+
794
+ /pan:map-codebase (existing code; re-run to refresh)
795
+ │
796
+ └── pan-document_code (x6 parallel when sharded: tech, arch, quality, concerns, relationships, practices; one agent in single-shot mode)
797
+
798
+ /pan:plan-phase N
799
+ │
800
+ ├── pan-phase-researcher (only with --research or workflow.research: at most 5 questions → research.md)
801
+ ├── pan-planner
802
+ └── pan-plan-checker (after planner; 2 checks on the sized ceremony, 3 under full ceremony)
803
+
804
+ /pan:exec-phase N
805
+ │
806
+ ├── pan-executor (per plan, wave-based parallelism)
807
+ ├── /pan:phase-tests (auto test generation, skippable; a lean phase skips it)
808
+ ├── pan-reviewer (code review, skippable; a lean phase keeps it)
809
+ └── pan-verifier (after all executors complete, with test gate)
810
+
811
+ autodev, lean phase (one session, workflows/exec-lean.md)
812
+ │
813
+ ├── the session does the executor's work itself
814
+ ├── pan-reviewer (one pass, one fix round)
815
+ └── pan-verifier
816
+
817
+ /pan:milestone-audit
818
+ │
819
+ └── pan-integration-checker (cross-phase verification)
820
+
821
+ /pan:debug
822
+ │
823
+ └── pan-debugger (standalone, persistent state)
824
+ ```
825
+
826
+ This file-mediated communication means:
827
+ - Agents can run in parallel (researchers, codebase mappers, executors in the same wave)
828
+ - Failed agents can be re-run without losing other agents' work
829
+ - Every intermediate artifact is inspectable on disk
830
+ - The orchestrator's context window stays light — heavy work happens in agent contexts
831
+
832
+ ---
833
+
834
+ ## Parallel Execution Patterns
835
+
836
+ ### Research Phase
837
+ ```text
838
+ /pan:plan-phase N
839
+ └── pan-phase-researcher
840
+ │
841
+ └── Writes research.md
842
+ ```
843
+
844
+ ### Codebase Mapping (6 parallel, or one single-shot pass)
845
+ ```text
846
+ /pan:map-codebase
847
+ ├── pan-document_code (tech) → stack.md, integrations.md
848
+ ├── pan-document_code (arch) → architecture.md, structure.md
849
+ ├── pan-document_code (quality) → conventions.md, testing.md
850
+ ├── pan-document_code (concerns) → concerns.md
851
+ ├── pan-document_code (relationships) → relationships.md
852
+ └── pan-document_code (practices) → best-practices.md
853
+ ```
854
+
855
+ ### Plan Execution (wave-based)
856
+ ```text
857
+ /pan:exec-phase N
858
+ Wave 1 (independent plans):
859
+ ├── pan-executor (Plan 01) → commit
860
+ └── pan-executor (Plan 02) → commit
861
+ Wave 2 (depends on Wave 1):
862
+ └── pan-executor (Plan 03) → commit
863
+ Post-execution:
864
+ └── pan-verifier → verification.md
865
+ ```
866
+
867
+ ---
868
+
869
+ ## Agent Design Principles
870
+
871
+ Four principles are shared across all agents:
872
+
873
+ ### 1. Goal-Backward Thinking
874
+ Start from what must be TRUE when the work is done, then work backwards to what must be built. This prevents the common failure of completing tasks without achieving goals.
875
+
876
+ Used by: `pan-planner` (must_haves derivation), `pan-verifier` (Observable Truths), `pan-plan-checker` (verification derivation), `pan-roadmapper` (success criteria).
877
+
878
+ ### 2. Professional Skepticism
879
+ Verify actual state — don't trust claims. The verifier checks real code, not summary.md. The plan-checker validates plans deliver goals, not just describe them. Researchers treat training data as hypothesis.
880
+
881
+ Used by: `pan-verifier` ("DO NOT trust summary.md"), `pan-phase-researcher` (confidence levels), `pan-plan-checker` (multi-dimension validation).
882
+
883
+ ### 3. Structured Returns
884
+ Every agent returns data in machine-parseable formats (YAML frontmatter, structured markdown sections, JSON). This enables orchestrators to route results programmatically and enables downstream agents to parse inputs reliably.
885
+
886
+ Used by: All agents — plan.md frontmatter, verification.md gap YAML, the `pan-verdict` block that ends every plan-checker, reviewer and design-checker report, debug session state machine.
887
+
888
+ ### 4. File-Mediated Communication
889
+ Agents never call each other. All data flows through `.planning/` files on disk. This makes every intermediate artifact inspectable, enables parallel execution, and means failed agents can be re-run without losing sibling work.
890
+
891
+ Used by: All agents — researchers write research.md, planner reads it; executor writes code, verifier checks it.
892
+
893
+ ---
894
+
895
+ ## Customizing Agents
896
+
897
+ Agent files are installed alongside commands. Location depends on runtime and install scope:
898
+
899
+ | Runtime | Global | Local |
900
+ |---------|--------|-------|
901
+ | Claude Code | `~/.claude/agents/*.md` | `.claude/agents/*.md` |
902
+ | OpenCode | `~/.config/opencode/agents/*.md` | `.opencode/agents/*.md` |
903
+ | Gemini CLI | `~/.gemini/agents/*.md` | `.gemini/agents/*.md` |
904
+ | Codex | `~/.codex/agents/*.toml` | `.codex/agents/*.toml` |
905
+ | Copilot CLI | `~/.copilot/agents/*.agent.md` | `.github/agents/*.agent.md` |
906
+
907
+ > **Note:** Copilot CLI uses the `.agent.md` extension; Codex uses standalone `.toml` agent files (markdown in `.codex/agents/` is not recognized). Claude, OpenCode, and Gemini use `.md`.
908
+
909
+ ### Common Customizations
910
+
911
+ - Add domain-specific constraints to the agent's procedure section — `<execution_flow>`, `<process>`, `<verification_process>`, `<reasoning_protocol>` or `<review_checks>` for most agents; the tag varies by agent (e.g., "Always use TypeScript strict mode")
912
+ - Modify output format requirements in the agent's output section — `<output_format>`, `<output>`, `<output_contract>` or `<structured_returns>` for most agents; for plan.md it is `pan-planner`'s `<plan_format>` (e.g., custom plan.md sections)
913
+ - Add project-specific patterns to `<project_context>` (e.g., "This project uses a monorepo with pnpm workspaces")
914
+
915
+ ### Preserving Customizations
916
+
917
+ After a PAN update (`npx pan-wizard@latest`), local modifications may be overwritten. The installer backs up modified files to `pan-local-patches/` before overwriting. Run `/pan:patches` to restore your changes.