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
@@ -0,0 +1,397 @@
1
+ ---
2
+ name: Opus 4.7 Extended Features (Consolidated)
3
+ type: feature-spec
4
+ status: accepted
5
+ accepted: 2026-04-18
6
+ created: 2026-04-18
7
+ owner: oharms
8
+ supersedes: opus_47_extended_features_featureai.md
9
+ depends_on: opus_47_existing_enhancements_featureai.md
10
+ decisions:
11
+ - adopt_v2_over_v1: yes
12
+ - wave_1_scope: cost_plus_bus (ships as v3.0)
13
+ - namespace: flat (no /pan:adv:*)
14
+ ---
15
+
16
+ # Spec B v2 — Extended Feature Designs (Consolidated)
17
+
18
+ **This spec supersedes [opus_47_extended_features_featureai.md](opus_47_extended_features_featureai.md).**
19
+
20
+ **Scope:** New capabilities layered on top of Spec A (shipped in v2.10.0). Consolidated from 13 user-facing commands down to 6 via intent-based grouping. The focus system (`/pan:focus-*`) is deliberately untouched — Spec B v2 interoperates with it via read boundaries and opt-in flags, never by modification.
21
+
22
+ **Guiding principles:**
23
+ 1. **Group by user intent, not capability.** Foresight, deep review, knowledge, cost — each gets one entry point with sub-modes where needed.
24
+ 2. **Additive only.** No feature in v2 breaks an existing command, agent, or `.planning/` file.
25
+ 3. **Infrastructure is not a command.** Hierarchical agent spawning + message bus ship as a capability behind a flag (`/pan:exec-phase --hierarchical`), not as a standalone command.
26
+ 4. **Runtime-graceful.** Each feature declares minimum runtime capability; non-Claude runtimes get a documented fallback.
27
+ 5. **Opt-in.** Every new command defaults off until the user enables it via `/pan:settings`.
28
+
29
+ ---
30
+
31
+ ## Consolidation map (v1 → v2)
32
+
33
+ | User intent | Spec B v1 items folded in | Spec B v2 entry point |
34
+ |-------------|---------------------------|-----------------------|
35
+ | See the future before committing | X-1 architect, X-5 simulate, X-11 predict-milestone | **Y-1** `/pan:preview {phases\|milestone\|phase N}` |
36
+ | Catch more in code review | X-4 self-review, X-12 harden | **Y-2** `/pan:review-deep` |
37
+ | Q&A, refine, teach | X-3 converse, X-6 teach, X-10 explain | **Y-3** `/pan:knowledge {ask\|discuss\|playbook}` |
38
+ | Explore alternatives | X-9 what-if | **Y-4** `/pan:what-if` (unchanged) |
39
+ | Discover external tools | X-7 bridge | **Y-5** `/pan:mcp-bridge` (reduced to discover+report) |
40
+ | See what PAN costs | X-14 cost | **Y-6** `/pan:cost` (unchanged) |
41
+ | Hierarchical agent spawning | X-2 orchestrate, X-13 bus | **Y-7** infrastructure: `exec-phase --hierarchical` + `bus.cjs` |
42
+
43
+ **Cut from v1:**
44
+ - X-8 watch — deferred to v3.x (no user-demand signal; cron works today).
45
+ - X-2 orchestrate as standalone command — folded into Y-7.
46
+ - X-13 bus as standalone surface — folded into Y-7.
47
+
48
+ ---
49
+
50
+ ## Y-1. `/pan:preview` — Foresight Entry Point
51
+
52
+ Consolidates X-1 architect + X-5 simulate + X-11 predict-milestone into one command with three modes.
53
+
54
+ **Problem.** Users wonder "what happens if I run phase 7?" or "when will this milestone finish?" or "which phases can run in parallel?". Previously these required 3 separate commands. One entry point, three modes, shared agent.
55
+
56
+ ### Modes
57
+
58
+ | Mode | Invocation | What it does |
59
+ |------|------------|--------------|
60
+ | `phase N` | `/pan:preview phase 7` | Simulate the phase: files likely touched, tests likely to break, migration steps, risk score 1-10. Read-only agent, large context, thinking-on. (Was X-5 simulate.) |
61
+ | `phases` | `/pan:preview phases` | Phase dependency graph: mermaid DAG, parallelizable batches, hidden coupling flags. (Was X-1 architect.) |
62
+ | `milestone` | `/pan:preview milestone` | Completion estimator: velocity from phase history, ETA ± confidence interval, bottleneck identification. (Was X-11 predict-milestone.) |
63
+
64
+ ### New files
65
+
66
+ - `commands/pan/preview.md` — single user-facing command with mode routing
67
+ - `agents/pan-previewer.md` — single agent, branches behavior by mode (read-only always)
68
+ - `pan-wizard-core/bin/lib/preview.cjs` — consolidated module: `buildPhasePreview()`, `buildPhaseDependencyGraph()`, `buildMilestoneETA()`
69
+ - `pan-wizard-core/templates/preview-report.md` — shared output template
70
+
71
+ ### Output paths
72
+
73
+ - `phase N` → `.planning/phases/<N>/preview.md`
74
+ - `phases` → `.planning/architecture/dependency-graph.md`
75
+ - `milestone` → `.planning/milestones/preview-<date>.md`
76
+
77
+ ### Runtime compatibility
78
+
79
+ Opus 4.7 primary (1M context for full-repo analysis in `phases` mode). Sonnet fallback shards into 3 agent calls. Other runtimes: mode `phase N` works via existing pattern; `phases` gets a "requires ≥200K context, upgrade to Opus 4.7 for single-shot analysis" note.
80
+
81
+ ### Tests (~15)
82
+
83
+ - `tests/preview.test.cjs` — unit tests for each mode's data layer
84
+ - `tests/scenarios/preview-phase.test.cjs` — E2E: create temp project, run preview, validate output shape
85
+
86
+ ---
87
+
88
+ ## Y-2. `/pan:review-deep` — Security + Cross-Check Review
89
+
90
+ Consolidates X-4 self-review + X-12 harden.
91
+
92
+ **Problem.** `pan-reviewer` catches convention and style issues. For high-stakes phases (auth, payment, PII), we want (1) OWASP/STRIDE security audit, AND (2) a second reviewer verifying the first one didn't miss anything. Today both would require two commands; v2 ships as one.
93
+
94
+ ### Single command, two passes
95
+
96
+ 1. **Security pass** — pan-hardener agent does OWASP Top 10 + STRIDE threat modeling on the files changed in the phase.
97
+ 2. **Cross-review pass** — pan-meta-reviewer reads pan-reviewer's review + pan-hardener's audit, flags anything the reviewer missed, disputes anything overstated.
98
+
99
+ Outputs merge into a single report.
100
+
101
+ ### New files
102
+
103
+ - `commands/pan/review-deep.md`
104
+ - `agents/pan-hardener.md` — OWASP Top 10 + STRIDE threat model agent
105
+ - `agents/pan-meta-reviewer.md` — reviews reviewer + hardener output
106
+ - `pan-wizard-core/bin/lib/review-deep.cjs` — orchestration, merge logic, conflict surfacing
107
+ - `.planning/reviews/<phase>/deep-review.md` — output document
108
+
109
+ ### Invocation
110
+
111
+ - Standalone: `/pan:review-deep <phase>` after `/pan:exec-phase` completes.
112
+ - Integrated: `/pan:exec-phase --deep-review <phase>` auto-runs after the normal review step.
113
+ - In focus: `/pan:focus-exec --deep-review` runs per high-stakes item.
114
+
115
+ ### Runtime compatibility
116
+
117
+ All 5 runtimes. Opus 4.7 benefits from thinking on both hardener and meta-reviewer.
118
+
119
+ ### Tests (~12)
120
+
121
+ - Unit: `review-deep.cjs` merge logic, conflict table generation
122
+ - Scenario: E2E phase with known OWASP-relevant code (e.g. unsanitized input) → assert hardener flags it
123
+
124
+ ---
125
+
126
+ ## Y-3. `/pan:knowledge` — Grounded Q&A, Refinement, Playbooks
127
+
128
+ Consolidates X-3 converse + X-6 teach + X-10 explain into one multi-mode command.
129
+
130
+ **Problem.** Three overlapping features (Q&A with citations, multi-turn design refinement, playbook generation from memory) each solve a "context retrieval" problem. User shouldn't have to remember which command does which.
131
+
132
+ ### Modes
133
+
134
+ | Mode | Invocation | What it does |
135
+ |------|------------|--------------|
136
+ | `ask` | `/pan:knowledge ask "why does phase 4 have a race condition fix?"` | Retrieval-grounded answer with inline citations `[ADR-0015]`, `[phase-4/summary.md:42]`. (Was X-10 explain.) |
137
+ | `discuss` | `/pan:knowledge discuss 12 "Redis vs Memcached"` | Multi-turn conversation about phase N, session state saved to `.planning/conversations/<phase>/session.json`. Uses prompt caching + memory. (Was X-3 converse.) |
138
+ | `playbook` | `/pan:knowledge playbook` | Generate `.planning/PLAYBOOK.md` from all agents' memory (E-4 layer). Auto-runs after `/pan:milestone-done`. (Was X-6 teach.) |
139
+
140
+ ### New files
141
+
142
+ - `commands/pan/knowledge.md` — mode router
143
+ - `agents/pan-knowledge.md` — single agent handling all three modes (stateful via session file)
144
+ - `pan-wizard-core/bin/lib/knowledge.cjs` — retrieval (ask), session state (discuss), playbook synthesis (playbook)
145
+ - `pan-wizard-core/templates/playbook.md` — for playbook mode
146
+
147
+ ### Leverages existing Spec A infrastructure
148
+
149
+ - **ask** reuses `buildCachedContext()` (E-1) for stable input prefixes
150
+ - **discuss** reuses E-4 memory per phase
151
+ - **playbook** reads `.planning/memory/*.md` directly (E-4)
152
+
153
+ ### Runtime compatibility
154
+
155
+ All runtimes. Opus + Claude gets caching benefit on multi-turn `discuss`.
156
+
157
+ ### Tests (~15)
158
+
159
+ - `tests/knowledge.test.cjs` — mode routing, retrieval, session state, playbook synthesis
160
+ - `tests/scenarios/knowledge-ask-cites.test.cjs` — ask returns valid citations that point to real files
161
+ - `tests/scenarios/knowledge-playbook-from-memory.test.cjs` — E2E: seed memory, run playbook, assert PLAYBOOK.md content
162
+
163
+ ---
164
+
165
+ ## Y-4. `/pan:what-if` — Counterfactual Phase Exploration
166
+
167
+ **Unchanged from v1 X-9** — already narrow enough to stand alone.
168
+
169
+ - Creates a git worktree, replays the phase with a different premise, emits a comparison report, auto-deletes the worktree.
170
+ - `.planning/counterfactuals/<phase>-<scenario>.md` — preview doc stays in the main tree.
171
+ - Claude Code primary (worktree integration best); other runtimes get a documented manual git-branch fallback.
172
+
173
+ ### Tests (~10)
174
+
175
+ - `tests/whatif.test.cjs` — worktree lifecycle, report generation
176
+ - `tests/scenarios/whatif-isolated.test.cjs` — E2E: mutation in worktree doesn't leak to main
177
+
178
+ ---
179
+
180
+ ## Y-5. `/pan:mcp-bridge` — MCP Discovery Only
181
+
182
+ **Reduced scope from v1 X-7.** Instead of deep MCP integration at planning time (which requires modifying `plan-phase` workflow + MCP tool schema translation), v2 ships the minimum viable version: **discover available MCP tools and report on them**. Auto-injection into plans defers to v3.x.
183
+
184
+ ### What it does
185
+
186
+ - `/pan:mcp-bridge list` — discovers MCP servers visible to Claude Code, lists their tool schemas, writes `.planning/bridge/available-tools.json`.
187
+ - `/pan:mcp-bridge recommend <phase>` — given a phase plan, recommends which MCP tools might apply ("phase 7 writes to Linear → consider `linear.updateTicket`").
188
+
189
+ **Explicitly NOT in v2:** auto-injection into planner context, auto-invocation of MCP tools from executor agent. Those require schema stability contracts that Claude Code's MCP doesn't yet guarantee.
190
+
191
+ ### New files
192
+
193
+ - `commands/pan/mcp-bridge.md`
194
+ - `pan-wizard-core/bin/lib/bridge.cjs` — discovery + recommendation logic
195
+ - `.planning/bridge/available-tools.json` — discovery cache
196
+
197
+ ### Runtime compatibility
198
+
199
+ Claude Code only (MCP is Claude-first). Other runtimes: command prints "MCP not available on this runtime".
200
+
201
+ ### Tests (~8)
202
+
203
+ - Unit: `bridge.cjs` recommendation heuristics
204
+ - Scenario: `tests/scenarios/mcp-bridge-discovery.test.cjs` with a mock MCP server
205
+
206
+ ---
207
+
208
+ ## Y-6. `/pan:cost` — Cost Dashboard
209
+
210
+ **Unchanged from v1 X-14** — already narrow and valuable. First priority to ship in Wave 1 because users need cost visibility *before* opting into other Opus 4.7 features.
211
+
212
+ ### Files
213
+
214
+ - `commands/pan/cost.md`
215
+ - `pan-wizard-core/bin/lib/cost.cjs` — parse `.planning/metrics/tokens.jsonl`, aggregate by command/agent/day
216
+ - `.planning/metrics/tokens.jsonl` — per-call cost log (new)
217
+ - Instrumentation hook in each agent spawn logs to this file
218
+
219
+ ### Output formats
220
+
221
+ `table` (default) | `json` | `chart` (ascii bar chart in terminal)
222
+
223
+ ### Runtime compatibility
224
+
225
+ Claude full visibility. Other runtimes: shows "cost data unavailable for runtime X" with a pointer to the runtime's own billing dashboard.
226
+
227
+ ### Tests (~10)
228
+
229
+ - Unit: parse jsonl, aggregate, format (table/json/chart)
230
+ - Scenario: append telemetry, invoke `/pan:cost`, assert aggregation matches
231
+
232
+ ---
233
+
234
+ ## Y-7. Infrastructure (no user command)
235
+
236
+ Consolidates X-2 orchestrate + X-13 bus.
237
+
238
+ **What ships:** `pan-wizard-core/bin/lib/bus.cjs` (file-based message channels at `.planning/bus/<channel>.jsonl`) + a new flag `exec-phase --hierarchical` that enables one agent (conductor) to spawn sub-agents (executors, reviewers, verifiers) in sequence with bounded safety.
239
+
240
+ **Why no user command:** hierarchical spawning is an *execution strategy*, not a user intent. Users already know `/pan:exec-phase`. They opt into the strategy.
241
+
242
+ ### Safety harness (mandatory)
243
+
244
+ - Max 3 levels of nesting (conductor → executor → reviewer = 2 levels; no more).
245
+ - Max 12 agent spawns per phase.
246
+ - Cost ceiling (reuses focus-auto's budget layer).
247
+ - Emergency stop via `.planning/orchestration/abort` file.
248
+ - Audit trail: every spawn logged to `.planning/bus/orchestrator.jsonl`.
249
+
250
+ ### New files
251
+
252
+ - `pan-wizard-core/bin/lib/bus.cjs` — `publish()`, `subscribe()`, `drain()` (file-backed, append-only)
253
+ - `agents/pan-conductor.md` — top-level orchestrator (only invoked when `--hierarchical` is set)
254
+ - Extension to `commands/pan/exec-phase.md` — document the new flag
255
+
256
+ ### Runtime compatibility
257
+
258
+ Claude Code + Opus 4.7 only for hierarchical mode (requires native subagent spawning). Other runtimes: `--hierarchical` flag is a no-op with a documented warning, falls back to flat exec.
259
+
260
+ ### Tests (~18)
261
+
262
+ - Unit: `bus.cjs` channel semantics, drain, concurrent append
263
+ - Scenario: E2E `/pan:exec-phase N --hierarchical` with abort file triggered mid-execution
264
+
265
+ ---
266
+
267
+ ## Files to Create Summary (Spec B v2)
268
+
269
+ | Category | Files | Count |
270
+ |----------|-------|-------|
271
+ | New commands | preview, review-deep, knowledge, what-if, mcp-bridge, cost | **6** |
272
+ | New agents | pan-previewer, pan-hardener, pan-meta-reviewer, pan-knowledge, pan-conductor | **5** |
273
+ | New core modules | preview.cjs, review-deep.cjs, knowledge.cjs, whatif.cjs, bridge.cjs, cost.cjs, bus.cjs | **7** |
274
+ | New templates | preview-report, playbook | **2** |
275
+ | Test files new | ~10 test files | **10** |
276
+ | Flag on existing command | `exec-phase --hierarchical`, `exec-phase --deep-review`, `focus-exec --deep-review` | — |
277
+
278
+ **Compared to v1:**
279
+ - Commands: 13 → 6 (**-54%**)
280
+ - Agents: 9 → 5 (**-44%**)
281
+ - Core modules: 14 → 7 (**-50%**)
282
+ - Templates: 4 → 2 (**-50%**)
283
+ - Test files: 14 → 10 (**-29%**)
284
+ - Estimated LOC: ~3200 → ~1800 (**-44%**)
285
+
286
+ **Estimated test count delta:** +110 to +140.
287
+
288
+ ---
289
+
290
+ ## Implementation Order
291
+
292
+ **Wave 1 (foundation + visibility, 2-3 weeks):**
293
+ 1. **Y-6 `/pan:cost`** — ship first. Gives users visibility before they opt into Opus 4.7-heavy features. Enables data-driven decisions for later waves.
294
+ 2. **Y-7 bus.cjs** (infrastructure only, no user command yet) — unblocks Y-2 + Y-3 + any future hierarchical flow.
295
+
296
+ **Wave 2 (foresight, 2-3 weeks):**
297
+ 3. **Y-1 `/pan:preview`** (all 3 modes). Biggest user-visible win from Opus 4.7's 1M context.
298
+
299
+ **Wave 3 (deep review + knowledge, 3 weeks):**
300
+ 4. **Y-2 `/pan:review-deep`** — leverages Y-7 bus for agent coordination.
301
+ 5. **Y-3 `/pan:knowledge`** (all 3 modes) — reuses E-4 memory + E-1 caching.
302
+
303
+ **Wave 4 (narrow features, 1-2 weeks):**
304
+ 6. **Y-4 `/pan:what-if`** — worktree-based, narrow scope.
305
+ 7. **Y-5 `/pan:mcp-bridge`** — discovery-only, Claude-only.
306
+
307
+ **Wave 5 (opt-in infrastructure, 1 week):**
308
+ 8. **Y-7 `exec-phase --hierarchical`** flag — now that bus.cjs exists + has been shipped + telemetry from Y-6 proves cost is controllable, enable the flag.
309
+
310
+ **Total calendar:** ~8 weeks vs v1's 15 weeks.
311
+
312
+ ### Release naming
313
+
314
+ - **v3.0** — Wave 1 (Y-6 cost + Y-7 infra). Major version because it introduces a new instrumentation file (`.planning/metrics/tokens.jsonl`).
315
+ - **v3.1** — Wave 2 (Y-1 preview).
316
+ - **v3.2** — Wave 3 (Y-2 review-deep + Y-3 knowledge).
317
+ - **v3.3** — Wave 4 (Y-4 what-if + Y-5 mcp-bridge).
318
+ - **v3.4** — Wave 5 (`--hierarchical` flag goes GA).
319
+
320
+ ---
321
+
322
+ ## Runtime Matrix (consolidated)
323
+
324
+ | Feature | Claude | Codex | Gemini | OpenCode | Copilot | Notes |
325
+ |---------|--------|-------|--------|----------|---------|-------|
326
+ | Y-1 preview (phase) | ✅ | ✅ | ✅ | ✅ | ✅ | Works everywhere; Opus best |
327
+ | Y-1 preview (phases, 1M single-shot) | ✅ Opus 4.7 | ⚠ Sharded | ⚠ Sharded | ⚠ Sharded | ⚠ Sharded | 1M ctx required for single-shot |
328
+ | Y-1 preview (milestone) | ✅ | ✅ | ✅ | ✅ | ✅ | Pure statistical, model-agnostic |
329
+ | Y-2 review-deep | ✅ | ✅ | ✅ | ✅ | ✅ | Thinking benefits on Opus 4.7 |
330
+ | Y-3 knowledge (ask) | ✅ | ✅ | ✅ | ✅ | ✅ | Citation format is plain markdown |
331
+ | Y-3 knowledge (discuss) | ✅ Cache bonus | ✅ | ✅ | ✅ | ✅ | Prompt caching a Claude-only bonus |
332
+ | Y-3 knowledge (playbook) | ✅ | ✅ | ✅ | ✅ | ✅ | File-based, all runtimes |
333
+ | Y-4 what-if | ✅ | ⚠ Branch-only | ⚠ | ⚠ | ⚠ | Worktree best in Claude |
334
+ | Y-5 mcp-bridge | ✅ | ❌ | ❌ | ❌ | ❌ | MCP is Claude-first |
335
+ | Y-6 cost | ✅ Full | ⚠ Limited | ⚠ Limited | ⚠ Limited | ⚠ Limited | Token-usage API coverage varies |
336
+ | Y-7 hierarchical exec | ✅ Opus 4.7 | ❌ | ❌ | ❌ | ❌ | Subagent spawn needs Claude |
337
+
338
+ ---
339
+
340
+ ## Cross-Spec Dependencies
341
+
342
+ ```
343
+ Spec A (v2.10.0, shipped)
344
+ ├─ E-1 caching ────────────── used by Y-3 discuss
345
+ ├─ E-4 memory ──────────────── used by Y-3 playbook, Y-2 audit trail
346
+ ├─ E-3 thinking ────────────── benefits Y-1, Y-2 on Opus 4.7
347
+ └─ E-7 routing ────────────────── Y-1 phases mode forces reasoning tier
348
+
349
+ Spec B v2
350
+ ├─ Y-6 cost ─────────────── foundation, ships first, unblocks everything else
351
+ ├─ Y-7 bus.cjs ──────────── foundation, blocks Y-2 agent coordination
352
+ ├─ Y-1 preview ────────── leverages E-1 + E-3 + E-7 (Spec A)
353
+ ├─ Y-2 review-deep ────── depends on Y-7 bus
354
+ ├─ Y-3 knowledge ────────── depends on E-1 + E-4 (Spec A)
355
+ ├─ Y-4 what-if ──────────── standalone
356
+ └─ Y-5 mcp-bridge ──────── standalone, Claude-only
357
+ ```
358
+
359
+ ---
360
+
361
+ ## Risk Register
362
+
363
+ | Risk | Likelihood | Impact | Mitigation |
364
+ |------|------------|--------|------------|
365
+ | Consolidation hides useful granularity (users prefer 3 narrow commands over 1 multi-mode) | M | M | Ship with flag-parity: every mode has a dedicated flag + can be invoked standalone |
366
+ | `/pan:preview phases` (1M-ctx) degrades to sharded poorly on Sonnet | M | M | Sharded fallback emits a prominent "confidence: low" marker |
367
+ | Hierarchical exec runaway cost | L | H | Hard caps on spawn depth + count + budget; abort file; audit trail |
368
+ | MCP schema churn breaks Y-5 discovery | M | L | MCP is Claude-only; cached discovery; explicit version negotiation |
369
+ | Y-6 cost instrumentation causes perf regression | L | L | Non-blocking jsonl append; benchmark installer time before/after |
370
+ | Users on Sonnet adopt Y-1/Y-2 and see degraded results, blame PAN | M | M | Each command prints capability detection at startup; installer warns on older models (already in E-9) |
371
+ | Telemetry files (`.planning/metrics/tokens.jsonl`) grow unbounded | M | L | Ship with documented rotation: truncate after 90 days; compaction CLI if needed |
372
+ | Bus.cjs concurrent writes corrupt channel files | L | H | File locking via `flock`/Windows file handle semantics; extensive scenario tests |
373
+
374
+ ---
375
+
376
+ ## Decision Points for User
377
+
378
+ Three calls needed before Wave 1 implementation starts:
379
+
380
+ 1. **Adopt v2 or keep v1?** v2 is smaller + ships faster + covers the same user intents via consolidation. v1 ships more raw surface area but takes ~2× the calendar. **Recommendation: v2.**
381
+
382
+ 2. **Wave 1 scope — cost + bus, or just cost?** Cost alone is ~2 weeks and immediately valuable. Adding bus.cjs in Wave 1 unblocks Y-2 for Wave 3 but adds a week. **Recommendation: both — ship as v3.0 together.**
383
+
384
+ 3. **Namespace — keep flat `/pan:*` or introduce `/pan:adv:*` for v2 items?** 6 new commands on top of 42 existing = 48 total. Flat is probably fine; namespacing helps discovery but clutters tab-completion. **Recommendation: keep flat.**
385
+
386
+ ---
387
+
388
+ ## What was cut vs Spec B v1 (explicit deferral list)
389
+
390
+ Preserved in [Spec B v1](opus_47_extended_features_featureai.md) for future consideration:
391
+
392
+ - **X-8 watch** (background monitoring). Cut entirely from v2. Revisit v3.x if users request it.
393
+ - **X-2 orchestrate as standalone command**. Folded into `exec-phase --hierarchical` flag. The underlying capability still ships; it's just not its own command.
394
+ - **X-13 bus as user-facing surface**. The module still ships as Y-7 infrastructure, just without a user command to interact with it directly.
395
+ - **Sub-features in X-3 converse / X-6 teach / X-10 explain that didn't survive consolidation:** e.g. X-10's "auto-invoked on ambiguous user questions" and X-6's "auto-run after every `milestone-done`". Both can still be enabled via `/pan:settings` toggles in Y-3 knowledge mode routing.
396
+
397
+ These items remain valid feature ideas — they just don't warrant standalone commands in the next milestone.