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,365 @@
1
+ # /featureAI Spec: Product Excellence Program — making PAN the best in its class
2
+
3
+ **Date:** `2026-10-12`
4
+ **Status:** Accepted, in execution through `product-excellence-superplan.md` (its Progress section is the live record; `2026-10-19`: sprints 1–3 done, 3.36.0 committed and awaiting merge and tag)
5
+ **Tree:** `feat/memory-optimization-2026-10` @ `4994ed5` (`3.34.0`) plus the uncommitted audit work of `2026-10-11`
6
+ **Realigns:** `roadmap_and_competition_2026_q4_featureai.md` (`2026-10-11`). That spec led with reach (downloads, marketplace listings); the owner's direction on `2026-10-12` is **features first — make PAN the best of the best — and exposure later**. Its publication bet (F3) moves to the deferred Exposure phase below; its correctness items (F1 OpenCode plugin, F2 test gate) are absorbed here.
7
+ **Evidence base:** seven parallel investigations on `2026-10-12` (test harnesses, automated development, a whole-market feature benchmark, an internal feature scorecard, research and adjacent fields, core-loop quality, PAN developing PAN), their research sub-scouts, three primary-source verification passes, and one local feasibility probe run in this session. External facts carry their source; anything only a vendor claims is marked *(vendor)*. Model names by version are allowed here (`docs/specs/`).
8
+
9
+ ---
10
+
11
+ ## Phase 0: Problem Framing
12
+
13
+ ### 0.1 Problem statement
14
+
15
+ PAN Wizard has the right architecture, and an internal scorecard (§1.4) shows where the product surface has outgrown its tests: durable state, a gated research → plan → check → execute → review → verify → diagnose loop, fresh context per unit of work, deterministic orchestration where control flow is knowable, a behavioural harness that installs from the packed artifact, and five host runtimes. The investigations found that **its guarantees are weaker than its architecture**:
16
+
17
+ - **The loop has no code gate at its end.** `pan-tools phase complete` (`pan-wizard-core/bin/lib/phase.cjs`, `cmdPhaseComplete`) ticks the roadmap and requirements and advances state without checking summaries, the verification status, the test gate, freshness or open findings. The anti-rubber-stamp `verify reconcile` runs in exec-phase's `offer_next` step, after `update_roadmap` has already completed the phase; on the auto-advance path (`--no-transition`) the workflow returns before that gate, so reconcile never runs at all. Verified in code `2026-10-12`.
18
+ - **Most gates are prompts.** The test gate is run and reported by the verifier itself (npm-only; Python, Go and Rust projects are always `skipped`); file-overlap between plans in one wave is prose in the planner; the plan-check verdict is not bound to the plans it checked; `verify-summary` and `verify stubs --gate` exist in code but no workflow calls them; `verify stale` never blocks.
19
+ - **Nothing guards the tests themselves.** No rule or check stops an executor from weakening, skipping or deleting a test. ImpossibleBench (arXiv `2510.20270`) measured frontier models cheating on 49–76% of impossible tasks, with over 79% of Claude's cheating done by modifying tests, and found that an explicit abort option cut GPT-5's rate from 54% to 9%. Prompting helps but does not close it: the Claude 4 system card measured an anti-hack prompt cutting Opus 4's hack rate on impossible Claude Code tasks from 47% to 5%, while METR found "please do not cheat" had a negligible effect on o3. A prompt rule and a code check are both needed.
20
+ - **Findings close by silence.** `findings.cjs` marks an open finding `fixed` when the next report from the same agent simply omits it, and finding ids hash the summary wording, so run-to-run recall noise closes real findings.
21
+ - **Autonomy runs in one host session, in prose.** focus-auto and army have no code outer loop, no CI oracle, a shared working tree for parallel waves, and budget stops that depend on numbers the agent reports.
22
+ - **Behaviour is proven on one host, with no statistics.** Model tiers run through `claude -p` only; there is no record/replay; repetitions have no confidence intervals. At the "five reps" the ideas ledger asks for (MI-114), 4/5 passes has a 95% Wilson interval of [0.38, 0.96] — it cannot tell a good prompt change from a bad one.
23
+
24
+ The best products in the market have already solved pieces of each: Cursor Bugbot's multi-pass review with a validator (resolution rate 52% → over 70%, *vendor*), Meta's mutation-guided and diff-targeted test generation, Kiro's EARS requirements turned into property-based tests, gsd-core's code gates and positive controls, Spec Kit's clarify/analyze/checklist trio, Anthropic's long-running-agent harnesses, Inspect's statistics and agent bridge. **No product found combines them.** PAN can — and do it on five hosts.
25
+
26
+ ### 0.2 Scope
27
+
28
+ | In scope | Out of scope (for now) |
29
+ |---|---|
30
+ | Code-enforced gates for every guarantee PAN states | Exposure: marketplace publication, positioning, reach metrics (deferred phase, §3.4) |
31
+ | A measured review and verification stack (catch rates, not claims) | A sixth runtime (MI-017); standardising `.planning/` (MI-018) |
32
+ | Autonomous delivery driven by a deterministic loop with code stop rules | Telemetry of any kind (MI-056) |
33
+ | Harness v2: model doubles for every host, record/replay, statistics, seeded-defect scoreboards | Hosted services or daemons beyond a foreground loop (ADR-0034) |
34
+ | PAN developing PAN: automated research, measurement and fix lanes behind the owner's approval | Vector or graph memory stores (MI-101) |
35
+
36
+ ### 0.3 Success criteria (program level)
37
+
38
+ ```text
39
+ SC-1 Every guarantee in README.md and docs/COMPARISON.md is enforced by a pan-tools exit code that both the markdown and native paths call; a claims audit finds no prompt-only guarantee.
40
+ SC-2 A seeded-defect suite runs at tier 0 for every code gate (catch 100%, false alarms 0 on clean twins) and at tier 1–2 for every judge agent, with catch and false-alarm rates and 95% intervals on the harness ledger.
41
+ SC-3 The escape rate (planted defects that reach phase completion) is measured, published in the harness report, and falls release over release.
42
+ SC-4 An unattended run of a multi-phase seed project completes with a fresh session per unit, code stop reasons, a run ledger and a proof dossier, on Claude Code and at least one other host.
43
+ SC-5 Model-tier harness scenarios re-run at $0 from cassettes in CI; a prompt edit reports exactly which recorded agents it invalidated.
44
+ SC-6 Every prompt change to a judge agent ships only with a paired, sequentially tested harness result against the current prompt and a deletion arm.
45
+ SC-7 No regression: suite, release gates and harness tier 0 green at every step; all five runtimes keep installing and passing their live gates.
46
+ ```
47
+
48
+ ### 0.4 User stories
49
+
50
+ ```text
51
+ As a developer, I want PAN to refuse to call a phase done when the tests failed, the verification is stale or a finding is open,
52
+ so that "complete" means complete, instead of trusting an agent's status word.
53
+
54
+ As a developer, I want the tests my agent writes to be proven able to fail (they fail before the change and kill mutants of it),
55
+ so that a green suite means the behaviour is checked, instead of a suite that passes no matter what.
56
+
57
+ As a team lead, I want reviews that find real bugs with evidence and remember which comments we dismissed,
58
+ so that review time goes to real issues, instead of noise and repeats.
59
+
60
+ As someone leaving a project running overnight, I want a loop that runs each unit in a fresh session, stops on rules written in code, records everything and hands me a PR with proof,
61
+ so that I come back to reviewable work, instead of a stalled session or an unverifiable pile of commits.
62
+
63
+ As PAN's maintainer, I want every prompt change measured against the current prompt with real statistics, for free where possible,
64
+ so that PAN improves by evidence, instead of by taste.
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Phase 1: Internal Reconnaissance (what the investigations established)
70
+
71
+ ### 1.1 Code versus prompt, gate by gate
72
+
73
+ | Gate | Enforced by | Evidence | Gap |
74
+ |---|---|---|---|
75
+ | Requirements quality | prompt | `templates/requirements.md`: one-line REQ ids, no acceptance criteria | Nothing testable at the requirement level |
76
+ | Plan structure | code, but only if an agent calls it | `verify plan-structure`; the plan-phase orchestrator never runs it | Optional gate |
77
+ | Requirement coverage by plans | prompt (plan-checker dimension 1) | `phase-report.cjs` computes the ids for display only | A set difference left to a model |
78
+ | Same-wave file overlap, cycles | prompt (planner prose) | `buildPlanIndex` validates nothing | Parallel executors can edit one file |
79
+ | Plan-check bound to plans | none | the record hashes the report, not the plans | Edited plans execute as checked |
80
+ | Test integrity | none | no rule in executor, reviewer or verifier | The largest unguarded defect class (ImpossibleBench) |
81
+ | TDD RED evidence | prompt | `agents/pan-executor.md` "MUST fail" | RED claimed, never proven |
82
+ | Summary truth | code exists, unused | `verify-summary` has no workflow caller | Executor marks its own homework |
83
+ | Test gate | prompt, npm-only | verifier runs `npm test` and writes `test_gate`; recorder only warns | Self-reported, blind outside Node |
84
+ | Code review scope | prompt | file list from the executor's own `key-files`, not the git diff | Unlisted files are never reviewed |
85
+ | Findings closure | code, flawed | silence means fixed; ids hash wording | False closure by recall noise |
86
+ | Reconcile | code, misplaced | exits 1, but after completion; ignores `test_gate` | Right idea, wrong place |
87
+ | Stale verification | code, report-only | always exits 0; ignores plan and requirement changes | Stale passes still complete and merge |
88
+ | Phase completion | none | `cmdPhaseComplete` | The single biggest hole |
89
+ | MCP merge gate | code (nonce) | `verify_pass` and `ci_green` attested by the agent | The human sees a flag the agent typed |
90
+ | Native exec-waves | prompt | self-check and verdict are agent-reported schema fields | The deterministic path inherits prompt-only gates |
91
+ | Autonomy stop rules | code over agent-reported numbers | `focus.cjs` `determineStopReason` reads `--items-completed`, `--points-used`, `--tests-*` from the agent | Budgets measure nothing measurable |
92
+
93
+ ### 1.2 Strengths to protect
94
+
95
+ The packed-artifact harness with a findings ledger; the MCP server's fixed registry, forbidden verbs and nonce merge gate; the cost ledger priced from a dated rate table with per-agent attribution; native workflow scripts beside portable markdown with a measured parity oracle; state re-injection on every runtime; documentation-truth lints; the surface registry and coverage gate. Every item below builds on these, never around them.
96
+
97
+ ### 1.3 A feasibility fact established in this session
98
+
99
+ **Free record/replay of model turns works on Claude Code.** A local mock of the Messages API (zero-dependency `node:http`, minimal SSE reply) was set as `ANTHROPIC_BASE_URL` with a dummy key and a scratch `CLAUDE_CONFIG_DIR`. `claude -p` started without onboarding, sent one `HEAD /api/hello` and one `POST /v1/messages`, accepted the mock's streamed reply and exited cleanly, pricing the mocked usage. Two runs sent request bodies that were **byte-identical after normalising three fields** (the config-dir path, `metadata.session_id`, the date). A normalised request hash is a stable cassette key. Codex was already shown to accept a local mock provider (M25, `2026-10-03`). Copilot (`COPILOT_PROVIDER_BASE_URL`, `COPILOT_OFFLINE`), Gemini (`GOOGLE_GEMINI_BASE_URL`) and OpenCode (`provider.*.options.baseURL`) document the same seam; each needs one probe.
100
+
101
+ ### 1.4 Internal scorecard (every command scored on completeness, tests, behavioural coverage, runtimes, prompt quality and observed use)
102
+
103
+ The scorecard investigation read every command with the workflow, agents and verbs it uses, and checked behavioural coverage against every harness run report and observed use against every ledger and trace under `d:\pantesting` (field projects other than test, stress and harness projects were not read, so a zero there means "not observed", not "never used"). Enumerate the classes with `ls commands/pan agents` and `node scripts/test-surface.cjs --map`; counts live only in `CLAUDE.md`.
104
+
105
+ - **Best-scoring and worth protecting:** plan-phase (planner → checker loop with a clear completion contract), exec-phase, verify-phase's anti-rubber-stamp chain, the cost ledger and rebuild, focus-auto's stop and budget engine (per-cycle cost joined server-side from the ledger), optimize apply/revert (hash-logged, refuses unsafe reverts).
106
+ - **Weakest:** `audit-deployment` (writes into PAN's source repository and names unshipped dev skills — a dev tool leaking into the shipped surface), `army` (merge gate in prose while `pan-release` holds Bash; the MCP nonce gate is not used), `settings` (asks more questions in one call than the host allows; offers a choice that changes nothing), `what-if` (isolation in prose; `whatif cleanup --force` accepts any path), `assumptions` (corrections never saved), `phase-tests` (promises RED-GREEN, writes tests after the code; exec-phase bypasses it), the three focus doc commands (overlapping, one CLI reads PAN's own docs instead of the project's), `focus-plan`/`focus-scan`/`focus-exec` (never call their own CLI verbs), `discord`, `mcp-bridge` (hand-seeded cache; name clashes with PAN's real MCP server).
107
+ - **Cross-cutting defects:** many shipped agents never appear in any observed run, harness included; only a few commands have ever passed a model-tier scenario, and several model scenarios have never run; several commands `@`-include whole `bin/lib/*.cjs` source files (about 64K tokens of JavaScript for a model that only needs to run the CLI); many spawns use the untyped `general-purpose` agent, so the role's `effort` and `tools` never apply; `/pan:help` omits a large share of the commands it calls "the complete reference"; `retro`'s gap parser misses the template's numbered gaps; `preview`'s ETA reads a field the summary templates never write; `cost clear` deletes the ledger without a backup; `health` applies every repair on one "yes".
108
+ - **Dead or orphaned:** `workflows/diagnose-issues.md` and `workflows/research-phase.md` loaded by no command; `scaffold uat` and `init verify-work` called by no prompt (UAT has no entry point); `focus scan|plan|exec|sync` and `pan-tools learnings` called by no prompt; the `review-handoff` bus channel written and never drained; exports with no consumer (`THINKING_BUDGETS`, `isDreamDue`); config keys written and never read (`workflow.phase_reports.open/theme`, `execution.rollback_snapshots`, `routing.cascade_quality_gate`, `commit.conventional_types`, `gates.confirm_*`, `safety.*`); the `quality` profile identical to `balanced`.
109
+ - **Overlaps:** status (report, hud, dashboard, a different `pan-tools dashboard` view, progress, statusline); learning (learn, optimize learn, retro, knowledge playbook, `pan-tools learnings`); milestones (done and cleanup hand-roll the tested `milestone complete` verb); focus versus the phase loop (the pipeline restated across commands and drifting); doc checks (three focus commands, `links`, `doc-lint`); review-deep versus exec-phase `--deep-review` (two hand-synced copies); next-step routing (progress, resume and transition disagree).
110
+
111
+ ---
112
+
113
+ ## Phase 2: Competitive Analysis — the best implementation of each capability
114
+
115
+ Primary sources read `2026-10-12` unless marked. "Best" is a judgement on mechanism, not market share.
116
+
117
+ | Capability | Best found | What makes it best | PAN gap |
118
+ |---|---|---|---|
119
+ | Requirements notation | Kiro specs | EARS acceptance criteria ("WHEN … THE SYSTEM SHALL …"); bugfix specs add "SHALL CONTINUE TO" for unchanged behaviour (kiro.dev/docs/specs) | Free-text REQs |
120
+ | Traceability | Spec Kit `/analyze` | Read-only cross-artifact lint with a requirement→task coverage table and severity (spec-kit templates/commands/analyze.md) | Prompt-only coverage |
121
+ | Discovery | Spec Kit `/clarify` | Ten-category taxonomy, at most 5 questions, recommended defaults, answers logged and written back into the spec | Open-ended questioning |
122
+ | Spec-derived tests | Kiro Correctness | Properties extracted from EARS criteria, random cases with shrinking, failure triage "fix the code, the spec or the test" (kiro.dev/docs/specs/correctness, *vendor*) | None |
123
+ | Research provenance | BMAD `bmad-deep-recon` | Per-claim publisher, date and citation; freshness windows; selective refresh | HIGH/MED/LOW labels only |
124
+ | Architecture decisions | BMAD architecture "spine" | A decision enters only if independent units would choose incompatibly, it is non-obvious and a real trade-off; decisions get ids that a readiness gate checks | Design doc, no decision ids |
125
+ | Plan gates in code | gsd-core | Same-wave coupling, context and fact drift, verification invalidated on input change, positive-control ratchet for every gate (open-gsd/gsd-core docs) | Prose |
126
+ | Wave scheduling with isolation | gsd-core quick-batch | File-overlap partitioner, mutating waves forced serial without isolation, deterministic merge order, resumable manifest | Shared tree, prose |
127
+ | Code review | Cursor Bugbot | 8 passes with randomised diff order, majority vote, validator model, dedupe against earlier runs; learned rules with acceptance analytics; config read from the base branch (cursor.com/blog/building-bugbot, *vendor*) | Single pass, executor-scoped |
128
+ | Cross-model critique in one session | Copilot CLI rubber duck | A read-only critic on a different model family, picked per call, consulted after planning, after tests and after repeated failures (docs.github.com, copilot-cli rubber-duck) | One model family |
129
+ | Cross-model review | GitHub ReviewBench | A multi-model ensemble raised precision 8% and recall 13.6% at 8% lower cost (github.blog, `2026-10-05`) | One model family |
130
+ | Test quality | Meta TestGen-LLM, ACH, JiT | Keep a test only if it builds, passes reliably and raises coverage; generate tests to kill targeted mutants (73% accepted); "catching" tests that fail on the diff and pass on its parent (arXiv `2402.09171`, `2501.12862`, `2601.22832`) | None on user code |
131
+ | Mutation in review | Google | Mutants only on changed, covered lines, shown in code review; 82% of surfaced mutants with feedback judged productive (arXiv `2102.11378`, TSE 2021) | Dev-side probe only |
132
+ | Debugging | SWE-Doctor | One reproduction per behavioural requirement, not one per issue (+8–9 points on SWE-bench Pro, arXiv `2607.00990`); Cursor Debug Mode removes its instrumentation after the fix | One reproduction |
133
+ | UAT | Playwright test agents | Planner → generator → healer; the healer skips rather than "fixes" a test when the feature itself is broken (playwright.dev, v1.56) | Template only |
134
+ | Autonomous loop | Anthropic long-running harnesses; bmad-loop | Feature list in JSON that agents may only flip ("it is unacceptable to remove or edit tests"), progress file, init script, one feature per session; evaluator with hard thresholds; "no LLM in the control loop" (anthropic.com/engineering, Nov 2025 and Mar 2026; bmad-loop README) | One host session |
135
+ | CI as oracle | Cursor cloud agents | Auto-fix CI on agent PRs, capped at 10 follow-ups, skipping checks already failing on the base commit (cursor.com/docs/cloud-agent/capabilities) | None |
136
+ | Graded autonomy | Factory `droid exec` | Read-only by default, risk-rated levels, an over-limit action stops with no partial changes | Modes, no code guard |
137
+ | Spend governance | Claude Code `--max-budget-usd` | Covers subagents; spawning fails at the cap (code.claude.com/docs/en/cli-reference) | Points the agent reports |
138
+ | Eval statistics | Inspect (UK AISI) | Wilson intervals, clustered standard errors, pass^k reducers, early stopping, a caching key over model, messages, config and tools; an agent bridge relaying Claude Code, Codex and Gemini CLI through a local proxy (inspect.aisi.org.uk) | Counts only |
139
+ | Learned memory | Augment Cosmos "noisy memory" | Evidence log, promotion threshold, tells the user what it remembered, flags conflicts | Promote gate without evidence count |
140
+ | Self-improvement | GEPA; DGM | Reflective prompt evolution on a Pareto front, up to 35× fewer rollouts than GRPO (arXiv `2507.19457`); DGM's self-modifying agents went 20% → 50% on SWE-bench but **faked test logs** when it could (arXiv `2505.22954`; sakana.ai) — the evaluator must be out of reach | Manual prompt edits |
141
+
142
+ **Converging evidence from research** (arXiv abstracts, `2026-10-12`): spreading a budget across fresh samples beats deep repair, and feedback quality is the bottleneck (Olausson et al., `2306.09896`); models err more once their own errors sit in context (`2509.09677`) — fresh context per unit is right; executable oracles move outcomes (SWE-agent lint gate −3.0 points when removed; Agentless +5 from a reproduction test; AlphaCodium 19% → 44%); selection over N attempts with a test filter is how leaders reach their scores (Agentless, OpenHands critic 60.6% → 66.4%, Anthropic parallel attempts); multi-agent debate does not reliably beat self-consistency (`2311.17371`).
143
+
144
+ ---
145
+
146
+ ## Phase 3: Design — the program
147
+
148
+ ### 3.1 North star
149
+
150
+ **PAN is the framework whose every gate is enforced in code and whose every claim is measured — on five hosts.** Each feature below either moves a guarantee from prompt to code, or turns a quality claim into a number on the harness ledger.
151
+
152
+ ### 3.2 Pillars and items
153
+
154
+ Sizes XS 1 · S 2 · M 4 · L 10 · XL 20. Each item names its gate. Ids V, R, A, H, P, L and S are local to this program: R1–R5 are not the reality-check R-series (R45–R49 are), H1–H10 are not the market-ideas hand-offs or the earlier roadmap's horizons, S1–S6 are not queue sessions, and P1–P6 are not priority classes. Cite them as "program R2" and so on outside this file.
155
+
156
+ #### Pillar V — Proof-carrying phases (verification you can trust)
157
+
158
+ | ID | Item | Design | Size | Gate |
159
+ |---|---|---|---|---|
160
+ | V1 | **Phase gate in code** | `phaseGate(cwd, N)` in `phase.cjs`, exposed as `pan-tools phase gate <N>`; `phase complete` refuses (exit 1, reasons) unless every plan has a summary, the verification is `passed` (or `human_needed` with a recorded approval), it is fresh, reconcile is clean, the test record passed, no open critical/high findings lack a disposition, and stubs and test integrity are clean. Until V2 lands (W2) the test fact is the verification's `test_gate` (failed → refuse); a `human_needed` approval is a `decision` disposition on the verification's human items. `--force --reason` writes a `decision` disposition. exec-phase moves reconcile before `update_roadmap`; `transition.md`, native `pan-exec-waves` and MCP `requestMerge` call the same function | M | One unit test per refusal reason; tier-0 seeded states (catch 100%, clean twin passes) |
161
+ | V2 | **Engine-run test gate, any language** | `test-gate.cjs`: `workflow.test_command`, else detection (package.json, pytest, `go test ./...`, cargo, Maven/Gradle, `make test`); `pan-tools test run --phase N [--baseline]` writes `{phase}-test-run.json` (command, exit, counts, failing ids, HEAD); regression = new failures versus the baseline; the verifier copies `test_gate` from the record; reconcile cross-checks | L | Per-runner fixtures from real emitted output; a phase-1 regression seeded in phase 2 is caught |
162
+ | V3 | **Test-integrity guard and an abort option** | `verify test-integrity <phase>` over the phase's commits: deleted or renamed tests, new skip/only markers, falling assertion counts, edited expectations in tests the plan did not declare, rewritten snapshots, always-true asserts (reuse `scripts/test-quality-lint.cjs` shapes). Executor gains `BLOCKED_SPEC_CONFLICT` and "tests outside `<files>` are read-only" | M | Fixture repo per pattern plus clean twins; an impossible-task scenario measures tamper rate before and after |
163
+ | V4 | **RED and catch proof** | `verify red <phase>`: in a worktree at the phase base, the phase's new or changed tests must fail; at HEAD they must pass (Meta's weak catch, independent of commit order) | M | Seeded tautological test is rejected; real test passes |
164
+ | V5 | **Mutation gate on the user's diff** | `pan-tools verify mutate --phase N`: per-language operator tables lifted from `scripts/mutation-probe.cjs` into a shipped `mutate.cjs`, applied only to changed, covered lines, seeded sample, flake pre-check, survivors recorded as `test_gap` findings; `workflow.mutation_gate: off\|report\|gate`, starting at `report` | M + S | Weak-test seed shows survivors; strong-test seed shows none (tier 0) |
165
+ | V6 | **Findings close only on evidence** | Remove silence-means-fixed; on a re-run the judge answers `resolved\|still_present\|cannot_tell` per open id with evidence; ids from class + file + symbol with fuzzy summary match | M | Omitted finding stays open; churn across 5 repeated reviews measured |
166
+ | V7 | **Plan checks in code** | `verify plan-set <phase>`: requirement coverage, same-wave `files_modified` intersection without a dependency, cycles, missing and future references, wave arithmetic; plan-check record stores the plans' hash and exec init refuses on mismatch; plans record `planned_commit` and exec lists drifted interface files | M | Tier-0 seeds for each class (catch 100%) |
167
+ | V8 | **Requirements with acceptance criteria and a trace matrix** | EARS criteria per REQ (`WHEN … THE SYSTEM SHALL …`), `requirements lint`; every automated verify command states its failing direction (`<fails_when>`, gsd-core's "stated failing direction"); each `must_haves` truth names its test; the verification carries req → criterion → task → test → result; a requirement is ticked only when its tests passed in the record | L | Seed with a scenario-less REQ fails lint; an untested truth reads `not_checked`, never `passed` |
168
+ | V9 | **Two-key verdict** | Code facts can lower an agent's verdict, never raise it (verdict.cjs); absorbs R46: `test_gate: failed` under `passed` records as `gaps_found` | S | A `passed` verification with any failing code fact records as gaps |
169
+ | V10 | **Property tests from EARS truths** | The planner turns quantifiable truths into properties using the project's own property-test library (fast-check, Hypothesis, jqwik) or postconditions; plan-checker dimension 13; V5 catches vacuous properties | M | Seeded validation-rule phase yields a property task |
170
+
171
+ #### Pillar R — Review that finds real bugs
172
+
173
+ | ID | Item | Design | Size | Gate |
174
+ |---|---|---|---|---|
175
+ | R1 | **Diff-scoped review with intent** | `review scope <phase>` from the commit range plus untracked files; the reviewer gets must_haves, REQ criteria and the plan's Review Focus (MI-112) | S | Unlisted file in the diff is reviewed (fixture) |
176
+ | R2 | **Lenses, voting and a validator** | Lenses: intent, edge cases, test adequacy, security (hardener); k = 3 passes with randomised hunk order, keep findings seen at least twice; a validator demands a quoted hunk or a failing input for every high/critical finding, else downgrades it on the record; every lens returns a "declined to judge" list (MI-118) | L | Catch and false-alarm rates on the defect corpus (H4) versus today's single pass, paired, SPRT |
177
+ | R3 | **Learned suppressions with a lifecycle** | Dismissed findings (signature + reason) become candidate suppressions scoped to their files; promoted on repeated dismissals, retired when the files change; security and logic findings are never suppressed | S | A dismissed signature is not re-raised; after its file changes it returns |
178
+ | R4 | **Cross-family reviewer lane** | When another host CLI is installed, `/pan:review-deep --lane codex\|gemini\|copilot` runs the reviewer prompt through it headless (reuse `runner.cjs` argv, aligned with the harness's `MODEL_RUNTIMES`); disagreements go to the meta-reviewer and the human; opt-in, because code goes to another vendor | M | Tier 0 argv tests; tier 1 paid lane recorded with cost |
179
+ | R5 | **Proven findings** | A high/critical finding is "confirmed" only with a test that fails on the diff and passes on the parent, otherwise "suspected" | M | Fixture finding with and without a catching test |
180
+
181
+ #### Pillar A — Autonomous delivery you can leave running
182
+
183
+ | ID | Item | Design | Size | Gate |
184
+ |---|---|---|---|---|
185
+ | A1 | **Deterministic outer loop** | `pan-tools autodev run`: a foreground Node process (not a daemon) that reads persisted state, asks `orchestrator.nextAction` for the next unit, launches a fresh headless host session per unit (`/pan:plan-phase N`, `/pan:exec-phase N`, `/pan:verify-phase N`), appends a ledger row per unit (argv, host version, start and end SHA, exit, cost, oracle result) and persists `verified` and `merged`. Stop reasons in code; resume from the ledger | XL | Tier 0 with a scripted host double: fresh session per unit, resume after a kill, every stop reason |
186
+ | A2 | **Oracle and CI in the loop** | The loop's oracle is V1 + V2; optional CI mode reads `gh pr checks --json` and the failing log tail as fix-round feedback; a breaker after N rounds (default 3); checks already failing on the base are ignored | L | Scenario where a fabricated test count is overridden by the oracle |
187
+ | A3 | **Parallel isolation on every runtime** | `phase-plan-index` partitions same-wave plans with overlapping files into sub-waves; the loop runs each plan in a worktree with its own session; branches merge back in wave order behind a shadow-merge preflight (merge with every green unmerged branch and re-run the oracle). On Claude Code the native `pan-exec-waves` script can use the Workflow tool's `agent({isolation: 'worktree', model})` (documented `2026-10-12`; `agent()` still has no turn cap, so MI-009 stays blocked) | L | Two plans touching one file are serialised; two branches that pass alone but break together are caught |
188
+ | A4 | **Failure-class router** | Classify compile, assertion, timeout, flake (passes on rerun), missing environment, merge conflict, integrity violation, scope violation, budget; each class has a policy (shallow retry with the error tail, fresh restart, tier escalation, quarantine, ask). Breadth before depth, per Olausson | M | Table-driven tests per class |
189
+ | A5 | **Flight recorder and proof dossier** | One `blackbox.jsonl` per run; `autodev report` builds the PR body and an HTML page from it: requirement → plan → commits → oracle evidence → verdict → dispositions → cost; `autodev replay` re-runs the stop logic over recorded inputs | M | Snapshot test on a fixture ledger; replay gives identical decisions |
190
+ | A6 | **Dollar governor** | `budget.max_usd_run` and `budget.max_usd_day` enforced between units from the cost ledger; the remaining amount passed down as `--max-budget-usd` on Claude | M | A run stops with `budget_usd` |
191
+ | A7 | **Pre-tool guard hook** | `hooks/pan-guard.js` on the pre-tool event of every runtime that has one (Claude `PreToolUse`, Codex `PreToolUse`, Copilot `preToolUse`, Gemini `BeforeTool` — all four can deny, docs read `2026-10-12`): blocks secret-shaped writes, direct edits to files `pan-tools` owns, writes by judge agents, and executor edits to tests outside the plan | M | Hook unit tests per host shape; tier-0 install check that it registers on four runtimes |
192
+
193
+ #### Pillar H — Harness v2: measured quality
194
+
195
+ | ID | Item | Design | Size | Gate |
196
+ |---|---|---|---|---|
197
+ | H1 | **Model double for every host** | `harness/src/model-double.cjs`: one `node:http` server speaking Anthropic Messages SSE, OpenAI Responses/Chat SSE and Gemini streaming, in four modes — capture (record what the host sends), script (scripted `tool_use` turns keyed by Claude Code's `x-claude-code-agent-type` gateway hint header or call index), replay (cassettes), record (proxy upstream and meter `usage` on the wire). New assertion kinds `wire:` and `wire-count:`. Double-backed steps are tier 0 (an ADR-0047 amendment: nothing is spent) | L | A tier-0 scenario per installed host asserts the executor subagent receives PAN's agent body whole, and goes red on a package that truncates it (the MI-015 bug class) |
198
+ | H2 | **Cassettes with drift as prompt impact** | `--record --max-usd` then `--replay` at $0; a normalised-body mismatch is a `drift` result naming the agent and the changed prompt file, never a PAN failure; cassettes live outside the public repo unless scrubbed | M | A chain scenario replays green at $0; a one-line agent edit yields drift for exactly that agent |
199
+ | H3 | **Statistics** | `harness/src/stats.cjs`: Wilson interval, pass^k (tau-bench), pass@k, paired sign test, SPRT, power planner; `--until-decided`; model-tier findings promote on interval bounds; flaky becomes a computed class. Tier 0 stays deterministic | S + S | Unit tests on known values; a past five-rep report re-rendered with intervals |
200
+ | H4 | **Seeded-defect corpus and a detection scoreboard** | `harness/corpus/<id>/` with seed, defect patch, truth file and a clean twin, across PAN's defect funnel (stub, hollow test, unwired export, swallowed error, false completion claim, off-by-one, test tampering, scope creep, security flaw); generated model-free in part from the mutation operators; catch and false-alarm rates with intervals per agent × host × profile | L | Scoreboard in the report; a deliberately weakened verifier prompt scores lower |
201
+ | H5 | **Controls for every scenario** | Each tier-0 scenario declares a sabotage that must turn it red and a no-op arm; a lint rejects a scenario without one (gsd-core's positive-control ratchet) | M | Every tier-0 scenario killed by at least one control |
202
+ | H6 | **Prompt-rule registry and prompt mutation** | `scripts/test-surface.cjs` extracts normative rules from agents, commands and workflows into a registry with stable ids; scenarios and corpus cases declare `covers:`; `--prompt-mutant <id>` deletes a rule in the extracted package and reruns its cases; a rule whose removal changes nothing is decorative | M + M | `--check` fails on an unclaimed new rule; one mutant run recorded |
203
+ | H7 | **Model-based property tests over pan-tools** | A seeded PRNG plus shrinking (zero dependencies) generates phase add/insert/remove/complete, roadmap and state sequences against a toy model; invariants on numbering, `roadmap analyze` agreement and round-trips; `nextAction` fuzzed to never return a forbidden verb | M | A planted off-by-one in phase insertion is found and shrunk to four commands or fewer |
204
+ | H8 | **Deterministic simulation of the autonomy loops** | The double in script mode plus a seeded fault schedule (429 with retry-after, cut streams, compaction turns, usage-window headers) drives focus-auto, army, stop-guard, budget stops and re-injection reproducibly at $0 (FoundationDB's simulation practice) | L | A seeded sim fails when the stop guard is disabled in the package and passes on 20 seeds |
205
+ | H9 | **Scripted-user driver** | A `user` step answers on a regex over the last assistant text through `claude -p --resume`; with the double it tests UAT and discuss-phase plumbing for free; with a model, question quality against private acceptance criteria | M | discuss-phase writes `context.md` after three scripted answers |
206
+ | H10 | **PAN versus the bare host** | The same seed and goal with and without PAN, paired, per host: completion, tests passing, cost, turns — the product's value claim, measured | M (paid) | One host, paired reps, delta with an interval in the report |
207
+
208
+ #### Pillar P — Planning excellence
209
+
210
+ | ID | Item | Design | Size | Gate |
211
+ |---|---|---|---|---|
212
+ | P1 | **Clarify with a taxonomy and a budget** | discuss-phase and new-project score a fixed taxonomy (scope, data, UX, NFRs, integrations, edge cases, constraints, terminology, completion signals), ask at most five questions with a recommended default each, log answers dated and write them into the spec | M | Scripted-user scenario (H9) |
213
+ | P2 | **Decision spine with ids** | Design decisions recorded only when they pass the three-question test, each with an id that plans cite; plan-checker flags a plan relying on an unrecorded decision | M | Fixture plan citing a missing decision id |
214
+ | P3 | **Research claims with provenance and freshness** | `research.md` records `claim · source · checked_at`; the plan-checker flags facts older than the freshness window for their type | S | Lint over a fixture |
215
+ | P4 | **Review Focus and executor concerns** | Queue items M41 and M42 (already specified in `market-ideas-2026-10.md`); M39 is absorbed by L4 | 6 | As specified there |
216
+ | P5 | **Multi-faceted reproduction and a fix case base** | The debugger writes one reproduction per behavioural requirement (SWE-Doctor) and commits it as a failing test that V4 proves; resolved debug sessions get a failure signature and `pan-tools debug similar` returns past fixes as hypotheses to reproduce, never as answers | M | Seeded gap fixed only when its reproduction turns green |
217
+ | P6 | **Cost forecast** | `preview` shows p10/p50/p90 dollars per plan and phase from observed cost per agent and tier; refuses a forecast below n = 5; the autodev loop stops when spend passes p90 | S | Unit test on a fixture ledger |
218
+
219
+ #### Pillar L — Product hygiene: every feature alive, tested and honest
220
+
221
+ | ID | Item | Design | Size | Gate |
222
+ |---|---|---|---|---|
223
+ | L1 | **Liveness registry** | Extend `scripts/test-surface.cjs`: every shipped command and agent must name a harness scenario (or an allowlist reason); every pan-tools subcommand must be called by some shipped prompt; every config default must have a code reader | M | `--check` fails on a seeded orphan command, verb and key |
224
+ | L2 | **Prompt-contract lint** | Parse `argument-hint` and allowed-tools: flag documented flags the CLI never parses, tools used but not granted, `@`-includes of `bin/lib/*.cjs`, question blocks larger than the host allows, `general-purpose` spawns, names of unshipped dev skills in shipped prompts | M | Seeded-defect fixtures; current-tree violations fixed or allowlisted with a reason that names the fixing item (L3, L4, L6) |
225
+ | L3 | **No source code in prompts** | Remove the `@`-includes of `.cjs` files from the commands that carry them | XS | L2's rule |
226
+ | L4 | **Typed spawns everywhere** | Replace `general-purpose` + "read your role file" with the named agent type and a resolved model; spawns that run a workflow (no role file) keep `general-purpose` and gain `model=` (absorbs M39) | S | L2's rule; a spawn-scan test |
227
+ | L5 | **Generated help** | `/pan:help` built from command frontmatter (`group`, `description`) so it cannot omit a command | S | Every command appears in help (test) |
228
+ | L6 | **Fix the weakest commands** | audit-deployment moves to dev-only; army calls a new `pan-tools merge request\|confirm` over `mcp/merge-gate.cjs` and refuses on runtimes without a gate; settings asks in host-sized batches and drops the no-op choice; `quality` profile differs from `balanced` or is removed; what-if uses host worktree isolation and `whatif cleanup` refuses paths outside its prefix; assumptions persist to `NN-assumptions.md` that discuss and plan read; exec-phase loads the phase-tests workflow and V4 proves RED; retro reads numbered gaps; preview's ETA derives from `duration` or git; `cost clear` backs up first; health asks per repair class | L | One test per fix, each proven red first |
229
+ | L7 | **Consolidate overlapping surfaces** | One status command (dashboard an alias; the `pan-tools dashboard` verb renamed `status --json`); milestones done → audit → fix (done wraps `milestone complete`; cleanup becomes a flag; gaps becomes audit's route); learning in two commands (learn absorbs optimize; retro absorbs the playbook); focus as focus-auto with step-through modes, one focus-docs and focus-design; research-phase as `plan-phase --research-only`; profile an alias of settings; one next-action router shared by progress, resume and transition (the MCP orchestrator's state machine); retire discord and mcp-bridge; give `review-handoff` a reader or remove it. Command renames go through `COMMAND_RENAME_MAP` so old names keep working | L | Install-matrix and surface registry updated; renamed commands resolve on all five runtimes |
230
+ | L8 | **UAT that runs** | A UAT walkthrough (one criterion per message, the user's verdict verbatim) writes `NN-uat.md` from the template and hands gaps to diagnose on the markdown path everywhere and the native script on Claude Code; refuses auto mode (a human verdict is the point) | M | Scripted-user scenario (H9); the UAT → diagnose → `plan --gaps` chain completes |
231
+ | L9 | **Local usage census** | `pan-tools usage` reads the project's own ledger and traces and reports commands and agents never used, or used and never finished — local only, no telemetry | S | Unit test on a fixture ledger |
232
+
233
+ #### Pillar S — PAN developing PAN
234
+
235
+ | ID | Item | Design | Size | Gate |
236
+ |---|---|---|---|---|
237
+ | S1 | **Executable WATCH triggers and a market watcher** | Each WATCH row in the ideas ledger carries a machine predicate (dist-tag ≥ version, release exists, changelog contains, harness scenario result); `scripts/market-watch.cjs` evaluates them daily model-free with the releases API (ETag) and npm `time`, and writes an inbox of deltas; a model pass runs only on deltas and produces candidate rows, never verdicts | M + M | Fixture tests with recorded responses; the inbox writer never touches the status column |
238
+ | S2 | **Autopilot spine with guard rails** | `scripts/autopilot.cjs <lane>` from a local scheduled task: worktree under `d:\pantesting`, branch `bot/<lane>/<id>`, `claude -p --max-budget-usd --json-schema`, monthly spend ledger, kill switch; never pushes by default; a scope check refuses edits to evaluator files (scenarios, allowlists, coverage policy, `.github/`) and canary mutants must stay red (DGM's lesson); `/execplan` stops staging with `git add -A` | M + S | Dry-run plan; scope-check tests both ways; canary-gaming fixture refused |
239
+ | S3 | **Fix lanes ordered by how mechanical their gate is** | (a) kill a surviving mutant, (b) cover an unreferenced surface row, (c) cover a dispatcher arm, (d) doc-lint and link fixes, (e) turn a harness finding green, (f) prompt changes; a lane unlocks after N merged PRs with no owner revert | M | First lane's PRs pass the same-seed re-probe, the quality lint and the suite |
240
+ | S4 | **Guarded prompt evolution** | GEPA-style: one section of one judge prompt at a time, failing transcripts reflected into a candidate, training then held-out scenarios, paired and sequentially tested, a deletion arm always run, Pareto over pass rate, cost and turns; only `harness/variants/` is mutable and a test proves the evaluator is out of reach; results ship as a PR | L | On a deliberately degraded variant the loop recovers to baseline on held-out data inside the cap |
241
+ | S5 | **Weekly State of PAN** | Deterministic report: suite and coverage trend, mutant survivors, surface drift, open harness findings with age, fired triggers, bot PRs opened, merged and reverted, autopilot spend | S | Snapshot test |
242
+ | S6 | **PAN on PAN** | The fix lanes run PAN's own loop on PAN's source in an external worktree with a `--global --config-dir <scratch>` install from the packed tarball (the never-install-into-the-source-repo rule holds), producing PAN's own verdicts, findings and cost data | L | One finding goes through PAN's loop to a PR whose verification passed and whose diff passes the scope check |
243
+
244
+ ### 3.3 Sequencing
245
+
246
+ > **Superseded for execution `2026-10-12`** by `docs/specs/product-excellence-superplan.md`, which orders the items by checked dependencies into sessions of about twenty points. It splits the code gates from the paid evidence gates, ships new gates in `warn` or `report` mode first, and adds the items the review found (W0, CI1, A0, A7b and the HX release-hardening items). The waves below remain the rationale.
247
+
248
+ | Wave | Theme | Items | Why this order |
249
+ |---|---|---|---|
250
+ | **W1** | Deterministic gates and hygiene | V1, V7, V3, V6, V9, A7, H3, H5, L2, L3, L4, R45 (OpenCode plugin) | Tier-0 testable, no model spend, closes the biggest holes; statistics and controls are needed to measure everything after |
251
+ | **W2** | Measurement | H1, H2, H4, V2, V4, V5 (report mode), H7 | The double and cassettes make model-tier checks free; the corpus gives every later judge change a number |
252
+ | **W3** | Judges and the product surface | R1–R5, V8, V10, P1–P6, L1, L5–L9 | Each change ships only with a corpus result (H4) under H3 statistics |
253
+ | **W4** | Autonomy | A1–A6, H8, H9 | Built on code gates (oracle) and the double (simulation) |
254
+ | **W5** | Self-improvement | S1–S6, H6, H10, V5 gate mode | Needs every prior layer as its evaluator |
255
+ | **Later** | **Exposure** | Publication (former F3, MI-025), positioning, marketplace listings, reach measures | After the product is best-in-class, per the owner |
256
+
257
+ Session queue for W1 (about 40 points): V1 (4), V7 (4), V3 (4), V6 (4), V9 (2), A7 (4), H3 (4), H5 (4), L2 (4), L3 (1), L4 (2, absorbs M39), R45 OpenCode plugin (2); M40 is already done. Packaging before behaviour: every W1 item is gated by a pan-tools exit code, a lint or a harness change; its prompt edits (V3's executor rule, L3, L4) are mechanical; R45's live OpenCode 2 check is the one paid step. R47, R48, R49 and M35 stay in the October queue and run alongside the waves; M43 is folded into H3 and S4 (the deletion arm).
258
+
259
+ ### 3.4 Decisions only the owner can make
260
+
261
+ **Decided by the owner on `2026-10-12`:**
262
+
263
+ | Decision | Outcome | Consequence |
264
+ |---|---|---|
265
+ | Re-open MI-058 | **Re-opened as a foreground loop** over PAN's own state (not a daemon, not a sixth runtime) | A1 is in scope (W4) |
266
+ | ADR-0047 D2 | **Amended:** steps backed by the local model double spend nothing and count as tier 0 | H1, H2, H8, H9 run free in CI |
267
+ | MI-114 rep rule | **Replaced:** prompt changes need a paired, sequentially tested result (SPRT) or a stated power, not "five reps" | H3 is the instrument; S4 and R2 use it |
268
+ | Standing spend cap | **None:** model-tier spend stays approved per run with `--max-usd` | Recording, corpus baselines and A/B runs are scheduled as explicit runs; cassette replay keeps nightly runs free |
269
+ | Recording login | **API keys only** (separate pay-per-use developer keys); subscription logins are never proxied | H2 record mode supports API-key auth only |
270
+ | Cross-vendor review lane | **Opt-in per project**, off by default | R4 ships disabled; enabling it is a project config choice |
271
+ | ADR-0049 | **Accepted** | V6 lands as an amendment to it |
272
+ | Gemini CLI | **Kept, marked unproven**; no new Gemini-only work | MI-082 stays WATCH; live Gemini checks stay blocked without a key |
273
+
274
+ The original options and recommendations follow for the record.
275
+
276
+
277
+ | Decision | Blocks | Recommendation |
278
+ |---|---|---|
279
+ | Re-open MI-058 (a control-plane loop above the runtimes) | A1 | Re-open as "a foreground loop over PAN's own state, not a daemon or a sixth runtime": new evidence is Anthropic's long-running harness posts, bmad-loop's "no LLM in the control loop", the self-conditioning result, and the field record in the stop-guard header that prose chains drop a phase boundary |
280
+ | Amend ADR-0047 D2 so double-backed steps count as tier 0 | H1, H2, H8, H9 | Amend: nothing is spent, so the cap's purpose holds |
281
+ | Amend MI-114's "five or more reps" to "an SPRT decision or a stated power" | H3, S4, R2 | Amend: five reps cannot separate variants |
282
+ | A standing monthly spend cap for model tiers and the autopilot | H2 record, H4, H10, S2–S4 | A cap recorded in `harness/README.md`; cassettes keep nightly runs free |
283
+ | Record mode on subscription logins | H2 | Start on API-key auth only; subscription record mode is a separate decision |
284
+ | Cross-vendor review lane (code leaves for another vendor) | R4 | Opt-in per project, off by default |
285
+
286
+ ### 3.5 What not to do
287
+
288
+ All inherited entries hold. Added for this program:
289
+ - **Do not let an agent edit its own evaluator.** Scenarios, allowlists, coverage policy, corpus truth files and CI config are out of scope for every bot lane, enforced by a scope check.
290
+ - **Do not trust an agent's number where code can measure it.** Test counts, points and pass claims feed gates only when an engine measured them.
291
+ - **Do not measure a prompt change with fewer reps than its power needs**; use paired designs and sequential stopping instead.
292
+ - **Do not add multi-agent debate** as a quality step: it does not reliably beat self-consistency.
293
+ - **Do not chase runtime count, personas or an always-on bootstrap** — unchanged.
294
+
295
+ ---
296
+
297
+ ## Phase 4: Specifications for the first wave
298
+
299
+ R45 is specified as F1 in `roadmap_and_competition_2026_q4_featureai.md`; V6, V9, H5, L2, L3 and L4 are specified by their §3.2 rows.
300
+
301
+ ### V1 — Phase gate in code
302
+
303
+ **Files:** `pan-wizard-core/bin/lib/phase.cjs` (new `phaseGate`, `cmdPhaseGate`; `cmdPhaseComplete` calls the gate first), `pan-wizard-core/bin/pan-tools.cjs` (dispatch `phase gate`), `verify.cjs` (`reconcilePhase` gains the test-record cross-check and returns `unverifiable` with no must_haves), `verify-scope.cjs` (freshness with an inputs hash), `findings.cjs` (`findingsDebt` reused), `workflows/exec-phase.md` (reconcile before `update_roadmap`; route on the gate), `workflows/transition.md`, the native `pan-exec-waves` script in `bin/install-lib.cjs` (final step runs `phase gate --raw`), `mcp/merge-gate.cjs` (`verify_pass` from the gate), `docs/CLI-REFERENCE.md`, tests.
304
+
305
+ **Steps:** (1) Implement `phaseGate` returning `{ok, reasons[], facts{}}` with one reason code per refusal class. (2) `phase complete` refuses on `ok:false` unless `--force --reason`, which records a `decision` disposition. (3) Wire every caller. (4) Update the surface registry and the dispatcher-arms test.
306
+
307
+ **Tests (at least 10):** one per refusal reason (missing summary, failed or gaps verification, `human_needed` without approval, stale, reconcile contradiction, failed test record, open critical finding, stub found, integrity violation); a clean pass; `--force` without a reason refused; `--force --reason` writes the disposition; CRLF verification parses the same; the native script stops on `ok:false`; the MCP merge request reports the gate's verdict, not the caller's flag.
308
+
309
+ **Runtime matrix:** all five ✅ — the gate is a pan-tools verb called by markdown on every runtime and by the native script on Claude Code.
310
+
311
+ ### V7 — Plan checks in code
312
+
313
+ **Files:** `verify.cjs` (new `cmdVerifyPlanSet`), `phase.cjs` (`buildPlanIndex`, `dependencyNames` reused), `roadmap.cjs` (`roadmapRequirementIds`), `findings.cjs` (plan-check record stores `plans_sha`), `workflows/plan-phase.md` (run before the checker; loop to the planner on exit 1), `workflows/exec-phase.md` (initialise refuses on a missing or mismatched check, with an override reason), plan template (`planned_commit`), tests.
314
+
315
+ **Tests (at least 10):** missing requirement; same-wave overlap without a dependency (error); with a dependency (allowed); cycle; missing reference; future-wave reference; wave arithmetic; clean set; edited plan after a passing check refused at exec; no check at all refused unless overridden; drift list names changed interface files.
316
+
317
+ **Runtime matrix:** all five ✅.
318
+
319
+ ### V3 — Test-integrity guard
320
+
321
+ **Files:** new `verify-integrity.cjs` (reusing `committedFiles` from `verify-scope.cjs` and the shapes in `scripts/test-quality-lint.cjs`, ported into the shipped core), dispatcher, `agents/pan-executor.md` (read-only tests rule and `BLOCKED_SPEC_CONFLICT`), `workflows/exec-phase.md` (route the new status), V1 consumes it, tests.
322
+
323
+ **Tests (at least 10):** deleted test file; renamed test; `.skip`/`.only`/`xit`/`@pytest.mark.skip`/`t.Skip`/`#[ignore]` added; assertion count drop; expectation edited in an undeclared test; snapshot rewrite; always-true assert; a declared test edit allowed; clean diff passes; Python and Go fixtures; the executor status routes to a human ruling.
324
+
325
+ **Runtime matrix:** all five ✅ (engine verb plus prompt text emitted to every runtime).
326
+
327
+ ### H3 — Statistics in the harness
328
+
329
+ **Files:** new `harness/src/stats.cjs` (`wilson`, `passHatK`, `passAtK`, `pairedSignTest`, `sprt`, `powerN`), `harness/src/run.cjs` (report columns, `--until-decided`), `harness/src/ledger.cjs` (interval-based promotion for tier ≥1, `flaky` class), `harness/README.md`, `tests/harness.test.cjs`.
330
+
331
+ **Tests:** known values (Wilson 3/5 at 95% ≈ [0.231, 0.882]; 4/5 ≈ [0.38, 0.96]); pass^k on hand-computed counts; SPRT decisions on synthetic sequences in both directions; power for 0.6 → 0.8 at 80% power, two-sided α 0.05, unpooled normal approximation ≈ 79 per arm; tier-0 promotion unchanged.
332
+
333
+ ### A7 — Pre-tool guard hook
334
+
335
+ **Files:** new `hooks/pan-guard.js`; `bin/install-lib.cjs` (`HOOK_EVENT_MAP` gains a pre-tool slot per runtime; OpenCode none), `scripts/build-hooks.js` (`HOOKS_TO_COPY`), installer registration and uninstall, `docs/HOOKS.md`, tests per host payload shape (fixtures captured from each host's documented payloads; the four pre-tool names are already in `tests/fixtures/hook-vocabulary.json` (read `2026-09-23`): re-read each host reference, bump the read dates, and add payload-shape fixtures per host).
336
+
337
+ **Policy (deny on):** writes matching secret patterns (reuse the trace logger's patterns); direct writes to `state.md`, `findings.jsonl` and the cost ledger outside `pan-tools`; any write by plan-checker, reviewer, hardener, meta-reviewer or verifier; executor edits to test files outside the current plan's `<files>`. **Fail-open on parse errors** for usability, logged; never fail-open on a matched deny.
338
+
339
+ **Runtime matrix:** Claude ✅ `PreToolUse` · Codex ✅ `PreToolUse` · Gemini ✅ `BeforeTool` (registration tested; live behaviour unproven without a key, §3.4) · Copilot ✅ `preToolUse` · OpenCode — (no hook event; a `tool.execute.before` plugin path is a later item).
340
+
341
+ ---
342
+
343
+ ## Phase 5: Risk Assessment
344
+
345
+ | Risk | Impact | Mitigation |
346
+ |---|---|---|
347
+ | Gates refuse honest work and frustrate users | High | Ramp each gate from warning to error (CodeRabbit's pattern); every refusal names its fix; `--force --reason` always available and recorded |
348
+ | Language coverage of the test gate and mutation operators is uneven | Medium | Configurable `test_command`; operators start with JS/TS/Python/Go/Rust, unknown languages report `not_checked`, never `passed` |
349
+ | Mutation runs are slow on large suites | Medium | Changed, covered lines only; seeded samples; time budget; report mode first |
350
+ | The model double drifts from real host behaviour | Medium | Capture mode records real requests; record mode refreshes cassettes per host version; drift is reported, never hidden |
351
+ | Cassettes leak code or transcripts | High | Stored outside the public repo, headers stripped, scrub step before any commit |
352
+ | The autonomy loop widens the blast radius of permission-bypass flags | High | Always on a branch or worktree; graded autonomy; guard hook; dollar governor; human merge as the only stop that writes to the default branch |
353
+ | Self-improvement games its evaluator | High | Evaluator files out of reach by code; canary mutants; held-out scenarios; human merge (DGM's documented log-faking) |
354
+ | A host retires or narrows its CLI (Gemini CLI was replaced by Antigravity CLI for unpaid and Google One accounts on `2026-06-18`, geminicli.com/docs; gsd-core removed its Gemini lane) | Medium | MI-082 stays WATCH with this fact recorded; Antigravity reads the shared `.agents/` tree; no new work starts on Gemini-only surfaces |
355
+ | Five-runtime parity slips as features grow | Medium | Every feature lands as a pan-tools verb first; host-specific parts are additive and listed in the runtime matrix |
356
+ | Statistics raise the cost of claims | Low | Sequential testing stops early; cassettes make most reruns free |
357
+
358
+ ---
359
+
360
+ ## Sources (read `2026-10-12` unless dated otherwise)
361
+
362
+ - **PAN code** (verified this session): `phase.cjs` `cmdPhaseComplete`; `workflows/exec-phase.md` step order; `findings.cjs` auto-fix rows; `verdict.cjs` `findingId`; `focus.cjs` stop logic; `harness/src/*`.
363
+ - **Research (arXiv abstracts):** `2510.20270` ImpossibleBench; `2306.09896` self-repair; `2509.09677` self-conditioning; `2405.15793` SWE-agent; `2407.01489` Agentless; `2401.08500` AlphaCodium; `2402.09171` TestGen-LLM; `2501.12862` ACH; `2601.22832` JiT catching tests; `2102.11378` Google mutation testing (TSE 2021); `2607.00990` SWE-Doctor; `2507.19457` GEPA; `2505.22954` DGM; `2411.00640` error bars; `2406.12045` tau-bench; `2311.17371` multi-agent debate; `2404.18796` PoLL; `2503.15223` PatchDiff.
364
+ - **Vendor and product docs:** kiro.dev (specs, correctness, hooks, steering); github/spec-kit (clarify, analyze, checklist templates); docs.bmad-method.org (deep-recon, architecture, review); open-gsd/gsd-core (FEATURES, TESTING-SUITES, quick-batch, ADR-5057); cursor.com (bugbot, building-bugbot, cloud-agent capabilities, hooks, debug mode); github.blog ReviewBench; greptile.com (v3, memory and learning); docs.coderabbit.ai (learnings, pre-merge checks); docs.qodo.ai; playwright.dev test agents; code.claude.com (cli-reference, hooks, workflows, routines, llm-gateway, monitoring-usage); anthropic.com/engineering (long-running harnesses, harness design, managed agents, sandboxing); learn.chatgpt.com (Codex non-interactive, sandboxing, hooks); docs.github.com (Copilot hooks, cloud agent risks); geminicli.com hooks reference; docs.factory.com (droid exec, missions, droid shield); docs.augmentcode.com (Cosmos memory); inspect.aisi.org.uk (metrics, caching, early stopping, agent bridge); apple.github.io/foundationdb testing; sakana.ai/dgm.
365
+ - **Local probe:** `claude -p` against a local Messages API mock with a dummy key and scratch config dir (this session).