@haposoft/cafekit 0.16.0-rc.8 → 0.16.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 (297) hide show
  1. package/README.md +116 -27
  2. package/bin/__tests__/codex-hooks-ownership.test.js +239 -0
  3. package/bin/__tests__/codex-hooks.test.js +50 -0
  4. package/bin/__tests__/codex-native.test.js +1882 -70
  5. package/bin/__tests__/develop-contract.test.js +400 -23
  6. package/bin/__tests__/installer-safety.test.js +3 -3
  7. package/bin/__tests__/optional-skill-inventory.test.js +249 -0
  8. package/bin/__tests__/output-styles.test.js +214 -0
  9. package/bin/__tests__/package-inventory.test.js +1735 -98
  10. package/bin/__tests__/runtime-schema.test.js +111 -0
  11. package/bin/__tests__/secret-output-guardrail.test.js +122 -0
  12. package/bin/__tests__/skill-routing-source.test.js +172 -0
  13. package/bin/__tests__/specs-v2-execution-closeout.test.js +1 -1
  14. package/bin/install.js +10 -0
  15. package/bin/lib/codex-install.js +170 -5
  16. package/bin/lib/context.js +14 -0
  17. package/bin/lib/i18n.js +12 -6
  18. package/bin/lib/skill-deps.js +5 -5
  19. package/bin/phases/claude-runtime.js +23 -0
  20. package/bin/phases/claude-settings.js +8 -0
  21. package/bin/phases/codex-hooks.js +156 -0
  22. package/bin/phases/codex-runtime.js +29 -38
  23. package/bin/phases/copy-payload.js +8 -2
  24. package/bin/phases/select-skill-bundles.js +96 -0
  25. package/bin/phases/skill-inventory.js +71 -0
  26. package/bin/phases/skills-setup.js +9 -2
  27. package/bin/phases/write-metadata.js +8 -5
  28. package/package.json +8 -2
  29. package/src/claude/CLAUDE.md +3 -3
  30. package/src/claude/agents/brainstormer.md +52 -69
  31. package/src/claude/agents/code-auditor.md +32 -14
  32. package/src/claude/agents/debugger.md +35 -20
  33. package/src/claude/agents/deployer.md +12 -5
  34. package/src/claude/agents/docs-keeper.md +11 -1
  35. package/src/claude/agents/implementer.md +25 -13
  36. package/src/claude/agents/inspector.md +6 -3
  37. package/src/claude/agents/project-manager.md +1 -1
  38. package/src/claude/agents/researcher.md +26 -55
  39. package/src/claude/agents/spec-maker.md +12 -7
  40. package/src/claude/agents/strategist.md +52 -0
  41. package/src/claude/agents/test-runner.md +117 -132
  42. package/src/claude/agents/ui-ux-designer.md +1 -1
  43. package/src/claude/hooks/__tests__/fixtures/statusline-default.golden +1 -0
  44. package/src/claude/hooks/__tests__/precompact.test.js +158 -0
  45. package/src/claude/hooks/__tests__/spec-gate.test.js +10 -3
  46. package/src/claude/hooks/__tests__/state.test.js +5 -0
  47. package/src/claude/hooks/__tests__/statusline.test.js +196 -0
  48. package/src/claude/hooks/agent.cjs +1 -1
  49. package/src/claude/hooks/docs-sync.cjs +12 -10
  50. package/src/claude/hooks/inspect-block.cjs +1 -1
  51. package/src/claude/hooks/lib/config.cjs +3 -0
  52. package/src/claude/hooks/lib/hook-state-dir.cjs +39 -0
  53. package/src/claude/hooks/lib/secret-keywords.cjs +42 -0
  54. package/src/claude/hooks/precompact.cjs +105 -0
  55. package/src/claude/hooks/rules.cjs +1 -1
  56. package/src/claude/hooks/secret-output-guardrail.cjs +43 -0
  57. package/src/claude/hooks/session.cjs +27 -1
  58. package/src/claude/hooks/spec-gate.cjs +3 -3
  59. package/src/claude/hooks/spec-state.cjs +2 -2
  60. package/src/claude/hooks/state.cjs +1 -1
  61. package/src/claude/hooks/task-scaffold-guard.cjs +1 -1
  62. package/src/claude/hooks/usage.cjs +1 -1
  63. package/src/claude/migration-manifest.json +29 -15
  64. package/src/claude/output-styles/coding-level-0-eli5.md +103 -0
  65. package/src/claude/output-styles/coding-level-1-junior.md +124 -0
  66. package/src/claude/output-styles/coding-level-2-mid.md +146 -0
  67. package/src/claude/output-styles/coding-level-3-senior.md +148 -0
  68. package/src/claude/output-styles/coding-level-4-lead.md +159 -0
  69. package/src/claude/output-styles/coding-level-5-god.md +91 -0
  70. package/src/claude/references/debugger/core-philosophy.md +5 -3
  71. package/src/claude/references/debugger/frontend-verification.md +2 -2
  72. package/src/claude/references/debugger/log-ci-analysis.md +13 -1
  73. package/src/claude/references/debugger/parallel-agent-hydration.md +19 -34
  74. package/src/claude/references/debugger/performance-diagnostics.md +2 -2
  75. package/src/claude/references/debugger/root-cause-tracing.md +37 -6
  76. package/src/claude/references/debugger/side-effect-gate.md +3 -1
  77. package/src/claude/references/debugger/verification-protocol.md +13 -12
  78. package/src/claude/rules/orchestrator.md +7 -1
  79. package/src/claude/rules/process-management.md +39 -0
  80. package/src/claude/rules/review-audit-self-decision.md +48 -0
  81. package/src/claude/rules/skill-domain-routing.md +26 -24
  82. package/src/claude/rules/skill-workflow-routing.md +22 -14
  83. package/src/claude/rules/workflow.md +3 -3
  84. package/src/claude/runtime.json +1 -0
  85. package/src/claude/runtime.schema.json +205 -0
  86. package/src/claude/scripts/generate-skill-catalog.cjs +156 -122
  87. package/src/claude/scripts/provenance.cjs +18 -5
  88. package/src/claude/scripts/workflow-policy.cjs +1 -1
  89. package/src/claude/settings/settings.json +16 -0
  90. package/src/claude/skills/agent-browser/SKILL.md +1 -1
  91. package/src/claude/skills/ai-multimodal/SKILL.md +1 -1
  92. package/src/claude/skills/brainstorm/SKILL.md +193 -172
  93. package/src/claude/skills/brainstorm/references/question-framework.md +105 -167
  94. package/src/claude/skills/chrome-devtools/SKILL.md +1 -1
  95. package/src/claude/skills/code-review/SKILL.md +43 -25
  96. package/src/claude/skills/code-review/references/spec-compliance-review.md +3 -4
  97. package/src/claude/skills/code-review/references/verification-gate.md +1 -1
  98. package/src/claude/skills/debug/SKILL.md +48 -19
  99. package/src/claude/skills/delegate/SKILL.md +1 -1
  100. package/src/claude/skills/develop/SKILL.md +92 -65
  101. package/src/claude/skills/develop/references/parallel-waves.md +36 -63
  102. package/src/claude/skills/develop/references/quality-gate.md +31 -4
  103. package/src/claude/skills/develop/references/subagent-patterns.md +21 -7
  104. package/src/claude/skills/docs/SKILL.md +42 -23
  105. package/src/claude/skills/docs/references/init-workflow.md +4 -4
  106. package/src/claude/skills/docs/references/reconstruct-workflow.md +6 -6
  107. package/src/claude/skills/docs/references/standard-docs-workflow.md +6 -2
  108. package/src/claude/skills/docs/references/summarize-workflow.md +2 -2
  109. package/src/claude/skills/docs/references/update-workflow.md +9 -7
  110. package/src/claude/skills/docs/templates/requirements-as-is.md +1 -1
  111. package/src/claude/skills/docx/SKILL.md +1 -1
  112. package/src/claude/skills/git/SKILL.md +1 -1
  113. package/src/claude/skills/git/references/commit-protocols.md +1 -1
  114. package/src/claude/skills/git/references/finish-branch.md +1 -1
  115. package/src/claude/skills/hotfix/SKILL.md +159 -170
  116. package/src/claude/skills/hotfix/references/diagnosis-protocol.md +14 -9
  117. package/src/claude/skills/hotfix/references/parallel-patterns.md +27 -13
  118. package/src/claude/skills/hotfix/references/prevention-gate.md +5 -0
  119. package/src/claude/skills/hotfix/references/review-cycle.md +21 -15
  120. package/src/claude/skills/hotfix/references/workflow-specialized.md +53 -21
  121. package/src/claude/skills/inspect/SKILL.md +55 -46
  122. package/src/claude/skills/inspect/references/internal-inspection.md +21 -5
  123. package/src/claude/skills/loop/SKILL.md +114 -0
  124. package/src/claude/skills/loop/references/bounded-loop-protocol.md +104 -0
  125. package/src/claude/skills/loop/references/metric-and-guard-contract.md +76 -0
  126. package/src/claude/skills/pdf/SKILL.md +1 -1
  127. package/src/claude/skills/pptx/SKILL.md +1 -1
  128. package/src/claude/skills/question/SKILL.md +16 -13
  129. package/src/claude/skills/research/SKILL.md +70 -43
  130. package/src/claude/skills/route/SKILL.md +94 -0
  131. package/src/claude/skills/route/references/agent-timing.md +46 -0
  132. package/src/claude/skills/route/references/chaining-patterns.md +53 -0
  133. package/src/claude/skills/route/references/task-taxonomy.md +48 -0
  134. package/src/claude/skills/specs/SKILL.md +41 -60
  135. package/src/claude/skills/specs/references/review.md +11 -8
  136. package/src/claude/skills/specs/references/templates.md +34 -18
  137. package/src/claude/skills/specs/templates/requirements-init.md +1 -1
  138. package/src/claude/skills/specs/templates/research.md +2 -2
  139. package/src/claude/skills/sync/SKILL.md +6 -6
  140. package/src/claude/skills/sync/references/sync-protocols.md +1 -1
  141. package/src/claude/skills/test/SKILL.md +120 -120
  142. package/src/claude/skills/test/references/execution-strategy.md +208 -361
  143. package/src/claude/skills/test/references/failure-triage.md +55 -121
  144. package/src/claude/skills/test/references/test-memory.md +20 -34
  145. package/src/claude/skills/ui-ux-pro-max/SKILL.md +1 -1
  146. package/src/claude/skills/web-testing/SKILL.md +1 -1
  147. package/src/claude/skills/xlsx/SKILL.md +1 -1
  148. package/src/claude/status.cjs +135 -33
  149. package/src/codex/AGENTS.md +14 -4
  150. package/src/codex/hooks/docs-sync.cjs +8 -3
  151. package/src/codex/hooks/lib/hook-context.cjs +18 -4
  152. package/src/codex/hooks/rules.cjs +29 -1
  153. package/src/codex/hooks/secret-output-guardrail.cjs +30 -0
  154. package/src/codex/hooks/spec-gate.cjs +3 -8
  155. package/src/codex/hooks/spec-state.cjs +2 -1
  156. package/src/codex/hooks.json +5 -0
  157. package/src/codex/runtime.json +2 -0
  158. package/src/common/.env.example +1 -1
  159. package/src/claude/skills/backend-development/SKILL.md +0 -101
  160. package/src/claude/skills/backend-development/references/backend-api-design.md +0 -495
  161. package/src/claude/skills/backend-development/references/backend-architecture.md +0 -454
  162. package/src/claude/skills/backend-development/references/backend-authentication.md +0 -338
  163. package/src/claude/skills/backend-development/references/backend-code-quality.md +0 -659
  164. package/src/claude/skills/backend-development/references/backend-debugging.md +0 -904
  165. package/src/claude/skills/backend-development/references/backend-devops.md +0 -491
  166. package/src/claude/skills/backend-development/references/backend-mindset.md +0 -387
  167. package/src/claude/skills/backend-development/references/backend-performance.md +0 -397
  168. package/src/claude/skills/backend-development/references/backend-security.md +0 -342
  169. package/src/claude/skills/backend-development/references/backend-technologies.md +0 -256
  170. package/src/claude/skills/backend-development/references/backend-testing.md +0 -429
  171. package/src/claude/skills/devops/.env.example +0 -76
  172. package/src/claude/skills/devops/SKILL.md +0 -102
  173. package/src/claude/skills/devops/references/browser-rendering.md +0 -305
  174. package/src/claude/skills/devops/references/cloudflare-d1-kv.md +0 -123
  175. package/src/claude/skills/devops/references/cloudflare-platform.md +0 -271
  176. package/src/claude/skills/devops/references/cloudflare-r2-storage.md +0 -280
  177. package/src/claude/skills/devops/references/cloudflare-workers-advanced.md +0 -312
  178. package/src/claude/skills/devops/references/cloudflare-workers-apis.md +0 -309
  179. package/src/claude/skills/devops/references/cloudflare-workers-basics.md +0 -418
  180. package/src/claude/skills/devops/references/docker-basics.md +0 -297
  181. package/src/claude/skills/devops/references/docker-compose.md +0 -292
  182. package/src/claude/skills/devops/references/gcloud-platform.md +0 -297
  183. package/src/claude/skills/devops/references/gcloud-services.md +0 -304
  184. package/src/claude/skills/devops/references/kubernetes-basics.md +0 -95
  185. package/src/claude/skills/devops/references/kubernetes-helm-advanced.md +0 -70
  186. package/src/claude/skills/devops/references/kubernetes-helm.md +0 -81
  187. package/src/claude/skills/devops/references/kubernetes-kubectl.md +0 -74
  188. package/src/claude/skills/devops/references/kubernetes-security-advanced.md +0 -94
  189. package/src/claude/skills/devops/references/kubernetes-security.md +0 -89
  190. package/src/claude/skills/devops/references/kubernetes-troubleshooting-advanced.md +0 -74
  191. package/src/claude/skills/devops/references/kubernetes-troubleshooting.md +0 -49
  192. package/src/claude/skills/devops/references/kubernetes-workflows-advanced.md +0 -75
  193. package/src/claude/skills/devops/references/kubernetes-workflows.md +0 -76
  194. package/src/claude/skills/devops/scripts/cloudflare_deploy.py +0 -269
  195. package/src/claude/skills/devops/scripts/docker_optimize.py +0 -332
  196. package/src/claude/skills/devops/scripts/requirements.txt +0 -20
  197. package/src/claude/skills/devops/scripts/tests/requirements.txt +0 -3
  198. package/src/claude/skills/devops/scripts/tests/test_cloudflare_deploy.py +0 -285
  199. package/src/claude/skills/devops/scripts/tests/test_docker_optimize.py +0 -436
  200. package/src/claude/skills/frontend-design/SKILL.md +0 -135
  201. package/src/claude/skills/frontend-design/references/ai-multimodal-overview.md +0 -165
  202. package/src/claude/skills/frontend-design/references/analysis-best-practices.md +0 -80
  203. package/src/claude/skills/frontend-design/references/analysis-prompts.md +0 -141
  204. package/src/claude/skills/frontend-design/references/analysis-techniques.md +0 -118
  205. package/src/claude/skills/frontend-design/references/animejs.md +0 -396
  206. package/src/claude/skills/frontend-design/references/anti-slop-rules.md +0 -103
  207. package/src/claude/skills/frontend-design/references/asset-generation.md +0 -337
  208. package/src/claude/skills/frontend-design/references/bento-motion-engine.md +0 -142
  209. package/src/claude/skills/frontend-design/references/design-extraction-overview.md +0 -71
  210. package/src/claude/skills/frontend-design/references/extraction-best-practices.md +0 -141
  211. package/src/claude/skills/frontend-design/references/extraction-output-templates.md +0 -162
  212. package/src/claude/skills/frontend-design/references/extraction-prompts.md +0 -127
  213. package/src/claude/skills/frontend-design/references/magicui-components.md +0 -129
  214. package/src/claude/skills/frontend-design/references/performance-guardrails.md +0 -169
  215. package/src/claude/skills/frontend-design/references/premium-design-patterns.md +0 -93
  216. package/src/claude/skills/frontend-design/references/redesign-audit-checklist.md +0 -114
  217. package/src/claude/skills/frontend-design/references/technical-accessibility.md +0 -119
  218. package/src/claude/skills/frontend-design/references/technical-best-practices.md +0 -97
  219. package/src/claude/skills/frontend-design/references/technical-optimization.md +0 -44
  220. package/src/claude/skills/frontend-design/references/technical-overview.md +0 -90
  221. package/src/claude/skills/frontend-design/references/technical-workflows.md +0 -150
  222. package/src/claude/skills/frontend-design/references/visual-analysis-overview.md +0 -95
  223. package/src/claude/skills/frontend-design/references/workflow-3d.md +0 -102
  224. package/src/claude/skills/frontend-design/references/workflow-describe.md +0 -87
  225. package/src/claude/skills/frontend-design/references/workflow-immersive.md +0 -87
  226. package/src/claude/skills/frontend-design/references/workflow-quick.md +0 -57
  227. package/src/claude/skills/frontend-design/references/workflow-screenshot.md +0 -63
  228. package/src/claude/skills/frontend-design/references/workflow-video.md +0 -74
  229. package/src/claude/skills/frontend-development/SKILL.md +0 -406
  230. package/src/claude/skills/frontend-development/resources/common-patterns.md +0 -331
  231. package/src/claude/skills/frontend-development/resources/complete-examples.md +0 -872
  232. package/src/claude/skills/frontend-development/resources/component-patterns.md +0 -502
  233. package/src/claude/skills/frontend-development/resources/data-fetching.md +0 -767
  234. package/src/claude/skills/frontend-development/resources/file-organization.md +0 -502
  235. package/src/claude/skills/frontend-development/resources/loading-and-error-states.md +0 -501
  236. package/src/claude/skills/frontend-development/resources/performance.md +0 -406
  237. package/src/claude/skills/frontend-development/resources/routing-guide.md +0 -364
  238. package/src/claude/skills/frontend-development/resources/styling-guide.md +0 -428
  239. package/src/claude/skills/frontend-development/resources/typescript-standards.md +0 -418
  240. package/src/claude/skills/mobile-development/SKILL.md +0 -218
  241. package/src/claude/skills/mobile-development/references/mobile-android.md +0 -604
  242. package/src/claude/skills/mobile-development/references/mobile-best-practices.md +0 -544
  243. package/src/claude/skills/mobile-development/references/mobile-debugging.md +0 -1089
  244. package/src/claude/skills/mobile-development/references/mobile-frameworks.md +0 -465
  245. package/src/claude/skills/mobile-development/references/mobile-ios.md +0 -496
  246. package/src/claude/skills/mobile-development/references/mobile-mindset.md +0 -542
  247. package/src/claude/skills/react-best-practices/AGENTS.md +0 -2249
  248. package/src/claude/skills/react-best-practices/README.md +0 -123
  249. package/src/claude/skills/react-best-practices/SKILL.md +0 -128
  250. package/src/claude/skills/react-best-practices/metadata.json +0 -15
  251. package/src/claude/skills/react-best-practices/rules/_sections.md +0 -46
  252. package/src/claude/skills/react-best-practices/rules/_template.md +0 -28
  253. package/src/claude/skills/react-best-practices/rules/advanced-event-handler-refs.md +0 -55
  254. package/src/claude/skills/react-best-practices/rules/advanced-use-latest.md +0 -49
  255. package/src/claude/skills/react-best-practices/rules/async-api-routes.md +0 -38
  256. package/src/claude/skills/react-best-practices/rules/async-defer-await.md +0 -80
  257. package/src/claude/skills/react-best-practices/rules/async-dependencies.md +0 -36
  258. package/src/claude/skills/react-best-practices/rules/async-parallel.md +0 -28
  259. package/src/claude/skills/react-best-practices/rules/async-suspense-boundaries.md +0 -99
  260. package/src/claude/skills/react-best-practices/rules/bundle-barrel-imports.md +0 -59
  261. package/src/claude/skills/react-best-practices/rules/bundle-conditional.md +0 -31
  262. package/src/claude/skills/react-best-practices/rules/bundle-defer-third-party.md +0 -49
  263. package/src/claude/skills/react-best-practices/rules/bundle-dynamic-imports.md +0 -35
  264. package/src/claude/skills/react-best-practices/rules/bundle-preload.md +0 -50
  265. package/src/claude/skills/react-best-practices/rules/client-event-listeners.md +0 -74
  266. package/src/claude/skills/react-best-practices/rules/client-swr-dedup.md +0 -56
  267. package/src/claude/skills/react-best-practices/rules/js-batch-dom-css.md +0 -82
  268. package/src/claude/skills/react-best-practices/rules/js-cache-function-results.md +0 -80
  269. package/src/claude/skills/react-best-practices/rules/js-cache-property-access.md +0 -28
  270. package/src/claude/skills/react-best-practices/rules/js-cache-storage.md +0 -70
  271. package/src/claude/skills/react-best-practices/rules/js-combine-iterations.md +0 -32
  272. package/src/claude/skills/react-best-practices/rules/js-early-exit.md +0 -50
  273. package/src/claude/skills/react-best-practices/rules/js-hoist-regexp.md +0 -45
  274. package/src/claude/skills/react-best-practices/rules/js-index-maps.md +0 -37
  275. package/src/claude/skills/react-best-practices/rules/js-length-check-first.md +0 -49
  276. package/src/claude/skills/react-best-practices/rules/js-min-max-loop.md +0 -82
  277. package/src/claude/skills/react-best-practices/rules/js-set-map-lookups.md +0 -24
  278. package/src/claude/skills/react-best-practices/rules/js-tosorted-immutable.md +0 -57
  279. package/src/claude/skills/react-best-practices/rules/rendering-activity.md +0 -26
  280. package/src/claude/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
  281. package/src/claude/skills/react-best-practices/rules/rendering-conditional-render.md +0 -40
  282. package/src/claude/skills/react-best-practices/rules/rendering-content-visibility.md +0 -38
  283. package/src/claude/skills/react-best-practices/rules/rendering-hoist-jsx.md +0 -46
  284. package/src/claude/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
  285. package/src/claude/skills/react-best-practices/rules/rendering-svg-precision.md +0 -28
  286. package/src/claude/skills/react-best-practices/rules/rerender-defer-reads.md +0 -39
  287. package/src/claude/skills/react-best-practices/rules/rerender-dependencies.md +0 -45
  288. package/src/claude/skills/react-best-practices/rules/rerender-derived-state.md +0 -29
  289. package/src/claude/skills/react-best-practices/rules/rerender-functional-setstate.md +0 -74
  290. package/src/claude/skills/react-best-practices/rules/rerender-lazy-state-init.md +0 -58
  291. package/src/claude/skills/react-best-practices/rules/rerender-memo.md +0 -44
  292. package/src/claude/skills/react-best-practices/rules/rerender-transitions.md +0 -40
  293. package/src/claude/skills/react-best-practices/rules/server-after-nonblocking.md +0 -73
  294. package/src/claude/skills/react-best-practices/rules/server-cache-lru.md +0 -41
  295. package/src/claude/skills/react-best-practices/rules/server-cache-react.md +0 -26
  296. package/src/claude/skills/react-best-practices/rules/server-parallel-fetching.md +0 -79
  297. package/src/claude/skills/react-best-practices/rules/server-serialization.md +0 -38
