cc-devflow 4.5.9 → 4.5.11
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/.claude/skills/cc-act/CHANGELOG.md +11 -0
- package/.claude/skills/cc-act/SKILL.md +19 -10
- package/.claude/skills/cc-act/assets/PR_BRIEF_TEMPLATE.md +1 -1
- package/.claude/skills/cc-act/references/closure-contract.md +1 -1
- package/.claude/skills/cc-act/references/git-commit-guidelines.md +1 -1
- package/.claude/skills/cc-check/CHANGELOG.md +23 -0
- package/.claude/skills/cc-check/PLAYBOOK.md +1 -0
- package/.claude/skills/cc-check/SKILL.md +15 -9
- package/.claude/skills/cc-check/references/review-contract.md +7 -0
- package/.claude/skills/cc-check/scripts/render-report-card.js +6 -1
- package/.claude/skills/cc-dev/CHANGELOG.md +10 -0
- package/.claude/skills/cc-dev/SKILL.md +34 -2
- package/.claude/skills/cc-do/CHANGELOG.md +18 -0
- package/.claude/skills/cc-do/PLAYBOOK.md +7 -7
- package/.claude/skills/cc-do/SKILL.md +47 -40
- package/.claude/skills/cc-do/references/execution-recovery.md +18 -13
- package/.claude/skills/cc-do/scripts/build-task-context.sh +4 -17
- package/.claude/skills/cc-do/scripts/record-review-decision.sh +4 -5
- package/.claude/skills/cc-do/scripts/recover-workflow.sh +9 -11
- package/.claude/skills/cc-do/scripts/verify-task-gates.sh +12 -10
- package/.claude/skills/cc-do/scripts/write-task-checkpoint.sh +7 -29
- package/.claude/skills/cc-investigate/CHANGELOG.md +24 -0
- package/.claude/skills/cc-investigate/PLAYBOOK.md +10 -9
- package/.claude/skills/cc-investigate/SKILL.md +163 -417
- package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +56 -10
- package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +6 -6
- package/.claude/skills/cc-investigate/assets/{ANALYSIS_TEMPLATE.md → legacy/ANALYSIS_TEMPLATE.md} +1 -0
- package/.claude/skills/cc-investigate/references/investigation-contract.md +5 -4
- package/.claude/skills/cc-investigate/scripts/bootstrap-analysis.sh +1 -1
- package/.claude/skills/cc-plan/CHANGELOG.md +32 -0
- package/.claude/skills/cc-plan/PLAYBOOK.md +55 -53
- package/.claude/skills/cc-plan/SKILL.md +209 -536
- package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +50 -14
- package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +5 -4
- package/.claude/skills/cc-plan/assets/{DESIGN_TEMPLATE.md → legacy/DESIGN_TEMPLATE.md} +1 -0
- package/.claude/skills/cc-plan/assets/{TINY_DESIGN_TEMPLATE.md → legacy/TINY_DESIGN_TEMPLATE.md} +1 -1
- package/.claude/skills/cc-plan/references/planning-contract.md +12 -10
- package/.claude/skills/cc-review/CHANGELOG.md +6 -0
- package/.claude/skills/cc-review/PLAYBOOK.md +9 -11
- package/.claude/skills/cc-review/SKILL.md +37 -61
- package/.claude/skills/cc-review/references/e2e-and-plugin-verification.md +1 -1
- package/.claude/skills/cc-review/references/implementation-review-branch.md +5 -5
- package/.claude/skills/cc-review/references/plan-review-branch.md +1 -1
- package/.claude/skills/cc-review/references/review-methods.md +4 -4
- package/.claude/skills/cc-review/scripts/collect-review-context.sh +14 -7
- package/CHANGELOG.md +30 -0
- package/CONTRIBUTING.md +40 -4
- package/CONTRIBUTING.zh-CN.md +40 -4
- package/README.md +22 -8
- package/README.zh-CN.md +22 -8
- package/bin/cc-devflow-cli.js +293 -36
- package/docs/examples/START-HERE.md +6 -4
- package/docs/examples/example-bindings.json +8 -8
- package/docs/examples/full-design-blocked/README.md +2 -2
- package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +2 -1
- package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/task-manifest.json +3 -2
- package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/tasks.md +11 -8
- package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/review/report-card.json +4 -4
- package/docs/examples/local-handoff/README.md +2 -2
- package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +2 -1
- package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/task-manifest.json +3 -2
- package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/tasks.md +9 -6
- package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/review/report-card.json +1 -1
- package/docs/examples/pdca-loop/README.md +2 -2
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/pr-brief.md +2 -2
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +2 -1
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +2 -1
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/tasks.md +9 -6
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/review/report-card.json +1 -1
- package/docs/examples/scripts/check-example-bindings.sh +2 -0
- package/docs/get-shit-done-strategy-audit.md +22 -22
- package/docs/guides/artifact-contract.md +5 -1
- package/docs/guides/getting-started.md +11 -8
- package/docs/guides/getting-started.zh-CN.md +11 -8
- package/docs/guides/minimize-artifacts.md +137 -0
- package/lib/compiler/__tests__/skills-registry.test.js +2 -2
- package/lib/skill-runtime/CLAUDE.md +1 -1
- package/lib/skill-runtime/__tests__/autopilot.test.js +42 -6
- package/lib/skill-runtime/__tests__/benchmark-artifacts.test.js +165 -0
- package/lib/skill-runtime/__tests__/benchmark-skills.test.js +109 -0
- package/lib/skill-runtime/__tests__/cli-bootstrap.integration.test.js +2 -2
- package/lib/skill-runtime/__tests__/dispatch.test.js +8 -38
- package/lib/skill-runtime/__tests__/intent.test.js +4 -20
- package/lib/skill-runtime/__tests__/lifecycle.test.js +1 -1
- package/lib/skill-runtime/__tests__/paths.test.js +7 -1
- package/lib/skill-runtime/__tests__/planner.tdd.test.js +61 -0
- package/lib/skill-runtime/__tests__/prepare-pr.test.js +3 -16
- package/lib/skill-runtime/__tests__/query.test.js +388 -7
- package/lib/skill-runtime/__tests__/review-check-integration.test.js +148 -0
- package/lib/skill-runtime/__tests__/review-records.test.js +619 -0
- package/lib/skill-runtime/__tests__/runtime.integration.test.js +64 -23
- package/lib/skill-runtime/__tests__/schemas.test.js +43 -0
- package/lib/skill-runtime/__tests__/task-contract-migrate.test.js +137 -0
- package/lib/skill-runtime/__tests__/task-contract.test.js +874 -0
- package/lib/skill-runtime/__tests__/verify-artifacts.test.js +203 -0
- package/lib/skill-runtime/__tests__/worker-run.test.js +4 -11
- package/lib/skill-runtime/__tests__/workflow-context-legacy-fallback.test.js +31 -0
- package/lib/skill-runtime/__tests__/workflow-context.test.js +98 -0
- package/lib/skill-runtime/artifacts.js +0 -5
- package/lib/skill-runtime/context-index.js +545 -0
- package/lib/skill-runtime/intent.js +9 -33
- package/lib/skill-runtime/lifecycle.js +1 -1
- package/lib/skill-runtime/operations/CLAUDE.md +2 -2
- package/lib/skill-runtime/operations/dispatch.js +4 -42
- package/lib/skill-runtime/operations/init.js +2 -6
- package/lib/skill-runtime/operations/janitor.js +2 -18
- package/lib/skill-runtime/operations/resume.js +21 -38
- package/lib/skill-runtime/operations/review-records.js +265 -0
- package/lib/skill-runtime/operations/snapshot.js +1 -1
- package/lib/skill-runtime/operations/task-contract.js +593 -0
- package/lib/skill-runtime/operations/worker-run.js +2 -30
- package/lib/skill-runtime/paths.js +4 -4
- package/lib/skill-runtime/planner.js +24 -11
- package/lib/skill-runtime/query-registry.js +2 -2
- package/lib/skill-runtime/query.js +15 -2
- package/lib/skill-runtime/review-records.js +123 -0
- package/lib/skill-runtime/review.js +246 -11
- package/lib/skill-runtime/schemas.js +174 -12
- package/lib/skill-runtime/store.js +0 -10
- package/lib/skill-runtime/task-contract.js +188 -0
- package/lib/skill-runtime/workflow-context.js +748 -0
- package/package.json +6 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cc-investigate
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.5.1
|
|
4
4
|
description: "Use when a bug, regression, broken task, or unexpected behavior needs root-cause investigation, reproducible evidence, and a frozen repair handoff before cc-do resumes coding."
|
|
5
5
|
triggers:
|
|
6
6
|
- "帮我查这个 bug"
|
|
@@ -15,15 +15,11 @@ reads:
|
|
|
15
15
|
- "CHANGELOG.md"
|
|
16
16
|
- "references/investigation-contract.md"
|
|
17
17
|
- "docs/guides/project-postmortem.md"
|
|
18
|
-
- "assets/ANALYSIS_TEMPLATE.md"
|
|
19
18
|
- "assets/TASKS_TEMPLATE.md"
|
|
20
19
|
- "assets/TASK_MANIFEST_TEMPLATE.json"
|
|
21
20
|
- "../cc-roadmap/scripts/locate-roadmap-item.sh"
|
|
22
21
|
- "../cc-roadmap/scripts/sync-roadmap-progress.sh"
|
|
23
22
|
writes:
|
|
24
|
-
- path: "devflow/changes/<change-key>/planning/analysis.md"
|
|
25
|
-
durability: "durable"
|
|
26
|
-
required: true
|
|
27
23
|
- path: "devflow/changes/<change-key>/planning/tasks.md"
|
|
28
24
|
durability: "durable"
|
|
29
25
|
required: true
|
|
@@ -36,44 +32,45 @@ writes:
|
|
|
36
32
|
effects:
|
|
37
33
|
- source roadmap progress sync when investigation freezes, reroutes, or diagnoses a roadmap mismatch
|
|
38
34
|
entry_gate:
|
|
39
|
-
- "Read the
|
|
40
|
-
- "
|
|
41
|
-
- "
|
|
42
|
-
- "
|
|
43
|
-
- "
|
|
44
|
-
- "
|
|
45
|
-
- "
|
|
46
|
-
- "Run the Root Cause Proof Ladder
|
|
47
|
-
- "For performance
|
|
48
|
-
- "Do not write production code here;
|
|
49
|
-
- "Before exit,
|
|
35
|
+
- "Read the bug report, existing change artifacts, relevant code/tests/logs, and recent history before forming hypotheses."
|
|
36
|
+
- "State assumptions, competing interpretations, and what evidence would change the root-cause route before testing hypotheses."
|
|
37
|
+
- "Assign the change key with `cc-devflow next-change-key --prefix FIX --description \"<short bug name>\"`; first output line is `changeId`, second is full `changeKey`."
|
|
38
|
+
- "Enforce the Worktree Branch Contract immediately: detached worktrees bind to `FIX/<task>`, default branches stop as setup blockers, unrelated branches need explicit same-change proof."
|
|
39
|
+
- "Write root-cause truth in `planning/tasks.md#Root Cause Contract`; machine JSON must be generated or refreshed by `cc-devflow task-contract compile`, not handwritten by the AI."
|
|
40
|
+
- "Build a runnable feedback loop that matches the reported symptom before freezing root cause."
|
|
41
|
+
- "Search prior investigations, recent fixes, TODO/backlog signals, and project postmortems before declaring the bug novel."
|
|
42
|
+
- "Run the Root Cause Proof Ladder: symptom site, first bad state, violated contract, original trigger, counterfactual proof, escape reason."
|
|
43
|
+
- "For multi-component, deep-stack, flaky, or performance symptoms, open the matching escalation pack before declaring root cause."
|
|
44
|
+
- "Do not write production code here; exit with a frozen repair handoff for cc-do or an explicit reroute."
|
|
45
|
+
- "Before exit, sync or explicitly no-op the source roadmap item."
|
|
50
46
|
exit_criteria:
|
|
51
|
-
- "planning/
|
|
52
|
-
- "planning/
|
|
53
|
-
- "planning/
|
|
54
|
-
- "
|
|
55
|
-
- "
|
|
56
|
-
- "planning/tasks.md and
|
|
57
|
-
- "
|
|
58
|
-
- "
|
|
47
|
+
- "`planning/tasks.md#Root Cause Contract` proves the first bad state and original trigger, not only the visible error site."
|
|
48
|
+
- "`planning/tasks.md#Root Cause Contract` records reproduction, feedback loop, evidence chain, tested hypotheses, confirmed root cause, and repair boundary."
|
|
49
|
+
- "`planning/tasks.md#Root Cause Contract` records the Project Postmortem Recall result or `no-project-postmortems-yet`."
|
|
50
|
+
- "`planning/task-manifest.json` and `change-meta.json` were generated or refreshed by `cc-devflow task-contract compile`, then validated."
|
|
51
|
+
- "`planning/tasks.md` and machine artifacts are explicit enough that cc-do can repair without chat memory."
|
|
52
|
+
- "`planning/tasks.md` and `change-meta.json` record the canonical work branch or why branch mutation was invalid."
|
|
53
|
+
- "`cc-devflow query workflow-context --compact` can derive the IDCA next action, packet digest, current task, trusted commands, and deep-open triggers."
|
|
54
|
+
- "Roadmap sync is updated or a no-op reason is recorded."
|
|
55
|
+
- "The honest next step is `cc-do`, `cc-plan`, or `roadmap`."
|
|
59
56
|
reroutes:
|
|
60
|
-
- when: "The issue is actually a new feature,
|
|
57
|
+
- when: "The issue is actually a new feature, scope redesign, missing spec truth, or product decision."
|
|
61
58
|
target: "cc-plan"
|
|
62
|
-
- when: "The discussion expands into project sequencing or roadmap priority
|
|
59
|
+
- when: "The discussion expands into project sequencing or roadmap priority."
|
|
63
60
|
target: "roadmap"
|
|
64
61
|
- when: "Root cause and repair boundary are already frozen."
|
|
65
62
|
target: "cc-do"
|
|
66
63
|
recovery_modes:
|
|
67
64
|
- name: "repro-reset"
|
|
68
|
-
when: "The
|
|
69
|
-
action: "Drop the narrative, rebuild the
|
|
65
|
+
when: "The reproduction path is stale, missing, or does not match the reported symptom."
|
|
66
|
+
action: "Drop the narrative, rebuild the feedback loop from fresh repo evidence, then restate the symptom before testing hypotheses."
|
|
70
67
|
- name: "re-open-investigation"
|
|
71
|
-
when: "
|
|
72
|
-
action: "Reopen planning/
|
|
68
|
+
when: "Execution evidence disproves the current root-cause contract or widens the suspected blast radius."
|
|
69
|
+
action: "Reopen `planning/tasks.md#Root Cause Contract`, update evidence, then regenerate machine artifacts only after the contract is stable."
|
|
73
70
|
tool_budget:
|
|
74
|
-
read_files:
|
|
75
|
-
search_steps:
|
|
76
|
-
shell_commands:
|
|
71
|
+
read_files: 8
|
|
72
|
+
search_steps: 5
|
|
73
|
+
shell_commands: 6
|
|
77
74
|
---
|
|
78
75
|
|
|
79
76
|
# CC-Investigate
|
|
@@ -82,451 +79,200 @@ tool_budget:
|
|
|
82
79
|
|
|
83
80
|
## Role
|
|
84
81
|
|
|
85
|
-
`cc-investigate` 是
|
|
86
|
-
|
|
87
|
-
它不是直接修 bug 的地方,而是替代原来 bug 场景下那种混在 `cc-do` 里的临场 planning。它先把症状压成证据,再把证据压成根因,再把根因压成一个可执行的修复 handoff。
|
|
82
|
+
`cc-investigate` 是 IDCA 的 `Investigate`:把 bug 现象压成证据,把证据压成根因,再把根因压成 `cc-do` 可执行的修复合同。
|
|
88
83
|
|
|
89
|
-
|
|
84
|
+
它不写生产代码,不做产品路线图,不制造调试文档农场。新需求走 `cc-plan`;bug / regression 走 `cc-investigate -> cc-do -> cc-check -> cc-act`。
|
|
90
85
|
|
|
91
|
-
|
|
92
|
-
- 已知需求里的 bug 走 `cc-investigate -> cc-do -> cc-check -> cc-act`
|
|
86
|
+
## Thin Harness Rule
|
|
93
87
|
|
|
94
|
-
|
|
88
|
+
默认相信顶级模型的工程判断。Harness 只守住四件事:
|
|
95
89
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
1. 分支、change key、roadmap/source truth 不错位。
|
|
91
|
+
2. 根因证明不能停在 symptom site。
|
|
92
|
+
3. 关键结论落到可恢复 artifact,而不是留在聊天里。
|
|
93
|
+
4. 机器态 JSON 必须由 CLI / 模板生成或更新,AI 不手写过程 JSON。
|
|
100
94
|
|
|
101
|
-
|
|
95
|
+
不要启动就读完所有 reference。先用本文件闭合常规调查;只有触发升级条件时,才打开 `PLAYBOOK.md` 或 `references/investigation-contract.md` 的对应段落。
|
|
102
96
|
|
|
103
|
-
|
|
104
|
-
- `agent_preferences` 是用户偏好建议,只影响表达方式和结构选择,不覆盖本 Skill 的工作流边界。
|
|
105
|
-
- 如果配置解析失败,先修配置或向用户说明阻塞,不要用默认语言继续生成正式文档。
|
|
106
|
-
|
|
107
|
-
## Read First
|
|
97
|
+
## Harness Contract
|
|
108
98
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
5. `assets/TASKS_TEMPLATE.md`
|
|
114
|
-
6. `assets/TASK_MANIFEST_TEMPLATE.json`
|
|
115
|
-
7. `docs/guides/project-postmortem.md`
|
|
99
|
+
- Allowed actions: reproduce, collect evidence, trace code paths, test hypotheses, freeze root cause in `planning/tasks.md`, run CLI artifact generation, validate, and sync/no-op roadmap.
|
|
100
|
+
- Forbidden actions: production code, guessed root cause, manual JSON authoring, legacy `planning/analysis.md` for new investigations, or symptom patches before root cause proof.
|
|
101
|
+
- Required evidence: every root-cause claim points to reproduction output, code facts, recent history, boundary probes, or explicit user confirmation.
|
|
102
|
+
- Reroute rule: scope/design truth changes go to `cc-plan`; project priority goes to `roadmap`; confirmed repair handoff goes to `cc-do`.
|
|
116
103
|
|
|
117
|
-
##
|
|
104
|
+
## Investigation Discipline
|
|
118
105
|
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
106
|
+
- Prefer evidence over speed: no reproduction or feedback loop means no confirmed root cause.
|
|
107
|
+
- Use the model for classification and hypothesis ranking; use commands, logs, diffs, and probes for deterministic proof.
|
|
108
|
+
- When evidence conflicts, choose the newer or stronger source and record why the other pattern was rejected.
|
|
109
|
+
- If the bug is really missing spec truth or roadmap mismatch, reroute instead of averaging bugfix and feature design.
|
|
110
|
+
- Any skipped probe, unavailable environment, or stale evidence is an explicit blocker or Evidence Request.
|
|
124
111
|
|
|
125
|
-
|
|
112
|
+
## Runtime Output Policy
|
|
126
113
|
|
|
127
|
-
|
|
114
|
+
写入 durable Markdown 或 metadata 前,先运行:
|
|
128
115
|
|
|
129
|
-
```
|
|
130
|
-
|
|
116
|
+
```bash
|
|
117
|
+
cc-devflow config resolve --format policy
|
|
131
118
|
```
|
|
132
119
|
|
|
133
|
-
`
|
|
120
|
+
`Output language` 是机器约束,必须记录在 `planning/tasks.md` 和 CLI 生成的 `change-meta.json` 来源字段里。配置解析失败时先修配置或报告阻塞,不用默认语言偷跑。
|
|
134
121
|
|
|
135
|
-
|
|
122
|
+
## Read Lazily
|
|
136
123
|
|
|
137
|
-
|
|
138
|
-
2. 哪条代码 / 配置 / 数据 / 依赖路径违反了什么契约。
|
|
139
|
-
3. 哪些假设被证伪,为什么不是它们。
|
|
140
|
-
4. 最小修复边界在哪里,哪些文件明确不该动。
|
|
124
|
+
启动时只读:
|
|
141
125
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
每次调查必须爬完这 6 层,无法爬完就不能生成 repair task:
|
|
147
|
-
|
|
148
|
-
1. `L1 Symptom Site`:用户看见的错误、失败命令、UI 状态、日志或坏 artifact。
|
|
149
|
-
2. `L2 First Bad State`:第一个可观察到状态从正确变成错误的位置;可以是文件、字段、缓存、队列消息、API 响应、配置或内存对象。
|
|
150
|
-
3. `L3 Violated Contract`:被破坏的 schema、capability invariant、API contract、state transition、权限边界或时序条件。
|
|
151
|
-
4. `L4 Original Trigger`:哪个用户动作、命令、事件、recent diff、配置变化或外部响应制造了 first bad state。
|
|
152
|
-
5. `L5 Counterfactual Proof`:如果恢复该 contract、替换输入、回滚 diff、固定配置或断言边界,症状应如何变化;必须记录实际观察。
|
|
153
|
-
6. `L6 Escape Reason`:为什么现有测试、类型、验证、监控、review 或 artifact gate 没提前挡住它。
|
|
154
|
-
|
|
155
|
-
硬规则:
|
|
156
|
-
|
|
157
|
-
- `First bad state` 为空时,root cause 只能是 `needs-more-evidence`。
|
|
158
|
-
- `Original trigger` 为空时,不能把下游 guard 写成根因修复。
|
|
159
|
-
- `Counterfactual proof` 为空时,假设只能停在 candidate,不准进入 confirmed root cause。
|
|
160
|
-
- `Escape reason` 不能写成人工提醒;必须变成 regression test、artifact guard、capability invariant、operator check 或明确的 follow-up。
|
|
161
|
-
- 如果 ladder 指向 spec 缺失或路线假设错误,停止生成修复任务,reroute 到 `cc-plan` 或 `roadmap`。
|
|
162
|
-
|
|
163
|
-
## Quick Start
|
|
164
|
-
|
|
165
|
-
先判断你面对的是哪一类调查现实:
|
|
166
|
-
|
|
167
|
-
| 现实状态 | 先走什么路径 |
|
|
168
|
-
| --- | --- |
|
|
169
|
-
| 症状真实,但还没有稳定复现 | `reproduce-first`,先把现象钉死 |
|
|
170
|
-
| 已有复现但信号慢 / 松 / 偶然 | `feedback-loop`,先把 pass/fail loop 做快、准、可复跑 |
|
|
171
|
-
| 明显是 regression | `diff-trace`,先查最近变化 |
|
|
172
|
-
| 多组件链路断裂 | `boundary-probe`,先记录每个边界的输入、输出、配置和状态 |
|
|
173
|
-
| 报错点很深或坏值来源不明 | `backward-trace`,从 symptom site 一直追到 original trigger |
|
|
174
|
-
| 同仓库有相似可用路径 | `reference-compare`,先列出 working vs broken differences |
|
|
175
|
-
| flaky / sleep / timeout 类问题 | `condition-wait`,先找真实等待条件,不先加大延时 |
|
|
176
|
-
| 症状已知,但修复边界可能扩大范围 | `contract-check`,先判是否还属于当前 requirement |
|
|
177
|
-
| 错误类型陌生,像框架 / 依赖 / 平台问题 | `pattern-research`,先做脱敏外部调研 |
|
|
178
|
-
| 同一区域反复坏 | `history-trace`,先查 prior investigations 和最近修复 |
|
|
179
|
-
| 看起来像 bug,实则是未定义行为或新需求 | 直接 reroute 到 `cc-plan` |
|
|
180
|
-
| 用户只要根因报告、不要求修复 | `diagnose-only`,停止在报告与 next action,不生成完成态实现任务 |
|
|
181
|
-
| 失败来自 workflow / artifact / git / state 断裂 | `workflow-forensics`,先分类坏在文件、状态、工具、权限还是流程 |
|
|
182
|
-
|
|
183
|
-
先说“这是什么类问题”,再说“我要怎么修”。没有分类的 debug,最后都会变成乱打补丁。
|
|
126
|
+
1. 用户 bug report / failed command / current artifact。
|
|
127
|
+
2. 当前 repo 指令:`CLAUDE.md` / `AGENTS.md` / README 中直接相关部分。
|
|
128
|
+
3. 相关代码、测试、日志、recent diff 的最小证据集。
|
|
129
|
+
4. `assets/TASKS_TEMPLATE.md`。
|
|
184
130
|
|
|
185
|
-
|
|
131
|
+
按需再读:
|
|
186
132
|
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
133
|
+
- `PLAYBOOK.md`:需要完整调查剧本、模式表、边界矩阵、flaky/perf 细则时打开。
|
|
134
|
+
- `references/investigation-contract.md`:要校验字段、hard rules、repair boundary 时打开。
|
|
135
|
+
- `docs/guides/project-postmortem.md`:仓库存在 `devflow/postmortems/` 且匹配历史失败类时打开。
|
|
136
|
+
- `assets/TASK_MANIFEST_TEMPLATE.json`:只在维护模板或对照 CLI 输出结构时打开;普通调查不照抄 JSON。
|
|
137
|
+
- `../cc-roadmap/scripts/*`:定位或回写 source RM 时打开。
|
|
191
138
|
|
|
192
|
-
##
|
|
139
|
+
## Change Key And Branch
|
|
193
140
|
|
|
194
|
-
|
|
141
|
+
新调查先分配 change key:
|
|
195
142
|
|
|
196
143
|
```bash
|
|
197
|
-
|
|
144
|
+
cc-devflow next-change-key --prefix FIX --description "short bug name"
|
|
198
145
|
```
|
|
199
146
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
1. `devflow/postmortems/` 不存在时,在 `planning/analysis.md` 记录 `no-project-postmortems-yet`。
|
|
203
|
-
2. 有命中时,先读 `INDEX.md` / `principles.md`,再打开最相关的 1-2 个 incident。
|
|
204
|
-
3. 相关 incident 必须进入假设表或反证表:同根因、相似症状不同根因、已知模型陷阱、或明确不相关。
|
|
205
|
-
4. 如果本次确认是重复根因,`Root Cause` 的 `Prior history relationship` 必须标成 `recurring` 或 `same-root-cause`。
|
|
206
|
-
|
|
207
|
-
## Output Model
|
|
208
|
-
|
|
209
|
-
`cc-investigate` 只允许产出 4 个主文件:
|
|
210
|
-
|
|
211
|
-
1. `planning/analysis.md`
|
|
212
|
-
- 现象
|
|
213
|
-
- 复现
|
|
214
|
-
- 证据链
|
|
215
|
-
- 假设表
|
|
216
|
-
- 已确认根因
|
|
217
|
-
- 修复边界
|
|
218
|
-
2. `planning/tasks.md`
|
|
219
|
-
- 只保留真正要执行的修复任务
|
|
220
|
-
- 顶部明确 canonical contract 是 `planning/analysis.md`
|
|
221
|
-
3. `planning/task-manifest.json`
|
|
222
|
-
- 机器真相源
|
|
223
|
-
- 标记当前任务、依赖、验证命令、调查版本链
|
|
224
|
-
4. `change-meta.json`
|
|
225
|
-
- 标记当前 bug 是实现偏离 spec、spec 本身缺失,还是 roadmap 假设错误
|
|
226
|
-
- 记录这次修复会如何影响 capability truth
|
|
227
|
-
|
|
228
|
-
`cc-investigate` 不写生产代码,不在这里偷跑 `cc-do`。
|
|
229
|
-
|
|
230
|
-
diagnose-only 仍然写 `planning/analysis.md`,但 `planning/tasks.md` 只能包含证据交接、
|
|
231
|
-
监控、人工动作或明确的 `reroute`;不能把“已经诊断”伪装成“已经修复”。
|
|
232
|
-
|
|
233
|
-
## Entry Gate
|
|
234
|
-
|
|
235
|
-
1. 先确认当前对象仍然属于一个 requirement,而不是整个项目级故障。
|
|
236
|
-
2. 先收症状事实:错误、触发条件、影响面、复现路径。
|
|
237
|
-
3. 先读现有 change 目录里的 `planning/design.md` / `planning/analysis.md` / `planning/tasks.md` / `planning/task-manifest.json`,不要假设自己是第一位调查者。
|
|
238
|
-
4. 先读代码、测试、日志、相关 capability spec 和最近提交,再下任何假设。
|
|
239
|
-
5. 如果复现都不稳定,先不要写根因。
|
|
240
|
-
|
|
241
|
-
## Investigation Loop
|
|
242
|
-
|
|
243
|
-
1. **Collect symptom**
|
|
244
|
-
- 记录用户看见了什么
|
|
245
|
-
- 记录预期与实际差异
|
|
246
|
-
- 记录复现命令或手动路径
|
|
247
|
-
- 确认复现的是用户描述的同一个失败,而不是旁边的红灯
|
|
248
|
-
- 如果上下文缺失,只问一个最关键问题,不一次性抛出问题清单
|
|
249
|
-
2. **Build feedback loop**
|
|
250
|
-
- 优先构造 agent 可运行的 pass/fail 信号:失败测试、curl / HTTP 脚本、CLI fixture、浏览器脚本、trace replay、throwaway harness、property / fuzz loop、bisect harness、differential loop,最后才是 HITL 脚本
|
|
251
|
-
- 记录 loop 类型、命令、运行时间、确定性、失败率、症状匹配证据和下一步 sharpen 计划
|
|
252
|
-
- loop 太慢、太宽、太 flaky 时,先优化 loop 本身;没有可信 loop,不进入 confirmed root cause
|
|
253
|
-
- 如果确实无法建 loop,写明尝试过什么,并请求 HAR、日志 dump、core dump、带时间戳录屏、可复现环境访问或临时生产探针权限
|
|
254
|
-
3. **Trace reality**
|
|
255
|
-
- 沿着代码路径找触点
|
|
256
|
-
- 多组件系统先写 `Boundary Probe Matrix`:每个边界的输入、输出、配置 / 环境、状态和 pass/fail
|
|
257
|
-
- 深层报错先写 `Backward Trace Chain`:immediate failure site、caller chain、bad value origin、original trigger
|
|
258
|
-
- 查最近提交和同类改动
|
|
259
|
-
- 查既有 `devflow/changes/*/planning/analysis.md`、`TODOS.md`、backlog、report-card finding
|
|
260
|
-
- 如果仓库有 `devflow/specs/`、roadmap/backlog handoff、历史 `planning/design.md` / `planning/analysis.md` 或 `change-meta.json`,把领域词汇和已冻结决策当成契约证据
|
|
261
|
-
- 找现有测试和断点证据
|
|
262
|
-
- 判定偏离的是 capability boundary、invariant,还是只是实现细节
|
|
263
|
-
4. **Classify pattern**
|
|
264
|
-
- 判定是否属于 race condition、null propagation、state corruption、integration failure、configuration drift、stale cache、resource leak、performance regression、trust boundary drift、timing guess / flaky wait
|
|
265
|
-
- 如果有同仓库 working example,先写 `Reference Comparison`,列出 working path、broken path、差异和被接受 / 排除的假设
|
|
266
|
-
- 如果错误类型陌生,先做脱敏外部调研;只搜索通用错误类型、框架 / 库名和版本,不搜索 raw secret / path / customer data
|
|
267
|
-
5. **Form hypotheses**
|
|
268
|
-
- 先列 3-5 个候选假设并排序,避免第一直觉锚定
|
|
269
|
-
- 再收敛到 1-3 个 active hypotheses 进入验证
|
|
270
|
-
- 每个假设都写支持证据、反证和优先级理由
|
|
271
|
-
- 每个假设都写 `falsification method`、`expected observation`、`actual observation`
|
|
272
|
-
6. **Test hypotheses**
|
|
273
|
-
- 用复现、日志、断言、最小探针验证
|
|
274
|
-
- 临时探针必须写 `Diagnostic Instrumentation Plan`:probe tag、probe location、question answered、command、expected signal、cleanup requirement
|
|
275
|
-
- 每个 probe 只回答一个假设预测;一次只改一个变量
|
|
276
|
-
- debug 日志必须带唯一前缀,例如 `[DEBUG-FIX123-a4f2]`,进入 `cc-do` 前用前缀 grep 清理或转正
|
|
277
|
-
- 三次假设都失败,就停下进入 escalation decision
|
|
278
|
-
7. **Freeze repair contract**
|
|
279
|
-
- 先填写 `Root Cause Proof Ladder`:symptom site、first bad state、violated contract、original trigger、counterfactual proof、escape reason
|
|
280
|
-
- 如果 first bad state、original trigger 或 counterfactual proof 缺失,只能写 `Evidence Request` 或 reroute,不能生成 repair task
|
|
281
|
-
- 根因确认后,写进 `planning/analysis.md`
|
|
282
|
-
- 只保留最小修复边界
|
|
283
|
-
- 写清正确测试缝隙:测试是否覆盖真实触发链;如果没有正确 seam,这本身就是需要记录的架构事实
|
|
284
|
-
- 写明 affected module、allowed files、forbidden files、blast radius estimate;超过 5 个文件默认拆分或 reroute
|
|
285
|
-
- 输出 `planning/tasks.md` + `planning/task-manifest.json` + `change-meta.json`
|
|
286
|
-
8. **Roadmap sync**
|
|
287
|
-
- 用 `locate-roadmap-item.sh` 定位 source RM;找不到时在 `analysis.md` 和 `change-meta.json.roadmapSync` 写 `no-source-rm`
|
|
288
|
-
- `implementation drift`:回写 source RM 为 `Repair planned` 或等价调查完成状态,绑定 `FIX-*`,进度保持在可执行修复前的真实百分比
|
|
289
|
-
- `missing spec truth`:回写 source RM 的 expected spec delta 或 follow-up,必要时 reroute 到 `cc-plan`
|
|
290
|
-
- `roadmap mismatch`:不要直接进入修复;先把 mismatch 写回 roadmap / backlog,下一步写 `roadmap` 或 `cc-plan`
|
|
291
|
-
- 使用 `sync-roadmap-progress.sh` 更新 `devflow/roadmap.json`,并重新生成 `devflow/ROADMAP.md` / `devflow/BACKLOG.md`
|
|
292
|
-
9. **Hand off**
|
|
293
|
-
- 下一步明确写成 `cc-do`
|
|
294
|
-
- 如果 repair contract 越过当前 requirement,就 reroute 到 `cc-plan`
|
|
295
|
-
- 如果是 diagnose-only,下一步写成 human action、monitoring、backlog、`cc-plan` 或 `cc-do`,但不得标记实现完成
|
|
296
|
-
|
|
297
|
-
## Pattern Analysis
|
|
298
|
-
|
|
299
|
-
不要从空白猜测开始。先把 bug 放进一个可检查的模式:
|
|
300
|
-
|
|
301
|
-
| Pattern | Signature | First place to inspect |
|
|
302
|
-
| --- | --- | --- |
|
|
303
|
-
| race condition | 间歇性、时序相关、重试后消失 | 并发写、锁、队列、共享状态 |
|
|
304
|
-
| null propagation | TypeError / NoMethod / undefined access | nullable 输入、默认值、边界 guard |
|
|
305
|
-
| state corruption | 数据不一致、部分更新、顺序错乱 | transaction、callback、hook、副作用 |
|
|
306
|
-
| integration failure | timeout、unexpected response、协议不匹配 | API boundary、service config、schema |
|
|
307
|
-
| configuration drift | 本地可用、CI/生产失败 | env、feature flag、版本、路径、权限 |
|
|
308
|
-
| stale cache | 清缓存后恢复、旧状态复现 | browser / CDN / Redis / build cache |
|
|
309
|
-
| resource leak | OOM、句柄增长、慢性崩溃 | lifecycle、subscription、retention、cleanup |
|
|
310
|
-
| performance regression | 变慢、CPU / IO / 查询耗时升高、吞吐下降 | baseline、profiler、query plan、bisect |
|
|
311
|
-
| trust boundary drift | LLM / 用户输入 / 外部响应被当成可信 | validation、escaping、policy gate |
|
|
312
|
-
| timing guess / flaky wait | sleep / setTimeout / timeout 增大后偶尔通过 | 真实完成条件、事件、文件、状态或队列计数 |
|
|
313
|
-
|
|
314
|
-
模式分析不是结论,只是定位第一批证据的索引。
|
|
315
|
-
|
|
316
|
-
## Boundary Probe Matrix
|
|
317
|
-
|
|
318
|
-
多组件链路不要先猜。先记录每个边界的事实:
|
|
319
|
-
|
|
320
|
-
- component boundary
|
|
321
|
-
- input observed
|
|
322
|
-
- output observed
|
|
323
|
-
- config / env observed
|
|
324
|
-
- state observed
|
|
325
|
-
- verdict: `pass` / `fail` / `unknown`
|
|
326
|
-
|
|
327
|
-
只有一个边界先失败时,后续调查才收缩到那个组件。多个边界都异常时,优先找共同上游,不在下游堆补丁。
|
|
328
|
-
|
|
329
|
-
## Backward Trace Chain
|
|
147
|
+
脚本输出两行:`changeId` 和完整 `changeKey`。直接使用输出,不手动扫描、不心算编号。
|
|
330
148
|
|
|
331
|
-
|
|
149
|
+
分支锚定规则:
|
|
332
150
|
|
|
333
|
-
-
|
|
334
|
-
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
- original trigger
|
|
338
|
-
- why symptom-site fix is rejected
|
|
151
|
+
1. `FIX-014-auth-race` 对应 `FIX/014-auth-race`。
|
|
152
|
+
2. 当前 detached 时,立刻 `git switch -c <canonical-work-branch>`。
|
|
153
|
+
3. 当前是 `main` / `master` / default branch 时停止,报告 setup blocker。
|
|
154
|
+
4. 当前是其它分支时,只有它已明确绑定同一个 change key 才继续。
|
|
339
155
|
|
|
340
|
-
|
|
156
|
+
`planning/tasks.md` 和 `change-meta.json` 必须记录 work branch。
|
|
341
157
|
|
|
342
|
-
##
|
|
158
|
+
## Machine Artifact Rule
|
|
343
159
|
|
|
344
|
-
|
|
160
|
+
AI 只手写默认人类合同:`planning/tasks.md#Root Cause Contract` 和后面的 repair task blocks。
|
|
345
161
|
|
|
346
|
-
|
|
347
|
-
- broken path
|
|
348
|
-
- differences found
|
|
349
|
-
- differences accepted as hypothesis
|
|
350
|
-
- differences ruled out
|
|
162
|
+
机器态文件必须由命令生成或更新:
|
|
351
163
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
临时日志、断言、探针只能用于回答一个明确问题:
|
|
357
|
-
|
|
358
|
-
- probe location
|
|
359
|
-
- question answered
|
|
360
|
-
- command to run
|
|
361
|
-
- expected signal
|
|
362
|
-
- actual signal
|
|
363
|
-
- cleanup requirement
|
|
364
|
-
|
|
365
|
-
探针不能变成修复。进入 `cc-do` 前,要么删除,要么明确写入 repair task 的清理 / 转正方式。
|
|
366
|
-
|
|
367
|
-
## Feedback Loop Contract
|
|
368
|
-
|
|
369
|
-
根因调查首先依赖一个可信 loop:
|
|
370
|
-
|
|
371
|
-
- loop type: failing test / HTTP script / CLI fixture / browser script / trace replay / throwaway harness / property-fuzz / bisect / differential / HITL
|
|
372
|
-
- command or manual driver
|
|
373
|
-
- expected failing signal
|
|
374
|
-
- actual failing signal
|
|
375
|
-
- symptom match: 为什么它复现的是用户报告的同一个问题
|
|
376
|
-
- runtime and determinism
|
|
377
|
-
- failure rate for flaky bugs
|
|
378
|
-
- sharpening plan: 如何让它更快、更准、更稳定
|
|
379
|
-
|
|
380
|
-
把 loop 当成调查产品来迭代。已有 loop 但信号差时,先优化它:
|
|
381
|
-
|
|
382
|
-
1. faster:缓存 setup、缩小 test scope、跳过无关启动。
|
|
383
|
-
2. sharper:断言用户看见的具体症状,不用“没有崩溃”冒充匹配。
|
|
384
|
-
3. more deterministic:固定时间、随机种子、filesystem、network、locale、feature flag。
|
|
385
|
-
|
|
386
|
-
flaky bug 的目标不是立刻 100% 复现,而是提高复现率直到可调试。可以循环 100 次、并行触发、加压力、缩小时序窗口或做 differential loop;如果失败率仍低到不可证伪,先写 Evidence Request,不要继续猜。
|
|
387
|
-
|
|
388
|
-
没有 loop 时,不能把代码阅读当成根因。只能写 `Evidence Request`:需要可复现环境、HAR、日志 dump、core dump、带时间戳录屏,或临时生产探针权限。
|
|
389
|
-
|
|
390
|
-
## Correct Test Seam
|
|
391
|
-
|
|
392
|
-
进入 repair handoff 前,必须说明回归测试缝隙是否正确:
|
|
393
|
-
|
|
394
|
-
- test seam
|
|
395
|
-
- public interface exercised
|
|
396
|
-
- why this seam reaches the real trigger chain
|
|
397
|
-
- why a shallower test would be false confidence
|
|
398
|
-
- if no correct seam exists, record it as an architecture finding and keep repair verification tied to the original feedback loop
|
|
399
|
-
|
|
400
|
-
## Timing And Flaky Bugs
|
|
401
|
-
|
|
402
|
-
遇到 flaky、sleep、timeout、重试后消失:
|
|
164
|
+
```bash
|
|
165
|
+
cc-devflow task-contract compile --change <changeId> --change-key <changeKey>
|
|
166
|
+
cc-devflow task-contract validate --change <changeId> --change-key <changeKey>
|
|
167
|
+
```
|
|
403
168
|
|
|
404
|
-
|
|
405
|
-
- 任意 timeout 必须说明为什么这个时间是业务 / 协议事实,不是猜测
|
|
406
|
-
- 如果只能在并发或负载下复现,记录对应命令和环境
|
|
407
|
-
- 不把“加大 sleep”写成 repair contract,除非它本身就是被证实的协议等待窗口
|
|
169
|
+
硬规则:
|
|
408
170
|
|
|
409
|
-
|
|
171
|
+
- 不手写 `planning/task-manifest.json`。
|
|
172
|
+
- 不手写 `change-meta.json`。
|
|
173
|
+
- 不生成 `planning/analysis.md`、task `context.md`、`checkpoint.json`、review Markdown 或其它 AI 手写过程文件。
|
|
174
|
+
- 需要修机器态结构时,改 CLI / 模板 / validator,再重新生成;不要在项目 change 目录里补 JSON。
|
|
175
|
+
- legacy `planning/analysis.md` 只能作为读取或 migration 输入。
|
|
410
176
|
|
|
411
|
-
|
|
177
|
+
## Investigation Loop
|
|
412
178
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
-
|
|
179
|
+
1. **Classify**:先说明属于 `reproduce-first`、`feedback-loop`、`diff-trace`、`boundary-probe`、`backward-trace`、`condition-wait`、`workflow-forensics`、`diagnose-only` 还是 reroute。
|
|
180
|
+
2. **Reproduce**:构造 agent 可运行的 pass/fail loop;证明它匹配用户看到的同一个失败。
|
|
181
|
+
3. **Trace**:读代码、测试、日志、recent diff、相关 spec / roadmap / history;找到 first bad state,而不是只看报错点。
|
|
182
|
+
4. **Hypothesize**:列 3-5 个候选,收敛到 1-3 个 active hypotheses;每个都写证伪方法、预期观察、实际观察。
|
|
183
|
+
5. **Prove**:爬完 Root Cause Proof Ladder;缺关键层级时只能写 Evidence Request 或 reroute。
|
|
184
|
+
6. **Freeze**:把根因、边界、测试缝隙、allowed/forbidden files 写进 `planning/tasks.md#Root Cause Contract`。
|
|
185
|
+
7. **Compile**:运行 `cc-devflow task-contract compile` 生成/刷新 manifest 和 meta,再 validate。
|
|
186
|
+
8. **Sync**:定位 source RM,回写调查结果或记录 no-op reason。
|
|
417
187
|
|
|
418
|
-
|
|
188
|
+
## Root Cause Proof Ladder
|
|
419
189
|
|
|
420
|
-
|
|
190
|
+
根因不是“报错点在哪里”,而是“坏状态第一次在哪里被制造”。每次调查必须回答:
|
|
421
191
|
|
|
422
|
-
|
|
192
|
+
1. `L1 Symptom Site`:用户看见的错误、失败命令、UI 状态、日志或坏 artifact。
|
|
193
|
+
2. `L2 First Bad State`:第一个字段、文件、缓存、队列消息、API 响应、配置或内存对象从正确变坏的位置。
|
|
194
|
+
3. `L3 Violated Contract`:被破坏的 schema、invariant、API contract、state transition、权限边界或时序条件。
|
|
195
|
+
4. `L4 Original Trigger`:制造 first bad state 的用户动作、命令、事件、recent diff、配置变化或外部响应。
|
|
196
|
+
5. `L5 Counterfactual Proof`:恢复 contract、替换输入、回滚 diff、固定配置或断言边界后的实际观察。
|
|
197
|
+
6. `L6 Escape Reason`:为什么测试、类型、验证、监控、review 或 artifact gate 没提前挡住。
|
|
423
198
|
|
|
424
|
-
|
|
425
|
-
2. `rg -n "<error-keyword>|<module>|<capability>" devflow/changes`
|
|
426
|
-
3. `TODOS.md`、backlog、roadmap 中的相关未解决项
|
|
427
|
-
4. 既有 `report-card.json` finding 和 `planning/analysis.md`
|
|
428
|
-
5. 可用时,查询项目记忆或历史调查摘要
|
|
199
|
+
硬规则:
|
|
429
200
|
|
|
430
|
-
|
|
201
|
+
- `First bad state` 为空时,root cause 只能是 `needs-more-evidence`。
|
|
202
|
+
- `Original trigger` 为空时,不能把下游 guard 写成根因修复。
|
|
203
|
+
- `Counterfactual proof` 为空时,假设只能停在 candidate。
|
|
204
|
+
- `Escape reason` 必须变成 regression test、artifact guard、capability invariant、operator check 或明确 follow-up。
|
|
205
|
+
- ladder 指向 spec 缺失或路线假设错误时,reroute 到 `cc-plan` 或 `roadmap`。
|
|
431
206
|
|
|
432
|
-
##
|
|
207
|
+
## Project Postmortem Recall Gate
|
|
433
208
|
|
|
434
|
-
|
|
209
|
+
形成最终假设前先查项目级 postmortem:
|
|
435
210
|
|
|
436
|
-
|
|
211
|
+
```bash
|
|
212
|
+
rg -n "<symptom|module|boundary|failure-class|model-risk>" devflow/postmortems
|
|
213
|
+
```
|
|
437
214
|
|
|
438
|
-
-
|
|
439
|
-
-
|
|
440
|
-
-
|
|
215
|
+
- `devflow/postmortems/` 不存在时,在 Root Cause Contract 记录 `no-project-postmortems-yet`。
|
|
216
|
+
- 有命中时读 `INDEX.md` / `principles.md`,再打开最相关的 1-2 个 incident。
|
|
217
|
+
- 相关 incident 必须进入假设表或反证表:同根因、相似症状不同根因、已知模型陷阱或明确不相关。
|
|
218
|
+
- 重复根因必须标记 `recurring` 或 `same-root-cause`。
|
|
441
219
|
|
|
442
|
-
|
|
220
|
+
## Output Model
|
|
443
221
|
|
|
444
|
-
|
|
222
|
+
默认 durable 输出只有 3 个:
|
|
445
223
|
|
|
446
|
-
|
|
224
|
+
1. `planning/tasks.md`
|
|
225
|
+
- 唯一默认 human-authored Markdown。
|
|
226
|
+
- `## Root Cause Contract` 记录症状、复现、feedback loop、证据链、Root Cause Proof Ladder、假设、confirmed root cause、repair boundary、correct test seam。
|
|
227
|
+
- 后续 task blocks 只保留真正要执行的修复任务。
|
|
228
|
+
2. `planning/task-manifest.json`
|
|
229
|
+
- CLI 生成的执行图真相源。
|
|
230
|
+
- 不复制调查叙事,不承载 roadmap progress,不手工编辑。
|
|
231
|
+
3. `change-meta.json`
|
|
232
|
+
- CLI 生成/更新的 change metadata;记录 spec / roadmap / root-cause 摘要和 work branch。
|
|
447
233
|
|
|
448
|
-
- `
|
|
449
|
-
- `allowedFiles`
|
|
450
|
-
- `forbiddenFiles`
|
|
451
|
-
- `blastRadiusFiles`
|
|
452
|
-
- `blastRadiusRisk`: `low` / `medium` / `high`
|
|
234
|
+
diagnose-only 仍写 `Root Cause Contract`,但 task blocks 只能包含证据交接、监控、人工动作或 reroute,不能伪装成已修复。
|
|
453
235
|
|
|
454
|
-
|
|
236
|
+
## Escalation Packs
|
|
455
237
|
|
|
456
|
-
|
|
457
|
-
2. 不能拆但仍是根因跨度,写明为什么。
|
|
458
|
-
3. 如果已经变成设计 / 架构范围,reroute 到 `cc-plan`。
|
|
238
|
+
只在触发时打开深层规则:
|
|
459
239
|
|
|
460
|
-
|
|
240
|
+
| Pack | Trigger | Open |
|
|
241
|
+
| --- | --- | --- |
|
|
242
|
+
| Boundary Probe | 多组件链路、API/service/DB/queue/build/deploy 边界断裂 | `PLAYBOOK.md#Boundary And Trace Evidence` |
|
|
243
|
+
| Backward Trace | 报错点很深、坏值来源不明、symptom-site guard 看起来诱人 | `references/investigation-contract.md#Backward Trace Chain` |
|
|
244
|
+
| Flaky / Timing | sleep、timeout、重试后消失、低复现率 | `PLAYBOOK.md#Investigation Modes` |
|
|
245
|
+
| Performance | 变慢、CPU/IO/query/throughput 回退 | `PLAYBOOK.md#Pattern Analysis` |
|
|
246
|
+
| External Research | 陌生框架/依赖/平台错误且本地证据不足 | `references/investigation-contract.md#External Research` |
|
|
247
|
+
| No-Code Root Cause | 环境、外部服务、配置或时序窗口 | `references/investigation-contract.md#No Code Root Cause` |
|
|
248
|
+
| Escalation | 三次假设失败或 loop 无法构造 | `references/investigation-contract.md#Escalation` |
|
|
461
249
|
|
|
462
|
-
|
|
250
|
+
如果没有触发条件,不要打开这些包。
|
|
463
251
|
|
|
464
|
-
|
|
465
|
-
- 如果答案是 seam / module / capability 边界问题,把它写成 architecture finding,并明确交给 `cc-plan` 或后续 backlog。
|
|
466
|
-
- 如果答案只是流程提醒或人工记忆,不算预防;要么转成可执行 guard,要么明确不记录。
|
|
252
|
+
## Roadmap Sync
|
|
467
253
|
|
|
468
|
-
|
|
254
|
+
退出前定位 source RM:
|
|
469
255
|
|
|
470
|
-
|
|
256
|
+
```bash
|
|
257
|
+
bash .claude/skills/cc-roadmap/scripts/locate-roadmap-item.sh --id <RM-or-FIX>
|
|
258
|
+
```
|
|
471
259
|
|
|
472
|
-
-
|
|
473
|
-
-
|
|
474
|
-
-
|
|
475
|
-
-
|
|
476
|
-
- evidence request if the loop cannot be built or the environment is missing
|
|
477
|
-
- recommendation
|
|
260
|
+
- `implementation drift`:回写 source RM 为 repair planned / investigation frozen,绑定 `FIX-*`。
|
|
261
|
+
- `missing spec truth`:写 expected spec delta 或 follow-up,必要时 reroute 到 `cc-plan`。
|
|
262
|
+
- `roadmap mismatch`:写回 roadmap / backlog,下一步是 `roadmap` 或 `cc-plan`,不要直接修。
|
|
263
|
+
- 找不到 source RM 时,在 `planning/tasks.md#Root Cause Contract` 和 `change-meta.json.roadmapSync` 记录 `no-source-rm`。
|
|
478
264
|
|
|
479
|
-
##
|
|
265
|
+
## Exit Rule
|
|
480
266
|
|
|
481
|
-
|
|
482
|
-
- 根因不是感觉,而是被证据钉死的具体断点
|
|
483
|
-
- 根因证明追到 first bad state 和 original trigger,而不是停在 symptom site
|
|
484
|
-
- 假设不是列表装饰,而是带证伪方法和实际观察
|
|
485
|
-
- 历史调查、最近改动、模式分析没有被跳过
|
|
486
|
-
- 修复边界清楚到 `cc-do` 不需要二次调查
|
|
487
|
-
- 正确测试缝隙写清楚,不用浅层测试制造假安全
|
|
488
|
-
- `planning/tasks.md` 只包含修复任务,不夹带新需求
|
|
489
|
-
- 如果应该回 `cc-plan`,理由写清楚,不假装还能继续 patch
|
|
490
|
-
- Roadmap Sync Gate 必须在 handoff 前闭合:source RM 绑定的 `FIX-*`、调查状态、spec diagnosis 和 next action 不能停留在聊天里。
|
|
267
|
+
调查合格的标准很简单:
|
|
491
268
|
|
|
492
|
-
|
|
269
|
+
- 复现 loop 可信,并匹配用户症状。
|
|
270
|
+
- First bad state、original trigger、counterfactual proof 已冻结。
|
|
271
|
+
- 修复边界清楚到 `cc-do` 不需要二次调查。
|
|
272
|
+
- machine artifacts 由 CLI 生成并通过 validate。
|
|
273
|
+
- source RM 已同步或 no-op reason 已落盘。
|
|
493
274
|
|
|
494
|
-
|
|
495
|
-
- 调查契约:`references/investigation-contract.md`
|
|
496
|
-
- 分析模板:`assets/ANALYSIS_TEMPLATE.md`
|
|
497
|
-
- 修复任务模板:`assets/TASKS_TEMPLATE.md`
|
|
498
|
-
- manifest 模板:`assets/TASK_MANIFEST_TEMPLATE.json`
|
|
499
|
-
- 分析骨架:`scripts/bootstrap-analysis.sh`
|
|
500
|
-
- Roadmap 定位:`../cc-roadmap/scripts/locate-roadmap-item.sh`
|
|
501
|
-
- Roadmap 回写:`../cc-roadmap/scripts/sync-roadmap-progress.sh`
|
|
502
|
-
|
|
503
|
-
## Working Rules
|
|
504
|
-
|
|
505
|
-
1. 没有复现,不准声称找到了根因。
|
|
506
|
-
2. 没有可信 feedback loop,不准把代码阅读包装成 confirmed root cause。
|
|
507
|
-
3. 没有证据,不准把猜测写成结论。
|
|
508
|
-
4. 先根因,再修复;先调查,再编码。
|
|
509
|
-
5. `planning/tasks.md` 必须足够让 `cc-do` 在脱离当前对话后继续推进。
|
|
510
|
-
6. 如果修复方案已经变成新 feature 设计,停止 debug,回 `cc-plan`。
|
|
511
|
-
7. 三次假设失败后,默认说明你的调查入口错了,不准继续硬猜。
|
|
512
|
-
8. 外部调研必须先脱敏,调研结论必须回到本仓库证据验证。
|
|
513
|
-
9. 修复触点超过 5 个文件时,默认先拆分或 reroute,不把大重构伪装成 bug fix。
|
|
514
|
-
10. 好的调查不是“找了很多可能性”,而是把错误世界缩成一个可信的 repair contract。
|
|
515
|
-
11. Roadmap 相关文件以 `devflow/roadmap.json` 为真相源,`devflow/ROADMAP.md` / `devflow/BACKLOG.md` 只是投影;不要再写旧式 `devflow/roadmap/*` 路径。
|
|
516
|
-
|
|
517
|
-
## Exit Criteria
|
|
518
|
-
|
|
519
|
-
- `planning/analysis.md` 已冻结症状、复现、证据链、根因和修复边界
|
|
520
|
-
- `planning/tasks.md` / `planning/task-manifest.json` 可直接交给 `cc-do`
|
|
521
|
-
- Roadmap Sync Gate 已闭合:source RM 已回写调查结果 / reroute,或 no-op reason 已落盘
|
|
522
|
-
- 下一步唯一答案是 `cc-do`、`cc-plan` 或 `roadmap`
|
|
523
|
-
|
|
524
|
-
## Do Not
|
|
525
|
-
|
|
526
|
-
- 不在这里写生产代码
|
|
527
|
-
- 不拿“可能是”冒充“已经证实”
|
|
528
|
-
- 不把新需求伪装成 bug 修复
|
|
529
|
-
- 不在根因未明时开始堆 patch
|
|
275
|
+
如果执行者还要猜“为什么坏、修哪里、不该碰哪里、怎么证明修好了”,调查没完成。
|
|
530
276
|
|
|
531
277
|
## Companion Files
|
|
532
278
|
|