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