@@ -1,6 +1,6 @@
1
1
  ---
2
- name: hapo:hotfix
3
- description: "ALWAYS activate this skill when you are asked to FIX a bug, error, test failure, CI/CD issue, type error, lint error, log error, UI issue, or code problem. Uses hapo:debug for evidence-first diagnosis before any code change."
2
+ name: cf:fix
3
+ description: "Use when asked to FIX a bug, error, test failure, CI/CD issue, type error, lint error, log error, UI issue, or code problem. Uses cf:debug for evidence-first diagnosis before any code change."
4
4
  user-invocable: true
5
5
  when_to_use: "Invoke to fix a bug or failure with scout-first diagnosis before change."
6
6
  category: dev-tools
@@ -8,33 +8,65 @@ keywords: [hotfix, fix, bug, diagnosis]
8
8
  argument-hint: "[issue] --quick|--parallel|--from-debug"
9
9
  metadata:
10
10
  author: haposoft
11
- version: "1.0.0"
11
+ version: "2.0.0"
12
12
  ---
13
- # Hotfix - Structured Bug Elimination
13
+ # Fix — root-cause repair workflow
14
14
 
15
- Kill bugs systematically. No guessing. Evidence first, fix second.
15
+ Fix the diagnosed root cause, prove the fix with fresh evidence, and leave no
16
+ side effects. Evidence first, fix second.
16
17
 
