pan-wizard 3.35.0 → 3.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/CHANGELOG.md +3645 -0
  2. package/README.md +46 -52
  3. package/agents/pan-conductor.md +2 -3
  4. package/agents/pan-counterfactual.md +1 -2
  5. package/agents/pan-debugger.md +14 -3
  6. package/agents/pan-design-checker.md +1 -2
  7. package/agents/pan-designer.md +2 -3
  8. package/agents/pan-document_code.md +1 -2
  9. package/agents/pan-executor.md +25 -0
  10. package/agents/pan-hardener.md +4 -3
  11. package/agents/pan-integration-checker.md +1 -2
  12. package/agents/pan-knowledge.md +1 -2
  13. package/agents/pan-meta-reviewer.md +3 -3
  14. package/agents/pan-optimizer.md +4 -4
  15. package/agents/pan-phase-researcher.md +80 -475
  16. package/agents/pan-plan-checker.md +40 -3
  17. package/agents/pan-planner.md +21 -7
  18. package/agents/pan-previewer.md +3 -2
  19. package/agents/pan-project-researcher.md +72 -493
  20. package/agents/pan-release.md +1 -1
  21. package/agents/pan-reviewer.md +14 -3
  22. package/agents/pan-roadmapper.md +12 -7
  23. package/agents/pan-verifier.md +9 -4
  24. package/bin/install-lib.cjs +134 -14
  25. package/bin/install.js +59 -12
  26. package/commands/pan/army.md +1 -1
  27. package/commands/pan/autodev.md +76 -0
  28. package/commands/pan/cost.md +21 -1
  29. package/commands/pan/exec-phase.md +3 -4
  30. package/commands/pan/focus-auto.md +14 -7
  31. package/commands/pan/focus-design.md +4 -5
  32. package/commands/pan/focus-docs.md +24 -0
  33. package/commands/pan/learn.md +13 -6
  34. package/commands/pan/milestone-audit.md +8 -1
  35. package/commands/pan/milestone-done.md +10 -5
  36. package/commands/pan/milestone-new.md +2 -2
  37. package/commands/pan/new-project.md +15 -12
  38. package/commands/pan/plan-phase.md +15 -9
  39. package/commands/pan/preview.md +1 -1
  40. package/commands/pan/quick.md +1 -1
  41. package/commands/pan/review-deep.md +11 -5
  42. package/commands/pan/settings.md +6 -0
  43. package/commands/pan/verify-phase.md +6 -2
  44. package/docs/AGENTS.md +917 -0
  45. package/docs/ARCHITECTURE.md +1054 -0
  46. package/docs/CLI-REFERENCE.md +4582 -0
  47. package/docs/COMPARISON.md +116 -0
  48. package/docs/DEVELOPMENT.md +490 -0
  49. package/docs/ECOSYSTEM-REVIEW-2026-06.md +107 -0
  50. package/docs/ECOSYSTEM-REVIEW-2026-08.md +349 -0
  51. package/docs/EXAMPLES.md +584 -0
  52. package/docs/FAQ.md +254 -0
  53. package/docs/FIELD-HARVEST-2026-07.md +88 -0
  54. package/docs/FIELD-REPORT-army-2026-06.md +121 -0
  55. package/docs/HOOKS.md +638 -0
  56. package/docs/IMPROVEMENT-TODO.md +246 -0
  57. package/docs/INTERNALS.md +485 -0
  58. package/docs/MIGRATION-v2-to-v3.md +258 -0
  59. package/docs/SECURITY-HARDENING.md +230 -0
  60. package/docs/SKILLS-ENHANCEMENT-PLAN-V2.md +122 -0
  61. package/docs/SKILLS-FULL-TEXT.md +9685 -0
  62. package/docs/SKILLS-REFERENCE.md +1037 -0
  63. package/docs/TROUBLESHOOTING.md +1084 -0
  64. package/docs/USER-GUIDE.md +1437 -0
  65. package/docs/archive/SKILLS-ENHANCEMENT-PLAN.md +230 -0
  66. package/docs/audits/AUDIT-2026-08-e2e-ROADMAP.md +117 -0
  67. package/docs/audits/AUDIT-2026-08-e2e-VERIFICATION.md +693 -0
  68. package/docs/audits/AUDIT-2026-08-e2e.md +1546 -0
  69. package/docs/audits/OUTSTANDING-2026-08.md +275 -0
  70. package/docs/audits/STABILITY-TEST-2026-08.md +640 -0
  71. package/docs/branding/README-brand-draft.md +119 -0
  72. package/docs/branding/handoff/IMPLEMENTATION.md +205 -0
  73. package/docs/branding/handoff/README-brand-draft.md +119 -0
  74. package/docs/branding/handoff/image-prompts.md +46 -0
  75. package/docs/branding/image-prompts.md +46 -0
  76. package/docs/branding/nano-banana-prompts.txt +60 -0
  77. package/docs/context-monitor.md +13 -0
  78. package/docs/decisions/ADR-0001-strategic-feature-prioritization.md +83 -0
  79. package/docs/decisions/ADR-0002-copilot-cli-runtime.md +71 -0
  80. package/docs/decisions/ADR-0003-smart-execution.md +84 -0
  81. package/docs/decisions/ADR-0004-copilot-cli-interaction.md +89 -0
  82. package/docs/decisions/ADR-0005-command-naming.md +80 -0
  83. package/docs/decisions/ADR-0006-focus-commands.md +101 -0
  84. package/docs/decisions/ADR-0007-ship-v1.md +73 -0
  85. package/docs/decisions/ADR-0008-map-codebase-mermaid-togaf.md +80 -0
  86. package/docs/decisions/ADR-0009-production-deployment-checklist.md +68 -0
  87. package/docs/decisions/ADR-0010-standards-integration.md +79 -0
  88. package/docs/decisions/ADR-0011-help-commands-rewrite.md +64 -0
  89. package/docs/decisions/ADR-0012-contributors-attribution-index.md +42 -0
  90. package/docs/decisions/ADR-0013-strategic-feature-additions.md +53 -0
  91. package/docs/decisions/ADR-0014-internal-cleanup-code-quality.md +53 -0
  92. package/docs/decisions/ADR-0015-focus-auto-runner.md +296 -0
  93. package/docs/decisions/ADR-0016-enhanced-doc-sync.md +54 -0
  94. package/docs/decisions/ADR-0017-enhanced-focus-design.md +69 -0
  95. package/docs/decisions/ADR-0018-user-reality-testing.md +84 -0
  96. package/docs/decisions/ADR-0019-end-to-end-user-acceptance-testing.md +113 -0
  97. package/docs/decisions/ADR-0020-ai-drift-prevention.md +55 -0
  98. package/docs/decisions/ADR-0021-codebase-mapper-v2.md +76 -0
  99. package/docs/decisions/ADR-0022-lifecycle-completeness.md +63 -0
  100. package/docs/decisions/ADR-0023-opus-4-7-adoption.md +89 -0
  101. package/docs/decisions/ADR-0024-spec-b-v2-completion.md +137 -0
  102. package/docs/decisions/ADR-0025-behavioral-guardrails-layer.md +129 -0
  103. package/docs/decisions/ADR-0026-self-improvement-loop.md +171 -0
  104. package/docs/decisions/ADR-0027-doc-code-link-graph.md +164 -0
  105. package/docs/decisions/ADR-0028-unified-agents-skills-target.md +46 -0
  106. package/docs/decisions/ADR-0029-experiment-evaluator.md +76 -0
  107. package/docs/decisions/ADR-0030-planning-concurrency.md +37 -0
  108. package/docs/decisions/ADR-0031-focus-auto-backlog-source.md +47 -0
  109. package/docs/decisions/ADR-0032-squad-model.md +64 -0
  110. package/docs/decisions/ADR-0033-army-campaign.md +40 -0
  111. package/docs/decisions/ADR-0034-scheduled-campaigns.md +57 -0
  112. package/docs/decisions/ADR-0035-army-hud-dashboard.md +40 -0
  113. package/docs/decisions/ADR-0036-agentic-memory-architecture.md +106 -0
  114. package/docs/decisions/ADR-0037-pin-security-agents-to-opus.md +51 -0
  115. package/docs/decisions/ADR-0038-skill-aligned-decomposition.md +41 -0
  116. package/docs/decisions/ADR-0039-worktree-as-project-variant.md +37 -0
  117. package/docs/decisions/ADR-0040-memory-injection-defense.md +55 -0
  118. package/docs/decisions/ADR-0041-mcp-dual-era-bridge.md +47 -0
  119. package/docs/decisions/ADR-0042-design-parity-both-flows.md +45 -0
  120. package/docs/decisions/ADR-0043-addressable-planning-roots.md +56 -0
  121. package/docs/decisions/ADR-0044-bound-the-cached-context.md +104 -0
  122. package/docs/decisions/ADR-0045-agent-plugins-bundle.md +76 -0
  123. package/docs/decisions/ADR-0046-subagent-frontmatter-decisions.md +39 -0
  124. package/docs/decisions/ADR-0047-pan-harness.md +76 -0
  125. package/docs/decisions/ADR-0048-one-core-per-project.md +43 -0
  126. package/docs/decisions/ADR-0049-machine-verdicts-and-findings-ledger.md +116 -0
  127. package/docs/specs/ai_drift_prevention_featureai.md +286 -0
  128. package/docs/specs/codebase_mapper_v2_featureai.md +930 -0
  129. package/docs/specs/command_naming_optimization_featureai.md +930 -0
  130. package/docs/specs/comp_analysis_markdown_v1.md +149 -0
  131. package/docs/specs/continuous_autonomous_execution_featureai.md +304 -0
  132. package/docs/specs/contributors_attribution_index_featureai.md +476 -0
  133. package/docs/specs/copilot_cli_interaction_featureai.md +868 -0
  134. package/docs/specs/copilot_cli_runtime_featureai.md +647 -0
  135. package/docs/specs/custom-skills-assessment.md +461 -0
  136. package/docs/specs/deployment_audit_findings_featureai.md +243 -0
  137. package/docs/specs/doc_code_link_graph_featureai.md +253 -0
  138. package/docs/specs/documentation_alignment_cleanup_featureai.md +69 -0
  139. package/docs/specs/e2e_visual_testing_featureai.md +615 -0
  140. package/docs/specs/end_to_end_user_acceptance_testing_featureai.md +810 -0
  141. package/docs/specs/evidence-loop-plan.md +76 -0
  142. package/docs/specs/evidence_loop_featureai.md +497 -0
  143. package/docs/specs/focus-auto-optimize-category.md +449 -0
  144. package/docs/specs/focus-auto-optimize-superplan.md +188 -0
  145. package/docs/specs/focus_auto_runner_featureai.md +1102 -0
  146. package/docs/specs/focus_design_v2_featureai.md +197 -0
  147. package/docs/specs/focus_sync_v2_featureai.md +202 -0
  148. package/docs/specs/git_integration_overhaul_featureai.md +326 -0
  149. package/docs/specs/glm_zai_provider_featureai.md +200 -0
  150. package/docs/specs/googlecli_adoption_featureai.md +661 -0
  151. package/docs/specs/help_commands_rewrite_featureai.md +860 -0
  152. package/docs/specs/industry_analysis_strategic_additions_featureai.md +231 -0
  153. package/docs/specs/industry_comparison_and_feature_gaps_featureai.md +674 -0
  154. package/docs/specs/internal_cleanup_code_quality_featureai.md +486 -0
  155. package/docs/specs/investigations/README.md +31 -0
  156. package/docs/specs/investigations/digests/2026-09-28.md +47 -0
  157. package/docs/specs/investigations/digests/2026-10-08.md +62 -0
  158. package/docs/specs/investigations/digests/2026-10-10.md +61 -0
  159. package/docs/specs/investigations/features/debugger-red-loop-first.md +55 -0
  160. package/docs/specs/investigations/features/harness-cross-host-behaviour.md +93 -0
  161. package/docs/specs/investigations/features/optimize-apply-regression-gate.md +66 -0
  162. package/docs/specs/investigations/features/reviewer-smell-baseline.md +57 -0
  163. package/docs/specs/investigations/features/trace-failure-capture.md +69 -0
  164. package/docs/specs/lifecycle_completeness_featureai.md +754 -0
  165. package/docs/specs/local-first-ci.md +42 -0
  166. package/docs/specs/map_codebase_mermaid_togaf_featureai.md +805 -0
  167. package/docs/specs/market-delta-2026-09-superplan.md +310 -0
  168. package/docs/specs/market-ideas-2026-09.md +131 -0
  169. package/docs/specs/market-ideas-2026-10.md +428 -0
  170. package/docs/specs/market-ideas-ledger.md +177 -0
  171. package/docs/specs/memory-optimization-2026-10.md +285 -0
  172. package/docs/specs/multi-track-planning-roots.md +143 -0
  173. package/docs/specs/multi_model_routing_featureai.md +687 -0
  174. package/docs/specs/multi_model_routing_superplan.md +197 -0
  175. package/docs/specs/opus_47_existing_enhancements_featureai.md +247 -0
  176. package/docs/specs/opus_47_extended_features_featureai.md +363 -0
  177. package/docs/specs/opus_47_extended_features_v2_featureai.md +397 -0
  178. package/docs/specs/pan_focus_commands_featureai.md +2336 -0
  179. package/docs/specs/pan_zcode_mcp_bridge_featureai.md +120 -0
  180. package/docs/specs/product-excellence-superplan.md +315 -0
  181. package/docs/specs/product_excellence_program_2026_q4_featureai.md +365 -0
  182. package/docs/specs/production_deployment_readiness_featureai.md +433 -0
  183. package/docs/specs/production_readiness_ship_v1_featureai.md +698 -0
  184. package/docs/specs/real_test_enforcement_featureai.md +213 -0
  185. package/docs/specs/reality-check-2026-09-superplan.md +362 -0
  186. package/docs/specs/right-sized-ceremony.md +74 -0
  187. package/docs/specs/roadmap_and_competition_2026_q4_featureai.md +390 -0
  188. package/docs/specs/self_improvement_loop_featureai.md +875 -0
  189. package/docs/specs/skill-aligned-decomposition.md +155 -0
  190. package/docs/specs/standards_integration_featureai.md +833 -0
  191. package/docs/specs/testing-system-redesign-2026-09.md +267 -0
  192. package/docs/specs/user_reality_testing_system_featureai.md +788 -0
  193. package/docs/specs/watch-triggers.json +22 -0
  194. package/docs/specs/workflow-integration-redesign.md +742 -0
  195. package/docs/specs/workflow_state_consistency_featureai.md +183 -0
  196. package/hooks/dist/pan-context-monitor.js +9 -2
  197. package/hooks/dist/pan-cost-logger.js +5 -0
  198. package/hooks/dist/pan-guard.js +28 -5
  199. package/hooks/dist/pan-stop-guard.js +9 -9
  200. package/hooks/dist/pan-trace-logger.js +5 -0
  201. package/package.json +10 -2
  202. package/pan-wizard-core/bin/lib/agents-md.cjs +57 -8
  203. package/pan-wizard-core/bin/lib/autodev-report.cjs +180 -0
  204. package/pan-wizard-core/bin/lib/autodev.cjs +642 -0
  205. package/pan-wizard-core/bin/lib/ci.cjs +143 -0
  206. package/pan-wizard-core/bin/lib/commands.cjs +1 -1
  207. package/pan-wizard-core/bin/lib/config.cjs +41 -5
  208. package/pan-wizard-core/bin/lib/constants.cjs +27 -1
  209. package/pan-wizard-core/bin/lib/core.cjs +31 -14
  210. package/pan-wizard-core/bin/lib/cost.cjs +160 -4
  211. package/pan-wizard-core/bin/lib/cross-family.cjs +164 -0
  212. package/pan-wizard-core/bin/lib/debug-cases.cjs +104 -0
  213. package/pan-wizard-core/bin/lib/doc-lint.cjs +5 -3
  214. package/pan-wizard-core/bin/lib/failure-class.cjs +81 -0
  215. package/pan-wizard-core/bin/lib/findings.cjs +148 -9
  216. package/pan-wizard-core/bin/lib/focus.cjs +1 -1
  217. package/pan-wizard-core/bin/lib/git.cjs +1 -1
  218. package/pan-wizard-core/bin/lib/hosts.cjs +88 -0
  219. package/pan-wizard-core/bin/lib/init.cjs +7 -2
  220. package/pan-wizard-core/bin/lib/knowledge.cjs +2 -0
  221. package/pan-wizard-core/bin/lib/merge.cjs +50 -0
  222. package/pan-wizard-core/bin/lib/mutate.cjs +268 -0
  223. package/pan-wizard-core/bin/lib/next-action.cjs +112 -0
  224. package/pan-wizard-core/bin/lib/optimize.cjs +2 -2
  225. package/pan-wizard-core/bin/lib/phase-gate.cjs +15 -9
  226. package/pan-wizard-core/bin/lib/phase-remove.cjs +91 -11
  227. package/pan-wizard-core/bin/lib/phase.cjs +85 -13
  228. package/pan-wizard-core/bin/lib/plan-lint.cjs +310 -0
  229. package/pan-wizard-core/bin/lib/preview.cjs +26 -4
  230. package/pan-wizard-core/bin/lib/requirements-lint.cjs +130 -0
  231. package/pan-wizard-core/bin/lib/research-lint.cjs +268 -0
  232. package/pan-wizard-core/bin/lib/review-deep.cjs +14 -22
  233. package/pan-wizard-core/bin/lib/review-vote.cjs +105 -0
  234. package/pan-wizard-core/bin/lib/roadmap.cjs +1 -0
  235. package/pan-wizard-core/bin/lib/runner.cjs +2 -16
  236. package/pan-wizard-core/bin/lib/sizing.cjs +356 -0
  237. package/pan-wizard-core/bin/lib/squads.cjs +1 -1
  238. package/pan-wizard-core/bin/lib/state-write.cjs +247 -0
  239. package/pan-wizard-core/bin/lib/test-gate.cjs +433 -0
  240. package/pan-wizard-core/bin/lib/uat.cjs +149 -0
  241. package/pan-wizard-core/bin/lib/usage.cjs +104 -0
  242. package/pan-wizard-core/bin/lib/verdict.cjs +26 -3
  243. package/pan-wizard-core/bin/lib/verify-plan-set.cjs +30 -1
  244. package/pan-wizard-core/bin/lib/verify-preflight.cjs +2 -2
  245. package/pan-wizard-core/bin/lib/verify-red.cjs +174 -0
  246. package/pan-wizard-core/bin/lib/verify-retro.cjs +3 -2
  247. package/pan-wizard-core/bin/lib/verify-scope.cjs +143 -2
  248. package/pan-wizard-core/bin/lib/verify.cjs +86 -31
  249. package/pan-wizard-core/bin/lib/worktree.cjs +70 -0
  250. package/pan-wizard-core/bin/pan-tools.cjs +257 -28
  251. package/pan-wizard-core/learnings/universal/autonomous-loop.md +2 -2
  252. package/pan-wizard-core/mcp/orchestrator.cjs +4 -1
  253. package/pan-wizard-core/references/continuation-format.md +3 -3
  254. package/pan-wizard-core/references/design-methodology.md +1 -1
  255. package/pan-wizard-core/references/guardrails.md +1 -1
  256. package/pan-wizard-core/references/handoff-decisions.md +1 -1
  257. package/pan-wizard-core/references/model-profiles.md +2 -3
  258. package/pan-wizard-core/references/questioning.md +24 -0
  259. package/pan-wizard-core/references/ui-brand.md +4 -6
  260. package/pan-wizard-core/references/verdict-contract.md +2 -1
  261. package/pan-wizard-core/templates/config.json +10 -2
  262. package/pan-wizard-core/templates/debug.md +1 -0
  263. package/pan-wizard-core/templates/design.md +5 -4
  264. package/pan-wizard-core/templates/discovery.md +2 -2
  265. package/pan-wizard-core/templates/phase-prompt.md +7 -0
  266. package/pan-wizard-core/templates/requirements.md +9 -0
  267. package/pan-wizard-core/templates/research.md +10 -0
  268. package/pan-wizard-core/templates/summary-complex.md +5 -1
  269. package/pan-wizard-core/templates/summary-minimal.md +4 -0
  270. package/pan-wizard-core/templates/summary-standard.md +5 -1
  271. package/pan-wizard-core/templates/summary.md +8 -1
  272. package/pan-wizard-core/workflows/add-phase.md +4 -6
  273. package/pan-wizard-core/workflows/assumptions.md +19 -1
  274. package/pan-wizard-core/workflows/diagnose-issues.md +2 -0
  275. package/pan-wizard-core/workflows/discuss-phase.md +4 -2
  276. package/pan-wizard-core/workflows/exec-lean.md +69 -0
  277. package/pan-wizard-core/workflows/exec-phase.md +79 -15
  278. package/pan-wizard-core/workflows/execute-plan.md +3 -1
  279. package/{commands/pan → pan-wizard-core/workflows}/focus-doc-audit.md +13 -29
  280. package/{commands/pan → pan-wizard-core/workflows}/focus-drift-walking.md +3 -18
  281. package/{commands/pan → pan-wizard-core/workflows}/focus-exec.md +8 -23
  282. package/{commands/pan → pan-wizard-core/workflows}/focus-plan.md +6 -20
  283. package/{commands/pan → pan-wizard-core/workflows}/focus-scan.md +3 -16
  284. package/{commands/pan → pan-wizard-core/workflows}/focus-sync.md +7 -21
  285. package/pan-wizard-core/workflows/health.md +6 -0
  286. package/pan-wizard-core/workflows/help.md +114 -77
  287. package/pan-wizard-core/workflows/insert-phase.md +4 -6
  288. package/pan-wizard-core/workflows/learn.md +3 -3
  289. package/pan-wizard-core/workflows/milestone-audit.md +2 -2
  290. package/pan-wizard-core/workflows/milestone-new.md +38 -95
  291. package/pan-wizard-core/workflows/new-project.md +96 -258
  292. package/pan-wizard-core/workflows/optimize.md +107 -5
  293. package/pan-wizard-core/workflows/phase-tests.md +10 -0
  294. package/pan-wizard-core/workflows/plan-phase.md +106 -45
  295. package/pan-wizard-core/workflows/profile.md +50 -0
  296. package/pan-wizard-core/workflows/progress.md +10 -0
  297. package/pan-wizard-core/workflows/quick.md +34 -43
  298. package/pan-wizard-core/workflows/remove-phase.md +11 -1
  299. package/pan-wizard-core/workflows/research-phase.md +118 -40
  300. package/pan-wizard-core/workflows/resume-project.md +18 -2
  301. package/pan-wizard-core/workflows/settings.md +33 -19
  302. package/pan-wizard-core/workflows/todo-check.md +6 -2
  303. package/pan-wizard-core/workflows/transition.md +22 -4
  304. package/pan-wizard-core/workflows/uat-walkthrough.md +90 -0
  305. package/pan-wizard-core/workflows/update.md +1 -1
  306. package/pan-wizard-core/workflows/verify-phase.md +39 -46
  307. package/scripts/build-agent-plugin.js +35 -15
  308. package/scripts/build-help.cjs +106 -0
  309. package/scripts/build-plugin.js +10 -1
  310. package/scripts/deprecate-old-versions.js +70 -3
  311. package/scripts/generate-skills-docs.py +1 -1
  312. package/scripts/git-hooks/pre-push +27 -0
  313. package/scripts/install-git-hooks.js +7 -5
  314. package/scripts/install-pre-push.cjs +38 -0
  315. package/scripts/land.cjs +151 -0
  316. package/scripts/local-ci.cjs +501 -0
  317. package/scripts/local-schedule.cjs +277 -0
  318. package/scripts/mutation-probe.cjs +7 -80
  319. package/scripts/prompt-lint.cjs +32 -0
  320. package/scripts/prompt-rules.cjs +156 -0
  321. package/scripts/run-tests.cjs +7 -1
  322. package/scripts/test-quality-lint.cjs +3 -3
  323. package/scripts/test-surface.cjs +175 -6
  324. package/agents/pan-research-synthesizer.md +0 -246
  325. package/commands/pan/audit-deployment.md +0 -386
  326. package/commands/pan/dashboard.md +0 -22
  327. package/commands/pan/discord.md +0 -19
  328. package/commands/pan/mcp-bridge.md +0 -143
  329. package/commands/pan/milestone-cleanup.md +0 -19
  330. package/commands/pan/milestone-gaps.md +0 -35
  331. package/commands/pan/optimize.md +0 -115
  332. package/commands/pan/profile.md +0 -76
  333. package/commands/pan/research-phase.md +0 -189
  334. package/pan-wizard-core/bin/lib/bridge.cjs +0 -269
  335. package/pan-wizard-core/templates/research-project/architecture.md +0 -204
  336. package/pan-wizard-core/templates/research-project/features.md +0 -147
  337. package/pan-wizard-core/templates/research-project/pitfalls.md +0 -200
  338. package/pan-wizard-core/templates/research-project/stack.md +0 -120
  339. package/pan-wizard-core/templates/research-project/summary.md +0 -170
