cc-devflow 4.5.1 → 4.5.3
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 +27 -0
- package/.claude/skills/cc-act/PLAYBOOK.md +32 -1
- package/.claude/skills/cc-act/SKILL.md +53 -7
- package/.claude/skills/cc-act/assets/PR_BRIEF_TEMPLATE.md +35 -1
- package/.claude/skills/cc-act/assets/RELEASE_NOTE_TEMPLATE.md +10 -1
- package/.claude/skills/cc-act/references/closure-contract.md +11 -0
- package/.claude/skills/cc-act/scripts/cc-act-common.sh +32 -1
- package/.claude/skills/cc-act/scripts/render-pr-brief.sh +130 -0
- package/.claude/skills/cc-act/scripts/verify-act-gate.sh +23 -1
- package/.claude/skills/cc-check/CHANGELOG.md +26 -0
- package/.claude/skills/cc-check/PLAYBOOK.md +128 -1
- package/.claude/skills/cc-check/SKILL.md +147 -7
- package/.claude/skills/cc-check/assets/REPORT_CARD_TEMPLATE.json +164 -1
- package/.claude/skills/cc-check/references/gate-contract.md +11 -0
- package/.claude/skills/cc-check/references/review-contract.md +104 -0
- package/.claude/skills/cc-check/scripts/render-report-card.js +209 -5
- package/.claude/skills/cc-check/scripts/verify-gate.sh +28 -0
- package/.claude/skills/cc-do/CHANGELOG.md +12 -0
- package/.claude/skills/cc-do/PLAYBOOK.md +14 -9
- package/.claude/skills/cc-do/SKILL.md +24 -13
- package/.claude/skills/cc-do/references/execution-recovery.md +16 -5
- package/.claude/skills/cc-do/scripts/verify-task-gates.sh +19 -6
- package/.claude/skills/cc-do/scripts/write-task-checkpoint.sh +14 -2
- package/.claude/skills/cc-investigate/CHANGELOG.md +31 -0
- package/.claude/skills/cc-investigate/PLAYBOOK.md +124 -8
- package/.claude/skills/cc-investigate/SKILL.md +252 -17
- package/.claude/skills/cc-investigate/assets/ANALYSIS_TEMPLATE.md +112 -3
- package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +17 -5
- package/.claude/skills/cc-investigate/assets/TASK_MANIFEST_TEMPLATE.json +141 -1
- package/.claude/skills/cc-investigate/references/investigation-contract.md +192 -0
- package/.claude/skills/cc-plan/CHANGELOG.md +26 -0
- package/.claude/skills/cc-plan/PLAYBOOK.md +18 -6
- package/.claude/skills/cc-plan/SKILL.md +72 -34
- package/.claude/skills/cc-plan/assets/DESIGN_TEMPLATE.md +30 -3
- package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +28 -0
- package/.claude/skills/cc-plan/assets/TASK_MANIFEST_TEMPLATE.json +46 -1
- package/.claude/skills/cc-plan/assets/TINY_DESIGN_TEMPLATE.md +24 -0
- package/.claude/skills/cc-plan/references/planning-contract.md +18 -4
- package/.claude/skills/cc-roadmap/CHANGELOG.md +14 -0
- package/.claude/skills/cc-roadmap/PLAYBOOK.md +10 -7
- package/.claude/skills/cc-roadmap/SKILL.md +43 -23
- package/.claude/skills/cc-roadmap/assets/BACKLOG_TEMPLATE.md +10 -0
- package/.claude/skills/cc-roadmap/assets/ROADMAP_TEMPLATE.md +15 -0
- package/.claude/skills/cc-roadmap/assets/TRACKING_TEMPLATE.json +1 -1
- package/.claude/skills/cc-roadmap/references/roadmap-dialogue.md +11 -7
- package/.claude/skills/cc-simplify/CHANGELOG.md +21 -0
- package/.claude/skills/cc-simplify/SKILL.md +264 -35
- package/.claude/skills/cc-spec-init/CHANGELOG.md +6 -0
- package/.claude/skills/cc-spec-init/SKILL.md +14 -1
- package/CHANGELOG.md +37 -0
- package/README.md +10 -2
- package/README.zh-CN.md +10 -2
- package/docs/examples/example-bindings.json +7 -7
- package/docs/examples/full-design-blocked/BACKLOG.md +1 -1
- package/docs/examples/full-design-blocked/README.md +1 -1
- package/docs/examples/full-design-blocked/ROADMAP.md +1 -1
- package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/design.md +1 -1
- package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/planning/tasks.md +1 -1
- package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/review/report-card.json +140 -3
- package/docs/examples/full-design-blocked/roadmap-tracking.json +1 -1
- package/docs/examples/local-handoff/BACKLOG.md +1 -1
- package/docs/examples/local-handoff/README.md +1 -1
- package/docs/examples/local-handoff/ROADMAP.md +1 -1
- package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/design.md +1 -1
- package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/planning/tasks.md +1 -1
- package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/review/report-card.json +92 -0
- package/docs/examples/local-handoff/roadmap-tracking.json +1 -1
- package/docs/examples/pdca-loop/BACKLOG.md +1 -1
- package/docs/examples/pdca-loop/README.md +1 -1
- package/docs/examples/pdca-loop/ROADMAP.md +1 -1
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/handoff/pr-brief.md +20 -0
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/design.md +1 -1
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/task-manifest.json +2 -2
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/planning/tasks.md +1 -1
- package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/review/report-card.json +92 -0
- package/docs/examples/pdca-loop/roadmap-tracking.json +1 -1
- package/docs/skill-strategy-audit.md +48 -0
- package/lib/skill-runtime/__tests__/runtime.integration.test.js +19 -1
- package/lib/skill-runtime/review.js +64 -1
- package/lib/skill-runtime/schemas.js +161 -4
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ set -euo pipefail
|
|
|
9
9
|
usage() {
|
|
10
10
|
cat <<'EOF'
|
|
11
11
|
Usage:
|
|
12
|
-
write-task-checkpoint.sh --dir path/to/change --task T001 --status pending|running|passed|failed|skipped --summary "..." [--event context_ready] [--attempt 0] [--session session-id] [--next-action "..."]
|
|
12
|
+
write-task-checkpoint.sh --dir path/to/change --task T001 --status pending|running|passed|failed|skipped --summary "..." [--event context_ready] [--attempt 0] [--session session-id] [--next-action "..."] [--tdd-json '{"red":...}']
|
|
13
13
|
EOF
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -23,6 +23,7 @@ EVENT_TYPE=""
|
|
|
23
23
|
ATTEMPT="0"
|
|
24
24
|
SESSION_ID=""
|
|
25
25
|
NEXT_ACTION=""
|
|
26
|
+
TDD_JSON=""
|
|
26
27
|
|
|
27
28
|
while [[ $# -gt 0 ]]; do
|
|
28
29
|
case "$1" in
|
|
@@ -34,6 +35,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
34
35
|
--attempt) ATTEMPT="$2"; shift 2 ;;
|
|
35
36
|
--session) SESSION_ID="$2"; shift 2 ;;
|
|
36
37
|
--next-action) NEXT_ACTION="$2"; shift 2 ;;
|
|
38
|
+
--tdd-json) TDD_JSON="$2"; shift 2 ;;
|
|
37
39
|
-h|--help) usage; exit 0 ;;
|
|
38
40
|
*) echo "Unknown arg: $1" >&2; usage; exit 1 ;;
|
|
39
41
|
esac
|
|
@@ -57,6 +59,15 @@ if [[ -z "$SESSION_ID" ]]; then
|
|
|
57
59
|
SESSION_ID="${TASK_ID}-$(date -u +%s)"
|
|
58
60
|
fi
|
|
59
61
|
|
|
62
|
+
tdd_payload="null"
|
|
63
|
+
if [[ -n "$TDD_JSON" ]]; then
|
|
64
|
+
if [[ -f "$TDD_JSON" ]]; then
|
|
65
|
+
tdd_payload="$(jq -c . "$TDD_JSON")"
|
|
66
|
+
else
|
|
67
|
+
tdd_payload="$(printf '%s' "$TDD_JSON" | jq -c .)"
|
|
68
|
+
fi
|
|
69
|
+
fi
|
|
70
|
+
|
|
60
71
|
jq -nc \
|
|
61
72
|
--arg changeId "$change_id" \
|
|
62
73
|
--arg taskId "$TASK_ID" \
|
|
@@ -66,6 +77,7 @@ jq -nc \
|
|
|
66
77
|
--arg summary "$SUMMARY" \
|
|
67
78
|
--arg timestamp "$timestamp" \
|
|
68
79
|
--arg attempt "$ATTEMPT" \
|
|
80
|
+
--argjson tdd "$tdd_payload" \
|
|
69
81
|
'{
|
|
70
82
|
changeId: $changeId,
|
|
71
83
|
taskId: $taskId,
|
|
@@ -75,7 +87,7 @@ jq -nc \
|
|
|
75
87
|
summary: $summary,
|
|
76
88
|
timestamp: $timestamp,
|
|
77
89
|
attempt: ($attempt | tonumber)
|
|
78
|
-
}' > "$runtime_task_dir/checkpoint.json"
|
|
90
|
+
} + (if $tdd == null then {} else {tdd: $tdd} end)' > "$runtime_task_dir/checkpoint.json"
|
|
79
91
|
|
|
80
92
|
if [[ -n "$EVENT_TYPE" || "$STATUS" == "failed" ]]; then
|
|
81
93
|
jq -nc \
|
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# CC-Investigate Skill Changelog
|
|
2
2
|
|
|
3
|
+
## v1.2.0 - 2026-04-28
|
|
4
|
+
|
|
5
|
+
- treat feedback loops as investigation products that must be made faster, sharper, and more deterministic before root cause freeze
|
|
6
|
+
- require flaky investigations to raise reproduction rate with stress, repetition, timing-window narrowing, or differential loops instead of guessing from weak signals
|
|
7
|
+
- add prevention handoff so confirmed root causes produce either a regression task, architecture finding, or explicit non-recorded reason
|
|
8
|
+
|
|
9
|
+
## v1.1.6 - 2026-04-28
|
|
10
|
+
|
|
11
|
+
- clarify that investigation domain language and durable decisions come from cc-devflow native sources: `devflow/specs/`, roadmap/backlog handoff, historical design/analysis, and change metadata
|
|
12
|
+
- remove external context/architecture-decision files from the standard investigation contract so they are not implied as generated artifacts
|
|
13
|
+
- route conflicts through capability specs, roadmap decisions, or historical design decisions instead of external decision-document language
|
|
14
|
+
|
|
15
|
+
## v1.1.5 - 2026-04-28
|
|
16
|
+
|
|
17
|
+
- add a feedback-loop contract so investigations record loop type, command, symptom match, runtime, determinism, failure rate, signal specificity, and sharpening plan before freezing root cause
|
|
18
|
+
- require ranked candidate hypotheses before narrowing to active falsification targets, plus probe tags for cleanup-safe diagnostic instrumentation
|
|
19
|
+
- add performance-regression, native domain/decision context, correct-test-seam, and evidence-request fields across the analysis, task, manifest, playbook, and investigation contract templates
|
|
20
|
+
|
|
21
|
+
## v1.1.4 - 2026-04-28
|
|
22
|
+
|
|
23
|
+
- add boundary-probe, backward-trace, reference-comparison, diagnostic-instrumentation, and condition-wait investigation modes for multi-component, deep-stack, similar-path, and flaky failures
|
|
24
|
+
- require analysis templates to record boundary matrices, caller chains, working-vs-broken comparisons, probe cleanup, root-cause class, and no-code-root-cause evidence
|
|
25
|
+
- update tasks and manifest templates so repair handoffs preserve the probe/trace facts that prove the confirmed root cause
|
|
26
|
+
|
|
27
|
+
## v1.1.3 - 2026-04-28
|
|
28
|
+
|
|
29
|
+
- add the explicit `NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT` iron law to keep investigation separate from implementation
|
|
30
|
+
- require prior investigation history, pattern analysis, falsification methods, sanitized external research, and escalation decisions before freezing a root cause
|
|
31
|
+
- add repair-boundary scope lock fields for affected module, allowed files, forbidden files, blast radius, and split-or-reroute decisions
|
|
32
|
+
- update analysis, tasks, and task-manifest templates with root-cause hypothesis and investigation metadata
|
|
33
|
+
|
|
3
34
|
## v1.1.2 - 2026-04-27
|
|
4
35
|
|
|
5
36
|
- require investigation outputs to resolve the runtime output policy before writing analysis, task, or change metadata artifacts
|
|
@@ -12,10 +12,22 @@
|
|
|
12
12
|
## Core Rules
|
|
13
13
|
|
|
14
14
|
1. 先复现,再猜原因。
|
|
15
|
-
2.
|
|
16
|
-
3.
|
|
17
|
-
4.
|
|
18
|
-
5.
|
|
15
|
+
2. 先把复现做成快、准、可复跑的 feedback loop。
|
|
16
|
+
3. 先确认 loop 复现的是用户报告的同一个失败。
|
|
17
|
+
4. 先看最近变化,再决定是不是 regression。
|
|
18
|
+
5. 先证伪假设,再冻结根因。
|
|
19
|
+
6. `planning/analysis.md` 和 `planning/tasks.md` 必须足够让 `cc-do` 脱离当前会话继续工作。
|
|
20
|
+
7. 调查失败三次后先重建入口,不准继续乱补。
|
|
21
|
+
8. 没有 frozen root-cause contract,不准进入 repair task。
|
|
22
|
+
9. 多组件、深层调用、flaky 问题必须先补边界探针、反向追踪或条件等待证据。
|
|
23
|
+
|
|
24
|
+
## Iron Law
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
root-cause contract 至少包含:稳定复现或缩小后的可验证症状、被破坏的代码 / 配置 / 数据 / 依赖契约、已证伪假设、最小修复边界。
|
|
19
31
|
|
|
20
32
|
## Required Outputs
|
|
21
33
|
|
|
@@ -26,10 +38,114 @@
|
|
|
26
38
|
## Investigation Standard
|
|
27
39
|
|
|
28
40
|
1. 先收集 symptom、expected、actual、repro。
|
|
29
|
-
2.
|
|
30
|
-
3.
|
|
31
|
-
4.
|
|
32
|
-
5.
|
|
41
|
+
2. 先构造 feedback loop:失败测试、HTTP 脚本、CLI fixture、浏览器脚本、trace replay、throwaway harness、fuzz、bisect、differential,最后才是 HITL。
|
|
42
|
+
3. 记录 loop 的运行时间、确定性、失败率、症状匹配证据和 sharpen 计划。
|
|
43
|
+
4. 先查 prior investigations、TODOS/backlog、report-card finding 和最近变更。
|
|
44
|
+
5. 先沿代码路径定位触点和最近变更。
|
|
45
|
+
6. 先做 pattern analysis,再列 3-5 个候选假设并收敛到 1-3 个 active hypotheses。
|
|
46
|
+
7. 每个假设都要写支持证据、反证、证伪方法、预期观察、实际观察。
|
|
47
|
+
8. 只有被证据钉死的根因才能进入 repair contract。
|
|
48
|
+
9. repair contract 只讲最小修复边界,不顺手发明新范围。
|
|
49
|
+
|
|
50
|
+
## Investigation Modes
|
|
51
|
+
|
|
52
|
+
| Mode | 什么时候用 | 第一动作 |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| `reproduce-first` | 症状真实但不稳定 | 缩小复现命令 / 手动路径 |
|
|
55
|
+
| `feedback-loop` | 已有复现但信号慢、松、偶然或不确定是否同一 bug | 记录 loop type、命令、runtime、determinism、failure rate 和 symptom match |
|
|
56
|
+
| `diff-trace` | 昨天可用、今天坏了 | `git log --oneline -20 -- <affected-files>` |
|
|
57
|
+
| `boundary-probe` | API -> service -> DB、CI -> build -> deploy 这类链路断裂 | 记录每层输入、输出、配置和状态 |
|
|
58
|
+
| `backward-trace` | 错误出现在深层堆栈或坏值来源不明 | 从 immediate failure site 反追 original trigger |
|
|
59
|
+
| `reference-compare` | 同仓库有相似可用路径 | 列出 working / broken 差异并逐项接受或排除 |
|
|
60
|
+
| `condition-wait` | flaky、sleep、timeout、重试后消失 | 找真实等待条件,不先加大延时 |
|
|
61
|
+
| `history-trace` | 同一区域反复坏 | 查历史 `analysis.md`、TODO、report-card finding |
|
|
62
|
+
| `pattern-research` | 陌生框架 / 依赖 / 平台错误 | 脱敏后查通用错误类型 |
|
|
63
|
+
| `contract-check` | 修复边界可能扩大 | 判定 implementation drift / missing spec truth / roadmap mismatch |
|
|
64
|
+
|
|
65
|
+
## Pattern Analysis
|
|
66
|
+
|
|
67
|
+
至少对照这些模式,不要直接猜:
|
|
68
|
+
|
|
69
|
+
- race condition:间歇性、时序相关、共享状态
|
|
70
|
+
- null propagation:TypeError / undefined / missing guard
|
|
71
|
+
- state corruption:数据不一致、部分更新、hook / transaction 顺序
|
|
72
|
+
- integration failure:timeout、协议不匹配、外部服务边界
|
|
73
|
+
- configuration drift:本地 / CI / 生产表现不同
|
|
74
|
+
- stale cache:清缓存后恢复或旧状态复现
|
|
75
|
+
- resource leak:OOM、句柄增长、生命周期未释放
|
|
76
|
+
- performance regression:变慢、CPU / IO / 查询耗时升高、吞吐下降
|
|
77
|
+
- trust boundary drift:外部输入、LLM 输出、用户输入被当成可信
|
|
78
|
+
- timing guess / flaky wait:任意 sleep / timeout / setTimeout 掩盖真实条件
|
|
79
|
+
|
|
80
|
+
性能回归先建 baseline、profiler、query plan 或 bisect,不把普通日志当性能证据。
|
|
81
|
+
|
|
82
|
+
## Boundary And Trace Evidence
|
|
83
|
+
|
|
84
|
+
复杂链路必须在 `analysis.md` 写清:
|
|
85
|
+
|
|
86
|
+
- Boundary Probe Matrix:component boundary、input observed、output observed、config/env observed、state observed、verdict
|
|
87
|
+
- Backward Trace Chain:immediate failure site、caller chain、bad value origin、original trigger、why symptom-site fix is rejected
|
|
88
|
+
- Reference Comparison:similar working example、broken path、differences accepted / ruled out
|
|
89
|
+
- Diagnostic Instrumentation Plan:probe tag、probe location、question answered、command、expected signal、cleanup requirement
|
|
90
|
+
- Feedback Loop Contract:loop type、command、expected / actual signal、symptom match、runtime、determinism、failure rate、sharpening plan
|
|
91
|
+
- Correct Test Seam:test seam、public interface exercised、why it reaches the real trigger chain、why shallow tests are rejected
|
|
92
|
+
|
|
93
|
+
这些字段不是装饰。它们的作用是证明根因位于源头,而不是报错点。
|
|
94
|
+
|
|
95
|
+
## Prior Investigation History
|
|
96
|
+
|
|
97
|
+
形成根因前至少查:
|
|
98
|
+
|
|
99
|
+
1. `git log --oneline -20 -- <affected-files>`
|
|
100
|
+
2. `rg -n "<error-keyword>|<module>|<capability>" devflow/changes`
|
|
101
|
+
3. `TODOS.md`、backlog、roadmap 中的相关项
|
|
102
|
+
4. 既有 `planning/analysis.md` 和 `review/report-card.json`
|
|
103
|
+
|
|
104
|
+
命中历史时,写入 `analysis.md` 的 `Prior Investigations`,说明这次是复发、同类结构味道,还是无关历史。
|
|
105
|
+
|
|
106
|
+
## Domain And Decision Context
|
|
107
|
+
|
|
108
|
+
优先读取 cc-devflow 原生上下文:`devflow/specs/INDEX.md`、相关 capability specs、roadmap/backlog handoff、历史 `planning/design.md` / `planning/analysis.md`、`change-meta.json`。调查输出里的领域名、假设名、测试名应沿用项目词汇;如果调查结论违反 capability spec、roadmap decision 或历史 design decision,要显式写入 evidence chain,而不是静默覆盖既有设计决策。
|
|
109
|
+
|
|
110
|
+
## External Research Hygiene
|
|
111
|
+
|
|
112
|
+
只有在本地证据不足、错误类型陌生、或像依赖 / 框架 / 平台问题时才做外部调研。
|
|
113
|
+
|
|
114
|
+
- 先删除 host、IP、token、customer id、内部路径、SQL、私有 repo 名。
|
|
115
|
+
- 只搜错误类别、框架 / 库名、版本、通用组件名。
|
|
116
|
+
- 调研结果只能进入候选假设,必须回到本仓库复现或代码证据验证。
|
|
117
|
+
|
|
118
|
+
## No Code Root Cause
|
|
119
|
+
|
|
120
|
+
如果结论是环境、外部服务或时序窗口:
|
|
121
|
+
|
|
122
|
+
- 写 `rootCauseClass`: `code` / `config` / `environment` / `external` / `timing`
|
|
123
|
+
- 写明为什么不是 code root cause
|
|
124
|
+
- 写明需要什么 monitoring / future evidence
|
|
125
|
+
- 写明 operator handling,不要把未知外因包装成代码修复
|
|
126
|
+
|
|
127
|
+
## Scope Lock
|
|
128
|
+
|
|
129
|
+
根因假设形成后,写清:
|
|
130
|
+
|
|
131
|
+
- affected module
|
|
132
|
+
- allowed files
|
|
133
|
+
- forbidden files
|
|
134
|
+
- blast radius estimate
|
|
135
|
+
- if touches >5 files: split / justify / reroute
|
|
136
|
+
|
|
137
|
+
超过 5 个文件默认是调查信号,不是正常 bug-fix 规模。
|
|
138
|
+
|
|
139
|
+
## Escalation
|
|
140
|
+
|
|
141
|
+
三次假设失败后写 `Escalation Decision`:
|
|
142
|
+
|
|
143
|
+
- failed hypothesis count
|
|
144
|
+
- attempted evidence
|
|
145
|
+
- why current entry is suspect
|
|
146
|
+
- next option:continue / instrument-and-wait / human-review / reroute-cc-plan
|
|
147
|
+
- evidence request:需要可复现环境、HAR、日志 dump、core dump、带时间戳录屏或临时生产探针权限
|
|
148
|
+
- recommendation
|
|
33
149
|
|
|
34
150
|
## Local Kit
|
|
35
151
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cc-investigate
|
|
3
|
-
version: 1.
|
|
3
|
+
version: 1.2.0
|
|
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"
|
|
@@ -33,10 +33,13 @@ writes:
|
|
|
33
33
|
entry_gate:
|
|
34
34
|
- "Read the current bug report, existing requirement artifacts, relevant code, tests, and recent history before forming any hypothesis."
|
|
35
35
|
- "Use a FIX-<number>-<description> change key for new bug-fix investigations."
|
|
36
|
-
- "
|
|
36
|
+
- "Build a runnable feedback loop, confirm it matches the reported symptom, then freeze the evidence chain before proposing repair tasks."
|
|
37
|
+
- "Search prior investigations, TODO/backlog signals, and recent fixes in the affected area before declaring the bug novel."
|
|
38
|
+
- "For multi-component, deep-stack, or flaky symptoms, record boundary probes, backward trace, or condition-wait evidence before declaring the root cause."
|
|
39
|
+
- "For performance regressions, collect a baseline or profile signal before treating logs as evidence."
|
|
37
40
|
- "Do not write production code here; this stage ends with planning/analysis.md plus executable repair tasks for cc-do."
|
|
38
41
|
exit_criteria:
|
|
39
|
-
- "planning/analysis.md records symptom, reproduction, evidence chain, confirmed root cause, and repair boundary."
|
|
42
|
+
- "planning/analysis.md records symptom, reproduction, evidence chain, boundary probes or backward trace when applicable, pattern analysis, tested hypotheses, confirmed root cause, and repair boundary."
|
|
40
43
|
- "planning/tasks.md and planning/task-manifest.json are explicit enough that cc-do can repair the bug without chat memory."
|
|
41
44
|
- "The honest next step is cc-do, cc-plan, or roadmap."
|
|
42
45
|
reroutes:
|
|
@@ -106,6 +109,21 @@ tool_budget:
|
|
|
106
109
|
|
|
107
110
|
如果问题其实是在问“应该做什么功能”或“范围是否要变”,别硬调试,回 `cc-plan`。
|
|
108
111
|
|
|
112
|
+
## Iron Law
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
NO REPAIR WITHOUT A FROZEN ROOT-CAUSE CONTRACT
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`cc-investigate` 可以跑复现、读代码、查日志、加临时探针、证伪假设,但不能把“可能是”写成 repair task。
|
|
119
|
+
|
|
120
|
+
根因合同必须同时回答:
|
|
121
|
+
|
|
122
|
+
1. 症状如何稳定复现或被缩小到可验证范围。
|
|
123
|
+
2. 哪条代码 / 配置 / 数据 / 依赖路径违反了什么契约。
|
|
124
|
+
3. 哪些假设被证伪,为什么不是它们。
|
|
125
|
+
4. 最小修复边界在哪里,哪些文件明确不该动。
|
|
126
|
+
|
|
109
127
|
## Quick Start
|
|
110
128
|
|
|
111
129
|
先判断你面对的是哪一类调查现实:
|
|
@@ -113,8 +131,15 @@ tool_budget:
|
|
|
113
131
|
| 现实状态 | 先走什么路径 |
|
|
114
132
|
| --- | --- |
|
|
115
133
|
| 症状真实,但还没有稳定复现 | `reproduce-first`,先把现象钉死 |
|
|
134
|
+
| 已有复现但信号慢 / 松 / 偶然 | `feedback-loop`,先把 pass/fail loop 做快、准、可复跑 |
|
|
116
135
|
| 明显是 regression | `diff-trace`,先查最近变化 |
|
|
136
|
+
| 多组件链路断裂 | `boundary-probe`,先记录每个边界的输入、输出、配置和状态 |
|
|
137
|
+
| 报错点很深或坏值来源不明 | `backward-trace`,从 symptom site 一直追到 original trigger |
|
|
138
|
+
| 同仓库有相似可用路径 | `reference-compare`,先列出 working vs broken differences |
|
|
139
|
+
| flaky / sleep / timeout 类问题 | `condition-wait`,先找真实等待条件,不先加大延时 |
|
|
117
140
|
| 症状已知,但修复边界可能扩大范围 | `contract-check`,先判是否还属于当前 requirement |
|
|
141
|
+
| 错误类型陌生,像框架 / 依赖 / 平台问题 | `pattern-research`,先做脱敏外部调研 |
|
|
142
|
+
| 同一区域反复坏 | `history-trace`,先查 prior investigations 和最近修复 |
|
|
118
143
|
| 看起来像 bug,实则是未定义行为或新需求 | 直接 reroute 到 `cc-plan` |
|
|
119
144
|
|
|
120
145
|
先说“这是什么类问题”,再说“我要怎么修”。没有分类的 debug,最后都会变成乱打补丁。
|
|
@@ -163,30 +188,237 @@ tool_budget:
|
|
|
163
188
|
- 记录用户看见了什么
|
|
164
189
|
- 记录预期与实际差异
|
|
165
190
|
- 记录复现命令或手动路径
|
|
166
|
-
|
|
191
|
+
- 确认复现的是用户描述的同一个失败,而不是旁边的红灯
|
|
192
|
+
- 如果上下文缺失,只问一个最关键问题,不一次性抛出问题清单
|
|
193
|
+
2. **Build feedback loop**
|
|
194
|
+
- 优先构造 agent 可运行的 pass/fail 信号:失败测试、curl / HTTP 脚本、CLI fixture、浏览器脚本、trace replay、throwaway harness、property / fuzz loop、bisect harness、differential loop,最后才是 HITL 脚本
|
|
195
|
+
- 记录 loop 类型、命令、运行时间、确定性、失败率、症状匹配证据和下一步 sharpen 计划
|
|
196
|
+
- loop 太慢、太宽、太 flaky 时,先优化 loop 本身;没有可信 loop,不进入 confirmed root cause
|
|
197
|
+
- 如果确实无法建 loop,写明尝试过什么,并请求 HAR、日志 dump、core dump、带时间戳录屏、可复现环境访问或临时生产探针权限
|
|
198
|
+
3. **Trace reality**
|
|
167
199
|
- 沿着代码路径找触点
|
|
200
|
+
- 多组件系统先写 `Boundary Probe Matrix`:每个边界的输入、输出、配置 / 环境、状态和 pass/fail
|
|
201
|
+
- 深层报错先写 `Backward Trace Chain`:immediate failure site、caller chain、bad value origin、original trigger
|
|
168
202
|
- 查最近提交和同类改动
|
|
203
|
+
- 查既有 `devflow/changes/*/planning/analysis.md`、`TODOS.md`、backlog、report-card finding
|
|
204
|
+
- 如果仓库有 `devflow/specs/`、roadmap/backlog handoff、历史 `planning/design.md` / `planning/analysis.md` 或 `change-meta.json`,把领域词汇和已冻结决策当成契约证据
|
|
169
205
|
- 找现有测试和断点证据
|
|
170
206
|
- 判定偏离的是 capability boundary、invariant,还是只是实现细节
|
|
171
|
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
|
|
207
|
+
4. **Classify pattern**
|
|
208
|
+
- 判定是否属于 race condition、null propagation、state corruption、integration failure、configuration drift、stale cache、resource leak、performance regression、trust boundary drift、timing guess / flaky wait
|
|
209
|
+
- 如果有同仓库 working example,先写 `Reference Comparison`,列出 working path、broken path、差异和被接受 / 排除的假设
|
|
210
|
+
- 如果错误类型陌生,先做脱敏外部调研;只搜索通用错误类型、框架 / 库名和版本,不搜索 raw secret / path / customer data
|
|
211
|
+
5. **Form hypotheses**
|
|
212
|
+
- 先列 3-5 个候选假设并排序,避免第一直觉锚定
|
|
213
|
+
- 再收敛到 1-3 个 active hypotheses 进入验证
|
|
214
|
+
- 每个假设都写支持证据、反证和优先级理由
|
|
215
|
+
- 每个假设都写 `falsification method`、`expected observation`、`actual observation`
|
|
216
|
+
6. **Test hypotheses**
|
|
175
217
|
- 用复现、日志、断言、最小探针验证
|
|
176
|
-
-
|
|
177
|
-
|
|
218
|
+
- 临时探针必须写 `Diagnostic Instrumentation Plan`:probe tag、probe location、question answered、command、expected signal、cleanup requirement
|
|
219
|
+
- 每个 probe 只回答一个假设预测;一次只改一个变量
|
|
220
|
+
- debug 日志必须带唯一前缀,例如 `[DEBUG-FIX123-a4f2]`,进入 `cc-do` 前用前缀 grep 清理或转正
|
|
221
|
+
- 三次假设都失败,就停下进入 escalation decision
|
|
222
|
+
7. **Freeze repair contract**
|
|
178
223
|
- 根因确认后,写进 `planning/analysis.md`
|
|
179
224
|
- 只保留最小修复边界
|
|
225
|
+
- 写清正确测试缝隙:测试是否覆盖真实触发链;如果没有正确 seam,这本身就是需要记录的架构事实
|
|
226
|
+
- 写明 affected module、allowed files、forbidden files、blast radius estimate;超过 5 个文件默认拆分或 reroute
|
|
180
227
|
- 输出 `planning/tasks.md` + `planning/task-manifest.json` + `change-meta.json`
|
|
181
|
-
|
|
228
|
+
8. **Hand off**
|
|
182
229
|
- 下一步明确写成 `cc-do`
|
|
183
230
|
- 如果 repair contract 越过当前 requirement,就 reroute 到 `cc-plan`
|
|
184
231
|
|
|
232
|
+
## Pattern Analysis
|
|
233
|
+
|
|
234
|
+
不要从空白猜测开始。先把 bug 放进一个可检查的模式:
|
|
235
|
+
|
|
236
|
+
| Pattern | Signature | First place to inspect |
|
|
237
|
+
| --- | --- | --- |
|
|
238
|
+
| race condition | 间歇性、时序相关、重试后消失 | 并发写、锁、队列、共享状态 |
|
|
239
|
+
| null propagation | TypeError / NoMethod / undefined access | nullable 输入、默认值、边界 guard |
|
|
240
|
+
| state corruption | 数据不一致、部分更新、顺序错乱 | transaction、callback、hook、副作用 |
|
|
241
|
+
| integration failure | timeout、unexpected response、协议不匹配 | API boundary、service config、schema |
|
|
242
|
+
| configuration drift | 本地可用、CI/生产失败 | env、feature flag、版本、路径、权限 |
|
|
243
|
+
| stale cache | 清缓存后恢复、旧状态复现 | browser / CDN / Redis / build cache |
|
|
244
|
+
| resource leak | OOM、句柄增长、慢性崩溃 | lifecycle、subscription、retention、cleanup |
|
|
245
|
+
| performance regression | 变慢、CPU / IO / 查询耗时升高、吞吐下降 | baseline、profiler、query plan、bisect |
|
|
246
|
+
| trust boundary drift | LLM / 用户输入 / 外部响应被当成可信 | validation、escaping、policy gate |
|
|
247
|
+
| timing guess / flaky wait | sleep / setTimeout / timeout 增大后偶尔通过 | 真实完成条件、事件、文件、状态或队列计数 |
|
|
248
|
+
|
|
249
|
+
模式分析不是结论,只是定位第一批证据的索引。
|
|
250
|
+
|
|
251
|
+
## Boundary Probe Matrix
|
|
252
|
+
|
|
253
|
+
多组件链路不要先猜。先记录每个边界的事实:
|
|
254
|
+
|
|
255
|
+
- component boundary
|
|
256
|
+
- input observed
|
|
257
|
+
- output observed
|
|
258
|
+
- config / env observed
|
|
259
|
+
- state observed
|
|
260
|
+
- verdict: `pass` / `fail` / `unknown`
|
|
261
|
+
|
|
262
|
+
只有一个边界先失败时,后续调查才收缩到那个组件。多个边界都异常时,优先找共同上游,不在下游堆补丁。
|
|
263
|
+
|
|
264
|
+
## Backward Trace Chain
|
|
265
|
+
|
|
266
|
+
报错点很深时,不准只在 symptom site 加 guard。`analysis.md` 必须追到:
|
|
267
|
+
|
|
268
|
+
- immediate failure site
|
|
269
|
+
- direct caller
|
|
270
|
+
- caller chain
|
|
271
|
+
- bad value origin
|
|
272
|
+
- original trigger
|
|
273
|
+
- why symptom-site fix is rejected
|
|
274
|
+
|
|
275
|
+
找不到 original trigger 时,根因还没有冻结,只能继续调查或进入 escalation。
|
|
276
|
+
|
|
277
|
+
## Reference Comparison
|
|
278
|
+
|
|
279
|
+
同仓库或参考实现有相似可用路径时,先对照再假设:
|
|
280
|
+
|
|
281
|
+
- similar working example
|
|
282
|
+
- broken path
|
|
283
|
+
- differences found
|
|
284
|
+
- differences accepted as hypothesis
|
|
285
|
+
- differences ruled out
|
|
286
|
+
|
|
287
|
+
不要用“看起来差不多”跳过差异。小差异也可能是根因。
|
|
288
|
+
|
|
289
|
+
## Diagnostic Instrumentation
|
|
290
|
+
|
|
291
|
+
临时日志、断言、探针只能用于回答一个明确问题:
|
|
292
|
+
|
|
293
|
+
- probe location
|
|
294
|
+
- question answered
|
|
295
|
+
- command to run
|
|
296
|
+
- expected signal
|
|
297
|
+
- actual signal
|
|
298
|
+
- cleanup requirement
|
|
299
|
+
|
|
300
|
+
探针不能变成修复。进入 `cc-do` 前,要么删除,要么明确写入 repair task 的清理 / 转正方式。
|
|
301
|
+
|
|
302
|
+
## Feedback Loop Contract
|
|
303
|
+
|
|
304
|
+
根因调查首先依赖一个可信 loop:
|
|
305
|
+
|
|
306
|
+
- loop type: failing test / HTTP script / CLI fixture / browser script / trace replay / throwaway harness / property-fuzz / bisect / differential / HITL
|
|
307
|
+
- command or manual driver
|
|
308
|
+
- expected failing signal
|
|
309
|
+
- actual failing signal
|
|
310
|
+
- symptom match: 为什么它复现的是用户报告的同一个问题
|
|
311
|
+
- runtime and determinism
|
|
312
|
+
- failure rate for flaky bugs
|
|
313
|
+
- sharpening plan: 如何让它更快、更准、更稳定
|
|
314
|
+
|
|
315
|
+
把 loop 当成调查产品来迭代。已有 loop 但信号差时,先优化它:
|
|
316
|
+
|
|
317
|
+
1. faster:缓存 setup、缩小 test scope、跳过无关启动。
|
|
318
|
+
2. sharper:断言用户看见的具体症状,不用“没有崩溃”冒充匹配。
|
|
319
|
+
3. more deterministic:固定时间、随机种子、filesystem、network、locale、feature flag。
|
|
320
|
+
|
|
321
|
+
flaky bug 的目标不是立刻 100% 复现,而是提高复现率直到可调试。可以循环 100 次、并行触发、加压力、缩小时序窗口或做 differential loop;如果失败率仍低到不可证伪,先写 Evidence Request,不要继续猜。
|
|
322
|
+
|
|
323
|
+
没有 loop 时,不能把代码阅读当成根因。只能写 `Evidence Request`:需要可复现环境、HAR、日志 dump、core dump、带时间戳录屏,或临时生产探针权限。
|
|
324
|
+
|
|
325
|
+
## Correct Test Seam
|
|
326
|
+
|
|
327
|
+
进入 repair handoff 前,必须说明回归测试缝隙是否正确:
|
|
328
|
+
|
|
329
|
+
- test seam
|
|
330
|
+
- public interface exercised
|
|
331
|
+
- why this seam reaches the real trigger chain
|
|
332
|
+
- why a shallower test would be false confidence
|
|
333
|
+
- if no correct seam exists, record it as an architecture finding and keep repair verification tied to the original feedback loop
|
|
334
|
+
|
|
335
|
+
## Timing And Flaky Bugs
|
|
336
|
+
|
|
337
|
+
遇到 flaky、sleep、timeout、重试后消失:
|
|
338
|
+
|
|
339
|
+
- 先找真实等待条件:event、state、file、count、queue empty、network response
|
|
340
|
+
- 任意 timeout 必须说明为什么这个时间是业务 / 协议事实,不是猜测
|
|
341
|
+
- 如果只能在并发或负载下复现,记录对应命令和环境
|
|
342
|
+
- 不把“加大 sleep”写成 repair contract,除非它本身就是被证实的协议等待窗口
|
|
343
|
+
|
|
344
|
+
## No Code Root Cause
|
|
345
|
+
|
|
346
|
+
如果调查证明是环境、外部服务或时序窗口,不要假装代码根因:
|
|
347
|
+
|
|
348
|
+
- `rootCauseClass`: `code` / `config` / `environment` / `external` / `timing`
|
|
349
|
+
- `why not code root cause`
|
|
350
|
+
- `monitoring or future evidence needed`
|
|
351
|
+
- `operator handling after fix`
|
|
352
|
+
|
|
353
|
+
这类结论仍然需要本地证据支撑;“没有根因”通常只是调查不完整。
|
|
354
|
+
|
|
355
|
+
## Prior Investigation History
|
|
356
|
+
|
|
357
|
+
同一区域反复坏是架构味道,不是巧合。形成根因前至少查:
|
|
358
|
+
|
|
359
|
+
1. `git log --oneline -20 -- <affected-files>`
|
|
360
|
+
2. `rg -n "<error-keyword>|<module>|<capability>" devflow/changes`
|
|
361
|
+
3. `TODOS.md`、backlog、roadmap 中的相关未解决项
|
|
362
|
+
4. 既有 `report-card.json` finding 和 `planning/analysis.md`
|
|
363
|
+
5. 可用时,查询项目记忆或历史调查摘要
|
|
364
|
+
|
|
365
|
+
如果命中过往调查,写入 `analysis.md` 的 `Prior Investigations`,包括是否复发、根因是否同类、这次是否说明结构问题。
|
|
366
|
+
|
|
367
|
+
## External Research Hygiene
|
|
368
|
+
|
|
369
|
+
外部调研只在本地证据不足、错误类型陌生、或像依赖 / 框架 / 平台 bug 时使用。
|
|
370
|
+
|
|
371
|
+
调研前必须脱敏:
|
|
372
|
+
|
|
373
|
+
- 删除 host、IP、token、customer id、内部路径、SQL 片段、私有 repo 名
|
|
374
|
+
- 搜索错误类别、框架 / 库名、版本和通用组件名
|
|
375
|
+
- 如果无法安全脱敏,就跳过外部搜索,并在 `researchEvidence` 写明原因
|
|
376
|
+
|
|
377
|
+
调研结论只能作为候选假设,不能直接变成 confirmed root cause。必须回到本仓库复现或代码证据验证。
|
|
378
|
+
|
|
379
|
+
## Scope Lock And Blast Radius
|
|
380
|
+
|
|
381
|
+
形成根因假设后,先锁定最小调查 / 修复边界:
|
|
382
|
+
|
|
383
|
+
- `affectedModule`
|
|
384
|
+
- `allowedFiles`
|
|
385
|
+
- `forbiddenFiles`
|
|
386
|
+
- `blastRadiusFiles`
|
|
387
|
+
- `blastRadiusRisk`: `low` / `medium` / `high`
|
|
388
|
+
|
|
389
|
+
如果修复预计触碰超过 5 个文件,默认说明这可能不是单点 bug:
|
|
390
|
+
|
|
391
|
+
1. 能拆成 critical path + follow-up,就拆。
|
|
392
|
+
2. 不能拆但仍是根因跨度,写明为什么。
|
|
393
|
+
3. 如果已经变成设计 / 架构范围,reroute 到 `cc-plan`。
|
|
394
|
+
|
|
395
|
+
## Prevention Handoff
|
|
396
|
+
|
|
397
|
+
根因冻结后必须写一句后验判断:什么结构、测试 seam、capability invariant、operator guard 或文档会让这个 bug 更早暴露或根本不出现。
|
|
398
|
+
|
|
399
|
+
- 如果答案是小范围 regression test,把它写进当前 repair task。
|
|
400
|
+
- 如果答案是 seam / module / capability 边界问题,把它写成 architecture finding,并明确交给 `cc-plan` 或后续 backlog。
|
|
401
|
+
- 如果答案只是流程提醒或人工记忆,不算预防;要么转成可执行 guard,要么明确不记录。
|
|
402
|
+
|
|
403
|
+
## Escalation Decision
|
|
404
|
+
|
|
405
|
+
三次假设失败后,不准继续硬猜。`analysis.md` 必须写:
|
|
406
|
+
|
|
407
|
+
- failedHypothesisCount
|
|
408
|
+
- what was attempted
|
|
409
|
+
- why current entry is suspect
|
|
410
|
+
- next option:`continue-with-new-hypothesis` / `instrument-and-wait` / `human-review` / `reroute-cc-plan`
|
|
411
|
+
- evidence request if the loop cannot be built or the environment is missing
|
|
412
|
+
- recommendation
|
|
413
|
+
|
|
185
414
|
## Good Output
|
|
186
415
|
|
|
187
416
|
- 看完第一屏就知道 bug 是什么、怎么复现、为什么会坏
|
|
188
417
|
- 根因不是感觉,而是被证据钉死的具体断点
|
|
418
|
+
- 假设不是列表装饰,而是带证伪方法和实际观察
|
|
419
|
+
- 历史调查、最近改动、模式分析没有被跳过
|
|
189
420
|
- 修复边界清楚到 `cc-do` 不需要二次调查
|
|
421
|
+
- 正确测试缝隙写清楚,不用浅层测试制造假安全
|
|
190
422
|
- `planning/tasks.md` 只包含修复任务,不夹带新需求
|
|
191
423
|
- 如果应该回 `cc-plan`,理由写清楚,不假装还能继续 patch
|
|
192
424
|
|
|
@@ -202,12 +434,15 @@ tool_budget:
|
|
|
202
434
|
## Working Rules
|
|
203
435
|
|
|
204
436
|
1. 没有复现,不准声称找到了根因。
|
|
205
|
-
2.
|
|
206
|
-
3.
|
|
207
|
-
4.
|
|
208
|
-
5.
|
|
209
|
-
6.
|
|
210
|
-
7.
|
|
437
|
+
2. 没有可信 feedback loop,不准把代码阅读包装成 confirmed root cause。
|
|
438
|
+
3. 没有证据,不准把猜测写成结论。
|
|
439
|
+
4. 先根因,再修复;先调查,再编码。
|
|
440
|
+
5. `planning/tasks.md` 必须足够让 `cc-do` 在脱离当前对话后继续推进。
|
|
441
|
+
6. 如果修复方案已经变成新 feature 设计,停止 debug,回 `cc-plan`。
|
|
442
|
+
7. 三次假设失败后,默认说明你的调查入口错了,不准继续硬猜。
|
|
443
|
+
8. 外部调研必须先脱敏,调研结论必须回到本仓库证据验证。
|
|
444
|
+
9. 修复触点超过 5 个文件时,默认先拆分或 reroute,不把大重构伪装成 bug fix。
|
|
445
|
+
10. 好的调查不是“找了很多可能性”,而是把错误世界缩成一个可信的 repair contract。
|
|
211
446
|
|
|
212
447
|
## Exit Criteria
|
|
213
448
|
|