17
18
  ## Arguments
18
19
 
19
20
  - `--quick` - Reduced-depth path for trivial issues (lint, type errors, syntax); still scout-first
20
- - `--parallel` - Spawn multiple `implementer` agents for independent issues
21
- - `--from-debug` - Start from an existing `hapo:debug` report and validate its root-cause contract
21
+ - `--parallel` - Fix independent issues concurrently, only through the Delegation Gate below
22
+ - `--from-debug` - Start from an existing `cf:debug` report and validate its contract before accepting it
22
23
 
23
- Default: deterministic scout-first hotfix. There is no initial mode selection step.
24
+ Default: deterministic scout-first fix. There is no initial mode selection step.
25
+
26
+ ## Proportional depth
27
+
28
+ Choose the smallest adequate depth from the diagnosed evidence. Depth vocabulary
29
+ follows `cf:debug`:
30
+
31
+ - **Quick/local:** one deterministic syntax, lint, type, or isolated-test failure
32
+ with obvious local scope. Quick mode only reduces depth; it never skips scout, pre-fix evidence, diagnosis, or before/after verification.
33
+ - **Standard:** a diagnosed root cause inside one bounded area. Fix plus a
34
+ regression test that fails without the fix and passes with it.
35
+ - **Incident/deep:** production impact, multiple components, intermittent
36
+ behavior, data/security risk, or concurrency. Consume the full Incident/deep
37
+ debug handoff (timeline, elimination path, recurrence candidates), implement in
38
+ stages, and verify each stage.
39
+
40
+ Depth changes evidence breadth, never the gates: scout, diagnosis, before/after
41
+ proof, and the side-effect gate apply at every depth.
42
+
43
+ ## Bounded repair frame
44
+
45
+ Quick/local does not add a separate framing ceremony when the issue and diagnosis
46
+ already establish the repaired behavior and proof. For Standard or Incident/deep,
47
+ or whenever scope or risk remains ambiguous after diagnosis, record four short
48
+ fields before choosing an implementation:
49
+
50
+ - **Outcome:** the observable repaired behavior.
51
+ - **Constraints:** compatibility, safety, ownership, rollout, and time boundaries.
52
+ - **Non-goals:** adjacent behavior the repair must not absorb.
53
+ - **Acceptance:** the exact reproduction plus broader evidence that proves completion.
54
+
55
+ Derive repository-owned facts from scout and diagnosis. Ask the user only for a
56
+ missing user-owned decision that could materially change the repair. This frame
57
+ does not select a solution, widen the issue into feature work, or run before the
58
+ root cause is proven.
24
59
 
