pan-wizard 3.36.0 → 3.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/CHANGELOG.md +3645 -0
  2. package/README.md +36 -48
  3. package/agents/pan-conductor.md +2 -3
  4. package/agents/pan-counterfactual.md +1 -2
  5. package/agents/pan-debugger.md +14 -3
  6. package/agents/pan-design-checker.md +1 -2
  7. package/agents/pan-designer.md +1 -2
  8. package/agents/pan-document_code.md +1 -2
  9. package/agents/pan-hardener.md +2 -3
  10. package/agents/pan-integration-checker.md +1 -2
  11. package/agents/pan-knowledge.md +1 -2
  12. package/agents/pan-meta-reviewer.md +3 -3
  13. package/agents/pan-optimizer.md +4 -4
  14. package/agents/pan-phase-researcher.md +79 -488
  15. package/agents/pan-plan-checker.md +12 -2
  16. package/agents/pan-planner.md +10 -6
  17. package/agents/pan-previewer.md +1 -2
  18. package/agents/pan-project-researcher.md +70 -499
  19. package/agents/pan-release.md +1 -1
  20. package/agents/pan-reviewer.md +9 -3
  21. package/agents/pan-roadmapper.md +12 -7
  22. package/agents/pan-verifier.md +7 -2
  23. package/bin/install-lib.cjs +134 -14
  24. package/bin/install.js +59 -12
  25. package/commands/pan/army.md +1 -1
  26. package/commands/pan/autodev.md +76 -0
  27. package/commands/pan/exec-phase.md +3 -4
  28. package/commands/pan/focus-auto.md +14 -7
  29. package/commands/pan/focus-design.md +4 -5
  30. package/commands/pan/focus-docs.md +24 -0
  31. package/commands/pan/learn.md +13 -6
  32. package/commands/pan/milestone-audit.md +8 -1
  33. package/commands/pan/milestone-done.md +10 -5
  34. package/commands/pan/milestone-new.md +2 -2
  35. package/commands/pan/new-project.md +15 -12
  36. package/commands/pan/plan-phase.md +15 -9
  37. package/commands/pan/quick.md +1 -1
  38. package/commands/pan/review-deep.md +11 -5
  39. package/commands/pan/settings.md +6 -0
  40. package/commands/pan/verify-phase.md +6 -2
  41. package/docs/AGENTS.md +917 -0
  42. package/docs/ARCHITECTURE.md +1054 -0
  43. package/docs/CLI-REFERENCE.md +4582 -0
  44. package/docs/COMPARISON.md +116 -0
  45. package/docs/DEVELOPMENT.md +490 -0
  46. package/docs/ECOSYSTEM-REVIEW-2026-06.md +107 -0
  47. package/docs/ECOSYSTEM-REVIEW-2026-08.md +349 -0
  48. package/docs/EXAMPLES.md +584 -0
  49. package/docs/FAQ.md +254 -0
  50. package/docs/FIELD-HARVEST-2026-07.md +88 -0
  51. package/docs/FIELD-REPORT-army-2026-06.md +121 -0
  52. package/docs/HOOKS.md +638 -0
  53. package/docs/IMPROVEMENT-TODO.md +246 -0
  54. package/docs/INTERNALS.md +485 -0
  55. package/docs/MIGRATION-v2-to-v3.md +258 -0
  56. package/docs/SECURITY-HARDENING.md +230 -0
  57. package/docs/SKILLS-ENHANCEMENT-PLAN-V2.md +122 -0
  58. package/docs/SKILLS-FULL-TEXT.md +9685 -0
  59. package/docs/SKILLS-REFERENCE.md +1037 -0
  60. package/docs/TROUBLESHOOTING.md +1084 -0
  61. package/docs/USER-GUIDE.md +1437 -0
  62. package/docs/archive/SKILLS-ENHANCEMENT-PLAN.md +230 -0
  63. package/docs/audits/AUDIT-2026-08-e2e-ROADMAP.md +117 -0
  64. package/docs/audits/AUDIT-2026-08-e2e-VERIFICATION.md +693 -0
  65. package/docs/audits/AUDIT-2026-08-e2e.md +1546 -0
  66. package/docs/audits/OUTSTANDING-2026-08.md +275 -0
  67. package/docs/audits/STABILITY-TEST-2026-08.md +640 -0
  68. package/docs/branding/README-brand-draft.md +119 -0
  69. package/docs/branding/handoff/IMPLEMENTATION.md +205 -0
  70. package/docs/branding/handoff/README-brand-draft.md +119 -0
  71. package/docs/branding/handoff/image-prompts.md +46 -0
  72. package/docs/branding/image-prompts.md +46 -0
  73. package/docs/branding/nano-banana-prompts.txt +60 -0
  74. package/docs/context-monitor.md +13 -0
  75. package/docs/decisions/ADR-0001-strategic-feature-prioritization.md +83 -0
  76. package/docs/decisions/ADR-0002-copilot-cli-runtime.md +71 -0
  77. package/docs/decisions/ADR-0003-smart-execution.md +84 -0
  78. package/docs/decisions/ADR-0004-copilot-cli-interaction.md +89 -0
  79. package/docs/decisions/ADR-0005-command-naming.md +80 -0
  80. package/docs/decisions/ADR-0006-focus-commands.md +101 -0
  81. package/docs/decisions/ADR-0007-ship-v1.md +73 -0
  82. package/docs/decisions/ADR-0008-map-codebase-mermaid-togaf.md +80 -0
  83. package/docs/decisions/ADR-0009-production-deployment-checklist.md +68 -0
  84. package/docs/decisions/ADR-0010-standards-integration.md +79 -0
  85. package/docs/decisions/ADR-0011-help-commands-rewrite.md +64 -0
  86. package/docs/decisions/ADR-0012-contributors-attribution-index.md +42 -0
  87. package/docs/decisions/ADR-0013-strategic-feature-additions.md +53 -0
  88. package/docs/decisions/ADR-0014-internal-cleanup-code-quality.md +53 -0
  89. package/docs/decisions/ADR-0015-focus-auto-runner.md +296 -0
  90. package/docs/decisions/ADR-0016-enhanced-doc-sync.md +54 -0
  91. package/docs/decisions/ADR-0017-enhanced-focus-design.md +69 -0
  92. package/docs/decisions/ADR-0018-user-reality-testing.md +84 -0
  93. package/docs/decisions/ADR-0019-end-to-end-user-acceptance-testing.md +113 -0
  94. package/docs/decisions/ADR-0020-ai-drift-prevention.md +55 -0
  95. package/docs/decisions/ADR-0021-codebase-mapper-v2.md +76 -0
  96. package/docs/decisions/ADR-0022-lifecycle-completeness.md +63 -0
  97. package/docs/decisions/ADR-0023-opus-4-7-adoption.md +89 -0
  98. package/docs/decisions/ADR-0024-spec-b-v2-completion.md +137 -0
  99. package/docs/decisions/ADR-0025-behavioral-guardrails-layer.md +129 -0
  100. package/docs/decisions/ADR-0026-self-improvement-loop.md +171 -0
  101. package/docs/decisions/ADR-0027-doc-code-link-graph.md +164 -0
  102. package/docs/decisions/ADR-0028-unified-agents-skills-target.md +46 -0
  103. package/docs/decisions/ADR-0029-experiment-evaluator.md +76 -0
  104. package/docs/decisions/ADR-0030-planning-concurrency.md +37 -0
  105. package/docs/decisions/ADR-0031-focus-auto-backlog-source.md +47 -0
  106. package/docs/decisions/ADR-0032-squad-model.md +64 -0
  107. package/docs/decisions/ADR-0033-army-campaign.md +40 -0
  108. package/docs/decisions/ADR-0034-scheduled-campaigns.md +57 -0
  109. package/docs/decisions/ADR-0035-army-hud-dashboard.md +40 -0
  110. package/docs/decisions/ADR-0036-agentic-memory-architecture.md +106 -0
  111. package/docs/decisions/ADR-0037-pin-security-agents-to-opus.md +51 -0
  112. package/docs/decisions/ADR-0038-skill-aligned-decomposition.md +41 -0
  113. package/docs/decisions/ADR-0039-worktree-as-project-variant.md +37 -0
  114. package/docs/decisions/ADR-0040-memory-injection-defense.md +55 -0
  115. package/docs/decisions/ADR-0041-mcp-dual-era-bridge.md +47 -0
  116. package/docs/decisions/ADR-0042-design-parity-both-flows.md +45 -0
  117. package/docs/decisions/ADR-0043-addressable-planning-roots.md +56 -0
  118. package/docs/decisions/ADR-0044-bound-the-cached-context.md +104 -0
  119. package/docs/decisions/ADR-0045-agent-plugins-bundle.md +76 -0
  120. package/docs/decisions/ADR-0046-subagent-frontmatter-decisions.md +39 -0
  121. package/docs/decisions/ADR-0047-pan-harness.md +76 -0
  122. package/docs/decisions/ADR-0048-one-core-per-project.md +43 -0
  123. package/docs/decisions/ADR-0049-machine-verdicts-and-findings-ledger.md +116 -0
  124. package/docs/specs/ai_drift_prevention_featureai.md +286 -0
  125. package/docs/specs/codebase_mapper_v2_featureai.md +930 -0
  126. package/docs/specs/command_naming_optimization_featureai.md +930 -0
  127. package/docs/specs/comp_analysis_markdown_v1.md +149 -0
  128. package/docs/specs/continuous_autonomous_execution_featureai.md +304 -0
  129. package/docs/specs/contributors_attribution_index_featureai.md +476 -0
  130. package/docs/specs/copilot_cli_interaction_featureai.md +868 -0
  131. package/docs/specs/copilot_cli_runtime_featureai.md +647 -0
  132. package/docs/specs/custom-skills-assessment.md +461 -0
  133. package/docs/specs/deployment_audit_findings_featureai.md +243 -0
  134. package/docs/specs/doc_code_link_graph_featureai.md +253 -0
  135. package/docs/specs/documentation_alignment_cleanup_featureai.md +69 -0
  136. package/docs/specs/e2e_visual_testing_featureai.md +615 -0
  137. package/docs/specs/end_to_end_user_acceptance_testing_featureai.md +810 -0
  138. package/docs/specs/evidence-loop-plan.md +76 -0
  139. package/docs/specs/evidence_loop_featureai.md +497 -0
  140. package/docs/specs/focus-auto-optimize-category.md +449 -0
  141. package/docs/specs/focus-auto-optimize-superplan.md +188 -0
  142. package/docs/specs/focus_auto_runner_featureai.md +1102 -0
  143. package/docs/specs/focus_design_v2_featureai.md +197 -0
  144. package/docs/specs/focus_sync_v2_featureai.md +202 -0
  145. package/docs/specs/git_integration_overhaul_featureai.md +326 -0
  146. package/docs/specs/glm_zai_provider_featureai.md +200 -0
  147. package/docs/specs/googlecli_adoption_featureai.md +661 -0
  148. package/docs/specs/help_commands_rewrite_featureai.md +860 -0
  149. package/docs/specs/industry_analysis_strategic_additions_featureai.md +231 -0
  150. package/docs/specs/industry_comparison_and_feature_gaps_featureai.md +674 -0
  151. package/docs/specs/internal_cleanup_code_quality_featureai.md +486 -0
  152. package/docs/specs/investigations/README.md +31 -0
  153. package/docs/specs/investigations/digests/2026-09-28.md +47 -0
  154. package/docs/specs/investigations/digests/2026-10-08.md +62 -0
  155. package/docs/specs/investigations/digests/2026-10-10.md +61 -0
  156. package/docs/specs/investigations/features/debugger-red-loop-first.md +55 -0
  157. package/docs/specs/investigations/features/harness-cross-host-behaviour.md +93 -0
  158. package/docs/specs/investigations/features/optimize-apply-regression-gate.md +66 -0
  159. package/docs/specs/investigations/features/reviewer-smell-baseline.md +57 -0
  160. package/docs/specs/investigations/features/trace-failure-capture.md +69 -0
  161. package/docs/specs/lifecycle_completeness_featureai.md +754 -0
  162. package/docs/specs/local-first-ci.md +42 -0
  163. package/docs/specs/map_codebase_mermaid_togaf_featureai.md +805 -0
  164. package/docs/specs/market-delta-2026-09-superplan.md +310 -0
  165. package/docs/specs/market-ideas-2026-09.md +131 -0
  166. package/docs/specs/market-ideas-2026-10.md +428 -0
  167. package/docs/specs/market-ideas-ledger.md +177 -0
  168. package/docs/specs/memory-optimization-2026-10.md +285 -0
  169. package/docs/specs/multi-track-planning-roots.md +143 -0
  170. package/docs/specs/multi_model_routing_featureai.md +687 -0
  171. package/docs/specs/multi_model_routing_superplan.md +197 -0
  172. package/docs/specs/opus_47_existing_enhancements_featureai.md +247 -0
  173. package/docs/specs/opus_47_extended_features_featureai.md +363 -0
  174. package/docs/specs/opus_47_extended_features_v2_featureai.md +397 -0
  175. package/docs/specs/pan_focus_commands_featureai.md +2336 -0
  176. package/docs/specs/pan_zcode_mcp_bridge_featureai.md +120 -0
  177. package/docs/specs/product-excellence-superplan.md +315 -0
  178. package/docs/specs/product_excellence_program_2026_q4_featureai.md +365 -0
  179. package/docs/specs/production_deployment_readiness_featureai.md +433 -0
  180. package/docs/specs/production_readiness_ship_v1_featureai.md +698 -0
  181. package/docs/specs/real_test_enforcement_featureai.md +213 -0
  182. package/docs/specs/reality-check-2026-09-superplan.md +362 -0
  183. package/docs/specs/right-sized-ceremony.md +74 -0
  184. package/docs/specs/roadmap_and_competition_2026_q4_featureai.md +390 -0
  185. package/docs/specs/self_improvement_loop_featureai.md +875 -0
  186. package/docs/specs/skill-aligned-decomposition.md +155 -0
  187. package/docs/specs/standards_integration_featureai.md +833 -0
  188. package/docs/specs/testing-system-redesign-2026-09.md +267 -0
  189. package/docs/specs/user_reality_testing_system_featureai.md +788 -0
  190. package/docs/specs/watch-triggers.json +22 -0
  191. package/docs/specs/workflow-integration-redesign.md +742 -0
  192. package/docs/specs/workflow_state_consistency_featureai.md +183 -0
  193. package/hooks/dist/pan-context-monitor.js +9 -2
  194. package/hooks/dist/pan-cost-logger.js +5 -0
  195. package/hooks/dist/pan-guard.js +28 -5
  196. package/hooks/dist/pan-stop-guard.js +9 -9
  197. package/hooks/dist/pan-trace-logger.js +5 -0
  198. package/package.json +10 -2
  199. package/pan-wizard-core/bin/lib/agents-md.cjs +57 -8
  200. package/pan-wizard-core/bin/lib/autodev-report.cjs +180 -0
  201. package/pan-wizard-core/bin/lib/autodev.cjs +642 -0
  202. package/pan-wizard-core/bin/lib/ci.cjs +143 -0
  203. package/pan-wizard-core/bin/lib/commands.cjs +1 -1
  204. package/pan-wizard-core/bin/lib/config.cjs +31 -2
  205. package/pan-wizard-core/bin/lib/constants.cjs +27 -1
  206. package/pan-wizard-core/bin/lib/core.cjs +22 -10
  207. package/pan-wizard-core/bin/lib/cost.cjs +14 -4
  208. package/pan-wizard-core/bin/lib/cross-family.cjs +164 -0
  209. package/pan-wizard-core/bin/lib/debug-cases.cjs +104 -0
  210. package/pan-wizard-core/bin/lib/failure-class.cjs +81 -0
  211. package/pan-wizard-core/bin/lib/findings.cjs +34 -4
  212. package/pan-wizard-core/bin/lib/focus.cjs +1 -1
  213. package/pan-wizard-core/bin/lib/hosts.cjs +88 -0
  214. package/pan-wizard-core/bin/lib/init.cjs +7 -2
  215. package/pan-wizard-core/bin/lib/knowledge.cjs +2 -0
  216. package/pan-wizard-core/bin/lib/merge.cjs +50 -0
  217. package/pan-wizard-core/bin/lib/mutate.cjs +16 -5
  218. package/pan-wizard-core/bin/lib/next-action.cjs +112 -0
  219. package/pan-wizard-core/bin/lib/optimize.cjs +2 -2
  220. package/pan-wizard-core/bin/lib/phase.cjs +48 -4
  221. package/pan-wizard-core/bin/lib/plan-lint.cjs +150 -1
  222. package/pan-wizard-core/bin/lib/preview.cjs +23 -4
  223. package/pan-wizard-core/bin/lib/requirements-lint.cjs +130 -0
  224. package/pan-wizard-core/bin/lib/research-lint.cjs +150 -3
  225. package/pan-wizard-core/bin/lib/review-deep.cjs +14 -22
  226. package/pan-wizard-core/bin/lib/review-vote.cjs +105 -0
  227. package/pan-wizard-core/bin/lib/runner.cjs +2 -16
  228. package/pan-wizard-core/bin/lib/sizing.cjs +356 -0
  229. package/pan-wizard-core/bin/lib/squads.cjs +1 -1
  230. package/pan-wizard-core/bin/lib/state-write.cjs +247 -0
  231. package/pan-wizard-core/bin/lib/uat.cjs +149 -0
  232. package/pan-wizard-core/bin/lib/verdict.cjs +26 -3
  233. package/pan-wizard-core/bin/lib/verify-plan-set.cjs +30 -1
  234. package/pan-wizard-core/bin/lib/verify-preflight.cjs +2 -2
  235. package/pan-wizard-core/bin/lib/verify-red.cjs +37 -1
  236. package/pan-wizard-core/bin/lib/verify-retro.cjs +3 -2
  237. package/pan-wizard-core/bin/lib/verify.cjs +59 -4
  238. package/pan-wizard-core/bin/lib/worktree.cjs +70 -0
  239. package/pan-wizard-core/bin/pan-tools.cjs +168 -27
  240. package/pan-wizard-core/learnings/universal/autonomous-loop.md +2 -2
  241. package/pan-wizard-core/references/continuation-format.md +3 -3
  242. package/pan-wizard-core/references/guardrails.md +1 -1
  243. package/pan-wizard-core/references/model-profiles.md +2 -3
  244. package/pan-wizard-core/references/questioning.md +24 -0
  245. package/pan-wizard-core/references/ui-brand.md +4 -6
  246. package/pan-wizard-core/references/verdict-contract.md +2 -1
  247. package/pan-wizard-core/templates/config.json +5 -1
  248. package/pan-wizard-core/templates/debug.md +1 -0
  249. package/pan-wizard-core/templates/discovery.md +2 -2
  250. package/pan-wizard-core/templates/requirements.md +9 -0
  251. package/pan-wizard-core/workflows/add-phase.md +4 -6
  252. package/pan-wizard-core/workflows/assumptions.md +19 -1
  253. package/pan-wizard-core/workflows/diagnose-issues.md +2 -0
  254. package/pan-wizard-core/workflows/discuss-phase.md +4 -2
  255. package/pan-wizard-core/workflows/exec-lean.md +69 -0
  256. package/pan-wizard-core/workflows/exec-phase.md +36 -8
  257. package/{commands/pan → pan-wizard-core/workflows}/focus-doc-audit.md +13 -29
  258. package/{commands/pan → pan-wizard-core/workflows}/focus-drift-walking.md +3 -18
  259. package/{commands/pan → pan-wizard-core/workflows}/focus-exec.md +8 -23
  260. package/{commands/pan → pan-wizard-core/workflows}/focus-plan.md +6 -20
  261. package/{commands/pan → pan-wizard-core/workflows}/focus-scan.md +3 -16
  262. package/{commands/pan → pan-wizard-core/workflows}/focus-sync.md +7 -21
  263. package/pan-wizard-core/workflows/health.md +6 -0
  264. package/pan-wizard-core/workflows/help.md +31 -53
  265. package/pan-wizard-core/workflows/insert-phase.md +4 -6
  266. package/pan-wizard-core/workflows/learn.md +3 -3
  267. package/pan-wizard-core/workflows/milestone-audit.md +2 -2
  268. package/pan-wizard-core/workflows/milestone-new.md +38 -95
  269. package/pan-wizard-core/workflows/new-project.md +96 -258
  270. package/pan-wizard-core/workflows/optimize.md +107 -5
  271. package/pan-wizard-core/workflows/phase-tests.md +10 -0
  272. package/pan-wizard-core/workflows/plan-phase.md +86 -43
  273. package/pan-wizard-core/workflows/profile.md +50 -0
  274. package/pan-wizard-core/workflows/progress.md +10 -0
  275. package/pan-wizard-core/workflows/quick.md +34 -43
  276. package/pan-wizard-core/workflows/research-phase.md +118 -40
  277. package/pan-wizard-core/workflows/resume-project.md +18 -2
  278. package/pan-wizard-core/workflows/settings.md +21 -24
  279. package/pan-wizard-core/workflows/todo-check.md +6 -2
  280. package/pan-wizard-core/workflows/transition.md +22 -4
  281. package/pan-wizard-core/workflows/uat-walkthrough.md +90 -0
  282. package/pan-wizard-core/workflows/update.md +1 -1
  283. package/pan-wizard-core/workflows/verify-phase.md +2 -2
  284. package/scripts/build-agent-plugin.js +35 -15
  285. package/scripts/build-plugin.js +10 -1
  286. package/scripts/deprecate-old-versions.js +70 -3
  287. package/scripts/generate-skills-docs.py +1 -1
  288. package/scripts/git-hooks/pre-push +27 -0
  289. package/scripts/install-git-hooks.js +7 -5
  290. package/scripts/install-pre-push.cjs +38 -0
  291. package/scripts/land.cjs +151 -0
  292. package/scripts/local-ci.cjs +501 -0
  293. package/scripts/local-schedule.cjs +277 -0
  294. package/scripts/prompt-lint.cjs +32 -0
  295. package/scripts/prompt-rules.cjs +156 -0
  296. package/scripts/run-tests.cjs +7 -1
  297. package/scripts/test-quality-lint.cjs +3 -3
  298. package/scripts/test-surface.cjs +9 -2
  299. package/agents/pan-research-synthesizer.md +0 -246
  300. package/commands/pan/audit-deployment.md +0 -386
  301. package/commands/pan/dashboard.md +0 -22
  302. package/commands/pan/discord.md +0 -19
  303. package/commands/pan/mcp-bridge.md +0 -143
  304. package/commands/pan/milestone-cleanup.md +0 -19
  305. package/commands/pan/milestone-gaps.md +0 -35
  306. package/commands/pan/optimize.md +0 -115
  307. package/commands/pan/profile.md +0 -76
  308. package/commands/pan/research-phase.md +0 -189
  309. package/pan-wizard-core/bin/lib/bridge.cjs +0 -269
  310. package/pan-wizard-core/templates/research-project/architecture.md +0 -210
  311. package/pan-wizard-core/templates/research-project/features.md +0 -153
  312. package/pan-wizard-core/templates/research-project/pitfalls.md +0 -206
  313. package/pan-wizard-core/templates/research-project/stack.md +0 -126
  314. package/pan-wizard-core/templates/research-project/summary.md +0 -170
