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,267 @@
1
+ # Spec: Testing System Redesign — surface-derived coverage that survives a rewrite
2
+
3
+ **Generated:** 2026-09-17 · **Method:** `/featureAI` · **Tree:** `main` + the uncommitted v3.28.1 cost-attribution work · **Status:** proposed
4
+
5
+ ---
6
+
7
+ ## Phase 0 — Problem Framing
8
+
9
+ ### 0.1 Problem statement
10
+
11
+ The suite is large and green, and it still let three things through in one week: hook rows that booked a whole session's usage to one subagent (no test drove the hook against a real per-agent transcript), a test file that reported one passing test while fifteen of its sixteen never executed (an in-process call reached `output()`, which exits the process), and a dozen "did not crash" assertions that a crash satisfies. The measured picture (2026-09-17, Node's own coverage instrumentation over every shipped file) is 93.6% of lines and 94.0% of functions executed — good — but 31% of the CLI dispatcher's branches, four verbs never dispatched by any test, every "unknown subcommand" error arm untouched, two hooks never spawned as processes, and MCP registration asserted after a real install for one runtime of five. Coverage is high where tests happened to be written and absent where nobody thought to look, because *what must be tested* is inferred from the tests rather than derived from the code. Why now: v3.28.1 rebuilds every field ledger on the strength of these tests, and the next surface change (a verb, a hook event, a runtime) will again be covered only if someone remembers.
12
+
13
+ ### 0.2 Scope
14
+
15
+ | In scope | Out of scope |
16
+ |---|---|
17
+ | A **surface registry** derived mechanically from the code: every dispatcher verb and subcommand and its error arm, every installer flag, every hook × runtime registration, every MCP tool and resource, every config default key, every shipped command, agent and workflow file | Rewriting PAN's shipped behaviour to make it easier to test |
18
+ | A **scenario map** that ties each surface item to the test that exercises it, failing when an item has none — static (a test names it) and dynamic (the arm actually executed under coverage) | Model-tier behavioural runs (the PAN Harness owns those; this spec wires tier 0 in, no more) |
19
+ | A **coverage gate** in the release check with per-group floors and an explicit, reasoned allowlist | Third-party coverage or mutation tooling as a *runtime* dependency (zero runtime dependencies is a release gate) |
20
+ | **Assertion-quality lints** that fail the suite on the shapes that proved vacuous: OR-shaped "no crash" checks, in-process `cmd*` calls, bare `return` skips, `assert.ok(true)`, unparsed CLI output | Test speed work beyond keeping the suite under the current wall-clock |
21
+ | **Process-level hook tests** for all six hooks from captured payload fixtures, and the six known-weak assertions rewritten | Playwright / VS Code e2e (unchanged) |
22
+ | A **from-scratch layout** with layer names and a migration that never breaks the glob-free runner | Moving existing files for tidiness alone |
23
+
24
+ ### 0.3 Success criteria (measurable)
25
+
26
+ ```text
27
+ SC-1 Every dispatcher case arm (verbs, subcommands, unknown-subcommand errors) is executed by at least one
28
+ test under coverage; the gate fails on the first arm that is not — measured from lcov, not from grep.
29
+ SC-2 Every installer flag, every hook×runtime registration, every MCP tool and resource, every config
30
+ default key is named by at least one test that runs the real code path; the static map fails otherwise.
31
+ SC-3 Line coverage ≥ 92% overall and per group (installer ≥ 90, hooks ≥ 90, lib ≥ 92, mcp ≥ 95, dispatcher
32
+ case arms 100%); function coverage ≥ 93%; every exclusion sits in an allowlist with a one-line reason.
33
+ SC-4 The assertion-quality lint passes with an empty allowlist for the seven banned shapes, and the six
34
+ weak assertions found by the 2026-09-17 audit are rewritten so a broken feature fails them.
35
+ SC-5 All six hooks have a spawned, stdin-driven test from a captured payload fixture, on all runtimes that
36
+ register them; MCP registration is asserted after a real install for all five runtimes.
37
+ SC-6 Starting from an empty tests/ directory, `node scripts/test-surface.cjs --scaffold` emits one stub per
38
+ surface item, so a rebuilt suite cannot miss a surface by construction.
39
+ SC-7 No regression: the existing suite stays green on the 3 OS × 3 Node CI matrix; the coverage gate runs
40
+ on the Node 22 job only (threshold flags exist from Node 22.8) and is advisory on 18/20.
41
+ SC-8 Documentation: DEVELOPMENT.md "Writing Tests" describes the layers, the doctrine and the lints;
42
+ CONTRIBUTING.md points at the scaffold; CLAUDE.md keeps the only counts.
43
+ ```
44
+
45
+ ### 0.4 User stories
46
+
47
+ ```text
48
+ As the maintainer, I want the suite to tell me which shipped surface has no test,
49
+ so that a new verb or hook cannot ship unexercised, instead of finding out from a field ledger.
50
+
51
+ As a contributor, I want to add a subcommand and be told exactly which test to write,
52
+ so that coverage is a checklist I complete, instead of a number I hope stays high.
53
+
54
+ As the maintainer, I want a green suite to mean the assertions could have failed,
55
+ so that "4,000 tests pass" carries information, instead of counting rows that assert nothing.
56
+
57
+ As a future maintainer rebuilding the tests from scratch, I want the required inventory to come from the code,
58
+ so that a rewrite covers everything the first suite covered, instead of everything someone remembered.
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Phase 1 — Internal Reconnaissance
64
+
65
+ ### 1.1 What exists
66
+
67
+ - **Runner and layers.** `scripts/run-tests.cjs` expands `tests/*.test.cjs` and `tests/scenarios/*.test.cjs` deterministically (PowerShell and Node < 22 do not expand globs). Two layers only: unit and scenario. `tests/helpers.cjs` exports `runPanTools` (real CLI via `execSync`), `createTempProject`, `cleanup`, `createScenarioRunner`, `buildPluginInto`, `buildAgentPluginInto` and the three path constants. `tests/contracts/` holds JSON-shape schemas for payloads; `tests/fixtures/` holds the module export pin and the Agent Plugins schemas.
68
+ - **Doctrine** (DEVELOPMENT.md "Writing Tests", the 2026-08 audit chain): fixtures come from emitted output, every assertion kind is proven able to fail, temp dirs only, all five runtimes where a path is runtime-specific, `node:test` not Jest.
69
+ - **Class-closing lints already in the suite**: `doc-command-surface` (the CLI surface parsed from the dispatcher's own error strings must appear in the shipped docs), `module-surface` (export pin), `claude-md-counts` (the counts table matches disk), `package-contract` (zero dependencies), `shipped-content-prefix`, `model-version-drift`, `native-workflows-drift` (script ⇄ markdown twin), `exit-code-contract` (error-family exit codes at their single point of definition), `guardrails`, `links validate` in CI. These are the model for what this spec generalises: derive the requirement from the code, assert the suite meets it.
70
+ - **Coverage baseline** (this session, dependency-free: `node --test --experimental-test-coverage` with include globs, lcov reporter, grandchild processes captured through the inherited `NODE_V8_COVERAGE`): lines 93.6%, functions 94.0%, branches 77.9%; lib 94.6, mcp 99.1, installer 92.9, hooks 91.3, scripts 87.5, dispatcher 80.2 lines / 31.2 branches. Never dispatched: `experiment`, `distill`, `squad`, `worktree`; sub-arms `optimize trace|apply|list|stats`, `learn promote|unpromote --pattern`, `learn lint --source-root`, `campaign schedule --daily-budget`, `campaign record-run`, `focus reflection`, `memory select|budget`, `doc-lint flags`, `bridge cache`, `git sync`, the MCP `git` tool, `--flag=value` parsing, and every "Unknown subcommand" arm.
71
+ - **Quality audit findings** (independent read, 2026-09-17): MCP registration after a real install asserted for OpenCode only; Gemini's settings check reduces to "hooks key truthy"; Claude's SubagentStop logger wiring asserted only on uninstall; `roadmap update-plan-progress` asserted as exit 0 only; the whatif worktree round-trip skips itself on the error it should catch; `commit --fail-on-error` asserted only inside a condition false on a machine with a global git identity; about a dozen scenario tests assert "some output or some error"; `pan-context-monitor` and `pan-check-update` never spawned; a bare `return` on Linux counts as a pass; wall-clock assertions under load; a test that snapshots the developer's real HOME.
72
+ - **The exit trap** (this session): `cost-rebuild.test.cjs` called `cmdCostRebuild` in-process; `output()` ends with `process.exit`, the child died after the first test, `node --test` reported `tests 1 / pass 1`, and CI would have stayed green. Nothing in the suite forbids it.
73
+ - **Harness.** `harness/` runs JSON scenarios against a packed, installed artifact; tier 0 is model-free and free and is already Gate 1 of `release:check`'s neighbours (`npm run harness`); it is not in CI.
74
+ - **CI.** `ci.yml`: `npm test`, `npm run test:scenarios`, `links validate`, 3 OS × Node 18/20/22; `release:check` runs `test:all` again as Gate 2.
75
+
76
+ ### 1.2 Where the surface lives (the registry's sources)
77
+
78
+ | Surface | Source of truth | Extraction |
79
+ |---|---|---|
80
+ | Verbs | `pan-tools.cjs` usage line (`Commands: …`) | already parsed by `doc-command-surface` |
81
+ | Subcommands + error arms | `Unknown <group> subcommand. Available: …` strings | `suggest.cjs buildSubcommandIndex` |
82
+ | Dispatcher case arms | `case '<label>':` in `pan-tools.cjs` | line-anchored regex; lcov `DA` lines |
83
+ | Installer flags | `'--flag'` literals in `bin/install.js` | regex |
84
+ | Hook × runtime | `HOOK_EVENT_MAP` / builders in `install-lib.cjs` | require + enumerate |
85
+ | MCP tools / resources | `pan-wizard-core/mcp/tool-registry.cjs` | require + enumerate |
86
+ | Config defaults | `buildConfigDefaults()` in `config.cjs` | require, flatten keys |
87
+ | Shipped content | `commands/pan/*.md`, `agents/*.md`, `pan-wizard-core/workflows/*` | readdir |
88
+ | Hook payload shapes | captured fixtures per event | `tests/fixtures/hooks/*.json` (new) |
89
+
90
+ ### 1.3 Runtime compatibility
91
+
92
+ The feature is development-side (nothing ships), but its requirements are runtime-aware: hook×runtime registration, per-runtime MCP registration, per-runtime installer paths and content conversion each become a row in the surface, so a runtime added or a hook event moved shows up as an uncovered row on the next run. Tests already run on Windows, Linux and macOS; nothing here is platform-specific except the rule that platform-conditional tests use `t.skip(reason)` so the skip is visible.
93
+
94
+ ---
95
+
96
+ ## Phase 2 — Comparative Notes
97
+
98
+ The spec-driven peers in `docs/COMPARISON.md` ship prompts and lightweight scripts and, as far as their public repositories show, test them thinly or not at all; PAN's practice of installing the real artifact into temp directories across five runtimes is already ahead of that field. The practices worth importing come from elsewhere:
99
+
100
+ - **Coverage as a gate, not a report** — mature CLIs fail the build on a floor with an explicit allowlist. Node's own runner supports `--test-coverage-lines/-functions/-branches` from 22.8, so the gate needs no dependency.
101
+ - **Contract-from-code** — projects that enumerate their CLI from its own help output and diff it against tests (the way `doc-command-surface` already diffs it against docs) do not regress a subcommand silently.
102
+ - **Golden payloads with provenance** — hook and webhook consumers keep captured real payloads with the producer version stamped on them; PAN's fixture doctrine says the same but has no hook payload captures yet.
103
+ - **Mutation testing** (Stryker for JavaScript) is the standard answer to "would this assertion fail?"; it is a dev-time tool with dependencies, so it is a later, optional phase here — the assertion-quality lint covers the shapes that actually bit.
104
+
105
+ Differentiation: PAN can make the surface registry itself a shipped-quality artifact (`tests/fixtures/surface.json`, committed, diffed in review), so a PR that adds a surface shows the new rows and their required tests in the same diff.
106
+
107
+ ---
108
+
109
+ ## Phase 3 — Design
110
+
111
+ ### 3.1 Architecture
112
+
113
+ Four new pieces, one gate, one migration.
114
+
115
+ 1. **`scripts/test-surface.cjs`** — extracts the registry (§1.2) and writes `tests/fixtures/surface.json` (sorted, stable). Modes: `--check` (fail if the committed file differs from the extraction: a surface changed without the registry), `--scaffold <dir>` (emit one `*.test.cjs` stub per surface item without a test, carrying the item's ID in the test title), `--map` (print the scenario map).
116
+ 2. **`tests/surface-map.test.cjs`** (static half) — for each registry row, at least one test file names it as the code names it: a quoted CLI argument for verbs and subcommands, the flag literal for installer flags, the hook filename and event for hook×runtime, the tool name for MCP. Tests declare coverage by referencing the item; no tags to maintain. Failure names the row and the scaffold command.
117
+ 3. **`scripts/coverage-gate.cjs`** (dynamic half; the scratchpad `lcov-summary` and `case-cov` scripts of 2026-09-17 promoted) — runs the suite under `--experimental-test-coverage` with the include globs, parses lcov, and enforces: per-group line/function floors; every dispatcher `case` arm executed; the never-called-function list against `tests/fixtures/coverage-allowlist.json` (`{ "path": "...", "symbol": "...", "reason": "interactive prompt" }`). Prints the ranked gap list on failure. Wired as Gate 9 of `release:check`, and as a CI step on the Node 22 jobs (advisory `continue-on-error` for one release, then required).
118
+ 4. **`tests/test-quality.test.cjs`** — a lint over the test sources themselves. Rules, each with an allowlist entry format `{ file, line, reason }`:
119
+ - Q1 no OR-shaped liveness assert (`output.length > 0 || error.length > 0` and variants);
120
+ - Q2 no in-process call to a `cmd[A-Z]\w+(` export of a lib module (they reach `output()`/`error()` and exit) — use `runPanTools`;
121
+ - Q3 no `assert.ok(true)` / `assert(true)`;
122
+ - Q4 a `runPanTools` result must assert `success` (or `.success === false`) and, when it parses output, parse JSON — flag `.output.length` as the only assertion;
123
+ - Q5 platform conditionals use `t.skip(reason)`, never a bare `return`;
124
+ - Q6 no wall-clock upper bound under 2 s on a spawned process (or an explicit allowlist reason);
125
+ - Q7 no read of the real `os.homedir()` / `process.env.HOME|USERPROFILE` unless wrapped by the `withFakeHome` helper.
126
+ 5. **Hook fixtures and the hook e2e test** — `tests/fixtures/hooks/<event>-<host>.json` captured from real hosts (Claude Code `SessionStart`, `PostToolUse`, `SubagentStop` with `agent_id`, `Stop`; Codex and Copilot shapes where they differ), each with `captured_from` (host, version, date) in a sibling `.meta.json`. `tests/hooks-e2e.test.cjs` spawns every hook in `HOOKS_TO_COPY` with the matching fixture on stdin against a temp PAN project and asserts the observable effect (ledger row, trace event, cache file, statusline output, stop-guard decision) and exit code — for each runtime that registers the hook, through the installed copy in that runtime's directory.
127
+ 6. **Helpers** — add to `tests/helpers.cjs`: `withFakeHome(fn)` (HOME/USERPROFILE/CLAUDE_CONFIG_DIR sandbox), `readLedger(cwd)`, `spawnHook(name, payload, cwd)`, `installInto(cwd, flags)` (the five-runtime matrix helper the scenario tests reimplement today).
128
+ 7. **Layout (from scratch)** — `tests/unit/`, `tests/contract/` (CLI exit-code and JSON contracts per verb, scaffolded from the registry), `tests/install/` (installer × runtime), `tests/hooks/`, `tests/mcp/`, `tests/lint/` (the class-closing lints), `tests/scenarios/` (workflow-level). The runner takes directories, so `package.json` gains the new directories and CI needs no change. **Migration rule:** new tests go into the new layout; existing files move only when touched for another reason; `tests/*.test.cjs` stays a valid location until the last file leaves it. The counts table's "unit test files" row becomes "test files (all layers)".
129
+
130
+ ### 3.2 Implementation plan
131
+
132
+ ```text
133
+ P1 Lints and gate (no behaviour change)
134
+ 1. scripts/test-surface.cjs — extractor + --check/--scaffold/--map; commits tests/fixtures/surface.json
135
+ 2. tests/surface-map.test.cjs — static map; initial allowlist = today's uncovered rows, each with a reason,
136
+ burned down in P2
137
+ 3. scripts/coverage-gate.cjs — lcov parse, group floors, case-arm rule, allowlist; release-check Gate 9;
138
+ CI Node-22 step (advisory first)
139
+ 4. tests/test-quality.test.cjs — Q1–Q7; initial allowlist = the ~12 OR-shaped asserts and the known bare returns
140
+ 5. tests/helpers.cjs — withFakeHome, readLedger, spawnHook, installInto
141
+
142
+ P2 Close the known gaps (the audit's six HIGHs + the dispatcher arms)
143
+ 6. tests/install/mcp-registration.test.cjs — install, parse the runtime's MCP config, assert the `pan` entry's args resolve
144
+ to an existing server.cjs, uninstall, assert removal — for all five runtimes
145
+ 7. tests/install/gemini-hooks.test.cjs — the three event arrays carry pan-* commands; experimental.enableAgents === true
146
+ 8. tests/scenarios/hook-registration — EXPECTED_HOOKS covers all six; SubagentStop carries both loggers on install
147
+ 9. roadmap update-plan-progress, whatif round-trip (assert.ifError), commit --fail-on-error (force the failure as
148
+ exit-code-contract does), the OR-shaped "no crash" asserts → exit code + parsed error body
149
+ 10. tests/contract/dispatcher-arms.test.cjs — one parametrised test per never-dispatched verb/sub-arm and per
150
+ "Unknown <group> subcommand" arm, asserting the exit-code contract and
151
+ the Available: string; `--flag=value` parsing
152
+
153
+ P3 Hooks as processes
154
+ 11. tests/fixtures/hooks/*.json + .meta.json — captured payloads with provenance (Claude Code first; Codex/Copilot as
155
+ their CLIs become available on a machine)
156
+ 12. tests/hooks/hooks-e2e.test.cjs — every hook × every registering runtime, spawned from the installed copy
157
+
158
+ P4 Layout migration + docs
159
+ 13. package.json scripts — add the new directories to test / test:all / test:watch
160
+ 14. docs/DEVELOPMENT.md "Writing Tests" — layers, doctrine, the lint rules and how to satisfy them, the scaffold
161
+ 15. CONTRIBUTING.md — "add a surface → run the scaffold → fill the stub"
162
+ 16. CLAUDE.md — counts row rename; nothing else numeric anywhere
163
+
164
+ P5 Behavioural tier in CI
165
+ 17. .github/workflows/ci.yml — `npm run harness` (tier 0) on the ubuntu Node-22 job; run dir under the
166
+ runner's temp; ledger untouched
167
+
168
+ P6 Optional, later
169
+ 18. Mutation testing with Stryker as a devDependency behind `npm run test:mutate`, sampled (the hooks and the
170
+ dispatcher first); results as a report, never a gate, until the run time is known
171
+ ```
172
+
173
+ ### 3.3 Test plan for the machinery itself (`tests/lint/test-system.test.cjs`)
174
+
175
+ Happy path
176
+ 1. The extractor finds `state snapshot` and every group parsed by `doc-command-surface` (sanity: the parse is not vacuous).
177
+ 2. `--check` passes on the committed registry and fails, naming the row, when a subcommand is added to a copied dispatcher.
178
+ 3. The static map passes on the current suite plus its allowlist; removing a named test file makes it fail on that row.
179
+ 4. The coverage gate passes on a fixture lcov above every floor and reports `ok` per group.
180
+ 5. `--scaffold` into an empty temp dir emits one stub per registry row, each stub's title carrying the row ID.
181
+
182
+ Edge cases
183
+ 6. A case arm whose first executable line is another `case` (fallthrough) is attributed to the shared body, not reported as unexecuted.
184
+ 7. An allowlisted never-called function with a reason is tolerated; the same entry without a reason fails the gate.
185
+ 8. Two spellings of a flag (`--flag`, `--flag=value`) count as one surface row.
186
+ 9. A hook fixture whose `.meta.json` lacks `captured_from` fails the fixtures lint.
187
+
188
+ Error cases
189
+ 10. Q2 flags `cmdCostRebuild(` called in a test file and points at `runPanTools`; the same call inside a `// quality-allow: reason` line is accepted once and listed.
190
+ 11. Q1 flags `assert.ok(a.length > 0 || b.length > 0)` and the `||`-in-`assert.ok` variants; a parsed-JSON assertion in the same file passes.
191
+ 12. A malformed lcov file makes the gate fail closed (exit 1 with the parse error), never pass.
192
+
193
+ Runtime-specific
194
+ 13. The hook e2e harness spawns the SubagentStop logger through each of the four registering runtimes' installed copies and finds one ledger row per runtime with `token_source: agent-transcript`.
195
+ 14. MCP registration is asserted for all five runtimes; the OpenCode and Gemini entries point at the installed `server.cjs`.
196
+
197
+ ---
198
+
199
+ ## Phase 4 — Specification Output
200
+
201
+ ```markdown
202
+ ## Feature: Surface-derived test coverage and quality gates
203
+
204
+ ### Files to Create/Modify
205
+ - scripts/test-surface.cjs (new) extractor, --check, --scaffold, --map
206
+ - scripts/coverage-gate.cjs (new) lcov gate; promoted from the 2026-09-17 scratchpad scripts
207
+ - tests/fixtures/surface.json (new, committed) the registry
208
+ - tests/fixtures/coverage-allowlist.json (new) reasoned exclusions
209
+ - tests/fixtures/hooks/*.json, *.meta.json (new) captured hook payloads with provenance
210
+ - tests/surface-map.test.cjs (new) static scenario map
211
+ - tests/test-quality.test.cjs (new) Q1–Q7 lint
212
+ - tests/hooks/hooks-e2e.test.cjs (new) every hook × registering runtime, spawned
213
+ - tests/install/mcp-registration.test.cjs (new) five-runtime MCP registration and strip
214
+ - tests/install/gemini-hooks.test.cjs (new) positive Gemini settings assertions
215
+ - tests/contract/dispatcher-arms.test.cjs (new) never-dispatched arms + unknown-subcommand errors + --flag=value
216
+ - tests/lint/test-system.test.cjs (new) the 14 cases above
217
+ - tests/helpers.cjs (modify) withFakeHome, readLedger, spawnHook, installInto
218
+ - tests/scenarios/hook-registration.test.cjs, tests/e2e-install.test.cjs, tests/whatif.test.cjs,
219
+ tests/commands.test.cjs, tests/scenarios/smoke.test.cjs, tests/scenarios/feedback-errors.test.cjs,
220
+ tests/scenarios/contracts-*.test.cjs, tests/scenarios/workflow-*.test.cjs, tests/scenarios/runtime-*.test.cjs,
221
+ tests/scenarios/state-integrity.test.cjs (modify) the audit's weak assertions rewritten
222
+ - scripts/release-check.js (modify) Gate 9: coverage gate
223
+ - .github/workflows/ci.yml (modify) coverage gate + tier-0 harness on the Node-22 job
224
+ - package.json (modify) test directories; `test:coverage`, `test:surface` scripts
225
+ - docs/DEVELOPMENT.md, CONTRIBUTING.md, CLAUDE.md (modify) layers, lints, scaffold, counts row rename
226
+
227
+ ### Implementation Steps
228
+ 1. P1 lints and gate with allowlists seeded from today's gaps — the suite stays green, every gap is now named.
229
+ 2. P2 burn the allowlists down: dispatcher arms, the six HIGHs, the OR-shaped asserts.
230
+ 3. P3 hook fixtures and the spawned hook matrix.
231
+ 4. P4 layout and docs; P5 harness tier 0 in CI; P6 mutation testing as a report.
232
+
233
+ ### Tests Required
234
+ - The 14 cases in §3.3; the P2 and P3 tests listed above; all existing tests unchanged in intent.
235
+
236
+ ### Documentation Updates
237
+ - DEVELOPMENT.md "Writing Tests": layers, the seven lint rules with the fix for each, the scaffold workflow,
238
+ the coverage gate and how to add an allowlist entry (reason mandatory).
239
+ - CONTRIBUTING.md: the surface-change checklist.
240
+ - CLAUDE.md: counts row rename only.
241
+ - CHANGELOG [Unreleased]: "Changed — the test suite is measured against the code's own surface".
242
+
243
+ ### Runtime Matrix
244
+ | Runtime | Supported | Notes |
245
+ |----------|-----------|-------|
246
+ | Claude | ✅ | hooks e2e for SessionStart, PostToolUse, SubagentStop, Stop; MCP `.mcp.json` asserted |
247
+ | Codex | ✅ | hooks e2e via `.codex/hooks.json` (async observers); MCP registration asserted; payload fixtures pending a Codex CLI on a build machine |
248
+ | Gemini | ✅ | hooks e2e via settings.json; positive hook-event and enableAgents assertions; MCP asserted |
249
+ | OpenCode | ✅ | no hooks (asserted absent); MCP `.opencode/opencode.json` asserted (already) |
250
+ | GitHub | ✅ | Copilot hooks via `.github/hooks/pan.json`; MCP `.github/mcp.json` asserted; payload fixtures pending a Copilot CLI |
251
+ ```
252
+
253
+ ---
254
+
255
+ ## Phase 5 — Risk Assessment
256
+
257
+ | Risk | Impact | Mitigation |
258
+ |---|---|---|
259
+ | The coverage gate is flaky across OS/Node versions (different lines counted) | Medium | Gate on the Node 22 job only; floors with 1-point headroom below the measured baseline; arms rule (binary) rather than exact percentages where possible |
260
+ | Coverage of grandchild processes is lost when a test passes a custom `env` without `process.env` | Medium | Q7-style lint: `env:` objects in spawn calls must spread `process.env`; the gate's per-file table makes the drop visible |
261
+ | Allowlists become the place gaps go to die | High | Every entry needs a reason and an owner date; the surface-map failure message counts allowlisted rows; P2 burns the seed list to the interactive prompt and network calls only |
262
+ | `--scaffold` emits stubs that get committed as passing no-op tests | Medium | Stubs contain `t.todo()` and fail the quality lint until filled; `node --test` reports todo counts |
263
+ | Hook payload fixtures drift from the hosts | Medium | `.meta.json` provenance; a `models check`-style staleness note after 90 days; the real-transcript probe pattern from 2026-09-17 documented as the capture method |
264
+ | Moving test files breaks the glob-free runner or PowerShell CI | Low | Directories, not globs; runner already takes a list; new dirs added to scripts before any file moves |
265
+ | Harness tier 0 in CI is slow or needs the packed artifact's disk space | Low | It packs and installs into temp in ~10 s locally; ubuntu Node-22 job only; `continue-on-error` for one release |
266
+ | Mutation testing adds a dependency and long runs | Low | P6 is optional, sampled, report-only, devDependency only; zero runtime dependencies untouched |
267
+ | The exit trap recurs in a new shape (a helper that calls `process.exit`) | Medium | Q2 lint plus a `node --test` reporter check in `run-tests.cjs`: a file whose declared test count exceeds its reported count fails the run |