25
60
  <HARD-GATE>
26
- Do NOT propose or implement fixes before completing Steps 1-2 (Scout + `hapo:debug` diagnosis).
27
- Symptom fixes are FAILURE. Find the root cause first.
28
- The exact root-cause contract is mandatory: symptom, reproduction, expected/actual, root cause file:line or config/env source, why now, evidence chain, blast radius.
29
- Answer each item in one concrete sentence.
30
- If any answer contains 'probably', 'I think', 'something with', or 'maybe' — it is not an answer; gather evidence instead.
31
- The side-effect gate is mandatory before completion.
32
- If 3+ fix attempts fail → STOP. Question the architecture. Discuss with user.
33
- Exception: `--quick` mode only abbreviates depth; it never skips scout, pre-fix evidence, diagnosis, or before/after verification.
61
+ Do not propose or implement a fix before Steps 1-2 (scout + diagnosis) complete.
62
+ A symptom patch without a diagnosed root cause is a failed fix.
63
+ The exact root-cause contract in Step 2 is mandatory; answer each field in one concrete sentence.
64
+ An answer containing 'probably', 'I think', 'something with', or 'maybe' is not an answer; gather evidence instead.
65
+ If 3+ fix attempts fail, stop, question the architecture, and discuss with the user.
34
66
  </HARD-GATE>
35
67
 
36
68
  <HARD-GATE-SCOUT-FIRST>
37
- Hotfix ALWAYS scouts before asking broad clarification questions, forming hypotheses, or changing files.
69
+ Fix always scouts before asking broad clarification questions, forming hypotheses, or changing files.
38
70
  Collect these scout outputs first:
39
71
  1. Project type, language(s), framework(s), and package/test runner from repo files.
40
72
  2. Exact file(s) where the symptom surfaces and their direct callers/dependents.
@@ -42,6 +74,7 @@ Collect these scout outputs first:
42
74
  4. Recent commits touching affected files: `git log --oneline -10 -- <affected-files>`.
43
75
  5. Existing patterns/conventions for this kind of fix.
44
76
  Then state a concise 3-6 bullet codebase-context summary before Step 2.
77
+ Do not ask generic questions before this step unless there is no repo, no error text, and no observable artifact to inspect.
45
78
  </HARD-GATE-SCOUT-FIRST>
46
79
 
47
80
  <HARD-GATE-NO-SIDE-EFFECTS>
@@ -52,7 +85,7 @@ The fix is not done until Step 5 proves:
52
85
  4. No new lint/type/build errors were introduced.
