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,661 @@
1
+ # featureAI: Google `agents-cli` Adoption — Behavioral Guardrails & Workflow Hardening
2
+
3
+ > **Generated**: 2026-04-27
4
+ > **Mode**: `--full` (all phases)
5
+ > **Source project**: `d:\googlecli\agents-cli` (Google ADK skills CLI for Gemini Enterprise)
6
+ > **Feature bundle**: 5 transferable patterns; v3.6.0 ships #1, #2, #5; #3 prototype-first; #4 deferred
7
+ > **Target version**: v3.6.0
8
+ > **Predecessors**: focus_auto_runner_featureai.md (focus system), ai_drift_prevention_featureai.md (existing guardrail surface)
9
+
10
+ ---
11
+
12
+ ## Phase 0: Problem Framing
13
+
14
+ ### 0.1 Problem Statement
15
+
16
+ PAN Wizard's structural systems — phases, milestones, focus, plans — are mature, but the project lacks a **consolidated behavioral rules surface** for AI agents. Anti-patterns (silent model swaps, skipping verification, manual scaffolding, scope creep) are addressed implicitly across many workflow files but are not named, named-and-named, and centrally referenced. After reviewing Google's `agents-cli` (a CLI + skills package that injects ADK development workflows into Claude Code, Gemini CLI, Codex, and others), three patterns stand out as cheap, high-ROI adoptions for PAN:
17
+
18
+ 1. **A consolidated guardrails reference** — one short file naming the top anti-patterns, code preservation rules, and the stop-the-line regression rule
19
+ 2. **Phase-gated re-read directives** in long workflows — explicit "re-read section X before phase Y" markers that resist context compaction drift
20
+ 3. **A mandatory Phase 0 clarify gate** before scaffolding new work — already implicit in PAN's `requirements.md` but not enforced by workflow text
21
+
22
+ This matters NOW because: (a) PAN Wizard has just shipped v3.5.x focused on doc/manifest hardening — the codebase is stable enough for a behavioral layer, (b) all 5 runtimes share the `pan-wizard-core/references/` directory, so a single new reference doc reaches every install with zero installer logic changes, and (c) AI agents are increasingly trusted with multi-cycle autonomous work via `/pan:focus-auto` (Session 26), where unchecked shortcuts compound across cycles.
23
+
24
+ The cost of NOT building this: AI agents continue to make context-pressured shortcuts that have to be re-corrected per session — silent model selection drift, skipping `/pan:verify-phase` because "tests passed locally," manually picking focus items instead of letting `focus.cjs` allocate by budget. Each correction is cheap individually; aggregated across sessions, it becomes the dominant source of rework.
25
+
26
+ ### 0.2 Demand Evidence
27
+
28
+ | Evidence Type | Source | Finding |
29
+ |---------------|--------|---------|
30
+ | **External pattern validation** | `d:\googlecli\agents-cli\skills\google-agents-cli-workflow\SKILL.md:242-325` | Google ships explicit "Common Shortcuts to Resist", "Code Preservation Principle", "Stop-the-Line Rule" sections. Validates the pattern is field-tested at scale |
31
+ | **Internal scattered surface** | `pan-wizard-core/workflows/*.md` (33 files) | Anti-patterns currently distributed across exec-phase.md, plan-phase.md, focus-exec.md, verify-phase.md without a single consolidated home |
32
+ | **Existing reference infrastructure** | `pan-wizard-core/references/*.md` (13 files) | The reference-include mechanism already exists and ships to all 5 runtimes — adding one more file is a known-cost operation |
33
+ | **AI drift specifically called out** | `docs/specs/ai_drift_prevention_featureai.md` | PAN already recognizes drift as a problem worth a feature spec — this proposal extends that thread with a Google-validated pattern |
34
+ | **Long-running autonomous mode** | `focus_auto_runner_featureai.md` (Session 26, ADR-0015) | `/pan:focus-auto` runs multi-cycle campaigns autonomously. Behavioral guardrails matter most when the human isn't between cycles |
35
+
36
+ **Demand status**: STRONG — external pattern validation + existing reference infrastructure + adjacent feature alignment.
37
+
38
+ ### 0.3 Scope Definition
39
+
40
+ | In Scope | Out of Scope (and why) |
41
+ |----------|------------------------|
42
+ | Behavioral guardrails reference (`references/guardrails.md`) | LLM-as-judge eval framework — different problem domain (Google evals *agent behavior*; PAN tests *code workflows*); 100+ pt effort with unclear demand |
43
+ | Phase-gated re-read checkpoints in 4 long workflows | Re-read directives in every workflow — only worthwhile in workflows >300 lines or with multiple phases |
44
+ | Phase 0 clarify gate strengthening in `new-project.md` and `plan-phase.md` | Hard-blocking the gate via tool refusal — workflow text is the right enforcement layer; tool-level blocks add brittleness |
45
+ | Optional `pan-tools info` self-discovery command | Replacing existing `state json` / `validate health` — `info` is composition only; if it duplicates, fold into `state json --full` |
46
+ | Cross-references from 4 workflows + 2 agents to guardrails.md | Frontmatter `requires`/`related` schema (#4) — defer until a concrete consumer (dispatcher checks, doc generator) justifies the 50+ command backfill cost |
47
+ | Tests asserting structural presence in all 5 runtime install dirs | Tests asserting AI agent behavioral compliance — out of scope for unit tests; belongs in scenario tests if anywhere |
48
+ | Documentation updates in USER-GUIDE.md and ARCHITECTURE.md | New top-level docs — additive, not architectural |
49
+
50
+ ### 0.4 Success Criteria (Measurable)
51
+
52
+ ```
53
+ SC-1: pan-wizard-core/references/guardrails.md exists, ≤80 lines, ships to all 5 runtimes
54
+ SC-2: 4 long workflows (exec-phase, plan-phase, verify-phase, focus-exec) reference guardrails.md
55
+ SC-3: 2 agents (pan-reviewer, pan-planner) reference guardrails.md in body
56
+ SC-4: 4 long workflows have a "## Re-Read Checkpoints" section with ≥3 entries each
57
+ SC-5: new-project.md and plan-phase.md have a "## Phase 0 — Clarify (MANDATORY)" section
58
+ SC-6: ≥15 new tests pass; 0 regressions in existing 2567 tests
59
+ SC-7: All 5 runtimes pass scenario tests (claude, codex, gemini, opencode, github copilot)
60
+ SC-8: Installer time delta ≤ 5ms (new files total < 5KB)
61
+ SC-9: (Optional, only if #3 ships) `pan-tools info` returns valid JSON in ≤200ms across all 5 runtimes
62
+ SC-10: CHANGELOG.md, USER-GUIDE.md, ARCHITECTURE.md updated for v3.6.0
63
+ ```
64
+
65
+ ### 0.5 User Stories
66
+
67
+ ```
68
+ As a PAN Wizard user running multi-cycle autonomous campaigns via /pan:focus-auto,
69
+ I want my AI agent to refuse the Top 5 shortcuts (skipping verify-phase, silent model
70
+ swaps, manual focus item picking, scope creep, marking docs-lag-okay),
71
+ so that quality gates aren't bypassed under cycle pressure,
72
+ instead of having to re-correct the agent on every session start.
73
+
74
+ As a PAN Wizard user starting a long phase that may span multiple AI sessions,
75
+ I want the workflow to force the agent to re-read its conventions before each
76
+ sub-phase (writing tests, committing, completing),
77
+ so that context compaction doesn't quietly drop my project standards mid-task,
78
+ instead of producing inconsistent code as the conversation grows.
79
+
80
+ As a PAN Wizard user starting a new project or planning a complex phase,
81
+ I want the workflow to require the agent to ask me 4 specific questions and save
82
+ the answers to requirements.md before scaffolding code,
83
+ so that the agent doesn't guess at intent and produce wasted scaffolding,
84
+ instead of having to redo work after I clarify what I actually wanted.
85
+
86
+ As a PAN Wizard user debugging a confusing pan-tools failure,
87
+ I want one command (pan-tools info) that prints install path, version, manifest,
88
+ runtime detection, and current project state in JSON,
89
+ so that the AI agent has a known starting point for diagnosis,
90
+ instead of grepping the project to locate PAN's install directory.
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Phase 1: Internal Reconnaissance
96
+
97
+ ### 1.1 Existing Capabilities Map
98
+
99
+ PAN Wizard already has equivalents for several `agents-cli` features. The proposal targets only the gaps:
100
+
101
+ | `agents-cli` capability | PAN Wizard equivalent | Status | Action |
102
+ |-------------------------|-----------------------|--------|--------|
103
+ | Phase 0–7 lifecycle | Milestone → phase → focus pipeline | ✅ Equivalent or stronger | None |
104
+ | `scaffold create/enhance/upgrade` | `pan init`, `phase add/insert/remove`, `milestone-new` | ✅ Equivalent | None |
105
+ | `agents-cli info` | `state json`, `validate health` (partial) | 🟡 Gap | Prototype #3 |
106
+ | `DESIGN_SPEC.md` mandatory gate | `requirements.md`, `project_spec_*.md` (no enforcement) | 🟡 Gap | #5 — strengthen |
107
+ | Phase-gated skill re-loading | Workflow files referenced by commands once | 🟡 Gap | #2 — add re-read checkpoints |
108
+ | LLM-as-judge eval | `pan-reviewer` agent + `phase-tests` (code review only) | 🟡 Different domain | Skip — not in scope |
109
+ | Code Preservation Principle | None as explicit named rule | ❌ Gap | #1 — guardrails.md |
110
+ | Common Shortcuts to Resist | Implicit in individual workflows | ❌ Gap | #1 — guardrails.md |
111
+ | Stop-the-Line regression rule | None as explicit rule | ❌ Gap | #1 — guardrails.md |
112
+ | Skill cross-references in frontmatter | Loose prose links | 🟡 Gap | Defer #4 to v3.7+ |
113
+ | Reference samples library | None — N/A | — | Skip — no analog |
114
+
115
+ ### 1.2 Codebase Search
116
+
117
+ | Target | Where to Look | Notes |
118
+ |--------|---------------|-------|
119
+ | Reference doc shipping | `bin/install-lib.cjs`, `pan-wizard-core/references/*.md` | Already 13 files; new files auto-shipped via glob |
120
+ | Workflow file convention | `pan-wizard-core/workflows/*.md` | 33 files; consistent markdown-frontmatter format |
121
+ | Agent file convention | `agents/*.md` | 20 files; consistent format |
122
+ | Frontmatter parser | `pan-wizard-core/bin/lib/frontmatter.cjs` | Existing — only need extension if #4 ships |
123
+ | `state json` output | `pan-wizard-core/bin/lib/state.cjs` (`cmdStateJson`) | Reference for `info` JSON shape |
124
+ | `validate health` | `pan-wizard-core/bin/lib/verify.cjs` | Reference for self-check pattern |
125
+ | Manifest format | `pan-file-manifest.json` (in installed dir) | New files must appear in manifest checksum |
126
+ | Test helper patterns | `tests/helpers.cjs` (`runPanTools`, `createScenarioRunner`) | Use `createScenarioRunner` for cross-runtime tests |
127
+
128
+ ### 1.3 Runtime Compatibility
129
+
130
+ All proposals are runtime-agnostic. The `references/` directory is shipped identically to:
131
+
132
+ | Runtime | Install path | Reference path |
133
+ |---------|--------------|----------------|
134
+ | Claude | `.claude/pan-wizard-core/` | `.claude/pan-wizard-core/references/guardrails.md` |
135
+ | Codex | `.codex/pan-wizard-core/` | `.codex/pan-wizard-core/references/guardrails.md` |
136
+ | Gemini | `.gemini/pan-wizard-core/` | `.gemini/pan-wizard-core/references/guardrails.md` |
137
+ | OpenCode | `.opencode/pan-wizard-core/` | `.opencode/pan-wizard-core/references/guardrails.md` |
138
+ | GitHub Copilot | `.github/pan-wizard-core/` | `.github/pan-wizard-core/references/guardrails.md` |
139
+
140
+ No installer changes required for #1, #2, #5. Optional `info` command (#3) needs registration in `pan-tools.cjs` dispatcher and a new `commands/pan/info.md` runtime adapter.
141
+
142
+ ---
143
+
144
+ ## Phase 2: Competitive / Source Analysis
145
+
146
+ ### 2.1 What `agents-cli` Does Well (Transferable)
147
+
148
+ **Consolidated rules surface.** Rather than scattering anti-patterns across 7 skill files, `agents-cli` collects them in one workflow skill with a named, tabular "Common Shortcuts to Resist" section. Reference: `d:\googlecli\agents-cli\skills\google-agents-cli-workflow\SKILL.md:242-251`. The table format is grep-friendly and copy-pasteable into agent context.
149
+
150
+ **Phase-gated re-load.** The workflow skill explicitly tells agents to re-read related skills *before* each phase, not after they hit a problem (SKILL.md:33-46). This counters the silent context-compaction failure mode where agents trust stale memory.
151
+
152
+ **Mandatory Phase 0 with concrete questions.** SKILL.md:82-99 lists 4 always-ask questions plus context-conditional questions. The agent is forbidden to proceed without answers. PAN's `requirements.md` exists but has no equivalent gate text.
153
+
154
+ **Code preservation as an explicit principle.** SKILL.md:253-282 names it Principle 1, gives a worked example showing a model-version drift mistake, and explicitly enumerates what must be preserved (`model`, `api_key`, comments, formatting). PAN has no equivalent.
155
+
156
+ **Stop-the-line regression rule.** SKILL.md:325 — "If a change breaks something that was working: stop feature work and fix the regression first." Short, memorable, enforceable in workflow text.
157
+
158
+ **`info` self-discovery.** A single command prints install path, project config, version. Cited use case: when an agent hits a confusing CLI failure, `info` collapses 3-5 grep/glob calls into one (SKILL.md:394-400). Even if 70% of `info`'s data exists in `state json` today, the convenience and the install-path discovery are net new.
159
+
160
+ ### 2.2 What `agents-cli` Does That We Should NOT Adopt
161
+
162
+ **LLM-as-judge eval framework.** Solves agent-behavior validation. PAN tests code workflows, not agent behavior. The infrastructure cost (evalsets, rubrics, judge models, trajectory scoring) is 100+ pts with no demand signal in PAN's session history.
163
+
164
+ **`npx skills add` distribution model.** PAN's installer (`bin/install.js`, ~2,050 LOC) is feature-complete with manifest tracking, runtime adapters, and update flow. Switching distribution mechanisms is cosmetic and breaks the existing `pan update` UX.
165
+
166
+ **Reference samples library (ADK samples).** ADK has a curated repo of working agent examples that users clone and study before scaffolding. PAN has no analog and no strong demand for one. Maintaining example projects adds drift risk.
167
+
168
+ **Hard eval-gates-deployment rule.** PAN doesn't have a "deploy" step. The closest analog is `verify-phase` blocking phase completion on test pass — which already exists.
169
+
170
+ **Strict programmatic mode (UsageError if flags missing).** PAN's CLI is interactive-friendly by design (`focus-auto` prompts, `init` walks the user through). Forcing strict mode breaks the UX.
171
+
172
+ ### 2.3 Differentiation
173
+
174
+ PAN keeps its core differentiators (zero runtime deps, 5-runtime support, milestone/phase/focus pipeline, scenario-tested across runtimes). What we adopt is purely the **behavioral injection surface** — a missing layer that complements, not replaces, structural workflow.
175
+
176
+ ---
177
+
178
+ ## Phase 3: Design
179
+
180
+ ### 3.1 Adoption Candidates Ranked by ROI
181
+
182
+ | # | Name | Effort | Risk | ROI | Decision |
183
+ |---|------|--------|------|-----|----------|
184
+ | 1 | Behavioral Guardrails Preamble (`references/guardrails.md`) | S (4-6 pts) | Low | High | **Ship in v3.6.0** |
185
+ | 2 | Phase-Gated Re-Read Directives in workflows | XS (3 pts) | Low | High | **Ship in v3.6.0** |
186
+ | 3 | `pan-tools info` self-discovery command | S (5-7 pts) | Medium (overlap risk with `state json`) | Medium | **Prototype first** — ship if non-redundant |
187
+ | 4 | Frontmatter `requires`/`related` schema | L (15-20 pts) | Medium | Low (no consumer yet) | **Defer to v3.7+** |
188
+ | 5 | DESIGN_SPEC Phase 0 Gate Strengthening | XS (2-3 pts) | Low | Medium | **Ship in v3.6.0** |
189
+
190
+ **Recommended v3.6.0 bundle: #1 + #2 + #5 (10-12 pts total).**
191
+
192
+ ### 3.2 Detailed Design — #1 Behavioral Guardrails Preamble
193
+
194
+ **Location:** `pan-wizard-core/references/guardrails.md`
195
+ **Size budget:** ≤80 lines (keeps agent context bloat negligible when referenced)
196
+ **Audience:** AI agents executing PAN workflows — not human users
197
+
198
+ **Proposed contents (full draft):**
199
+
200
+ ```markdown
201
+ # AI Agent Guardrails for PAN Wizard
202
+
203
+ This document is read by AI agents (Claude, Codex, Gemini, OpenCode, Copilot)
204
+ executing PAN workflows. It encodes rules that prevent the most common
205
+ shortcut failures observed across 35+ development sessions.
206
+
207
+ ## Common Shortcuts to Resist
208
+
209
+ | Shortcut | Why it fails | Correct action |
210
+ |----------|--------------|----------------|
211
+ | "User's request is clear, no need to clarify" | You're guessing at intent. Phase 0 catches misunderstandings before scaffolding. | Run the Phase 0 4-question check (see `new-project.md` / `plan-phase.md`). |
212
+ | "Phase tests passed locally, /pan:verify-phase isn't needed" | One run isn't validation. verify-phase checks state consistency, doc sync, blockers, and full suite — not just the phase's own tests. | Always run `/pan:verify-phase` before marking a phase complete. |
213
+ | "I'll skip /pan:focus-scan and pick the next item myself" | Manual selection ignores priority/budget logic in `focus.cjs`. You'll bias toward easy items and miss higher-priority work. | Use `/pan:focus-scan` → `/pan:focus-plan` → `/pan:focus-exec`. |
214
+ | "I'll bump the model / add a flag / refactor while I'm here" | Scope creep. The user asked for one change; surrounding cleanup belongs in a separate item. | Do only the requested change. Note unrelated cleanup as a TODO for a future focus-scan. |
215
+ | "I'll mark this phase complete; the docs can lag behind" | Doc/state drift compounds. By the next session, the agent reads stale docs and proceeds on false assumptions. | Run `/pan:sync` before phase completion. CHANGELOG and version bumps are part of the phase, not after it. |
216
+
217
+ ## Code Preservation Principle
218
+
219
+ Code modifications require surgical precision — alter only the lines directly
220
+ targeted by the user's request. Strictly preserve all surrounding code.
221
+
222
+ Before finalizing any edit, verify:
223
+ 1. **Target identification** — the exact lines to change, based solely on the user's instructions
224
+ 2. **Preservation check** — all code, config values (model, version, api_key), comments, and formatting outside the target are identical
225
+
226
+ If you must touch surrounding code (e.g., to fix an import a rename broke),
227
+ name it explicitly in your reply: "Also updating import in X because the
228
+ rename broke it." Never silently expand scope.
229
+
230
+ ## Stop-the-Line Rule
231
+
232
+ If a change breaks something that was working: **stop feature work and fix
233
+ the regression first.** Do not push forward with "I'll circle back" — regressions
234
+ compound across sessions and become 10x harder to localize later.
235
+
236
+ A failing test, a broken command, or a manifest-checksum mismatch is a
237
+ stop-the-line event. Resume feature work only after the line is restored.
238
+
239
+ ## Systematic Debugging Sequence
240
+
241
+ When something breaks, follow this sequence — don't shotgun fixes:
242
+
243
+ 1. **Reproduce** — exact failing command, full error output
244
+ 2. **Localize** — narrow to module, config, or environment
245
+ 3. **Fix one variable at a time** — changing instruction + tool + config simultaneously means you won't know what fixed it
246
+ 4. **Verify** — rerun the exact reproduction command
247
+ 5. **Guard** — if the bug was non-obvious, add a test to catch regressions
248
+
249
+ ## Cross-References
250
+
251
+ - `references/standards.md` — coding conventions (test patterns, error handling, path normalization)
252
+ - `workflows/exec-phase.md` — phase execution checklist
253
+ - `workflows/verify-phase.md` — phase completion validation
254
+ - `workflows/focus-exec.md` — focus item execution
255
+ ```
256
+
257
+ **Workflows that reference this doc** (added line near top of each):
258
+ ```markdown
259
+ > **Read first:** `references/guardrails.md` — anti-patterns and code preservation rules. Re-read at the start of every phase.
260
+ ```
261
+
262
+ - `pan-wizard-core/workflows/exec-phase.md`
263
+ - `pan-wizard-core/workflows/plan-phase.md`
264
+ - `pan-wizard-core/workflows/verify-phase.md`
265
+ - `pan-wizard-core/workflows/focus-exec.md`
266
+ - `pan-wizard-core/workflows/focus-auto.md` (if exists; verify path)
267
+
268
+ **Agents that reference this doc** (added in agent body, after frontmatter):
269
+ - `agents/pan-reviewer.md`
270
+ - `agents/pan-planner.md`
271
+
272
+ ### 3.3 Detailed Design — #2 Phase-Gated Re-Read Directives
273
+
274
+ **Pattern:** Add a `## Re-Read Checkpoints` section near the top of each long workflow, listing 3-5 boundaries where the agent should re-read a specific section before proceeding.
275
+
276
+ **Template** (insert at top of each target workflow):
277
+
278
+ ```markdown
279
+ ## Re-Read Checkpoints
280
+
281
+ Context compaction may have dropped earlier sections. Re-read the relevant
282
+ section *before* you begin each step — not after you hit a problem.
283
+
284
+ | Before this step | Re-read | Why |
285
+ |------------------|---------|-----|
286
+ | Writing code | This workflow's "Implementation" section | Conventions drift across long sessions |
287
+ | Writing tests | `references/standards.md` | Test patterns vary by module type (unit vs scenario) |
288
+ | Committing | `references/guardrails.md` | Pre-commit shortcuts are tempting under pressure |
289
+ | Marking phase complete | `workflows/verify-phase.md` | Completion criteria are easy to misremember |
290
+ ```
291
+
292
+ **Targets** (4 long workflows >200 lines):
293
+ - `pan-wizard-core/workflows/exec-phase.md`
294
+ - `pan-wizard-core/workflows/plan-phase.md`
295
+ - `pan-wizard-core/workflows/verify-phase.md`
296
+ - `pan-wizard-core/workflows/focus-exec.md`
297
+
298
+ **Customization per workflow:** The "Before this step" column adapts to the workflow's actual phases. The general pattern (re-read at boundaries) is constant.
299
+
300
+ ### 3.4 Detailed Design — #5 Phase 0 Clarify Gate Strengthening
301
+
302
+ **Files modified:**
303
+ - `pan-wizard-core/workflows/new-project.md`
304
+ - `pan-wizard-core/workflows/plan-phase.md`
305
+
306
+ **Insertion text (top of `new-project.md`, hard form):**
307
+
308
+ ```markdown
309
+ ## Phase 0 — Clarify (MANDATORY, do not skip)
310
+
311
+ Before scaffolding or coding anything, confirm with the user:
312
+
313
+ 1. **What problem will this solve?** — Core purpose, not the implementation
314
+ 2. **What does success look like?** — Concrete, measurable outcomes
315
+ 3. **What's in scope vs out of scope?** — Boundary definition
316
+ 4. **Constraints?** — Tech stack, dependencies, deadlines, runtime support requirements
317
+
318
+ **Do NOT proceed** until the user has answered. Do not assume, research, or
319
+ fill in blanks yourself. The user's intent drives everything — skipping this
320
+ step leads to wasted scaffolding and mis-aligned implementation.
321
+
322
+ Save answers to `.planning/requirements.md` (or update if exists). Confirm
323
+ with the user before scaffolding.
324
+ ```
325
+
326
+ **Insertion text (top of `plan-phase.md`, lighter form):**
327
+
328
+ ```markdown
329
+ ## Phase 0 — Clarify Phase Scope (recommended)
330
+
331
+ Before drafting the phase plan, confirm:
332
+
333
+ 1. **What does "complete" look like for this phase?**
334
+ 2. **What's deliberately out of scope?**
335
+ 3. **Any constraints or dependencies on other phases?**
336
+
337
+ If the answers aren't already in `.planning/requirements.md` or the phase
338
+ context file, ask the user. A 2-minute clarification prevents 30-minute rework.
339
+ ```
340
+
341
+ ### 3.5 Detailed Design — #3 `pan-tools info` (Prototype-First, Optional)
342
+
343
+ **⚠ Prototype before committing.** Verify the output isn't fully redundant with `state json` + `validate health`. If 80%+ overlap, fold into `state json --full` instead of adding a new command.
344
+
345
+ **Proposed JSON shape:**
346
+
347
+ ```json
348
+ {
349
+ "pan_version": "3.6.0",
350
+ "node_version": "v20.11.0",
351
+ "platform": "win32",
352
+ "install": {
353
+ "root": "/abs/path/to/.claude/pan-wizard-core",
354
+ "manifest": "/abs/path/to/.claude/pan-file-manifest.json",
355
+ "manifest_checksum_ok": true
356
+ },
357
+ "runtimes_detected": ["claude", "codex"],
358
+ "project": {
359
+ "exists": true,
360
+ "planning_dir": ".planning/",
361
+ "current_phase": "03-ui-polish",
362
+ "current_milestone": "v3.6.0",
363
+ "model_profile": "balanced",
364
+ "config_path": ".planning/config.json"
365
+ },
366
+ "git": {
367
+ "branch": "main",
368
+ "clean": true,
369
+ "ahead": 0,
370
+ "behind": 0
371
+ }
372
+ }
373
+ ```
374
+
375
+ **Files to create:**
376
+ - `pan-wizard-core/bin/lib/info.cjs` — composes data from `state.cjs`, `config.cjs`, `git.cjs`, `verify.cjs`
377
+ - `commands/pan/info.md` — runtime adapter exposing `/pan:info`
378
+ - `tests/info.test.cjs`
379
+
380
+ **Files to modify:**
381
+ - `pan-wizard-core/bin/pan-tools.cjs` — register `info` subcommand
382
+
383
+ ### 3.6 Implementation Plan (v3.6.0 bundle)
384
+
385
+ | Step | File | Change | Effort |
386
+ |------|------|--------|--------|
387
+ | 1 | `pan-wizard-core/references/guardrails.md` | Create — full text from §3.2 | S |
388
+ | 2 | `pan-wizard-core/workflows/exec-phase.md` | Add Re-Read Checkpoints + guardrails reference | XS |
389
+ | 3 | `pan-wizard-core/workflows/plan-phase.md` | Add Re-Read Checkpoints + guardrails reference + Phase 0 gate | XS |
390
+ | 4 | `pan-wizard-core/workflows/verify-phase.md` | Add Re-Read Checkpoints + guardrails reference | XS |
391
+ | 5 | `pan-wizard-core/workflows/focus-exec.md` | Add Re-Read Checkpoints + guardrails reference | XS |
392
+ | 6 | `pan-wizard-core/workflows/new-project.md` | Add Phase 0 mandatory gate | XS |
393
+ | 7 | `agents/pan-reviewer.md` | Add guardrails reference in body | XS |
394
+ | 8 | `agents/pan-planner.md` | Add guardrails reference in body | XS |
395
+ | 9 | `tests/guardrails.test.cjs` | Create — file present + content shape | S |
396
+ | 10 | `tests/workflows-checkpoints.test.cjs` | Create — Re-Read sections in 4 workflows | S |
397
+ | 11 | `tests/phase0-gate.test.cjs` | Create — Phase 0 sections in 2 workflows | XS |
398
+ | 12 | `tests/scenarios/guardrails-installed.test.cjs` | Create — file ships to all 5 runtimes | S |
399
+ | 13 | `bin/install-lib.cjs` | Verify references glob includes new file (likely no change) | XS |
400
+ | 14 | `package.json` | Bump version to 3.6.0 | XS |
401
+ | 15 | `CHANGELOG.md` | Add v3.6.0 entry | XS |
402
+ | 16 | `docs/USER-GUIDE.md` | Add "AI Agent Guardrails" section | XS |
403
+ | 17 | `docs/ARCHITECTURE.md` | Note `references/` directory's behavioral role | XS |
404
+ | 18 | (Optional #3) `pan-wizard-core/bin/lib/info.cjs` + tests + dispatcher reg + command file | All for `info` | S |
405
+
406
+ **Total v3.6.0 (without #3):** ~10-12 pts
407
+ **Total v3.6.0 (with #3):** ~15-19 pts
408
+
409
+ ### 3.7 Test Plan
410
+
411
+ Minimum 15 new tests across the bundle. Distribution:
412
+
413
+ #### Unit tests (`tests/*.test.cjs`)
414
+
415
+ **`tests/guardrails.test.cjs`** (4 tests)
416
+ - `references/guardrails.md` exists at expected source path
417
+ - File is non-empty and ≤120 lines (allow 50% slack from 80-line target)
418
+ - Contains required headings: "Common Shortcuts to Resist", "Code Preservation Principle", "Stop-the-Line Rule"
419
+ - Contains required cross-references: `references/standards.md`, `workflows/exec-phase.md`, `workflows/verify-phase.md`
420
+
421
+ **`tests/workflows-checkpoints.test.cjs`** (4 tests)
422
+ - `exec-phase.md` contains `## Re-Read Checkpoints` section
423
+ - `plan-phase.md` contains `## Re-Read Checkpoints` section
424
+ - `verify-phase.md` contains `## Re-Read Checkpoints` section
425
+ - `focus-exec.md` contains `## Re-Read Checkpoints` section
426
+
427
+ **`tests/guardrails-references.test.cjs`** (6 tests)
428
+ - `exec-phase.md` references `references/guardrails.md`
429
+ - `plan-phase.md` references `references/guardrails.md`
430
+ - `verify-phase.md` references `references/guardrails.md`
431
+ - `focus-exec.md` references `references/guardrails.md`
432
+ - `agents/pan-reviewer.md` references `references/guardrails.md`
433
+ - `agents/pan-planner.md` references `references/guardrails.md`
434
+
435
+ **`tests/phase0-gate.test.cjs`** (2 tests)
436
+ - `new-project.md` contains `## Phase 0 — Clarify (MANDATORY` heading
437
+ - `plan-phase.md` contains `## Phase 0 — Clarify Phase Scope` heading
438
+
439
+ #### Scenario tests (`tests/scenarios/*.test.cjs`)
440
+
441
+ **`tests/scenarios/guardrails-installed.test.cjs`** (5 tests, one per runtime)
442
+ - After `createScenarioRunner('claude')`, `references/guardrails.md` exists in install dir
443
+ - Same for codex, gemini, opencode, copilot
444
+ - Use existing `createScenarioRunner` helper from `tests/helpers.cjs`
445
+
446
+ #### Optional — if #3 ships (`tests/info.test.cjs`, 5+ tests)
447
+ - `pan-tools info` returns valid JSON with required keys
448
+ - Returns `project.exists: false` when not in a planning dir
449
+ - Returns `git.clean: true` for clean repo, `false` for dirty
450
+ - Returns correct `pan_version` matching `package.json`
451
+ - Completes in <200ms (`assert(elapsed < 200)`)
452
+
453
+ **Test count target:** 16 new tests (without #3) → 21 with #3.
454
+
455
+ ### 3.8 Documentation Updates
456
+
457
+ **`CHANGELOG.md`** — new entry:
458
+ ```markdown
459
+ ## v3.6.0 — 2026-MM-DD
460
+
461
+ ### Added
462
+ - `references/guardrails.md` — consolidated AI agent behavioral rules (anti-patterns, Code Preservation, Stop-the-Line)
463
+ - Phase-gated re-read checkpoints in 4 long workflows (exec-phase, plan-phase, verify-phase, focus-exec)
464
+ - Mandatory Phase 0 clarify gate in new-project.md and plan-phase.md
465
+ - (Optional) `pan-tools info` — self-discovery command returning install path, version, project config
466
+
467
+ ### Changed
468
+ - `pan-reviewer` and `pan-planner` agents now reference `references/guardrails.md`
469
+ ```
470
+
471
+ **`docs/USER-GUIDE.md`** — new section:
472
+ ```markdown
473
+ ## AI Agent Guardrails
474
+
475
+ PAN Wizard ships `references/guardrails.md` — a consolidated rules doc that
476
+ all PAN workflows reference. It encodes anti-patterns (silent model swaps,
477
+ skipping verification, scope creep), the Code Preservation Principle, and
478
+ the Stop-the-Line regression rule.
479
+
480
+ This document is read by your AI coding agent (Claude, Codex, Gemini,
481
+ OpenCode, Copilot) at the start of each phase. You don't need to interact
482
+ with it directly, but you can review it at `.claude/pan-wizard-core/references/guardrails.md`
483
+ (or the equivalent path for your runtime).
484
+ ```
485
+
486
+ **`docs/ARCHITECTURE.md`** — update existing references section:
487
+ ```markdown
488
+ The `references/` directory ships behavioral and structural reference docs
489
+ that PAN workflows include by relative path. As of v3.6.0, this includes
490
+ `guardrails.md` for AI behavioral rules — a layer that complements the
491
+ structural workflow files in `workflows/`.
492
+ ```
493
+
494
+ ### 3.9 Runtime Matrix
495
+
496
+ | Runtime | Supported | Install path | Notes |
497
+ |---------|-----------|--------------|-------|
498
+ | Claude | ✅ | `.claude/pan-wizard-core/references/guardrails.md` | Existing references include path; CLAUDE.md ingestion auto-loads on relevant prompts |
499
+ | Codex | ✅ | `.codex/pan-wizard-core/references/guardrails.md` | AGENTS.md ingestion auto-loads |
500
+ | Gemini | ✅ | `.gemini/pan-wizard-core/references/guardrails.md` | GEMINI.md ingestion auto-loads |
501
+ | OpenCode | ✅ | `.opencode/pan-wizard-core/references/guardrails.md` | AGENTS.md ingestion auto-loads |
502
+ | GitHub Copilot | ✅ | `.github/pan-wizard-core/references/guardrails.md` | copilot-instructions.md ingestion |
503
+
504
+ All 5 runtimes already ship the `references/` directory. The new file is purely additive content — no installer logic changes, no manifest schema changes, no runtime adapter changes.
505
+
506
+ ---
507
+
508
+ ## Phase 4: Specification Output (Ready-to-Implement)
509
+
510
+ ### Files to Create
511
+ 1. `pan-wizard-core/references/guardrails.md` — full text per §3.2
512
+ 2. `tests/guardrails.test.cjs` — 4 unit tests
513
+ 3. `tests/workflows-checkpoints.test.cjs` — 4 unit tests
514
+ 4. `tests/guardrails-references.test.cjs` — 6 unit tests
515
+ 5. `tests/phase0-gate.test.cjs` — 2 unit tests
516
+ 6. `tests/scenarios/guardrails-installed.test.cjs` — 5 scenario tests
517
+ 7. *(Optional #3)* `pan-wizard-core/bin/lib/info.cjs`
518
+ 8. *(Optional #3)* `commands/pan/info.md`
519
+ 9. *(Optional #3)* `tests/info.test.cjs`
520
+
521
+ ### Files to Modify
522
+ 1. `pan-wizard-core/workflows/exec-phase.md` — Re-Read Checkpoints section + guardrails reference
523
+ 2. `pan-wizard-core/workflows/plan-phase.md` — Re-Read Checkpoints + guardrails reference + Phase 0 gate
524
+ 3. `pan-wizard-core/workflows/verify-phase.md` — Re-Read Checkpoints + guardrails reference
525
+ 4. `pan-wizard-core/workflows/focus-exec.md` — Re-Read Checkpoints + guardrails reference
526
+ 5. `pan-wizard-core/workflows/new-project.md` — Phase 0 mandatory gate
527
+ 6. `agents/pan-reviewer.md` — guardrails reference
528
+ 7. `agents/pan-planner.md` — guardrails reference
529
+ 8. `package.json` — bump version to 3.6.0
530
+ 9. `CHANGELOG.md` — v3.6.0 entry
531
+ 10. `docs/USER-GUIDE.md` — AI Agent Guardrails section
532
+ 11. `docs/ARCHITECTURE.md` — references directory note
533
+ 12. *(Optional #3)* `pan-wizard-core/bin/pan-tools.cjs` — register `info` subcommand
534
+
535
+ ### Implementation Step Order (recommended)
536
+ 1. Write `references/guardrails.md` (the anchor — everything else references it)
537
+ 2. Write the 4 test files for guardrails + workflows-checkpoints + phase0-gate (TDD-style; tests fail before edits)
538
+ 3. Edit 4 workflows (Re-Read Checkpoints + guardrails references)
539
+ 4. Edit 2 workflows (Phase 0 gate in new-project.md, plan-phase.md)
540
+ 5. Edit 2 agents (guardrails reference)
541
+ 6. Run `npm test` — should now go green
542
+ 7. Write scenario test (`guardrails-installed.test.cjs`)
543
+ 8. Run `npm run test:scenarios` — verifies all 5 runtimes
544
+ 9. Run `npm run test:all` — full 2567+ suite
545
+ 10. Manual verify: install in `d:\pantesting` for at least 2 runtimes (claude + one other)
546
+ 11. Update CHANGELOG, USER-GUIDE, ARCHITECTURE
547
+ 12. Bump version, commit
548
+ 13. *(Optional)* Prototype `pan-tools info`; ship if non-redundant
549
+ 14. Tag v3.6.0
550
+
551
+ ### Test Coverage Summary
552
+
553
+ | File | Test count | Type |
554
+ |------|------------|------|
555
+ | `tests/guardrails.test.cjs` | 4 | Unit |
556
+ | `tests/workflows-checkpoints.test.cjs` | 4 | Unit |
557
+ | `tests/guardrails-references.test.cjs` | 6 | Unit |
558
+ | `tests/phase0-gate.test.cjs` | 2 | Unit |
559
+ | `tests/scenarios/guardrails-installed.test.cjs` | 5 | Scenario |
560
+ | **Total (without #3)** | **21** | — |
561
+ | `tests/info.test.cjs` *(optional)* | 5+ | Unit |
562
+ | **Total (with #3)** | **26+** | — |
563
+
564
+ ---
565
+
566
+ ## Phase 5: Risk Assessment
567
+
568
+ | Risk | Impact | Likelihood | Mitigation |
569
+ |------|--------|------------|------------|
570
+ | Guardrails preamble bloats agent context | Medium | Medium | Keep `guardrails.md` ≤80 lines; reference by path, never inline |
571
+ | Re-read directives feel naggy / get ignored | Low | High | Frame as "before phase X" not "every action"; trust agents to skip when appropriate. Naggy directives that are skipped are still better than absent directives. |
572
+ | Phase 0 gate annoys users on small phases | Medium | Medium | Apply hard gate only to `new-project.md`; soften wording in `plan-phase.md` to "recommended" |
573
+ | `pan-tools info` (#3) duplicates `state json` | Medium | High | **Prototype first.** If 80%+ overlap, fold into `state json --full` instead of new command. |
574
+ | Frontmatter schema (#4) breaks 50+ commands during migration | High | Medium | **Deferred to v3.7+.** Do not include in v3.6.0. |
575
+ | Test count drops if removing redundant assertions | Low | Low | All changes additive; expect +21 tests, no removals |
576
+ | Cross-runtime path resolution differences | Medium | Low | Existing `references/` already ships to all 5 runtimes; verified by existing scenario tests; new test extends that pattern |
577
+ | Performance regression in installer time | Low | Low | New file <2KB; total bundle <5KB; benchmark unchanged within noise |
578
+ | Breaking change to existing installs on `pan update` | High | Low | All changes are additive content; `pan update` flow already handles new files in `references/` |
579
+ | Workflow files become harder to read with extra sections | Low | Medium | Place new sections at top so they're skim-skippable; use clear `## Re-Read Checkpoints` heading |
580
+ | AI agents misread Phase 0 gate as blocking ALL work | Low | Low | Wording explicitly scopes to "scaffolding or coding" — small bug fixes don't trigger Phase 0 |
581
+ | Guardrails drift out of sync with actual workflows | Medium | Medium | Add to `/pan:doc-audit` checklist (post-v3.6.0); catch in retros |
582
+
583
+ ### Backward Compatibility
584
+
585
+ **All proposals are additive.** No existing command, workflow, or test changes behavior. Existing v3.5.x installs upgrading to v3.6.0 receive the new files via standard `pan update` flow. No migration required.
586
+
587
+ ### What's Explicitly NOT in v3.6.0
588
+
589
+ - **#3 `pan-tools info`** — gated on prototype showing it's not redundant with `state json`
590
+ - **#4 Frontmatter `requires`/`related` schema** — deferred to v3.7+ until a concrete consumer exists
591
+ - **LLM-as-judge evaluation framework** — out of scope; different problem domain
592
+ - **`npx skills add` distribution** — not adopting; PAN's installer is feature-complete
593
+ - **Reference samples library** — no analog needed
594
+ - **Tool-level enforcement of Phase 0** — workflow text is the right enforcement layer
595
+
596
+ ---
597
+
598
+ ## Appendix A: Source File References (`agents-cli`)
599
+
600
+ | Pattern | File | Lines |
601
+ |---------|------|-------|
602
+ | Common Shortcuts to Resist (table) | `d:\googlecli\agents-cli\skills\google-agents-cli-workflow\SKILL.md` | 242-251 |
603
+ | Code Preservation Principle | same | 253-282 |
604
+ | Stop-the-Line Rule | same | 325 |
605
+ | Systematic Debugging | same | 315-326 |
606
+ | Phase-gated skill loading table | same | 33-46 |
607
+ | Phase 0 mandatory gate (4 questions) | same | 82-99 |
608
+ | `agents-cli info` description | same | 394-400 |
609
+ | Frontmatter `requires` schema | same | 12-19 |
610
+ | Skill cross-references (Related Skills) | same | 424-432 |
611
+ | Scaffold name constraints (≤26 chars) | `d:\googlecli\agents-cli\skills\google-agents-cli-scaffold\SKILL.md` | 78 |
612
+ | Critical Rules block | same | 208-218 |
613
+
614
+ ## Appendix B: Mapping to PAN Wizard Existing Surface
615
+
616
+ | `agents-cli` element | PAN Wizard analog | Drift risk |
617
+ |----------------------|-------------------|------------|
618
+ | Workflow SKILL.md | `pan-wizard-core/workflows/*.md` | Low — same markdown-frontmatter format |
619
+ | `references/` (per-skill) | `pan-wizard-core/references/*.md` | None — already exists |
620
+ | `agents-cli setup` | `node bin/install.js --<runtime>` | None — different distribution model, kept as-is |
621
+ | `agents-cli info` | `state json` + `validate health` | Medium — overlap; prototype before adopting |
622
+ | Skill cross-refs | Workflow includes (prose) | Medium — defer formal schema to v3.7+ |
623
+ | `DESIGN_SPEC.md` | `.planning/requirements.md` + `project_spec_*.md` | None — equivalent artifact |
624
+
625
+ ## Appendix C: Open Questions (resolve before implementation)
626
+
627
+ 1. **Should `references/guardrails.md` be loaded by `CLAUDE.md` itself, or only by workflows?** Recommendation: only by workflows, to keep CLAUDE.md tight and let the agent load guardrails when context demands it.
628
+
629
+ 2. **Should the Phase 0 gate in `plan-phase.md` be "MANDATORY" or "recommended"?** Recommendation: "recommended" for plan-phase (it runs frequently), "MANDATORY" for new-project (it runs rarely and getting it wrong is expensive).
630
+
631
+ 3. **Should `pan-tools info` ship in v3.6.0 or wait?** Recommendation: wait. Prototype during v3.6.0 development; if it's 80%+ redundant with `state json --full`, fold into that command. If it's clearly distinct, ship in v3.6.1.
632
+
633
+ 4. **Should we add a `/pan:guardrails` slash command for explicit invocation?** Recommendation: no. The reference is read by workflows, not by user choice. A slash command implies the user should think about guardrails, which inverts the goal.
634
+
635
+ 5. **Should the Stop-the-Line rule include a hard threshold (e.g., "if a regression touches >2 files, escalate to user")?** Recommendation: no for v3.6.0 — keep the rule simple. Add thresholds only if observed need emerges.
636
+
637
+ 6. **Should `references/guardrails.md` be versioned (e.g., date stamp at top)?** Recommendation: no — it's part of the package version (v3.6.0). The CHANGELOG tracks evolution.
638
+
639
+ ---
640
+
641
+ ## Verification Checklist (pre-merge)
642
+
643
+ - [ ] `references/guardrails.md` exists, is ≤120 lines, contains required sections
644
+ - [ ] 4 workflows have `## Re-Read Checkpoints` section
645
+ - [ ] 4 workflows reference `references/guardrails.md`
646
+ - [ ] 2 agents reference `references/guardrails.md`
647
+ - [ ] `new-project.md` has MANDATORY Phase 0 gate
648
+ - [ ] `plan-phase.md` has recommended Phase 0 gate
649
+ - [ ] `npm test` passes (unit tests, including 16 new)
650
+ - [ ] `npm run test:scenarios` passes (scenario tests, including 5 new)
651
+ - [ ] `npm run test:all` passes (full 2588+ test suite)
652
+ - [ ] Manual install in `d:\pantesting` for claude runtime — `references/guardrails.md` present
653
+ - [ ] Manual install in `d:\pantesting` for one other runtime — same check
654
+ - [ ] `package.json` version is 3.6.0
655
+ - [ ] `CHANGELOG.md` has v3.6.0 entry
656
+ - [ ] `docs/USER-GUIDE.md` has AI Agent Guardrails section
657
+ - [ ] `docs/ARCHITECTURE.md` mentions guardrails.md role
658
+
659
+ ---
660
+
661
+ **End of spec. Ready for /pan:plan-phase or /pan:focus-plan.**