@@ -0,0 +1,183 @@
1
+ # Workflow State Consistency & Multi-Runtime Manifest Coverage — Feature Specification
2
+
3
+ **Generated:** 2026-03-09
4
+ **Version:** 1.0
5
+ **Status:** Proposed
6
+ **Source:** Deployment audit of d:\xxxx (PAN v2.8.0, 5 runtimes: Claude, Gemini, OpenCode, Codex, Copilot CLI)
7
+
8
+ ---
9
+
10
+ ## Problem Statement
11
+
12
+ A deployment audit of a completed 5-phase Rust project with all 5 PAN runtimes installed simultaneously revealed systemic gaps in state consistency and multi-runtime manifest coverage:
13
+
14
+ 1. **Workflow state not auto-updated on phase/plan completion.** When phases execute and complete, REQUIREMENTS.md checkboxes and ROADMAP.md plan checkboxes/counts are not automatically updated. In the audited project, STATE.md correctly showed 42/42 requirements and 9/9 plans complete, yet REQUIREMENTS.md had 28/43 unchecked and ROADMAP.md had 6/9 plans unchecked with wrong counts ("0/0 plans complete"). This creates a trust gap — the project appears incomplete when it is actually done.
15
+
16
+ 2. **Copilot CLI runtime has 42 orphaned files.** The `.github/` runtime installed 39 skill files and 3 hook scripts that are not tracked in `pan-file-manifest.json`. The manifest generator does not cover `.github/copilot-skills/` or `.github/hooks/` paths, making these files invisible to the upgrade, patch-save, and validation systems.
17
+
18
+ 3. **Hook files not tracked across any runtime.** The 3 hook scripts (`pan-check-update.js`, `pan-context-monitor.js`, `pan-statusline.js`) are absent from the manifest in all 5 runtimes (#154 files tracked, 0 hooks). User modifications to hooks are silently overwritten during `pan-update`.
19
+
20
+ 4. **OpenCode runtime missing hook registration.** The `opencode.json` configuration file contains permissions but no hook registration entries. Context-monitor, status-line, and update-check hooks may not fire in the OpenCode runtime, degrading the user experience silently.
21
+
22
+ 5. **Phase/plan naming inconsistency.** Phases 1-3 use `NN-PLAN-MM-slug.md` naming (e.g., `01-PLAN-01-cli-connection.md`) while Phases 4-5 use `NN-MM-PLAN.md` (e.g., `04-01-PLAN.md`). PAN's state-tracking code must handle both patterns, but the inconsistency suggests plan creation doesn't enforce a canonical format.
23
+
24
+ ## Demand Evidence
25
+
26
+ | Evidence Type | Source | Finding |
27
+ |---|---|---|
28
+ | Deployment audit | d:\xxxx REQUIREMENTS.md | 28/43 requirement checkboxes unchecked despite all code implemented |
29
+ | Deployment audit | d:\xxxx ROADMAP.md | 6/9 plan checkboxes unchecked, plan counts showed "0/0" for completed phases |
30
+ | Deployment audit | d:\xxxx STATE.md | Correctly showed 42/42 requirements, 5/5 phases — inconsistent with REQUIREMENTS.md |
31
+ | Manifest scan | .github/pan-file-manifest.json | 154 entries; 39 skills + 3 hooks in `.github/` not tracked |
32
+ | Manifest scan | .claude/pan-file-manifest.json | 154 entries; 3 hooks not tracked (same as all runtimes) |
33
+ | Config review | .opencode/opencode.json | No hook registration section; only permissions present |
34
+ | File listing | .planning/phase-*/ | Plans 1-3 use `NN-PLAN-MM-slug` format; Plans 4-5 use `NN-MM-PLAN` format |
35
+ | Code review | install-lib.cjs `generateManifest()` | Skips `hooks/` directory and runtime-specific skill paths |
36
+
37
+ ## Success Criteria
38
+
39
+ ```
40
+ SC-1: Phase completion auto-updates REQUIREMENTS.md checkboxes for mapped requirements
41
+ SC-2: Phase completion auto-updates ROADMAP.md plan checkboxes and X/Y counts
42
+ SC-3: All installed files (hooks, skills, agents, commands, core) tracked in manifest across all 5 runtimes
43
+ SC-4: OpenCode runtime registers hooks in opencode.json during installation
44
+ SC-5: Plan creation enforces a single canonical naming format
45
+ SC-6: No regression in existing 1622+ tests
46
+ SC-7: STATE.md ↔ REQUIREMENTS.md ↔ ROADMAP.md consistency is verifiable via /pan:health
47
+ ```
48
+
49
+ ## Competitive Landscape
50
+
51
+ No competing AI workflow tool maintains cross-document state consistency or multi-runtime manifest tracking at this level.
52
+
53
+ | Tool | State Auto-Sync | Manifest Tracking | Multi-Runtime | Cross-Doc Validation |
54
+ |---|---|---|---|---|
55
+ | **PAN Wizard** | STATE.md only | Partial (no hooks) | 5 runtimes | None |
56
+ | **Aider** | N/A (no state) | None | 1 (CLI) | N/A |
57
+ | **Cursor** | N/A | None | 1 (editor) | N/A |
58
+ | **Cline** | N/A | None | 1 (editor) | N/A |
59
+
60
+ ## Design
61
+
62
+ ### Architecture
63
+
64
+ ```
65
+ ┌─────────────────────────────────────┐
66
+ │ Phase Execution Flow │
67
+ │ (pan-executor completes a plan) │
68
+ └──────────────┬──────────────────────┘
69
+ │
70
+ ▼
71
+ ┌──────────────────────────────────────┐
72
+ │ State Sync Module (NEW) │
73
+ │ ┌────────────────────────────────┐ │
74
+ │ │ syncRequirements(phase, plans) │ │ ← Check requirement boxes mapped to completed phase
75
+ │ │ syncRoadmap(phase, plans) │ │ ← Check plan boxes + update X/Y counts
76
+ │ │ validateConsistency() │ │ ← Cross-check STATE ↔ REQ ↔ ROADMAP
77
+ │ └────────────────────────────────┘ │
78
+ └──────────────────────────────────────┘
79
+
80
+ ┌─────────────────────────────────────┐
81
+ │ Manifest Generator (ENHANCED) │
82
+ │ generateManifest() now covers: │
83
+ │ - pan-wizard-core/ ✓ (existing) │
84
+ │ - commands/ ✓ (existing) │
85
+ │ - agents/ ✓ (existing) │
86
+ │ - hooks/ ★ (NEW) │
87
+ │ - copilot-skills/ ★ (NEW) │
88
+ └─────────────────────────────────────┘
89
+
90
+ ┌─────────────────────────────────────┐
91
+ │ OpenCode Installer (ENHANCED) │
92
+ │ writeOpenCodeConfig() now adds: │
93
+ │ - hook registration entries ★ NEW │
94
+ └─────────────────────────────────────┘
95
+ ```
96
+
97
+ ### Key Design Decisions
98
+
99
+ 1. **State sync runs post-plan, not post-phase.** Each plan knows its parent phase and requirement mappings. Syncing after each plan gives incremental progress visibility rather than a batch update at phase end.
100
+ 2. **Cross-doc validation added to /pan:health.** The `validate health` route gains a `state-consistency` check that compares STATE.md counts against REQUIREMENTS.md checkboxes and ROADMAP.md plan checkboxes.
101
+ 3. **Manifest generation is additive.** Hooks and skills are added to the existing manifest structure — no schema change needed, just expanding the file walker's include paths.
102
+
103
+ ## Feature Ladder
104
+
105
+ | Priority | Feature | Effort | Impact | Dependency |
106
+ |---|---|---|---|---|
107
+ | P0 | B.1 Manifest covers hooks in all runtimes | S | High | None |
108
+ | P0 | B.2 Manifest covers Copilot skills | S | High | None |
109
+ | P0 | B.3 OpenCode hook registration | S | Medium | None |
110
+ | P1 | B.4 State sync: REQUIREMENTS.md auto-update | M | High | None |
111
+ | P1 | B.5 State sync: ROADMAP.md auto-update | M | High | B.4 |
112
+ | P1 | B.6 Cross-doc consistency check in /pan:health | M | High | B.4, B.5 |
113
+ | P2 | B.7 Canonical plan naming enforcement | S | Low | None |
114
+ | P2 | B.8 Plan summary enforcement (all plans get SUMMARY.md) | S | Low | None |
115
+
116
+ ## Implementation Tasks
117
+
118
+ | ID | Task | Points | Dependencies | Priority |
119
+ |---|---|---|---|---|
120
+ | B.1 | Add hooks/ to `generateManifest()` file walker in install-lib.cjs | 2 | — | P0 |
121
+ | B.2 | Add `.github/copilot-skills/` to manifest walker for Copilot runtime | 2 | — | P0 |
122
+ | B.3 | Add hook registration to `writeOpenCodeConfig()` in install.js | 2 | — | P0 |
123
+ | B.4 | Create `syncRequirements()` in state-mutations or new state-sync module | 5 | — | P1 |
124
+ | B.5 | Create `syncRoadmap()` — update plan checkboxes and X/Y counters | 5 | B.4 | P1 |
125
+ | B.6 | Add `state-consistency` check to `validate health` route | 3 | B.4, B.5 | P1 |
126
+ | B.7 | Enforce canonical `NN-PLAN-MM-slug.md` format in plan creation | 2 | — | P2 |
127
+ | B.8 | Check for missing SUMMARY.md on completed plans in health check | 2 | — | P2 |
128
+ | B.9 | Tests for B.1-B.3 (manifest and config) | 3 | B.1, B.2, B.3 | P0 |
129
+ | B.10 | Tests for B.4-B.6 (state sync and health) | 5 | B.4, B.5, B.6 | P1 |
130
+ | **Total** | | **31** | | |
131
+
132
+ ### Dependency Graph
133
+
134
+ ```
135
+ B.1 ──┐
136
+ B.2 ──┼── B.9 (tests)
137
+ B.3 ──┘
138
+ B.4 ──── B.5 ──┐
139
+ ├── B.6 ──── B.10 (tests)
140
+ │
141
+ B.7 (independent)
142
+ B.8 (independent)
143
+ ```
144
+
145
+ ## Test Plan
146
+
147
+ ### Unit Tests
148
+ - `generateManifest()` includes hooks/ entries with correct SHA256
149
+ - `generateManifest()` includes `.github/copilot-skills/` for Copilot runtime
150
+ - `writeOpenCodeConfig()` produces valid JSON with hook registrations
151
+ - `syncRequirements()` checks boxes for specified requirement IDs
152
+ - `syncRoadmap()` checks plan boxes and updates count strings
153
+ - `validateConsistency()` returns mismatch list when STATE ↔ REQ diverge
154
+
155
+ ### Integration Tests
156
+ - Full install + audit cycle: install all 5 runtimes → verify manifest covers all files
157
+ - Phase execution → verify REQUIREMENTS.md + ROADMAP.md updated
158
+ - `/pan:health` reports state inconsistency when manually introduced
159
+
160
+ ### Acceptance Criteria
161
+ - Audit of a completed multi-phase project shows 0 state inconsistencies
162
+ - Audit of a multi-runtime install shows 0 orphaned files
163
+
164
+ ## Security Considerations
165
+
166
+ - Manifest SHA256 hashes prevent undetected file tampering
167
+ - No user input enters file paths (all paths derived from known install prefixes)
168
+
169
+ ## Risk Register
170
+
171
+ | Risk | Probability | Impact | Mitigation |
172
+ |---|---|---|---|
173
+ | State sync corrupts REQUIREMENTS.md | Medium | High | Write atomically (temp + rename); validate markdown structure before write |
174
+ | Regex-based checkbox update mismatches | Medium | Medium | Unit tests with diverse markdown formatting; match requirement IDs exactly |
175
+ | OpenCode hook format changes | Low | Medium | Pin to known opencode.json schema; test against current version |
176
+ | Plan naming migration breaks existing projects | Low | Medium | Enforce only on new plans; add migration command for existing projects |
177
+
178
+ ## Sources
179
+
180
+ - Deployment audit of d:\xxxx (2026-03-09): 5-runtime install, completed Rust project
181
+ - Deployment audit of d:\pantesting (2026-03-09): fresh Claude single-runtime install
182
+ - PAN Wizard source: install-lib.cjs `generateManifest()`, install.js `writeOpenCodeConfig()`
183
+ - PAN executor agent: pan-executor.md phase completion flow
@@ -412,12 +412,18 @@ function buildContextWarning(metrics, warnState, nowSeconds, opts = {}) {
412
412
  // No figures (O7): a countdown makes a model wrap up early, and a percentage is
413
413
  // the thing it would count down. The note names the checkpoint, says compaction
414
414
  // is safe, and asks for no shortcuts.
415
+ // Name .planning/state.md only in a project that keeps one: elsewhere the note sent the
416
+ // session to update a file the project does not have (field report, 2026-10-21).
417
+ const where = opts.hasState === false
418
+ ? 'wherever this project records its progress'
419
+ : '.planning/state.md';
420
+ const pause = opts.hasState === false ? '' : '; /pan:pause writes it';
415
421
  const message = isCritical
416
422
  ? 'PAN context note (from the context-monitor hook, not the user): the host will compact this session soon. ' +
417
- 'Before your next step, make sure .planning/state.md records where you are — the phase, the plan and task, and what comes next; /pan:pause writes it. ' +
423
+ `Before your next step, make sure ${where} records where you are — the phase, the plan and task, and what comes next${pause}. ` +
418
424
  'Then carry on with the current task as normal. After compaction PAN restores the planning state, so finish the task properly rather than quickly.'
419
425
  : 'PAN context note (from the context-monitor hook, not the user): this session\'s context is filling up. ' +
420
- 'At your next natural stopping point, such as a finished task or a commit, make sure .planning/state.md records where you are; /pan:pause writes it. ' +
426
+ `At your next natural stopping point, such as a finished task or a commit, make sure ${where} records where you are${pause}. ` +
421
427
  'Nothing needs to stop: the host compacts on its own and PAN restores the planning state afterwards, so keep working at full quality, with no shortcuts and no skipped verification.';
422
428
 
423
429
  return {
@@ -502,6 +508,7 @@ function main() {
502
508
  }
503
509
 
504
510
  const decision = buildContextWarning(metrics, warnData, now, {
511
+ hasState: fs.existsSync(path.join(data.cwd || process.cwd(), '.planning', 'state.md')),
505
512
  env: process.env,
506
513
  settings: Number.isFinite(Number(metrics.total_input_tokens)) ? settings : [],
507
514
  });
@@ -227,6 +227,10 @@ const COMMAND_TAIL_BYTES = 262144;
227
227
  // so only these are attributed — a host UI command (`/model`, `/compact`) and a plain
228
228
  // typed prompt leave the row honestly unattributed instead of borrowing a name.
229
229
  const PAN_COMMAND_RE = /<command-name>\s*\/?pan[:-]([a-z0-9][a-z0-9-]*)\s*<\/command-name>/i;
230
+ // Autodev's lean execute unit types no slash command: its prompt names the exec-lean
231
+ // workflow (autodev.cjs unitPrompt). Without this the lean sessions, most of a lean
232
+ // project's spend, carried `command: null` (2026-10-25).
233
+ const LEAN_UNIT_RE = /^PAN autodev unit, lean phase \d/i;
230
234
 
231
235
  /**
232
236
  * The PAN command in whose turn this agent ran, read from the PARENT session transcript.
@@ -286,6 +290,7 @@ function readCommandFromTranscript(transcriptPath) {
286
290
  if (!typed) continue;
287
291
  const m = typed.match(PAN_COMMAND_RE);
288
292
  if (m) return m[1].toLowerCase();
293
+ if (LEAN_UNIT_RE.test(typed.trim())) return 'exec-lean';
289
294
  }
290
295
  return null;
291
296
  } catch {
@@ -12,14 +12,18 @@
12
12
  // or a long key=value secret)
13
13
  // state_write a direct write to PAN's own state: state.md, findings.jsonl,
14
14
  // the token ledger (pan-tools owns those)
15
+ // judge_write a judge (verifier, reviewer, plan-checker, design-checker)
16
+ // writing outside the planning tree; the payload names the
17
+ // agent (`agent_type`) only on hosts that say so
15
18
  // undeclared_test_edit a test file the phase in flight does not declare in any
16
19
  // unfinished plan's files_modified
17
20
  //
18
21
  // Mode, from the planning tree's config.json `hooks.guard`:
19
22
  // off nothing
20
23
  // report (default) every match is appended to <planning>/guard.jsonl, the call proceeds
21
- // enforce as report, and a secret_write is denied; the other rules still only report
22
- // until the writers of PAN's state go through pan-tools verbs (A7b)
24
+ // enforce as report, and secret_write, state_write and judge_write are denied (the
25
+ // writers of state.md go through pan-tools verbs since A7b);
26
+ // undeclared_test_edit still only reports
23
27
  //
24
28
  // Inert outside a PAN project. Fail-open on anything it cannot parse; never fail-open
25
29
  // on a matched deny. Never writes outside the planning tree.
@@ -32,6 +36,9 @@ const SECRET_KV_RE = /\b(api[_-]?key|access[_-]?token|auth[_-]?token|refresh[_-]
32
36
  const TEST_PATH_RE = /(^|\/)(tests?|__tests__|specs?)\//i;
33
37
  const TEST_FILE_RE = /(\.(test|spec)\.[a-z0-9]+|(^|\/)test_[^/]+\.py|_test\.(py|go)|Tests?\.(java|kt|cs))$/i;
34
38
  const MODES = ['off', 'report', 'enforce'];
39
+ // The agents that judge work and must not change it. Their reports go in the planning tree.
40
+ const JUDGES = new Set(['pan-verifier', 'pan-reviewer', 'pan-plan-checker', 'pan-design-checker']);
41
+ const DENIED = ['secret_write', 'state_write', 'judge_write'];
35
42
 
36
43
  // ─── R39: one run per hook when Claude and Copilot share a project ───────────
37
44
  // Copilot CLI also runs the hooks in a repository's .claude/settings.json and
@@ -130,7 +137,8 @@ function normalise(payload) {
130
137
  if (cur && line.startsWith('+')) cur.text += line.slice(1) + '\n';
131
138
  }
132
139
  }
133
- return { tool, writes, command };
140
+ const agent = String(p.agent_type || p.subagent_type || p.agentType || '') || null;
141
+ return { tool, writes, command, agent };
134
142
  }
135
143
 
136
144
  /** Project-relative POSIX path, or null when the path is outside the project. */
@@ -184,6 +192,7 @@ function evaluate(call, projectDir, planningRel) {
184
192
  if (hasSecret(w.text)) hits.push({ rule: 'secret_write', path: r || w.path });
185
193
  if (!r) continue;
186
194
  if (ownState.has(r)) hits.push({ rule: 'state_write', path: r });
195
+ if (call.agent && JUDGES.has(call.agent) && !(r === planningRel || r.startsWith(`${planningRel}/`))) hits.push({ rule: 'judge_write', path: r, agent: call.agent });
187
196
  if (declared && isTestFile(r) && !declared.has(r)) hits.push({ rule: 'undeclared_test_edit', path: r });
188
197
  }
189
198
  return hits;
@@ -191,7 +200,11 @@ function evaluate(call, projectDir, planningRel) {
191
200
 
192
201
  function decide(hits, mode) {
193
202
  if (mode !== 'enforce') return null;
194
- return hits.find((h) => h.rule === 'secret_write') || null;
203
+ for (const rule of DENIED) {
204
+ const hit = hits.find((h) => h.rule === rule);
205
+ if (hit) return hit;
206
+ }
207
+ return null;
195
208
  }
196
209
 
197
210
  /** The host whose deny format this call needs: Copilot by payload shape, else the --host flag. */
@@ -201,6 +214,16 @@ function hostOf(payload, flagHost) {
201
214
  return flagHost;
202
215
  }
203
216
 
217
+ function denyReason(deny) {
218
+ if (deny.rule === 'state_write') {
219
+ return `PAN guard: ${deny.path} is PAN's own state. Write it through pan-tools (\`pan-tools state init|section|apply|patch|update\`, \`findings record\`), which keeps it consistent, then retry. (hooks.guard: enforce)`;
220
+ }
221
+ if (deny.rule === 'judge_write') {
222
+ return `PAN guard: ${deny.agent} is a judge and does not change the work it judges (${deny.path}). Report the defect in your verdict instead; your own report goes in the planning tree. (hooks.guard: enforce)`;
223
+ }
224
+ return `PAN guard: this write puts a credential into ${deny.path}. Keep secrets out of the repository (an environment variable or a local, ignored file), then retry. (hooks.guard: enforce)`;
225
+ }
226
+
204
227
  function main() {
205
228
  const flagHost = (process.argv[process.argv.indexOf('--host') + 1] || 'claude').toLowerCase();
206
229
  let raw = '';
@@ -230,7 +253,7 @@ function main() {
230
253
  fs.appendFileSync(path.join(planning, 'guard.jsonl'), lines.join('\n') + '\n');
231
254
  } catch { /* the log is best effort; a deny below still stands */ }
232
255
  if (!deny) return;
233
- const reason = `PAN guard: this write puts a credential into ${deny.path}. Keep secrets out of the repository (an environment variable or a local, ignored file), then retry. (hooks.guard: enforce)`;
256
+ const reason = denyReason(deny);
234
257
  if (host === 'copilot') {
235
258
  process.stdout.write(JSON.stringify({ permissionDecision: 'deny', permissionDecisionReason: reason }) + '\n');
236
259
  return;
@@ -59,7 +59,11 @@
59
59
  // Copilot also ends the turn itself after eight consecutive blocks.
60
60
  //
61
61
  // Escape hatch: set workflow.stop_guard to false in .planning/config.json to
62
- // disable the guard entirely without turning off auto_advance.
62
+ // disable the guard entirely without turning off auto_advance. That is the user's
63
+ // setting: the block reason tells an agent that was asked to stop to end its turn
64
+ // again (the guard is one-shot), never to change it (2026-10-25: a harness session
65
+ // told to stop after /pan:new-project followed the old reason's advice and
66
+ // committed workflow.stop_guard: false into the project, disarming every later run).
63
67
  //
64
68
  // Fail-open everywhere: no .planning, unparseable config/state/roadmap, bad
65
69
  // stdin — exit 0 silently. This guard must never block a stop on uncertainty;
@@ -73,10 +77,6 @@ const fs = require('fs');
73
77
  const os = require('os');
74
78
  const path = require('path');
75
79
 
76
- // The CLI the block reason tells the agent to run. Installs and the plugin put the
77
- // core beside hooks/; no `pan-tools` bin is on PATH.
78
- const PAN_TOOLS = `node "${path.join(__dirname, '..', 'pan-wizard-core', 'bin', 'pan-tools.cjs').split(path.sep).join('/')}"`;
79
-
80
80
  // ─── R39: one run per hook when Claude and Copilot share a project ───────────
81
81
  // Copilot CLI also runs the hooks in a repository's .claude/settings.json and
82
82
  // .claude/settings.local.json. Measured 2026-09-26 (Copilot CLI 1.0.88, repository
@@ -209,10 +209,10 @@ function buildStopDecision({ stopHookActive, config, stateContent, roadmapConten
209
209
  `Continue the chain now: if the current phase is finished, follow transition.md's ` +
210
210
  `offer_next_phase Route A and spawn Phase ${nextPhase} as a Task subagent ` +
211
211
  `(plan-phase orchestrator, ARGUMENTS='${nextPhase} --auto'); if the current phase is ` +
212
- `mid-flight, resume it instead. If the user explicitly asked to stop, first run ` +
213
- `\`${PAN_TOOLS} config-set workflow.auto_advance false\` (under mode: yolo, which arms this ` +
214
- `guard by itself, set \`workflow.stop_guard false\` the same way instead) — then stop. ` +
215
- `(Disable this guard permanently with workflow.stop_guard: false.)`
212
+ `mid-flight, resume it instead. If the user or the command you are running explicitly ` +
213
+ `said to stop here, end your turn again: this guard blocks a stop only once, so the next ` +
214
+ `stop goes through. Do not change workflow.auto_advance, workflow.stop_guard or mode to ` +
215
+ `get past it: they are the user's settings and every later session reads them.`
216
216
  };
217
217
  }
218
218
 
@@ -223,6 +223,10 @@ const COMMAND_TAIL_BYTES = 262144;
223
223
  // so only these are attributed — a host UI command (`/model`, `/compact`) and a plain
224
224
  // typed prompt leave the row honestly unattributed instead of borrowing a name.
225
225
  const PAN_COMMAND_RE = /<command-name>\s*\/?pan[:-]([a-z0-9][a-z0-9-]*)\s*<\/command-name>/i;
226
+ // Autodev's lean execute unit types no slash command: its prompt names the exec-lean
227
+ // workflow (autodev.cjs unitPrompt). Without this the lean sessions, most of a lean
228
+ // project's spend, carried `command: null` (2026-10-25).
229
+ const LEAN_UNIT_RE = /^PAN autodev unit, lean phase \d/i;
226
230
 
227
231
  /**
228
232
  * The PAN command in whose turn this agent ran, read from the PARENT session transcript.
@@ -282,6 +286,7 @@ function readCommandFromTranscript(transcriptPath) {
282
286
  if (!typed) continue;
283
287
  const m = typed.match(PAN_COMMAND_RE);
284
288
  if (m) return m[1].toLowerCase();
289
+ if (LEAN_UNIT_RE.test(typed.trim())) return 'exec-lean';
285
290
  }
286
291
  return null;
287
292
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pan-wizard",
3
- "version": "3.35.0",
3
+ "version": "3.37.0",
4
4
  "description": "Command a bot army for your codebase: a reasoning-tier Mission Control delegates whole-project goals to specialist squads and ships behind a human merge gate. Five AI CLIs, zero context rot.",
5
5
  "bin": {
6
6
  "pan-wizard": "bin/install.js"
@@ -14,7 +14,10 @@
14
14
  "hooks/dist",
15
15
  "scripts",
16
16
  "assets",
17
- "pan-zcode"
17
+ "pan-zcode",
18
+ "docs",
19
+ "!docs/branding/assets",
20
+ "CHANGELOG.md"
18
21
  ],
19
22
  "keywords": [
20
23
  "claude",
@@ -73,6 +76,11 @@
73
76
  "test:coverage": "node scripts/coverage-gate.cjs",
74
77
  "test:surface": "node scripts/test-surface.cjs --check",
75
78
  "test:mutate": "node scripts/mutation-probe.cjs",
79
+ "ci:local": "node scripts/local-ci.cjs",
80
+ "ci:local:fast": "node scripts/local-ci.cjs --fast",
81
+ "hooks:pre-push": "node scripts/install-pre-push.cjs",
82
+ "ci:schedule": "node scripts/local-schedule.cjs",
83
+ "land": "node scripts/land.cjs",
76
84
  "build:plugin": "node scripts/build-plugin.js",
77
85
  "build:agent-plugin": "node scripts/build-agent-plugin.js",
78
86
  "harness": "node harness/src/run.cjs --tier 0",
@@ -6,7 +6,11 @@
6
6
  // OpenCode and Copilot CLI read it natively, Claude Code only through the @AGENTS.md
7
7
  // import in CLAUDE.md; Gemini CLI reads GEMINI.md by default, not this file. PAN contributes one
8
8
  // marker-fenced section so agents in any runtime understand the PAN context
9
- // when reading the repo. User content outside the markers is never touched.
9
+ // when reading the repo. User content outside the markers is never touched, and
10
+ // neither is a section the project edited inside them: PAN replaces only text it
11
+ // generated itself, this release's or an earlier one's (sectionState). A project
12
+ // whose work does not live in .planning/ said so in its own words there, and an
13
+ // update put PAN's generic text back (field report, 2026-10-21).
10
14
  //
11
15
  // SSOT NOTE: these builders are the single source of truth for the AGENTS.md
12
16
  // PAN section and the CLAUDE.md @AGENTS.md bridge. They live under
@@ -16,6 +20,30 @@
16
20
 
17
21
  const PAN_AGENTS_BEGIN = '<!-- BEGIN PAN WIZARD -->';
18
22
  const PAN_AGENTS_END = '<!-- END PAN WIZARD -->';
23
+ const crypto = require('crypto');
24
+
25
+ // What earlier releases generated between the markers, by sha256 (first 16 hex) of the
26
+ // text with LF line endings, trimmed. Taken from the builders at every commit that
27
+ // changed them. A section with any other text was written by the project.
28
+ const PRIOR_AGENTS_SECTIONS = Object.freeze([
29
+ 'a92a7488b866611d', // to 2026-10-03: "PAN commands install as pan-* skills/commands"
30
+ 'c66f9afd44d80489', // 2026-10-03 to 2026-10-21: commands named per runtime (M34)
31
+ ]);
32
+ const PRIOR_CLAUDE_BRIDGES = Object.freeze([
33
+ '918b1c90559355ef', // the @AGENTS.md import alone
34
+ '90d0654c91061ec1', // the import and compact instructions (O8), to 2026-10-21
35
+ ]);
36
+
37
+ const innerHash = (text) => crypto.createHash('sha256').update(String(text).replace(/\r\n/g, '\n').trim()).digest('hex').slice(0, 16);
38
+
39
+ /** The text between PAN's markers, or null when the markers are absent. */
40
+ function fencedInner(existing) {
41
+ if (!existing) return null;
42
+ const b = existing.indexOf(PAN_AGENTS_BEGIN);
43
+ const e = existing.indexOf(PAN_AGENTS_END);
44
+ if (b === -1 || e === -1 || e < b) return null;
45
+ return existing.slice(b + PAN_AGENTS_BEGIN.length, e);
46
+ }
19
47
 
20
48
  /**
21
49
  * Build the PAN section for AGENTS.md (marker-fenced, runtime-neutral).
@@ -28,7 +56,7 @@ function buildAgentsMdSection() {
28
56
  '',
29
57
  'This project uses PAN Wizard for structured, phase-based planning and execution.',
30
58
  '',
31
- '- `.planning/` is PAN\'s state directory (state.md, roadmap.md, phase directories). Treat it as the source of truth for planning state and modify it through PAN commands, not by hand.',
59
+ '- When this project plans with PAN, `.planning/` holds that state (state.md, roadmap.md, phase directories): change it through PAN commands, not by hand. Where this project keeps its work elsewhere, its own instructions say so and win.',
32
60
  // One section serves every runtime in the project, so it names each one's form
33
61
  // (the README's list); `/pan-help` alone sent Claude Code users to a command
34
62
  // that does not exist there (prompt audit, market-ideas M34).
@@ -38,11 +66,27 @@ function buildAgentsMdSection() {
38
66
  ].join('\n');
39
67
  }
40
68
 
69
+ /**
70
+ * Whose text sits between PAN's markers: 'absent' (no markers), 'pan' (this release's
71
+ * text or an earlier release's), or 'edited' (the project changed it).
72
+ * @param {string|null} existing - AGENTS.md (or CLAUDE.md) content
73
+ * @param {'agents'|'claude'} [kind]
74
+ */
75
+ function sectionState(existing, kind = 'agents') {
76
+ const inner = fencedInner(existing);
77
+ if (inner === null) return 'absent';
78
+ const known = kind === 'claude'
79
+ ? [...PRIOR_CLAUDE_BRIDGES, innerHash(fencedInner(buildClaudeMdBridge()))]
80
+ : [...PRIOR_AGENTS_SECTIONS, innerHash(fencedInner(buildAgentsMdSection()))];
81
+ return known.includes(innerHash(inner)) ? 'pan' : 'edited';
82
+ }
83
+
41
84
  /**
42
85
  * Insert or replace the PAN section in AGENTS.md content.
43
86
  * - No existing content (null/empty) → just the section.
44
- * - Markers present → replace exactly the fenced block, preserving everything
45
- * around it.
87
+ * - Markers present around text PAN generated → replace exactly the fenced block,
88
+ * preserving everything around it.
89
+ * - Markers present around text the project edited → return the content unchanged.
46
90
  * - Markers absent → append with a separating blank line.
47
91
  * @param {string|null} existing - Current AGENTS.md content, or null if absent
48
92
  * @param {string} section - Output of buildAgentsMdSection()
@@ -55,6 +99,7 @@ function upsertAgentsMdSection(existing, section) {
55
99
  const beginIdx = existing.indexOf(PAN_AGENTS_BEGIN);
56
100
  const endIdx = existing.indexOf(PAN_AGENTS_END);
57
101
  if (beginIdx !== -1 && endIdx !== -1 && endIdx > beginIdx) {
102
+ if (sectionState(existing, 'agents') === 'edited') return existing;
58
103
  const before = existing.slice(0, beginIdx);
59
104
  const after = existing.slice(endIdx + PAN_AGENTS_END.length);
60
105
  return before + section + after;
@@ -101,8 +146,8 @@ function buildClaudeMdBridge() {
101
146
  '# Compact instructions',
102
147
  '',
103
148
  'When this conversation is compacted, keep what PAN work needs to resume where it stopped:',
104
- '- the current phase and plan, and the task in progress with its stopping point (`.planning/state.md` records them; keep that path);',
105
- '- decisions made in this session that `.planning/state.md` does not yet hold;',
149
+ '- the current phase and plan, and the task in progress with its stopping point, with the path of the file that records them (`.planning/state.md` when the project keeps one);',
150
+ '- decisions made in this session that are not yet written down;',
106
151
  '- the files changed since the last commit.',
107
152
  'Leave out file contents and command output: they can be read again.',
108
153
  PAN_AGENTS_END,
@@ -126,8 +171,9 @@ function ensureClaudeMdImport(existing) {
126
171
  const beginIdx = existing.indexOf(PAN_AGENTS_BEGIN);
127
172
  const endIdx = existing.indexOf(PAN_AGENTS_END);
128
173
  if (beginIdx !== -1) {
129
- // PAN's own bridge: bring it up to date. Any other PAN block is left alone.
130
- if (endIdx > beginIdx && /^@AGENTS\.md\s*$/m.test(existing.slice(beginIdx, endIdx))) {
174
+ // PAN's own bridge, as some release generated it: bring it up to date. A block the
175
+ // project edited, or any other PAN block, is left alone.
176
+ if (endIdx > beginIdx && sectionState(existing, 'claude') === 'pan') {
131
177
  const eol = existing.includes('\r\n') ? '\r\n' : '\n';
132
178
  return existing.slice(0, beginIdx) + block.replace(/\n/g, eol) + existing.slice(endIdx + PAN_AGENTS_END.length);
133
179
  }
@@ -150,6 +196,9 @@ function removeClaudeMdImport(existing) {
150
196
  }
151
197
 
152
198
  module.exports = {
199
+ sectionState,
200
+ PRIOR_AGENTS_SECTIONS,
201
+ PRIOR_CLAUDE_BRIDGES,
153
202
  PAN_AGENTS_BEGIN,
154
203
  PAN_AGENTS_END,
155
204
  buildAgentsMdSection,