53
86
  5. Public contracts are unchanged unless intentionally called out: function signatures, exported types, response shapes, DB schemas, env vars.
54
87
 
55
- If verification reveals a side effect or regression, STOP and present 2-4 concrete options to the user:
88
+ If verification reveals a side effect or regression, stop and present 2-4 concrete options to the user:
56
89
  - Revert this fix and try a different root-cause angle
57
90
  - Keep the fix and update <dependent files> to match the new contract
58
91
  - Narrow the fix to <subset> so the regression disappears
@@ -60,192 +93,166 @@ If verification reveals a side effect or regression, STOP and present 2-4 concre
60
93
  Do not silently patch around the regression.
61
94
  </HARD-GATE-NO-SIDE-EFFECTS>
62
95
 
63
- ## Anti-Rationalization
96
+ ## Delegation Gate
97
+
98
+ Dispatch subagents (parallel scouts, hypothesis tests, deep research, or
99
+ `--parallel` fix trees) only when all three conditions hold:
64
100
 
65
- | Thought | Reality |
66
- |---------|---------|
67
- | "I can see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. Scout first. |
68
- | "Quick fix for now, investigate later" | "Later" never comes. Fix properly now. |
69
- | "Just try changing X" | Random fixes waste time and create new bugs. Diagnose first. |
70
- | "It's probably X" | "Probably" = guessing. Use structured diagnosis. |
71
- | "One more fix attempt" (after 2+) | 3+ failures = wrong approach. Question architecture. |
72
- | "Quick mode means skip process" | Quick mode only reduces depth. Scout, diagnosis, and before/after proof remain mandatory. |
101
+ - The user explicitly requested or permitted delegation or parallel agents.
102
+ - The active runtime exposes an Explore/delegation capability.
103
+ - The work splits into at least two distinct, non-overlapping scopes with useful independent work.
104
+
105
+ Otherwise continue sequentially in the main agent with focused local evidence.
106
+ Task-tracking tools are an optional visibility fallback, never a required step;
107
+ a concise markdown checklist is always sufficient.
73
108
 
74
109
  ## Process Flow
75
110
 
76
111
  ```mermaid
77
112
  flowchart TD
78
- A[Issue Input] --> B[Step 1: Scout via hapo:inspect]
79
- B --> C[Step 2: Diagnose via hapo:debug]
80
- C --> D[Step 3: Classify Complexity]
81
- D -->|Trivial| E[Quick Fix after scout+diagnose]
82
- D -->|Standard| F[Standard Fix]
83
- D -->|Complex| G[Deep Fix + Subagents]
84
- D -->|Multiple Issues| H[Parallel Fix]
85
- E --> I[Step 4: Implement Fix]
86
- F --> I
87
- G --> I
88
- H --> I
89
- I --> J[Step 5: Verify + Prevent]
90
- J --> N[Side-Effect Gate]
91
- N -->|Pass| K[Step 6: Finalize]
92
- N -->|Regression Risk| C
93
- J -->|Fail, <3 attempts| C
94
- J -->|Fail, 3+ attempts| L[Question Architecture → Discuss with User]
95
- K --> M[Report + Commit]
113
+ A[Issue Input] --> B[Step 1: Scout via cf:scout]
114
+ B --> C[Step 2: Diagnose via cf:debug]
115
+ C --> D[Step 3: Select Depth]
116
+ D --> E[Step 4: Implement Fix]
117
+ E --> F[Step 5: Verify + Prevent]
118
+ F --> G[Side-Effect Gate]
119
+ G -->|Pass| H[Step 6: Finalize]
120
+ G -->|Regression risk| C
121
+ F -->|Fail, <3 attempts| C
122
+ F -->|Fail, 3+ attempts| I[Question architecture with user]
123
+ H --> J[Report]
96
124
  ```
97
125
 
98
- **This diagram is the authoritative workflow.** If prose conflicts with this flow, follow the diagram.
126
+ If prose conflicts with this flow, follow the diagram.
99
127
 
100
128
  ---
101
129
 
102
- ## Step 1: Scout (MANDATORY — never skip)
103
-
104
- **Purpose:** Understand the affected codebase BEFORE forming any hypotheses.
130
+ ## Step 1: Scout
105
131
 
106
- **Action:** Activate `hapo:inspect` skill to map the blast radius.
132
+ Understand the affected codebase before forming any hypotheses. Activate
133
+ `cf:scout` or perform an equivalent focused local scout (`rg` plus targeted
134
+ reads) to map the blast radius.
107
135
 
108
- Do not ask generic questions before this step unless there is no repo, no error text, and no observable artifact to inspect.
109
-
110
- | Path | Scout Depth |
136
+ | Path | Scout depth |
111
137
  |------|-------------|
112
- | `--quick` | Minimal — project type, affected file(s), direct callers/dependents, related tests, recent commits |
113
- | Standard | Full — project type, module boundaries, test coverage, call chains, recent changes, existing patterns |
114
- | `--parallel` | Per-issue independent scouts |
115
-
116
- **Checklist:**
117
- - [ ] Project type, language, framework, package manager, and test runner identified
118
- - [ ] Affected files identified
119
- - [ ] Direct callers/dependents mapped (imports/exports, route registrations, provider wiring, consumers)
120
- - [ ] Related tests located
121
- - [ ] Recent git changes checked: `git log --oneline -10 -- <affected-files>`
122
- - [ ] Existing local patterns for this code path identified
123
- - [ ] 3-6 bullet codebase-context summary reported before diagnosis
138
+ | Quick/local | Minimal - project type, affected file(s), direct callers/dependents, related tests, recent commits |
139
+ | Standard and deeper | Full - module boundaries, test coverage, call chains, recent changes, existing patterns |
140
+ | `--parallel` | Per-issue independent scouts, one scope each, only through the Delegation Gate |
124
141
 
125
142
  **Output:** `✓ Step 1: Scouted — [N] files mapped, [M] dependencies, [K] tests found`
126
143
 
127
144
  ---
128
145
 
129
- ## Step 2: Diagnose via `hapo:debug` (MANDATORY — never skip)
146
+ ## Step 2: Diagnose via `cf:debug`
130
147
 
131
- **Purpose:** Evidence-based root cause analysis. NO guessing.
148
+ Evidence-based root cause analysis; no guessing. Use `cf:debug`, or validate
149
+ an existing debug report when `--from-debug` is provided. See
150
+ `references/diagnosis-protocol.md` for the Fix-local checklist.
132
151
 
133
- Use `hapo:debug` or validate an existing debug report when `--from-debug` is provided. See `references/diagnosis-protocol.md` for full methodology.
152
+ Diagnosis chain:
134
153
 
135
- **Mandatory chain:**
136
- 1. **Capture pre-fix state:** Record exact error messages, failing test output, stack traces. This is your baseline for Step 5.
137
- 2. **Observe:** Read the actual error. Where does it occur? When did it start? (`git log -p`)
138
- 3. **Hypothesize:** Form 2-3 hypotheses through structured reasoning:
139
- ```
140
- Hypothesis: [statement]
141
- Confirm if: [what evidence would prove it]
142
- Refute if: [what evidence would disprove it]
143
- Quick test: [how to verify fast]
144
- ```
145
- 4. **Test:** Use `Grep`, `Read`, or spawn parallel `Explore` subagents to validate each hypothesis against codebase evidence.
146
- 5. **Trace root cause:** Follow the chain backward — symptom → immediate cause → contributing factor → **ROOT CAUSE**.
147
- 6. **Escalate:** If 2+ hypotheses fail, apply Inversion Thinking (see `references/escalation-tactics.md`).
154
+ 1. **Capture pre-fix state:** exact error messages, failing test output, stack traces. This is the baseline for Step 5.
155
+ 2. **Observe:** read the actual error; locate where it occurs and when it started (`git log -p`).
156
+ 3. **Hypothesize:** form 2-3 hypotheses, each with confirm/refute evidence and a quick test.
157
+ 4. **Test:** validate each hypothesis against codebase evidence with focused local reads; test hypotheses in parallel only through the Delegation Gate.
158
+ 5. **Trace root cause:** symptom → immediate cause → contributing factor → root cause.
159
+ 6. **Escalate:** if 2+ hypotheses fail, apply `references/escalation-tactics.md`.
148
160
 