@@ -0,0 +1,61 @@
1
+ # Investigation — 2026-10-10
2
+
3
+ Source: the `mattpocock/skills` repository (`github.com/mattpocock/skills`, MIT, `main` at `49dd158`, `2026-10-09`), read from the GitHub API; each skill's frontmatter, plus the full `code-review` and `diagnosing-bugs` bodies · no local copy (public repository, cited by commit) · ADD 0 · ENHANCE 2 · HAVE 7 · WATCH 1 · SKIP 4
4
+
5
+ ## Recommendations
6
+ 1. **Debugger: a failing command before any hypothesis**: ENHANCE, P2, S. `pan-debugger` ranks hypotheses but treats reproduction as an end check. Make "run a command that goes red on the reported symptom, then shrink it" the first step, record it in the session file, and hand it to the fix as its check. → [write-up](../features/debugger-red-loop-first.md)
7
+ 2. **Reviewer: a fixed code-smell baseline**: ENHANCE, P3, S. Twelve named design smells, always INFO, phrased as "possible …", overridden by the project's own standards. → [write-up](../features/reviewer-smell-baseline.md)
8
+
9
+ The repository is a skill library for one engineer's workflow, wired to an issue tracker. Most of it maps onto things PAN does through `.planning/` instead. The two items worth taking are disciplines inside skills, not new commands.
10
+
11
+ ## Triage
12
+
13
+ | # | Item | Area | Relevance | Verdict | Ledger |
14
+ |---|---|---|---|---|---|
15
+ | 1 | `diagnosing-bugs`: a red-capable, minimised reproduction before any hypothesis | agents | HIGH | ENHANCE → rec. 1 | — |
16
+ | 2 | `code-review`: Standards and Spec reviewed separately, in parallel, never merged | agents | MED | HAVE | — |
17
+ | 3 | `code-review`: a fixed smell baseline as labelled heuristics | agents | MED | ENHANCE → rec. 2 | — |
18
+ | 4 | `tdd`: red-green-refactor, integration tests | orchestration/workflows | LOW | HAVE | — |
19
+ | 5 | `retro`: a retrospective on a coding session | learnings/optimize | LOW | HAVE | — |
20
+ | 6 | `handoff`: compact the conversation into a document for another agent | planning state | LOW | HAVE | MI-036 |
21
+ | 7 | `to-spec`, `to-tickets`, `wayfinder`, `implement`: plans as tickets with blocking edges | planning state | MED | HAVE | MI-018 |
22
+ | 8 | `grilling`, `grill-me`, `grill-with-docs`: a relentless interview on a plan | orchestration/workflows | LOW | HAVE | — |
23
+ | 9 | `research`: primary-source research written to a file | agents | LOW | HAVE | — |
24
+ | 10 | `triage`, `pr`, `setup-matt-pocock-skills`: issue-tracker state machines and PR bodies | other | LOW | SKIP: built on GitHub or GitLab issue trackers; PAN keeps its state in `.planning/` and depends on no tracker | — |
25
+ | 11 | `git-guardrails-claude-code`, `setup-pre-commit`: hooks that block git commands, Husky pre-commit | security/supply-chain | LOW | SKIP: project tooling choices a user makes, not PAN's; PAN's own commit guard covers what PAN commits | — |
26
+ | 12 | TypeScript and teaching skills (`setup-ts-deep-modules`, `migrate-to-shoehorn`, `scaffold-exercises`, `teach`) | other | NONE | SKIP: language- or course-specific | — |
27
+ | 13 | Writing skills (`writing-for-agents`, `writing-beats`, `writing-shape`, `writing-fragments`) | docs/positioning | LOW | SKIP: authoring aids for people; PAN's prompt rules live in its own tests and doc lints | — |
28
+ | 14 | Installing these skills puts project-owned skills where PAN's scope check treats every entry as PAN's (`.agents/`) | planning state | LOW | WATCH | — |
29
+
30
+ ## HAVE — already covered
31
+ - **2, two-axis review.** `pan-reviewer` reviews against discovered project conventions and flags unrequested work (`agents/pan-reviewer.md:39-44`, `:72`). `pan-verifier` checks goal achievement backward from the phase's must-haves. Both are fresh-context agents spawned separately in exec-phase. SOURCE.
32
+ - **4, TDD.** `pan-wizard-core/references/tdd.md` and TDD plans with `verify plan-structure`. SOURCE.
33
+ - **5, retro.** `/pan:retro`. SOURCE.
34
+ - **6, handoff.** `/pan:pause` writes `.continue-here.md`. `state record-session`, and the re-injection hook after compaction, restore position (MI-036). SOURCE.
35
+ - **7, specs and tickets.** Roadmap phases, plans with `depends_on` and waves, and the army's campaign. They live in `.planning/`, not an issue tracker; MI-018 keeps that layout PAN's own. SOURCE.
36
+ - **8, grilling.** `/pan:discuss-phase` and `/pan:assumptions` question the user before planning. SOURCE.
37
+ - **9, research.** `pan-phase-researcher` and the project researchers, with primary sources and confidence levels. SOURCE.
38
+
39
+ ## WATCH
40
+ - **14, project skills under `.agents/`.** PAN treats the whole `.agents/` tree as its own in three places:
41
+ - the scope check (`verify-scope.cjs` `PAN_OWNED_PREFIXES`);
42
+ - the reviewer's skip list (`agents/pan-reviewer.md:48`);
43
+ - the mapping and scan exclusions (`map-codebase.md`, `phase-tests.md`, the focus commands).
44
+
45
+ Codex and unified-skills installs write `.agents/skills/pan-*` and `.agents/pan-wizard-core/`. A project's own skills there would also be skipped. Excluding them from mapping and scans is arguably right, since skills are not source code. Only the scope check loses something: a phase that edits a project skill is never checked for unrequested work.
46
+
47
+ `.github/` was narrowed to `pan-*` entries on `2026-10-05`. The same narrowing here (`.agents/skills/pan-`, `.agents/pan-wizard-core/`) is cheap, but nothing shows the case happening. Where the skills installer writes per agent was not confirmed; the repository README does not say.
48
+
49
+ Trigger: a field project, or a user report, with project skills edited inside a phase.
50
+
51
+ ## Hand-offs to /reality-check
52
+ None.
53
+
54
+ ## How far to trust the material
55
+ - **Primary, but practitioner guidance.** This is a public repository read at a pinned commit. The skills are one engineer's workflow, not measured results: nothing in it reports an outcome comparison, so the two ENHANCE items rest on the discipline being sound, not on evidence that it changes outcomes.
56
+ - **The reproduction gate is consistent with PAN's own evidence-over-assertion rules**, and checking it is cheap. The smell baseline is standard software-engineering vocabulary (Fowler); its value in an AI reviewer is untested.
57
+ - **Popularity is secondary.** The star count the API reports (over 280,000) shows reach, not quality.
58
+
59
+ ## Notes
60
+ - The material contains no text addressed to the agent.
61
+ - The repository's own out-of-scope records (`.out-of-scope/`) include "subagent recursion" and "harness name collisions". Not read in full; noted as possible input for a later run.
@@ -0,0 +1,55 @@
1
+ # Debugger: a failing command before any hypothesis
2
+
3
+ | | |
4
+ |---|---|
5
+ | Verdict | ENHANCE |
6
+ | Priority | P2 (this release cycle) |
7
+ | Size | S 2 points |
8
+ | Area | agents |
9
+ | Runtimes | all five (agent prompt only) |
10
+ | First seen | `2026-10-10` — [digest](../digests/2026-10-10.md) |
11
+ | Ledger | MI-105 |
12
+ | Status | FILED MI-105 |
13
+
14
+ ## Source trail
15
+ - `2026-10-10` — Matt Pocock's `diagnosing-bugs` skill puts a hard gate first. The agent may not theorise until it has run one command that goes red on the user's exact symptom. That command must give the same verdict every run, finish in seconds, and run without a human. It is then shrunk until every remaining part is needed for the failure. Only after that does the agent list 3–5 ranked hypotheses. (source: `github.com/mattpocock/skills`, `skills/engineering/diagnosing-bugs/SKILL.md` at `49dd158`, `2026-10-09`, MIT)
16
+
17
+ ## Why it matters for PAN
18
+ `pan-debugger` is spawned by `/pan:debug`, by exec-phase's UAT diagnosis and by the native `pan-diagnose-issues` script. Its job is a root cause the executor can act on.
19
+
20
+ A diagnosis built on a hypothesis that was never tested against a red command is the failure the skill names: the agent reads code, builds a story and "fixes" a neighbouring bug. PAN's verification pillar asks for evidence over assertion. A reproduction command the debugger has run is that evidence. It also hands the fix its regression test.
21
+
22
+ ## Current state (evidence)
23
+ - **The hypothesis half is there.** Three or more independent hypotheses with priors, the top two investigated in parallel, and the tree recorded in the debug file (`agents/pan-debugger.md:131-139`). Generating several hypotheses before investigating is the anti-anchoring rule (`:76`). SOURCE.
24
+ - **Reproduction is only an end-of-session check.** "Reproduce reliably?" sits among the criteria for calling the root cause found (`:175`), not as a step before theorising. No rule says the session file must record the command that reproduces the symptom. Nothing asks for the repro to be minimised. SOURCE.
25
+
26
+ ## Proposal
27
+ Add a first step to the debugger's investigation, before the hypothesis tree:
28
+ - **Build a reproduction command and run it.** The agent writes one command (a test, a CLI call with a fixture, a script) that fails on the symptom the user reported, and runs it. Command and output are recorded under a new `Reproduction` section of the debug session file, with secrets redacted.
29
+ - **It must catch this bug.** The command must assert the reported symptom, not merely "runs without error". It must give the same verdict across runs; for a flaky bug, record the reproduction rate instead.
30
+ - **Shrink it.** Cut inputs and steps one at a time while it stays red.
31
+ - **When no command can be built,** say so and list what was tried. In `find_root_cause_only` mode return a checkpoint asking for the missing access or artifact, rather than theorising.
32
+ - **The command becomes the fix's check.** In `find_and_fix` mode the fix is done only when the same command goes green. In diagnose mode the root-cause report names it, so the gap-closure plan can turn it into its test.
33
+
34
+ ## Implementation sketch
35
+ | Layer | Change |
36
+ |---|---|
37
+ | Core module | none |
38
+ | Dispatcher | none |
39
+ | Installer / per-runtime | none |
40
+ | Commands / agents / workflows | `agents/pan-debugger.md`: the new first step and its completion criterion; the `Reproduction` section in its File Structure. `pan-wizard-core/templates/debug.md`: the same section. `pan-wizard-core/workflows/diagnose-issues.md` and `commands/pan/debug.md`: say the returned diagnosis names the reproduction command. |
41
+ | Hooks / MCP | none |
42
+ | Tests | a prompt-shape test that the debugger's investigation step names the reproduction gate before the hypothesis tree, and that the template and the agent's File Structure carry the same section (the existing debug template/agent agreement tests are the pattern) |
43
+ | Harness | optional tier-1 scenario: a seeded bug, `/pan:debug`, assert the session file records a command that fails on the seed and passes after the fix |
44
+ | Docs | `docs/AGENTS.md` pan-debugger section |
45
+
46
+ ## Gate
47
+ The prompt-shape test, shown failing before the change. If the owner wants a behavioural check, the optional harness scenario: the debug file records a command that is red on the seeded bug.
48
+
49
+ ## Effort & risk
50
+ - Small and prompt-only.
51
+ - A strict gate can stall on bugs that only reproduce in an environment the agent cannot reach. The checkpoint return keeps that honest instead of guessing.
52
+ - Session-file readers that parse sections must tolerate the new one: check the `debug.md` parsers before adding it.
53
+
54
+ ## Open questions for the owner
55
+ - Hard gate (no hypotheses without a red command) or strong default (allowed with a recorded reason)?
@@ -0,0 +1,93 @@
1
+ # Behavioural harness runs on every host CLI
2
+
3
+ | | |
4
+ |---|---|
5
+ | Verdict | ENHANCE |
6
+ | Priority | P2 (this release cycle) |
7
+ | Size | L 10 points (all four non-Claude hosts); M 4 for the first host and the shape |
8
+ | Area | harness/evals/testing |
9
+ | Runtimes | Codex, Copilot CLI, Gemini CLI and OpenCode measured beside Claude Code; nothing shipped changes |
10
+ | First seen | `2026-10-08` — [digest](../digests/2026-10-08.md) |
11
+ | Ledger | MI-104 (related: MI-044, MI-071) |
12
+ | Status | FILED MI-104 |
13
+
14
+ ## Source trail
15
+ - `2026-10-08` — Hugging Face ran one set of small-model weights through four unmodified coding-agent harnesses and got very different pass rates on the same held-out tasks: 62.1% under Mini-SWE-Agent, 40.0 under Codex, 33.6 under OpenCode and 33.2 under Claude Code. Training through one harness transferred poorly to another: OpenCode-only RL scored 52.3 overall but 42 under Claude Code. (source: "The ultimate guide to multi-harness RL", Hugging Face with Liquid AI, published `2026-09-24`, updated `2026-10-01`, read via the VentureBeat AI Weekly of `2026-10-08`)
16
+
17
+ ## Why it matters for PAN
18
+ PAN's product claim is one planning, execution and verification layer that behaves the same under five host tools. Its evidence for that is behavioural on one host only. The harness pillar (ADR-0047, "behavioural evals against deployed installs") checks behaviour through `claude -p`. On the other four hosts it checks that PAN installs and is discovered, and nothing more.
19
+
20
+ The Hugging Face result is outside evidence that the host shapes outcomes, even with everything else held fixed. PAN's own record says the same from the other side. The host differences that mattered were all found by running the host live, never by reading its docs:
21
+ - Codex cuts plugin skills at 8,000 bytes (MI-015, found by the M25 live probe).
22
+ - The Codex gate wrote into the user's real `CODEX_HOME` (M31).
23
+ - Gemini's hooks were registered under event names Gemini skips, from 3.4 until `2026-09-23`.
24
+
25
+ Every one of those was an install or discovery fault. Nothing yet tells PAN whether a `/pan:exec-phase` chain completes under Codex or Copilot, or how much it costs there.
26
+
27
+ The cost of not doing it: tuning decided on Claude-only measurements is assumed to hold on four hosts that were never measured. That covers the R21 body-split A/B, the O6 memory retirement and the chain timings. The Hugging Face transfer result is a warning against exactly that assumption.
28
+
29
+ ## Current state (evidence)
30
+ - **Model steps drive Claude Code only.** `modelArgs()` builds a `claude` argv (`harness/src/model.cjs:46-55`), and `runModelStep()` spawns `claude` (`harness/src/model.cjs:63`). ADR-0047 D4 says the same in prose: "`model` runs `claude -p` in the workspace". SOURCE.
31
+ - **Non-Claude coverage is install and discovery.**
32
+ - `live-gate-codex`, `live-gate-copilot`, `live-gate-gemini` and `live-gate-opencode` are tier 0. Their `cli` steps list plugins, MCP servers and agents.
33
+ - `copilot-agent-frontmatter` is the one paid non-Claude step: a single `copilot --agent … -p` turn that checks a frontmatter shape loads.
34
+
35
+ SOURCE (`harness/scenarios/*.json`).
36
+ - **The chain scenarios are Claude-pinned.** `markdown-exec-phase-chain` installs `--claude`, requires `cli: claude` and prompts `/pan:exec-phase 1 --skip-tests`, budget `maxUsd: 8`. `native-exec-waves-chain` is Claude-only by nature (native workflows are a Claude Code feature, MI-002). SOURCE.
37
+ - **Four of the five host CLIs are on this machine, each with a headless JSON mode.** PROBED `2026-10-08` (help output only, no model call):
38
+ - codex-cli 0.157.1: `codex exec --json`, plus `--dangerously-bypass-approvals-and-sandbox` and `--skip-git-repo-check`.
39
+ - GitHub Copilot CLI 1.0.91: `-p`, `--output-format json` (JSONL) and `--allow-all-tools`.
40
+ - Gemini CLI 0.61.0: `-p`, `-o json|stream-json` and `--approval-mode yolo`.
41
+ - OpenCode 1.18.32: `run --format json`.
42
+ - Antigravity (`agy`) is absent.
43
+ - **Spend is priced and capped for Claude only.** `--max-budget-usd` is passed to `claude` (`model.cjs:50`), and the step cost comes from Claude's JSON. The other CLIs' usage fields are not read anywhere in the harness. SOURCE.
44
+ - **What is missing:**
45
+ - a host-selectable model step;
46
+ - per-host cost accounting;
47
+ - a portable chain scenario run per host.
48
+
49
+ ## Proposal
50
+ - **A `runtime` field on `model` steps.** It defaults to `claude`, so every existing scenario is unchanged. One adapter per host covers:
51
+ - the argv, including the flags an unattended run inside the scratch workspace needs;
52
+ - how the prompt is passed (stdin where the CLI accepts it, which avoids Windows `.cmd` quoting, as the Claude step already does);
53
+ - the output parser (final message, error flag, usage).
54
+ - **Cost under `--max-usd` stays mandatory.**
55
+ - When the CLI reports dollars, use them.
56
+ - When it reports tokens, price them with PAN's own rate table (`cost.cjs`). MI-023 already prices the runtime defaults with the pricing page cited.
57
+ - A step whose CLI reports neither is refused, because the cap could not be enforced. ADR-0047 D2's rule stays as it is.
58
+ - **One portable chain per host.** It uses the seed and assertions of `markdown-exec-phase-chain`, installed with that host's flag. The prompt is written in the host's command syntax, taken from the installer's own rewrite (`$pan-exec-phase` on Codex, `/pan-exec-phase` on OpenCode and Copilot; Gemini's form to confirm). A missing CLI skips with its reason, never green (D4's existing rule).
59
+ - **Results per host.** The run report and the ledger signature carry the runtime and the CLI version, so a finding on one host is not merged with the same step on another.
60
+
61
+ ## Implementation sketch
62
+ | Layer | Change |
63
+ |---|---|
64
+ | Core module (`pan-wizard-core/bin/lib/`) | none (the harness may `require` `cost.cjs` for its rate table) |
65
+ | Dispatcher (`pan-tools.cjs`) | none |
66
+ | Installer / per-runtime (`bin/install-lib.cjs`) | none; the chain prompt reuses the installer's command-syntax rewrite rather than a second table |
67
+ | Commands / agents / workflows (markdown) | none |
68
+ | Hooks / MCP | none |
69
+ | Harness | `harness/src/model.cjs`: a runtime adapter table (argv, env, prompt input, parser, usage). `harness/src/scenario.cjs`: validate `runtime`. `harness/src/run.cjs`: per-host budget share and result keys. New scenarios: `markdown-exec-phase-chain-<host>` for each host, or one scenario with a `runtimes` list. |
70
+ | Tests | `tests/harness.test.cjs`: per adapter, the argv builder and the parser against output captured from that CLI version, each shown to fail on the pre-change runner. A runtime-tagged scenario validates, and skips with its reason when the CLI is absent. A step whose usage cannot be priced is refused under `--max-usd`. |
71
+ | Docs / ADR | `harness/README.md` (scenario table, how to run per host). An ADR-0047 amendment for D4 ("model steps take a runtime"), because it widens a recorded decision. No counts. |
72
+
73
+ ## Gate
74
+ A tier-2 run of the first host's chain (Codex is suggested) must pass the same assertions as the Claude oracle. That means plans executed, the verification report written and the seed's tests passing. The run is recorded with the CLI version and its cost. Behind it, the adapter unit tests must fail on the pre-change runner.
75
+
76
+ ## Effort & risk
77
+ - **Spend.**
78
+ - A Claude chain rep costs $3–6 (harness run of `2026-09-10`).
79
+ - The other hosts bill differently: Copilot in premium requests, Codex against a plan quota. So "dollars" may need an estimate from tokens, and the cap's meaning differs per host.
80
+ - Model tiers stay the owner's runs (ADR-0047 D2).
81
+ - **Isolation versus auth.** M31 found the Codex gate writing into the real `CODEX_HOME`. A model step needs the user's credentials, and a scratch home does not have them. Copying a credential into a scratch directory is a security decision for the owner; the alternative is config-isolation flags on the real home.
82
+ - **Unstable output shapes.** The CLIs' JSON is not a published contract. Pin the parser fixtures to the CLI version and re-capture them on upgrade, the way M25 and M31 pinned versions.
83
+ - **Scope.**
84
+ - Only the markdown chain is portable.
85
+ - Antigravity cannot be run here (CLI absent).
86
+ - Gemini's headless model behaviour has not been exercised on this machine yet.
87
+ - **Noise.** The Hugging Face cells are single attempts. PAN's chain already uses `--repeat 5`. Per-host results need the same repeats before any host-specific conclusion.
88
+
89
+ ## Open questions for the owner
90
+ - Which host first? Codex is suggested: the most-exercised non-Claude gate (MI-071, M25, M31).
91
+ - What spend cap per host per run, and how should a host billed in requests count against `--max-usd`?
92
+ - Should credentials be copied into scratch homes, or the real home run with config overrides?
93
+ - Should a host that fails the chain block a release (a gate), or only file a finding?
@@ -0,0 +1,66 @@
1
+ # Regression gate and rollback for `optimize apply`
2
+
3
+ | | |
4
+ |---|---|
5
+ | Verdict | ENHANCE |
6
+ | Priority | P3 (backlog) — its signal depends on [trace-failure-capture](trace-failure-capture.md) |
7
+ | Size | M 4 points |
8
+ | Area | learnings/optimize/experiment |
9
+ | Runtimes | all five (the verbs are runtime-neutral; the signal they read is richest where the trace hook runs) |
10
+ | First seen | `2026-09-28` — [digest](../digests/2026-09-28.md) |
11
+ | Ledger | — |
12
+ | Status | FILED `MI-061` |
13
+
14
+ ## Source trail
15
+ - `2026-09-28` — Growing Harness (arXiv:2609.26760 v2): each proposed change to the agent program is kept only if success on a held-out gate set does not drop; otherwise the whole change sequence since the last accepted checkpoint is rolled back, including state. Without the gate, their gate success rose to 30% and then fell to 16%; with it, the best result was retained (one run per variant, 50 tasks). Repairing a window of several failures at once beat single-failure repairs by 8 points (same caveats) (source: arXiv:2609.26760, via the LLM brief of `2026-09-28`).
16
+
17
+ ## Why it matters for PAN
18
+ `optimize apply` writes what a report recommends into the project, and the memory entries it writes are read by agents in every later run. A bad entry therefore degrades every future session, which is the regression the paper's gate exists to catch. Today PAN cannot tell whether an apply helped, and it cannot undo one mechanically.
19
+
20
+ ## Current state (evidence)
21
+ - `pan-wizard-core/bin/lib/optimize.cjs:675` `applyReportRecommendations`: `memory` actions create a file (skipped if it exists), `memory_append` actions **append to an existing memory file**, and `note`/`planning_note` actions append to suggestion files. There is no check before or after. **SOURCE**
22
+ - `optimize.cjs:752-761`: the log line in `optimization/applied.jsonl` records the timestamp, report name, counts and action **types** only: not the paths, not the appended text, not a pre-image. An append cannot be located afterwards to undo it. **SOURCE**
23
+ - `optimize.cjs:800` `getOptimizeStats`: sums applied/skipped counts; nothing compares sessions before and after an apply. **SOURCE**
24
+ - `pan-tools optimize` subcommands are `trace`, `learn`, `apply`, `list`, `stats` (dispatcher arm and `tests/fixtures/surface.json`). No `revert`. **SOURCE**
25
+ - `optimize learn` analyses one trace session (`--session`), so each report reflects a single run. **SOURCE**
26
+
27
+ ## Proposal
28
+ 1. **Revertible applies.** `optimize apply` gives each run an `apply_id` and records, per action, the path, the kind (`created` / `appended`) and the exact appended text with a hash of the file after the write. `pan-tools optimize revert <apply_id>` deletes created files and removes appended spans, **refusing** any file whose current hash differs from the recorded one (a human edited it since), and reports what it refused.
29
+ 2. **A success-first verdict.** `pan-tools optimize verdict <apply_id>` compares trace sessions after the apply against an equal number before it: error events per spawn, verdict failures, retries, then tokens per spawn. It emits `kept`, `regressed` or `insufficient-data` (fewer than N sessions on either side; N in `.planning/config.json` under a new `optimize` section: `config.cjs` has none today). As in the paper, a cost drop never outweighs a rise in failures. The verdict recommends `revert`; it never reverts by itself.
30
+ 3. **Window, not single session (optional).** `optimize learn --sessions <n>` pools the last n sessions, so a recommendation must explain failures recurring across them rather than one run's accident.
31
+
32
+ Honest limit: the paper gates on a fixed held-out task set. A PAN project has no such set; sessions before and after an apply do different work. The verdict is therefore advisory and says so in its output.
33
+
34
+ ## Implementation sketch
35
+ | Layer | Change |
36
+ |---|---|
37
+ | Core module (`pan-wizard-core/bin/lib/`) | `optimize.cjs`: `apply_id`, per-action records, `revertApply()`, `applyVerdict()`, `--sessions` pooling in `generateLocalReport`; regenerate `tests/fixtures/module-surface.json` for the new exports |
38
+ | Dispatcher (`pan-tools.cjs`) | `revert` and `verdict` arms inside `case 'optimize'`; extend the unknown-subcommand error text |
39
+ | Installer / per-runtime (`bin/install-lib.cjs`) | none |
40
+ | Commands / agents / workflows (markdown) | `commands/pan/optimize.md` and `workflows/optimize.md` document revert/verdict; `/pan:learn --apply` prints the `apply_id` |
41
+ | Hooks / MCP | none (not an MCP verb: it writes the project) |
42
+ | Tests | unit: append → revert restores bytes; edited-since file is refused; verdict thresholds; each shown to fail on the current module. `node scripts/test-surface.cjs` for the two new rows; the dispatcher-arms contract sees both arms |
43
+ | Harness | not needed for the mechanics; a tier-1 scenario only once the trace signal exists |
44
+ | Docs / ADR | `docs/CLI-REFERENCE.md` (no counts) |
45
+
46
+ ## Gate
47
+ `tests/optimize.test.cjs` proves apply → revert round-trips byte-for-byte on a `memory_append`, refuses a hand-edited file, and fails on the current tree because `revert` does not exist.
48
+
49
+ ## Effort & risk
50
+ - The revert half stands alone and is cheap. The verdict half is only as good as the trace signal, which is empty in the field today. Build it after, or together with, [trace-failure-capture](trace-failure-capture.md).
51
+ - CRLF: appended spans must be matched EOL-tolerantly (the 3.31.0 lesson from `bytesMatchHashIgnoringEol`).
52
+
53
+ ## Open questions for the owner
54
+ - Ship revert alone first (XS–S), and hold the verdict until the trace hook produces errors?
55
+ - Is the optimize loop worth this investment at all, given the field shows it is barely used? The alternative is to fix the signal first and measure use before adding verbs.
56
+
57
+ ## Outcome (`2026-09-28`)
58
+
59
+ Part 1 (revertible applies) is built on `feat/evidence-loop`:
60
+ - every apply gets an `apply_id` with per-action records;
61
+ - `optimize revert <apply_id|--last>` refuses a hand-edited file and reverts last-in, first-out per file, matching line endings tolerantly;
62
+ - applying the same report twice now writes nothing the second time, where it used to append everything twice.
63
+
64
+ Part 3 is built too: `optimize learn --sessions <n>` pools sessions.
65
+
66
+ Part 2, the advisory before/after verdict, is deferred, which answers the owner's question: the loop is worth fixing (signal and safety) but not worth growing until it is used. The field showed 1 apply run in 14 projects. The apply records keep what the verdict needs, so it can be added without a migration. Trigger: apply runs in three or more projects.
@@ -0,0 +1,57 @@
1
+ # Reviewer: a fixed code-smell baseline, each reported as a judgement call
2
+
3
+ | | |
4
+ |---|---|
5
+ | Verdict | ENHANCE |
6
+ | Priority | P3 (backlog) |
7
+ | Size | S 2 points |
8
+ | Area | agents |
9
+ | Runtimes | all five (agent prompt only) |
10
+ | First seen | `2026-10-10` — [digest](../digests/2026-10-10.md) |
11
+ | Ledger | MI-106 |
12
+ | Status | FILED MI-106 |
13
+
14
+ ## Source trail
15
+ - `2026-10-10` — Matt Pocock's `code-review` skill always adds a fixed baseline of twelve smells from Fowler's *Refactoring* to whatever standards the repository documents. The smells are Mysterious Name, Duplicated Code, Feature Envy, Data Clumps, Primitive Obsession, Repeated Switches, Shotgun Surgery, Divergent Change, Speculative Generality, Message Chains, Middle Man and Refused Bequest. Two rules bind the baseline. A documented repository standard always overrides it. And each smell is reported as a labelled heuristic ("possible Feature Envy"), never a hard violation, and is skipped where tooling already enforces it. (source: `github.com/mattpocock/skills`, `skills/engineering/code-review/SKILL.md` at `49dd158`, `2026-10-09`, MIT)
16
+
17
+ ## Why it matters for PAN
18
+ `pan-reviewer` reviews every phase's diff after execution. In a project that documents no standards, its quality checks reduce to a few size thresholds. The baseline gives it a stable, named vocabulary for design problems that thresholds miss.
19
+
20
+ Several smells map onto failures PAN already guards against elsewhere:
21
+ - **Speculative Generality** is the code-level form of the unrequested-work class (MI-031 lineage, `verify scope`).
22
+ - **Shotgun Surgery** and **Divergent Change** are visible in a phase's diff and nowhere else.
23
+
24
+ Reporting them as judgement calls keeps them below the verdict-changing tiers, so the meta-reviewer and the dispositions ledger handle them like any INFO finding.
25
+
26
+ ## Current state (evidence)
27
+ - **The quality table is size-only.** It holds function length, nesting depth, dead imports, duplicate code (">10 identical lines across files", INFO) and new TODOs (`agents/pan-reviewer.md:63-70`). SOURCE.
28
+ - **Conventions are discovered, never assumed.** The reviewer reads project instructions, `.agents/skills/` and existing code patterns, and is told not to assume any (`:39-44`). The baseline must keep that priority: the repository wins. SOURCE.
29
+ - **The Spec axis is already separate.** The reviewer's Scope section covers unrequested work (`:72`), and `pan-verifier` checks the result against the phase goal. That is the skill's two-axis split, already in PAN's structure. SOURCE.
30
+
31
+ ## Proposal
32
+ - **Add a "Design smells (baseline)" table** to the reviewer: the twelve smells, each with one line on what it is and one on the usual fix.
33
+ - **Rules:**
34
+ - Always INFO and phrased "possible <smell>".
35
+ - Suppressed where a documented project standard endorses the pattern.
36
+ - Only for code the phase changed.
37
+ - Never a cause for a non-PASS verdict on its own.
38
+ - **Speculative Generality defers to Scope.** It points at the Scope section, so the same code is not reported twice: unrequested behaviour stays `Unrequested`, and an unused abstraction is the smell.
39
+
40
+ ## Implementation sketch
41
+ | Layer | Change |
42
+ |---|---|
43
+ | Core module / dispatcher / installer | none |
44
+ | Commands / agents / workflows | `agents/pan-reviewer.md`: the table and its rules. `agents/pan-meta-reviewer.md`: one line saying baseline smells are judgement calls to downgrade or dismiss, never to escalate. |
45
+ | Hooks / MCP | none |
46
+ | Tests | a prompt-shape test that the reviewer carries the baseline as INFO with the "repository standard wins" rule, shown failing before the change |
47
+ | Docs | `docs/AGENTS.md` pan-reviewer section |
48
+
49
+ ## Gate
50
+ The prompt-shape test. A behavioural check is not worth paid runs for an INFO-only change.
51
+
52
+ ## Effort & risk
53
+ - More INFO findings mean more noise in review reports. The meta-reviewer dedupes, and dispositions record dismissals.
54
+ - The real risk is a smell creeping up to WARNING. The test pins INFO.
55
+
56
+ ## Open questions for the owner
57
+ - All twelve, or only the ones visible in a diff?
@@ -0,0 +1,69 @@
1
+ # Failure capture in the trace hook, not in agent prompts
2
+
3
+ | | |
4
+ |---|---|
5
+ | Verdict | ENHANCE |
6
+ | Priority | P2 (this release cycle) |
7
+ | Size | M 4 points |
8
+ | Area | learnings/optimize/experiment · hooks |
9
+ | Runtimes | Claude first (per-agent transcripts are proven there); Codex and Copilot also fire a subagent-stop event (`HOOK_EVENT_MAP` in `bin/install-lib.cjs`) but their transcript shape is unverified; Gemini and OpenCode register no subagent-stop hook |
10
+ | First seen | `2026-09-28` — [digest](../digests/2026-09-28.md) |
11
+ | Ledger | — |
12
+ | Status | FILED `MI-060` |
13
+
14
+ ## Source trail
15
+ - `2026-09-28` — Growing Harness (arXiv:2609.26760 v2): an agent program improves from task feedback only when each failure is recorded by the runtime as an execution trace (function calls, model and tool calls, errors) and tied to the code it passed through. Removing that function-level localisation halved final success in their ablation (36% → 18%, one run, 50 tasks). The paper's thesis is that recurring control belongs in code, not in model context (source: arXiv:2609.26760, via the LLM brief of `2026-09-28`).
16
+
17
+ ## Why it matters for PAN
18
+ PAN's optimisation loop (`optimize trace` → `/pan:learn` → `optimize apply`) exists to learn from failures, but its failure signal is **delegated to the model**: the workflows instruct agents to run `pan-tools optimize trace log --type error …` at fixed points, and agents do not. This is the exact pattern the paper argues against: recurring control that the model is asked to redo every run. The field sweep of September 2026 measured the result: across the D-drive projects, trace events were almost all `decision/agent_completion`, and **zero** errors, gaps or corrections were ever recorded (project memory `field-telemetry-2026-09`, finding 4). The loop runs, but it has nothing to learn from. That also blocks the [optimize-apply regression gate](optimize-apply-regression-gate.md), which needs a failure signal to compare.
19
+
20
+ Thesis fit: it moves an observation that can be made mechanically out of the prompt and into code, the "deterministic orchestration where control flow is knowable pre-run" pillar.
21
+
22
+ ## Current state (evidence)
23
+ - `hooks/pan-trace-logger.js:830`: the SubagentStop hook writes one `type: 'decision', category: 'agent_completion'` event per spawn (tokens, duration, `exit_code`, model, command). **SOURCE**
24
+ - `hooks/pan-trace-logger.js:880`: its only other event is a `redundancy` heuristic (same agent type twice with similar tokens). **SOURCE**
25
+ - The hook already reads the per-agent transcript for token counts (v4 rows, per-agent `subagents/agent-<id>.jsonl`), and already walks `tool_result` records, but only to skip them when finding typed user turns (`hooks/pan-trace-logger.js:274`). **SOURCE**
26
+ - Error, gap and correction events come only from `optimize trace log` calls written into workflow prose: `exec-phase.md`, `plan-phase.md`, `verify-phase.md`, `discuss-phase.md` and `optimize.md` all carry the instruction (`grep -c "optimize trace log" pan-wizard-core/workflows/*.md`). **SOURCE**
27
+ - The field result (zero error events ever) is recorded in project memory, not re-measured today. **DOC**
28
+
29
+ ## Proposal
30
+ Have the trace hook derive failure events from the subagent's own transcript, deterministically, when the spawn completes:
31
+
32
+ - **`error / tool_error`**: a `tool_result` block with `is_error: true`, carrying the tool name and a normalised, truncated error line. One event per distinct (tool, first line) pair per spawn, so a retry loop does not flood the trace.
33
+ - **`error / verdict_failed`**: the agent's final message carries a verdict PAN's own agents emit (the verifier's gaps verdict, the plan-checker's issues verdict). Match on the agent's own transcript, not on the parent's framed copy (Claude Code frames and indents subagent results since 2.1.277).
34
+ - **`correction / retry`**: the same agent type re-spawned in the same phase after a `verdict_failed`. That is the escalation path MI-029 shipped (`resolve-model --attempt`), so the attempt number is the localisation.
35
+
36
+ The localisation is `(command, phase, agent, tool)`, PAN's counterpart of the paper's "function the failure passed through". Keep the prompt-side `optimize trace log` instructions for what only the model can know (a knowledge gap, a surprise), and drop them where the hook now sees the event, so the prose shrinks.
37
+
38
+ ## Implementation sketch
39
+ | Layer | Change |
40
+ |---|---|
41
+ | Core module (`pan-wizard-core/bin/lib/`) | `optimize.cjs`: accept the new categories in `generateLocalReport`'s error/gap grouping (`EVENT_TYPES` already has `error` and `correction`) |
42
+ | Dispatcher (`pan-tools.cjs`) | none |
43
+ | Installer / per-runtime (`bin/install-lib.cjs`) | none. The hook is already registered wherever `subagentStop` is non-null |
44
+ | Commands / agents / workflows (markdown) | remove the `optimize trace log --type error` instructions the hook now covers; keep gap/surprise |
45
+ | Hooks / MCP | `hooks/pan-trace-logger.js`: a pure `extractFailureEvents(transcriptRecords, agent)` beside the token reader; same dedupe signature scheme as the completion event |
46
+ | Tests | fixture transcripts **emitted by a real run** (the fixture-from-emitted-output rule), one with a failing Bash tool call and one with a gaps verdict; assert events appear; show the test fails on the current hook; hook payload fixtures in `tests/` alongside the hooks-e2e suite |
47
+ | Harness | a tier-0 scenario is not enough (no model step); a tier-1 scenario whose seed makes a test fail, asserting `optimize stats` shows a non-zero error count |
48
+ | Docs / ADR | `docs/HOOKS.md` trace-logger section; no ADR (it restores the loop's stated design) |
49
+
50
+ ## Gate
51
+ A tier-1 harness run on a seed with a deliberately failing test records at least one `error` event in `.planning/optimization/traces/*/trace.jsonl` without any agent calling `optimize trace log`, and the unit test built from that run's transcript fails against the pre-change hook.
52
+
53
+ ## Effort & risk
54
+ - Transcript formats move. Claude's per-agent transcript is proven (the cost rebuild depends on it); Codex and Copilot payloads need a live probe before the extractor claims them. Ship Claude-only first and say so.
55
+ - Noise: an `is_error` tool result is often a normal step (a grep with no match, a test run expected to fail in TDD). Categorise it rather than dropping it, and let `optimize learn` weigh repeats across spawns.
56
+ - Privacy: error lines can carry paths or secrets. Truncate and redact with the same rules the cost ledger uses; everything stays in the project's `.planning/`.
57
+
58
+ ## Open questions for the owner
59
+ - Keep or delete the workflow-prose `optimize trace log` calls the hook makes redundant?
60
+ - Is the verdict match stable enough across PAN's agents, or should the verifier and plan-checker emit a machine line (for example a fenced JSON verdict) that the hook reads?
61
+
62
+ ## Outcome (`2026-09-28`)
63
+
64
+ Built on `feat/evidence-loop`, designed in [evidence_loop_featureai.md](../../evidence_loop_featureai.md) (ADR-0049).
65
+ - **Premise re-measured first.** No field project had ever recorded an error event, while subagent transcripts held 869 failed tool calls across 1,969 spawns. The write-up's claim that agents never call `optimize trace log` was only half right: they did, on success branches, and never on error branches.
66
+ - **Verdicts.** Both open questions are answered in the spec. The judges emit a `pan-verdict` block, and a verb (`findings record`) reads it rather than the hook, because the verb works on every runtime and the workflow needs the answer. The verdict-path prose calls were removed.
67
+ - **Tool failures.** The hook records them from per-agent transcripts on Claude Code, redacted, and `execution.error_pattern_learning: false` turns it off.
68
+ - **Runtimes.** Codex and Copilot were checked: Copilot's documented payload has no per-subagent transcript, and its field names are now read.
69
+ - **Gate met.** The tier-1 harness run `tool-error-capture` captured a real subagent's failing `npm test` through the installed hook ($0.50); the unit test built on the real record shape fails against the pre-change hook.