@haposoft/cafekit 0.16.0-rc.7 → 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.
- package/README.md +116 -27
- package/bin/__tests__/codex-hooks-ownership.test.js +239 -0
- package/bin/__tests__/codex-hooks.test.js +295 -0
- package/bin/__tests__/codex-native.test.js +2289 -34
- package/bin/__tests__/develop-contract.test.js +400 -23
- package/bin/__tests__/installer-safety.test.js +3 -3
- package/bin/__tests__/optional-skill-inventory.test.js +249 -0
- package/bin/__tests__/output-styles.test.js +214 -0
- package/bin/__tests__/package-inventory.test.js +2131 -16
- package/bin/__tests__/runtime-schema.test.js +111 -0
- package/bin/__tests__/secret-output-guardrail.test.js +122 -0
- package/bin/__tests__/skill-routing-source.test.js +172 -0
- package/bin/__tests__/specs-v2-execution-closeout.test.js +1 -1
- package/bin/install.js +10 -0
- package/bin/lib/codex-install.js +170 -5
- package/bin/lib/context.js +14 -0
- package/bin/lib/i18n.js +12 -6
- package/bin/lib/skill-deps.js +5 -5
- package/bin/phases/claude-runtime.js +23 -0
- package/bin/phases/claude-settings.js +8 -0
- package/bin/phases/codex-hooks.js +156 -0
- package/bin/phases/codex-runtime.js +29 -38
- package/bin/phases/copy-payload.js +8 -2
- package/bin/phases/select-skill-bundles.js +96 -0
- package/bin/phases/skill-inventory.js +71 -0
- package/bin/phases/skills-setup.js +9 -2
- package/bin/phases/write-metadata.js +8 -5
- package/package.json +8 -2
- package/src/claude/CLAUDE.md +3 -3
- package/src/claude/agents/brainstormer.md +52 -69
- package/src/claude/agents/code-auditor.md +32 -14
- package/src/claude/agents/debugger.md +35 -20
- package/src/claude/agents/deployer.md +12 -5
- package/src/claude/agents/docs-keeper.md +11 -1
- package/src/claude/agents/implementer.md +25 -13
- package/src/claude/agents/inspector.md +6 -3
- package/src/claude/agents/project-manager.md +1 -1
- package/src/claude/agents/researcher.md +26 -55
- package/src/claude/agents/spec-maker.md +24 -13
- package/src/claude/agents/strategist.md +52 -0
- package/src/claude/agents/test-runner.md +117 -132
- package/src/claude/agents/ui-ux-designer.md +1 -1
- package/src/claude/hooks/__tests__/fixtures/statusline-default.golden +1 -0
- package/src/claude/hooks/__tests__/precompact.test.js +158 -0
- package/src/claude/hooks/__tests__/spec-gate.test.js +87 -4
- package/src/claude/hooks/__tests__/state.test.js +254 -3
- package/src/claude/hooks/__tests__/statusline.test.js +196 -0
- package/src/claude/hooks/agent.cjs +1 -1
- package/src/claude/hooks/docs-sync.cjs +12 -10
- package/src/claude/hooks/inspect-block.cjs +1 -1
- package/src/claude/hooks/lib/config.cjs +3 -0
- package/src/claude/hooks/lib/hook-state-dir.cjs +39 -0
- package/src/claude/hooks/lib/secret-keywords.cjs +42 -0
- package/src/claude/hooks/precompact.cjs +105 -0
- package/src/claude/hooks/rules.cjs +1 -1
- package/src/claude/hooks/secret-output-guardrail.cjs +43 -0
- package/src/claude/hooks/session.cjs +27 -1
- package/src/claude/hooks/spec-gate.cjs +3 -3
- package/src/claude/hooks/spec-state.cjs +32 -5
- package/src/claude/hooks/state.cjs +1 -1
- package/src/claude/hooks/task-scaffold-guard.cjs +1 -1
- package/src/claude/hooks/usage.cjs +1 -1
- package/src/claude/migration-manifest.json +29 -15
- package/src/claude/output-styles/coding-level-0-eli5.md +103 -0
- package/src/claude/output-styles/coding-level-1-junior.md +124 -0
- package/src/claude/output-styles/coding-level-2-mid.md +146 -0
- package/src/claude/output-styles/coding-level-3-senior.md +148 -0
- package/src/claude/output-styles/coding-level-4-lead.md +159 -0
- package/src/claude/output-styles/coding-level-5-god.md +91 -0
- package/src/claude/references/debugger/core-philosophy.md +5 -3
- package/src/claude/references/debugger/frontend-verification.md +2 -2
- package/src/claude/references/debugger/log-ci-analysis.md +13 -1
- package/src/claude/references/debugger/parallel-agent-hydration.md +19 -34
- package/src/claude/references/debugger/performance-diagnostics.md +2 -2
- package/src/claude/references/debugger/root-cause-tracing.md +37 -6
- package/src/claude/references/debugger/side-effect-gate.md +3 -1
- package/src/claude/references/debugger/verification-protocol.md +13 -12
- package/src/claude/rules/orchestrator.md +7 -1
- package/src/claude/rules/process-management.md +39 -0
- package/src/claude/rules/review-audit-self-decision.md +48 -0
- package/src/claude/rules/skill-domain-routing.md +26 -24
- package/src/claude/rules/skill-workflow-routing.md +22 -14
- package/src/claude/rules/workflow.md +3 -3
- package/src/claude/runtime.json +1 -0
- package/src/claude/runtime.schema.json +205 -0
- package/src/claude/scripts/generate-skill-catalog.cjs +156 -122
- package/src/claude/scripts/provenance.cjs +18 -5
- package/src/claude/scripts/spec-receipt.cjs +76 -21
- package/src/claude/scripts/spec-resolver.cjs +144 -4
- package/src/claude/scripts/workflow-policy.cjs +1 -1
- package/src/claude/settings/settings.json +16 -0
- package/src/claude/skills/agent-browser/SKILL.md +1 -1
- package/src/claude/skills/ai-multimodal/SKILL.md +1 -1
- package/src/claude/skills/brainstorm/SKILL.md +193 -172
- package/src/claude/skills/brainstorm/references/question-framework.md +105 -167
- package/src/claude/skills/chrome-devtools/SKILL.md +1 -1
- package/src/claude/skills/code-review/SKILL.md +43 -25
- package/src/claude/skills/code-review/references/spec-compliance-review.md +3 -4
- package/src/claude/skills/code-review/references/verification-gate.md +1 -1
- package/src/claude/skills/debug/SKILL.md +48 -19
- package/src/claude/skills/delegate/SKILL.md +1 -1
- package/src/claude/skills/develop/SKILL.md +92 -65
- package/src/claude/skills/develop/references/parallel-waves.md +36 -63
- package/src/claude/skills/develop/references/quality-gate.md +31 -4
- package/src/claude/skills/develop/references/subagent-patterns.md +21 -7
- package/src/claude/skills/docs/SKILL.md +42 -23
- package/src/claude/skills/docs/references/init-workflow.md +4 -4
- package/src/claude/skills/docs/references/reconstruct-workflow.md +6 -6
- package/src/claude/skills/docs/references/standard-docs-workflow.md +6 -2
- package/src/claude/skills/docs/references/summarize-workflow.md +2 -2
- package/src/claude/skills/docs/references/update-workflow.md +9 -7
- package/src/claude/skills/docs/templates/requirements-as-is.md +1 -1
- package/src/claude/skills/docx/SKILL.md +1 -1
- package/src/claude/skills/git/SKILL.md +1 -1
- package/src/claude/skills/git/references/commit-protocols.md +1 -1
- package/src/claude/skills/git/references/finish-branch.md +1 -1
- package/src/claude/skills/hotfix/SKILL.md +159 -170
- package/src/claude/skills/hotfix/references/diagnosis-protocol.md +14 -9
- package/src/claude/skills/hotfix/references/parallel-patterns.md +27 -13
- package/src/claude/skills/hotfix/references/prevention-gate.md +5 -0
- package/src/claude/skills/hotfix/references/review-cycle.md +21 -15
- package/src/claude/skills/hotfix/references/workflow-specialized.md +53 -21
- package/src/claude/skills/inspect/SKILL.md +55 -46
- package/src/claude/skills/inspect/references/internal-inspection.md +21 -5
- package/src/claude/skills/loop/SKILL.md +114 -0
- package/src/claude/skills/loop/references/bounded-loop-protocol.md +104 -0
- package/src/claude/skills/loop/references/metric-and-guard-contract.md +76 -0
- package/src/claude/skills/pdf/SKILL.md +1 -1
- package/src/claude/skills/pptx/SKILL.md +1 -1
- package/src/claude/skills/question/SKILL.md +16 -13
- package/src/claude/skills/research/SKILL.md +70 -43
- package/src/claude/skills/route/SKILL.md +94 -0
- package/src/claude/skills/route/references/agent-timing.md +46 -0
- package/src/claude/skills/route/references/chaining-patterns.md +53 -0
- package/src/claude/skills/route/references/task-taxonomy.md +48 -0
- package/src/claude/skills/specs/SKILL.md +48 -57
- package/src/claude/skills/specs/references/review.md +26 -8
- package/src/claude/skills/specs/references/templates.md +76 -31
- package/src/claude/skills/specs/templates/requirements-init.md +1 -1
- package/src/claude/skills/specs/templates/research.md +2 -2
- package/src/claude/skills/sync/SKILL.md +6 -6
- package/src/claude/skills/sync/references/sync-protocols.md +1 -1
- package/src/claude/skills/test/SKILL.md +120 -120
- package/src/claude/skills/test/references/execution-strategy.md +208 -361
- package/src/claude/skills/test/references/failure-triage.md +55 -121
- package/src/claude/skills/test/references/test-memory.md +20 -34
- package/src/claude/skills/ui-ux-pro-max/SKILL.md +1 -1
- package/src/claude/skills/web-testing/SKILL.md +1 -1
- package/src/claude/skills/xlsx/SKILL.md +1 -1
- package/src/claude/status.cjs +135 -33
- package/src/codex/AGENTS.md +14 -4
- package/src/codex/hooks/docs-sync.cjs +8 -3
- package/src/codex/hooks/lib/hook-context.cjs +18 -4
- package/src/codex/hooks/rules.cjs +29 -1
- package/src/codex/hooks/secret-output-guardrail.cjs +30 -0
- package/src/codex/hooks/spec-gate.cjs +3 -8
- package/src/codex/hooks/spec-state.cjs +34 -5
- package/src/codex/hooks.json +5 -0
- package/src/codex/runtime.json +2 -0
- package/src/common/.env.example +1 -1
- package/src/claude/skills/backend-development/SKILL.md +0 -101
- package/src/claude/skills/backend-development/references/backend-api-design.md +0 -495
- package/src/claude/skills/backend-development/references/backend-architecture.md +0 -454
- package/src/claude/skills/backend-development/references/backend-authentication.md +0 -338
- package/src/claude/skills/backend-development/references/backend-code-quality.md +0 -659
- package/src/claude/skills/backend-development/references/backend-debugging.md +0 -904
- package/src/claude/skills/backend-development/references/backend-devops.md +0 -491
- package/src/claude/skills/backend-development/references/backend-mindset.md +0 -387
- package/src/claude/skills/backend-development/references/backend-performance.md +0 -397
- package/src/claude/skills/backend-development/references/backend-security.md +0 -342
- package/src/claude/skills/backend-development/references/backend-technologies.md +0 -256
- package/src/claude/skills/backend-development/references/backend-testing.md +0 -429
- package/src/claude/skills/devops/.env.example +0 -76
- package/src/claude/skills/devops/SKILL.md +0 -102
- package/src/claude/skills/devops/references/browser-rendering.md +0 -305
- package/src/claude/skills/devops/references/cloudflare-d1-kv.md +0 -123
- package/src/claude/skills/devops/references/cloudflare-platform.md +0 -271
- package/src/claude/skills/devops/references/cloudflare-r2-storage.md +0 -280
- package/src/claude/skills/devops/references/cloudflare-workers-advanced.md +0 -312
- package/src/claude/skills/devops/references/cloudflare-workers-apis.md +0 -309
- package/src/claude/skills/devops/references/cloudflare-workers-basics.md +0 -418
- package/src/claude/skills/devops/references/docker-basics.md +0 -297
- package/src/claude/skills/devops/references/docker-compose.md +0 -292
- package/src/claude/skills/devops/references/gcloud-platform.md +0 -297
- package/src/claude/skills/devops/references/gcloud-services.md +0 -304
- package/src/claude/skills/devops/references/kubernetes-basics.md +0 -95
- package/src/claude/skills/devops/references/kubernetes-helm-advanced.md +0 -70
- package/src/claude/skills/devops/references/kubernetes-helm.md +0 -81
- package/src/claude/skills/devops/references/kubernetes-kubectl.md +0 -74
- package/src/claude/skills/devops/references/kubernetes-security-advanced.md +0 -94
- package/src/claude/skills/devops/references/kubernetes-security.md +0 -89
- package/src/claude/skills/devops/references/kubernetes-troubleshooting-advanced.md +0 -74
- package/src/claude/skills/devops/references/kubernetes-troubleshooting.md +0 -49
- package/src/claude/skills/devops/references/kubernetes-workflows-advanced.md +0 -75
- package/src/claude/skills/devops/references/kubernetes-workflows.md +0 -76
- package/src/claude/skills/devops/scripts/cloudflare_deploy.py +0 -269
- package/src/claude/skills/devops/scripts/docker_optimize.py +0 -332
- package/src/claude/skills/devops/scripts/requirements.txt +0 -20
- package/src/claude/skills/devops/scripts/tests/requirements.txt +0 -3
- package/src/claude/skills/devops/scripts/tests/test_cloudflare_deploy.py +0 -285
- package/src/claude/skills/devops/scripts/tests/test_docker_optimize.py +0 -436
- package/src/claude/skills/frontend-design/SKILL.md +0 -135
- package/src/claude/skills/frontend-design/references/ai-multimodal-overview.md +0 -165
- package/src/claude/skills/frontend-design/references/analysis-best-practices.md +0 -80
- package/src/claude/skills/frontend-design/references/analysis-prompts.md +0 -141
- package/src/claude/skills/frontend-design/references/analysis-techniques.md +0 -118
- package/src/claude/skills/frontend-design/references/animejs.md +0 -396
- package/src/claude/skills/frontend-design/references/anti-slop-rules.md +0 -103
- package/src/claude/skills/frontend-design/references/asset-generation.md +0 -337
- package/src/claude/skills/frontend-design/references/bento-motion-engine.md +0 -142
- package/src/claude/skills/frontend-design/references/design-extraction-overview.md +0 -71
- package/src/claude/skills/frontend-design/references/extraction-best-practices.md +0 -141
- package/src/claude/skills/frontend-design/references/extraction-output-templates.md +0 -162
- package/src/claude/skills/frontend-design/references/extraction-prompts.md +0 -127
- package/src/claude/skills/frontend-design/references/magicui-components.md +0 -129
- package/src/claude/skills/frontend-design/references/performance-guardrails.md +0 -169
- package/src/claude/skills/frontend-design/references/premium-design-patterns.md +0 -93
- package/src/claude/skills/frontend-design/references/redesign-audit-checklist.md +0 -114
- package/src/claude/skills/frontend-design/references/technical-accessibility.md +0 -119
- package/src/claude/skills/frontend-design/references/technical-best-practices.md +0 -97
- package/src/claude/skills/frontend-design/references/technical-optimization.md +0 -44
- package/src/claude/skills/frontend-design/references/technical-overview.md +0 -90
- package/src/claude/skills/frontend-design/references/technical-workflows.md +0 -150
- package/src/claude/skills/frontend-design/references/visual-analysis-overview.md +0 -95
- package/src/claude/skills/frontend-design/references/workflow-3d.md +0 -102
- package/src/claude/skills/frontend-design/references/workflow-describe.md +0 -87
- package/src/claude/skills/frontend-design/references/workflow-immersive.md +0 -87
- package/src/claude/skills/frontend-design/references/workflow-quick.md +0 -57
- package/src/claude/skills/frontend-design/references/workflow-screenshot.md +0 -63
- package/src/claude/skills/frontend-design/references/workflow-video.md +0 -74
- package/src/claude/skills/frontend-development/SKILL.md +0 -406
- package/src/claude/skills/frontend-development/resources/common-patterns.md +0 -331
- package/src/claude/skills/frontend-development/resources/complete-examples.md +0 -872
- package/src/claude/skills/frontend-development/resources/component-patterns.md +0 -502
- package/src/claude/skills/frontend-development/resources/data-fetching.md +0 -767
- package/src/claude/skills/frontend-development/resources/file-organization.md +0 -502
- package/src/claude/skills/frontend-development/resources/loading-and-error-states.md +0 -501
- package/src/claude/skills/frontend-development/resources/performance.md +0 -406
- package/src/claude/skills/frontend-development/resources/routing-guide.md +0 -364
- package/src/claude/skills/frontend-development/resources/styling-guide.md +0 -428
- package/src/claude/skills/frontend-development/resources/typescript-standards.md +0 -418
- package/src/claude/skills/mobile-development/SKILL.md +0 -218
- package/src/claude/skills/mobile-development/references/mobile-android.md +0 -604
- package/src/claude/skills/mobile-development/references/mobile-best-practices.md +0 -544
- package/src/claude/skills/mobile-development/references/mobile-debugging.md +0 -1089
- package/src/claude/skills/mobile-development/references/mobile-frameworks.md +0 -465
- package/src/claude/skills/mobile-development/references/mobile-ios.md +0 -496
- package/src/claude/skills/mobile-development/references/mobile-mindset.md +0 -542
- package/src/claude/skills/react-best-practices/AGENTS.md +0 -2249
- package/src/claude/skills/react-best-practices/README.md +0 -123
- package/src/claude/skills/react-best-practices/SKILL.md +0 -128
- package/src/claude/skills/react-best-practices/metadata.json +0 -15
- package/src/claude/skills/react-best-practices/rules/_sections.md +0 -46
- package/src/claude/skills/react-best-practices/rules/_template.md +0 -28
- package/src/claude/skills/react-best-practices/rules/advanced-event-handler-refs.md +0 -55
- package/src/claude/skills/react-best-practices/rules/advanced-use-latest.md +0 -49
- package/src/claude/skills/react-best-practices/rules/async-api-routes.md +0 -38
- package/src/claude/skills/react-best-practices/rules/async-defer-await.md +0 -80
- package/src/claude/skills/react-best-practices/rules/async-dependencies.md +0 -36
- package/src/claude/skills/react-best-practices/rules/async-parallel.md +0 -28
- package/src/claude/skills/react-best-practices/rules/async-suspense-boundaries.md +0 -99
- package/src/claude/skills/react-best-practices/rules/bundle-barrel-imports.md +0 -59
- package/src/claude/skills/react-best-practices/rules/bundle-conditional.md +0 -31
- package/src/claude/skills/react-best-practices/rules/bundle-defer-third-party.md +0 -49
- package/src/claude/skills/react-best-practices/rules/bundle-dynamic-imports.md +0 -35
- package/src/claude/skills/react-best-practices/rules/bundle-preload.md +0 -50
- package/src/claude/skills/react-best-practices/rules/client-event-listeners.md +0 -74
- package/src/claude/skills/react-best-practices/rules/client-swr-dedup.md +0 -56
- package/src/claude/skills/react-best-practices/rules/js-batch-dom-css.md +0 -82
- package/src/claude/skills/react-best-practices/rules/js-cache-function-results.md +0 -80
- package/src/claude/skills/react-best-practices/rules/js-cache-property-access.md +0 -28
- package/src/claude/skills/react-best-practices/rules/js-cache-storage.md +0 -70
- package/src/claude/skills/react-best-practices/rules/js-combine-iterations.md +0 -32
- package/src/claude/skills/react-best-practices/rules/js-early-exit.md +0 -50
- package/src/claude/skills/react-best-practices/rules/js-hoist-regexp.md +0 -45
- package/src/claude/skills/react-best-practices/rules/js-index-maps.md +0 -37
- package/src/claude/skills/react-best-practices/rules/js-length-check-first.md +0 -49
- package/src/claude/skills/react-best-practices/rules/js-min-max-loop.md +0 -82
- package/src/claude/skills/react-best-practices/rules/js-set-map-lookups.md +0 -24
- package/src/claude/skills/react-best-practices/rules/js-tosorted-immutable.md +0 -57
- package/src/claude/skills/react-best-practices/rules/rendering-activity.md +0 -26
- package/src/claude/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
- package/src/claude/skills/react-best-practices/rules/rendering-conditional-render.md +0 -40
- package/src/claude/skills/react-best-practices/rules/rendering-content-visibility.md +0 -38
- package/src/claude/skills/react-best-practices/rules/rendering-hoist-jsx.md +0 -46
- package/src/claude/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
- package/src/claude/skills/react-best-practices/rules/rendering-svg-precision.md +0 -28
- package/src/claude/skills/react-best-practices/rules/rerender-defer-reads.md +0 -39
- package/src/claude/skills/react-best-practices/rules/rerender-dependencies.md +0 -45
- package/src/claude/skills/react-best-practices/rules/rerender-derived-state.md +0 -29
- package/src/claude/skills/react-best-practices/rules/rerender-functional-setstate.md +0 -74
- package/src/claude/skills/react-best-practices/rules/rerender-lazy-state-init.md +0 -58
- package/src/claude/skills/react-best-practices/rules/rerender-memo.md +0 -44
- package/src/claude/skills/react-best-practices/rules/rerender-transitions.md +0 -40
- package/src/claude/skills/react-best-practices/rules/server-after-nonblocking.md +0 -73
- package/src/claude/skills/react-best-practices/rules/server-cache-lru.md +0 -41
- package/src/claude/skills/react-best-practices/rules/server-cache-react.md +0 -26
- package/src/claude/skills/react-best-practices/rules/server-parallel-fetching.md +0 -79
- package/src/claude/skills/react-best-practices/rules/server-serialization.md +0 -38
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: "
|
|
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: "
|
|
11
|
+
version: "2.0.0"
|
|
12
12
|
---
|
|
13
|
-
#
|
|
13
|
+
# Fix — root-cause repair workflow
|
|
14
14
|
|
|
15
|
-
|
|
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` -
|
|
21
|
-
- `--from-debug` - Start from an existing `
|
|
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
|
|
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
|
|
27
|
-
|
|
28
|
-
The exact root-cause contract
|
|
29
|
-
|
|
30
|
-
If
|
|
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
|
-
|
|
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,
|
|
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
|
-
##
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
|
79
|
-
B --> C[Step 2: Diagnose via
|
|
80
|
-
C --> D[Step 3:
|
|
81
|
-
D
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
F
|
|
87
|
-
|
|
88
|
-
H -->
|
|
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
|
-
|
|
126
|
+
If prose conflicts with this flow, follow the diagram.
|
|
99
127
|
|
|
100
128
|
---
|
|
101
129
|
|
|
102
|
-
## Step 1: Scout
|
|
103
|
-
|
|
104
|
-
**Purpose:** Understand the affected codebase BEFORE forming any hypotheses.
|
|
130
|
+
## Step 1: Scout
|
|
105
131
|
|
|
106
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
| Path | Scout Depth |
|
|
136
|
+
| Path | Scout depth |
|
|
111
137
|
|------|-------------|
|
|
112
|
-
|
|
|
113
|
-
| Standard | Full
|
|
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 `
|
|
146
|
+
## Step 2: Diagnose via `cf:debug`
|
|
130
147
|
|
|
131
|
-
|
|
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
|
-
|
|
152
|
+
Diagnosis chain:
|
|
134
153
|
|
|
135
|
-
**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
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:
|
|
189
|
+
## Step 3: Select Depth + Bound Repair
|
|
165
190
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
174
|
-
|
|
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: [
|
|
199
|
+
**Output:** `✓ Step 3: [Depth] selected — [workflow]`
|
|
179
200
|
|
|
180
201
|
---
|
|
181
202
|
|
|
182
203
|
## Step 4: Implement Fix
|
|
183
204
|
|
|
184
|
-
|
|
185
|
-
- Fix the
|
|
186
|
-
- Minimal changes only
|
|
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
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
|
217
|
-
|
|
218
|
-
**Purpose:** Prove the fix works AND prevent the same bug class from recurring.
|
|
227
|
+
## Step 5: Verify + Prevent
|
|
219
228
|
|
|
220
|
-
**
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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
|
-
|
|
237
|
-
|
|
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
|
|
251
|
+
## Step 6: Finalize
|
|
244
252
|
|
|
245
|
-
1. **Report:**
|
|
246
|
-
2. **Docs update:**
|
|
247
|
-
3. **
|
|
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: [
|
|
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
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
-
|
|
287
|
-
-
|
|
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
|
|
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` —
|
|
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 `
|
|
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
|
-
|
|
7
|
+
Do not guess root causes. Form hypotheses through structured reasoning and test them against evidence.
|
|
8
8
|
|
|
9
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
//
|
|
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
|
|
87
|
+
## Exact Root-Cause Contract
|
|
87
88
|
|
|
88
|
-
Before Step 4 implementation in `
|
|
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
|
|
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
|
|
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
|
|
88
|
+
## Pattern E: Deep Workflow — Parallel Evidence Gathering
|
|
77
89
|
|
|
78
|
-
In complex bugs
|
|
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
|
-
//
|
|
82
|
-
Agent(subagent_type="Explore", prompt="Scout: map affected files, dependencies, and test coverage")
|
|
83
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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:
|