149
161
  **Exact root-cause contract:**
150
162
  - Symptom: exact observable failure
151
163
  - Reproduction: command, user flow, CI job, log trigger, or route
152
164
  - Expected vs actual behavior
165
+ - Trigger: event or input that activated the failure, or `unknown`
153
166
  - Root cause: file:line, config, environment, dependency, or data source
167
+ - Contributing factors: conditions that raised likelihood or impact but are not sufficient causes, or `none evidenced`
154
168
  - Why now: recent change, dependency drift, data state, environment, timing, or load
155
169
  - Evidence chain: observations proving the cause
156
170
  - Blast radius: affected files, modules, tests, users, workflows, or release paths
157
171
 
158
- If any field is vague (`probably`, `maybe`, `I think`, or missing file:line/config/env evidence), keep diagnosing or ask the user for the specific missing artifact. Do not implement.
172
+ With `--from-debug`, validate the report before accepting it:
173
+
174
+ - the exact root-cause contract above is complete;
175
+ - `Evidence Timeline` is present — a skipped timeline is valid in either producer form (`Timeline: skipped - <reason>` or `- skipped: <reason>`);
176
+ - `Elimination Path` records the decisive observation for each removed or retained candidate;
177
+ - `Recurrence-Prevention Handoff`, when present, carries evidence-backed candidates only.
178
+
179
+ A report missing required fields routes back to diagnosis (`cf:debug`); it
180
+ does not enter implementation.
181
+
182
+ If any contract field is vague or missing file:line/config/env evidence, keep
183
+ diagnosing or ask the user for the specific missing artifact. Do not implement.
159
184
 
160
185
  **Output:** `✓ Step 2: Diagnosed — Root cause: [summary], Evidence: [brief], Scope: [N files]`
161
186
 
162
187
  ---
163
188
 
164
- ## Step 3: Classify Complexity
189
+ ## Step 3: Select Depth + Bound Repair
165
190
 
166
- | Level | Indicators | Workflow |
167
- |-------|------------|----------|
168
- | **Trivial** | Single file, clear error, type/lint/syntax | Quick: straight to fix |
169
- | **Standard** | Multi-file, root cause identified via diagnosis | Standard: fix + regression test |
170
- | **Complex** | System-wide, architecture impact, unclear boundaries | Deep: research + plan + fix |
171
- | **Parallel** | 2+ independent issues OR `--parallel` flag | Spawn `implementer` agents per issue |
191
+ Apply the Proportional depth rule above. For 2+ independent issues (or
192
+ `--parallel`), evaluate the Delegation Gate; when it is closed, fix the issues
193
+ sequentially. Track progress with the runtime's task surface when available, or
194
+ a markdown checklist otherwise.
172
195
 
173
- **Task Orchestration (Standard+ only):**
174
- - Use `TaskCreate` with dependencies to track fix phases
175
- - Skip for Trivial (overhead exceeds benefit)
176
- - If `TaskCreate` / `TaskUpdate` are unavailable, use a concise markdown checklist or `TodoWrite` fallback. Do not block the hotfix because structured task tools are missing.
196
+ For Standard and Incident/deep, complete the bounded repair frame above. Quick
197
+ records no separate frame unless scope or risk is still ambiguous.
177
198
 
178
- **Output:** `✓ Step 3: [Complexity] detected — [workflow] selected`
199
+ **Output:** `✓ Step 3: [Depth] selected — [workflow]`
179
200
 
180
201
  ---
181
202
 
182
203
  ## Step 4: Implement Fix
183
204
 
184
- **Rules:**
185
- - Fix the ROOT CAUSE, not the symptom. Follow diagnosis findings.
186
- - Minimal changes only. Follow existing code patterns.
205
+ Rules:
206
+ - Fix the root cause, not the symptom. Follow diagnosis findings.
207
+ - Minimal changes only; follow existing code patterns.
187
208
  - One logical change per commit boundary.
188
209
 
189
- ### Quick Workflow
190
- 1. Apply the minimal fix directly from completed scout + diagnosis
191
- 2. Run exact pre-fix command plus typecheck/lint immediately
192
- 3. Report before/after proof
193
-
194
- ### Standard Workflow
195
- 1. Implement fix targeting root cause
196
- 2. Add/update regression test that fails without fix, passes with it
197
- 3. Run full test suite
198
-
199
- ### Deep Workflow
200
- 1. **Parallel investigation:** After initial scope is known, gather evidence in parallel — Scout (`hapo:inspect`), Diagnose (`hapo:debug`), and Research (`researcher` subagent) can run concurrently. See `references/parallel-patterns.md` Pattern E.
201
- 2. Synthesize findings from all three into a unified fix approach
202
- 3. Plan the fix (consider writing to `references/` for future use)
203
- 4. Implement in stages, verifying each stage
204
- 5. Comprehensive regression tests
205
-
206
- ### Parallel Workflow
207
- 1. Create separate `TaskCreate` per independent issue
208
- 2. Spawn `implementer` subagents — one per issue
209
- 3. Each agent follows Steps 1-5 independently
210
- 4. Aggregate results upon completion
210
+ Workflows by depth:
211
+ - **Quick:** apply the minimal fix from completed scout + diagnosis, run the exact pre-fix command plus typecheck/lint immediately, report before/after proof.
212
+ - **Standard:** implement the fix, add or update a regression test that fails without the fix and passes with it, run the relevant suite.
213
+ - **Incident/deep:** after diagnosis, research only unresolved external facts. If
214
+ multiple cause-aligned remedies or an architecture decision remain, use
215
+ `cf:brainstorm` to compare 2-3 options against the bounded repair frame, then
216
+ write a concise staged implementation plan with dependencies and proof per
217
+ stage. When diagnosis leaves one safe direct repair, skip research and
218
+ brainstorm, record why it satisfies the frame, and implement it. Delegated
219
+ research follows the Delegation Gate; implementation starts only after the
220
+ direction is resolved.
221
+ - **Parallel:** one independent issue per agent, each following Steps 1-5, dispatched only through the Delegation Gate; aggregate results on completion.
211
222
 
212
223
  **Output:** `✓ Step 4: Fixed — [N] files changed`
213
224
 
214
225
  ---
215
226
 
216
- ## Step 5: Verify + Prevent (MANDATORY — never skip)
217
-
218
- **Purpose:** Prove the fix works AND prevent the same bug class from recurring.
227
+ ## Step 5: Verify + Prevent
219
228
 
220
- **Mandatory chain:**
221
- 1. **Iron-law verification:** Run the EXACT commands from pre-fix state capture (Step 2). Compare output. NO claims without fresh terminal evidence.
222
- 2. **Regression test:** The test MUST fail without the fix and pass with it.
223
- 3. **Parallel verification:** Run typecheck + lint + build + test simultaneously via `Bash`. See `references/parallel-patterns.md` Pattern C.
224
- 4. **Prevention guard (Standard+ only):** See `references/prevention-gate.md`.
225
- 5. **Side-effect gate:** Sweep the full blast radius identified in Step 2:
226
- - Modified files and direct dependents pass relevant tests
227
- - Affected user/API/CLI workflows still work
228
- - Public contracts unchanged unless intentionally called out
229
- - No new lint/type/build errors
230
- 6. **Code review:** Trigger `hapo:code-review`; never auto-approve blocking security, auth, data-loss, resource-exhaustion, or public-contract issues.
229
+ 1. **Iron-law verification:** run the exact commands from the pre-fix state capture and compare output. No claims without fresh command output from the current run.
230
+ 2. **Regression test:** must fail without the fix and pass with it.
231
+ 3. **Full check:** typecheck + lint + build + test (see `references/parallel-patterns.md` Pattern C).
232
+ 4. **Prevention guard (Standard+):** see `references/prevention-gate.md`; consume the debug report's recurrence candidates when present.
233
+ 5. **Side-effect gate:** sweep the full blast radius from Step 2 against the five checks in the gate above.
234
+ 6. **Review:** trigger `cf:code-review`; see `references/review-cycle.md`.
231
235
 
232
- **If verification fails:**
233
- - < 3 attempts → Loop back to Step 2 (re-diagnose with new evidence)
234
- - 3+ attempts → STOP. Question architecture. Discuss with user.
236
+ Verification and review report `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`.
237
+ The definition of `PASS` defers to `cf:code-review`. `PASS_WITH_WARNINGS`
238
+ routes through the same remediation or user-pause path as `FAIL` and never
239
+ auto-accepts. `BLOCKED` is terminal for the cycle; resolve the blocker instead
240
+ of retrying. A review-only result is not execution proof; completion claims
241
+ require fresh command output.
235
242
 
236
- **If a side effect appears:**
237
- - STOP and present concrete options to the user. Do not silently broaden the fix.
243
+ If verification fails: under 3 attempts, loop back to Step 2 and re-diagnose
244
+ with the new evidence; at 3+ attempts, stop and discuss with the user. Never
245
+ weaken, delete, or mock a failing assertion to obtain green.
238
246
 
239
247
  **Output:** `✓ Step 5: Verified + Prevented — [before/after comparison], [N] tests added`
240
248
 
241
249
  ---
242
250
 
243
- ## Step 6: Finalize (MANDATORY — never skip)
251
+ ## Step 6: Finalize
244
252
 
245
- 1. **Report:** Confidence score, root cause, changes made, files affected, prevention measures, side-effect sweep result
246
- 2. **Docs update:** If API/behavior changed → delegate to `docs-keeper` subagent
247
- 3. **Task cleanup:** `TaskUpdate` → mark all tasks `completed` (skip if no tasks created)
248
- 4. **Commit:** Ask user if ready to commit via `git-ops` subagent
253
+ 1. **Report:** root cause, changes made, files affected, prevention measures, side-effect sweep result, and any remaining limitations.
254
+ 2. **Docs update:** if API or behavior changed, update only the affected existing docs through the docs flow.
255
+ 3. **Commit:** ask the user before committing; use conventional commits.
249
256
 
250
257
  **Output:** `✓ Step 6: Complete — [action taken]`
251
258
 
@@ -257,44 +264,26 @@ Unified step markers (emit after each step):
257
264
  ```
258
265
  ✓ Step 1: Scouted — [N] files, [M] deps
259
266
  ✓ Step 2: Diagnosed — Root cause: [summary]
260
- ✓ Step 3: [Complexity] detected — [workflow] selected
267
+ ✓ Step 3: [Depth] selected — [workflow]
261
268
  ✓ Step 4: Fixed — [N] files changed
262
269
  ✓ Step 5: Verified + Prevented — [tests added], [guards added]
263
270
  ✓ Step 6: Complete — [action taken]
264
271
  ```
265
272
 
266
- ## Subagent Usage
267
-
268
- | Subagent | When |
269
- |----------|------|
270
- | `hapo:debug` | Mandatory diagnosis gate before code edits (Step 2) |
271
- | `debugger` | Root cause unclear, need deep systematic investigation (Step 2) |
272
- | `Explore` (parallel) | Scout multiple areas (Step 1), test hypotheses (Step 2) |
273
- | `Bash` (parallel) | Verify: typecheck + lint + build + test (Step 5) |
274
- | `researcher` | External docs needed (Deep workflow only) |
275
- | `test-runner` | After fix, verify correctness (Step 5) |
276
- | `hapo:code-review` | After fix, quality check (Step 5) |
277
- | `git-ops` | Commit changes (Step 6) |
278
- | `docs-keeper` | Update docs if behavior changed (Step 6) |
279
- | `implementer` | Parallel independent issues (each gets own agent) |
280
-
281
273
  ## Specialized Paths
282
274
 
283
- Use `references/workflow-specialized.md` as an overlay after Step 1 scout:
284
- - CI/CD failures
285
- - Test suite failures
286
- - TypeScript type errors
287
- - UI / visual issues
288
- - Application log errors
289
-
290
- Specialized paths do not replace the 6-step hotfix process.
275
+ Use `references/workflow-specialized.md` as a progressively disclosed overlay
276
+ after Step 1 scout for CI/CD failures, test suite failures, TypeScript type
277
+ errors, UI/visual issues, and application log errors. Load only the matching
278
+ section. Specialized paths add category-specific evidence and proof; they do
279
+ not replace the six-step flow, weaken diagnosis, or broaden the repair scope.
291
280
 
292
281
  ## References
293
282
 
294
283
  Load as needed:
295
- - `references/diagnosis-protocol.md` — Structured root cause analysis methodology
284
+ - `references/diagnosis-protocol.md` — Structured root cause analysis and the exact root-cause contract
296
285
  - `references/escalation-tactics.md` — What to do when hypotheses fail (Inversion, Scale Game)
297
286
  - `references/prevention-gate.md` — Defense-in-depth validation after fix
298
- - `references/review-cycle.md` — Review handling and required user-pause conditions
299
- - `references/parallel-patterns.md` — Parallel Explore/Bash/Task coordination with code templates
287
+ - `references/review-cycle.md` — Review verdict handling and required user-pause conditions
288
+ - `references/parallel-patterns.md` — Delegation Gate patterns for parallel work
300
289
  - `references/workflow-specialized.md` — CI/CD, test, TypeScript, UI-specific workflows
@@ -1,14 +1,14 @@
1
1
  # Diagnosis Protocol
2
2
 
3
- Structured root cause analysis methodology. Replaces ad-hoc guessing with evidence-based investigation. Prefer running `hapo:debug` directly; use this file as the hotfix-local checklist.
3
+ Structured root cause analysis methodology. Replaces ad-hoc guessing with evidence-based investigation. Prefer running `cf:debug` directly; use this file as the Fix-local checklist.
4
4
 
5
5
  ## Core Principle
6
6
 
7
- **NEVER guess root causes.** Form hypotheses through structured reasoning and test them against evidence.
7
+ Do not guess root causes. Form hypotheses through structured reasoning and test them against evidence.
8
8
 
9
- **NO FIXES IN DIAGNOSIS.** Product-code changes start only after the exact root-cause contract is complete.
9
+ No fixes during diagnosis: product-code changes start only after the exact root-cause contract is complete.
10
10
 
11
- ## Pre-Diagnosis: Capture State (MANDATORY)
11
+ ## Pre-Diagnosis: Capture State
12
12
 
13
13
  Before any investigation, capture the current broken state as baseline:
14
14
 
@@ -56,13 +56,14 @@ For each hypothesis:
56
56
 
57
57
  ### Phase 3: Test — Verify hypotheses against evidence
58
58
 
59
- Spawn parallel `Explore` subagents to test each hypothesis simultaneously:
59
+ Test each hypothesis with focused local evidence (`rg`, targeted reads, exact
60
+ commands). Spawn parallel `Explore` subagents only when the Delegation Gate in
61
+ `../SKILL.md` is open:
60
62
 
61
63
  ```
62
- // Launch in SINGLE message — max 3 parallel agents
64
+ // Only through the Delegation Gate — single message, max 3 parallel agents
63
65
  Agent(subagent_type="Explore", prompt="Test hypothesis A: [specific search/check]")
64
66
  Agent(subagent_type="Explore", prompt="Test hypothesis B: [specific search/check]")
65
- Agent(subagent_type="Explore", prompt="Test hypothesis C: [specific search/check]")
66
67
  ```
67
68
 
68
69
  **For each hypothesis result:**
@@ -83,15 +84,17 @@ Symptom (where error appears)
83
84
 
84
85
  **Rule:** NEVER fix where the error appears. Trace back to the source.
85
86
 
86
- ## Exact Root-Cause Contract (MANDATORY)
87
+ ## Exact Root-Cause Contract
87
88
 
88
- Before Step 4 implementation in `hapo:hotfix`, record:
89
+ Before Step 4 implementation in `cf:fix`, record:
89
90
 
90
91
  - Symptom: exact observable failure
91
92
  - Reproduction: command, user flow, CI job, log trigger, or route
92
93
  - Expected: intended behavior
93
94
  - Actual: observed behavior
95
+ - Trigger: event or input that activated the failure, or `unknown`
94
96
  - Root cause: file:line, config, environment, dependency, or data source
97
+ - Contributing factors: conditions that raised likelihood or impact but are not sufficient causes, or `none evidenced`
95
98
  - Why now: recent change, data state, dependency drift, environment, timing, or load factor
96
99
  - Evidence chain: observations proving this cause
97
100
  - Blast radius: affected files, modules, tests, users, workflows, or release paths
@@ -116,7 +119,9 @@ If 2+ hypotheses are REFUTED → see `escalation-tactics.md`.
116
119
  - Reproduction:
117
120
  - Expected:
118
121
  - Actual:
122
+ - Trigger:
119
123
  - Root cause:
124
+ - Contributing factors:
120
125
  - Why now:
121
126
  - Blast radius:
122
127
 
@@ -1,6 +1,17 @@
1
1
  # Parallel Patterns & Task Coordination
2
2
 
3
- How to effectively leverage multiple subagents (the `Agent` tool) and native task tracking (`TaskCreate`/`TaskUpdate`) during fix workflows.
3
+ How to leverage multiple subagents (the `Agent` tool) and optional task tracking during fix workflows.
4
+
5
+ ## Delegation Gate (applies to every subagent pattern)
6
+
7
+ Patterns A, B, D, and E dispatch subagents only when all three conditions hold:
8
+
9
+ - The user explicitly requested or permitted delegation or parallel agents.
10
+ - The active runtime exposes an Explore/delegation capability.
11
+ - The work splits into at least two distinct, non-overlapping scopes with useful independent work.
12
+
13
+ Otherwise continue sequentially in the main agent with focused local evidence.
14
+ Pattern C runs shell commands in the main agent and needs no gate.
4
15
 
5
16
  ## When to Go Parallel
6
17
 
@@ -10,7 +21,7 @@ How to effectively leverage multiple subagents (the `Agent` tool) and native tas
10
21
  | Testing 2-3 diagnostic hypotheses simultaneously | Parallel hypothesis test | `Explore` × 2-3 |
11
22
  | Verifying fix (typecheck + lint + build + test) | Parallel verification | `Bash` × 3-4 |
12
23
  | Fixing 2+ independent bugs in one session | Parallel issue trees | `implementer` × N |
13
- | Deep workflow: scout + diagnose + research together | Parallel investigation | Mixed |
24
+ | Deep workflow: parallel scout, then diagnose, then optional research | Staged investigation | Mixed |
14
25
 
15
26
  ## Pattern A: Parallel Scouting
16
27
 
@@ -52,7 +63,8 @@ All four must pass. If any fails, investigate that specific failure before re-at
52
63
 
53
64
  ## Pattern D: Task-Coordinated Issue Trees
54
65
 
55
- For 2+ independent bugs, create separate dependency chains per issue:
66
+ For 2+ independent bugs, optionally create separate dependency chains per issue
67
+ (task tools add visibility, never a required step):
56
68
 
57
69
  ```
58
70
  // Issue A — payment processing error
@@ -73,21 +85,23 @@ TaskCreate(subject="Integration verification", addBlockedBy=[A4, B4
73
85
 
74
86
  Spawn one `implementer` agent per issue tree. Each agent claims tasks via `TaskUpdate(status="in_progress")` and completes via `TaskUpdate(status="completed")`.
75
87
 
76
- ## Pattern E: Deep Workflow — Parallel Investigation Phase
88
+ ## Pattern E: Deep Workflow — Parallel Evidence Gathering
77
89
 
78
- In complex bugs (Deep workflow), Steps 1+2+3 should run **concurrently** to save time:
90
+ In complex bugs, independent scout scopes may run concurrently when the
91
+ Delegation Gate is open. Diagnosis still starts only after the required scout
92
+ outputs are synthesized:
79
93
 
80
94
  ```
81
- // All three launch simultaneously:
82
- Agent(subagent_type="Explore", prompt="Scout: map affected files, dependencies, and test coverage")
83
- // Meanwhile, main agent starts diagnosis using available error context
84
- // Meanwhile:
85
- Agent(subagent_type="researcher", prompt="Research: find latest docs and known issues for [library/framework]")
95
+ // Both read-only scout scopes launch simultaneously:
96
+ Agent(subagent_type="Explore", prompt="Scout scope A: map affected files, dependencies, and test coverage")
97
+ Agent(subagent_type="Explore", prompt="Scout scope B: map runtime/config paths and recent changes")
86
98
  ```
87
99
 
88
- The main agent begins hypothesis formation (Step 2) immediately using the error message and stack trace. Scout results enrich the diagnosis when they arrive. Research results inform the fix approach.
89
-
90
- **Key insight:** You don't need to wait for scouting to finish before starting diagnosis — the error message itself is often enough to form initial hypotheses.
100
+ Wait for the scout evidence, synthesize the required codebase-context summary,
101
+ then begin hypotheses and diagnosis. Research begins only after Step 2 diagnosis
102
+ proves the root cause and identifies one unresolved external fact. It may inform
103
+ a post-diagnosis remedy decision; it never substitutes for repository evidence
104
+ or selects a fix early.
91
105
 
92
106
  ## Resource Constraints
93
107
 
@@ -2,6 +2,11 @@
2
2
 
3
3
  After a fix is verified, apply defense-in-depth to prevent the same bug class from recurring. Prevention is not the same as side-effect safety; run the Step 5 side-effect sweep in `../SKILL.md` before claiming completion.
4
4
 
5
+ When the debug report carries a `Recurrence-Prevention Handoff`, consume its
6
+ evidence-backed candidates (missing invariant or validation layer,
7
+ observability/alerting gap, regression scenario) as guard inputs below instead
8
+ of inventing new ones.
9
+
5
10
  ## Mandatory Prevention Checklist
6
11
 
7
12
  For every fix (Standard+ complexity), evaluate and apply at least ONE: