cc-discipline 2.10.2 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -8
- package/README.zh-CN.md +93 -1
- package/global/CLAUDE.md +1 -1
- package/init.sh +9 -28
- package/lib/doctor.sh +6 -6
- package/lib/status.sh +5 -8
- package/package.json +3 -3
- package/templates/.claude/hooks/action-counter.sh +10 -3
- package/templates/.claude/hooks/pre-edit-guard.sh +5 -7
- package/templates/.claude/skills/finish/SKILL.md +44 -0
- package/templates/.claude/skills/self-check/SKILL.md +30 -4
- package/templates/.claude/skills/think/SKILL.md +9 -0
package/README.md
CHANGED
|
@@ -21,21 +21,104 @@ Three shell scripts that run automatically before/after Claude's actions:
|
|
|
21
21
|
|
|
22
22
|
**`streak-breaker.sh`** — Tracks per-file edit counts. Warns at 3, **hard-blocks at 5**. Forces Claude to stop and find the root cause instead of endlessly patching.
|
|
23
23
|
|
|
24
|
+
Here's what it looks like in practice:
|
|
25
|
+
|
|
24
26
|
```
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
You: "Fix the login validation bug in auth.py"
|
|
28
|
+
|
|
29
|
+
Claude: I'll fix the validation logic.
|
|
30
|
+
[Edit src/auth.py — fix email regex]
|
|
31
|
+
|
|
32
|
+
Claude: The regex wasn't enough, let me also add length check.
|
|
33
|
+
[Edit src/auth.py — add input length validation]
|
|
34
|
+
|
|
35
|
+
Claude: That broke the existing tests, let me adjust.
|
|
36
|
+
[Edit src/auth.py — fix test compatibility]
|
|
37
|
+
⚠️ EDIT NOTE: File src/auth.py has been edited 3 times.
|
|
38
|
+
Quick check: are these edits building toward a goal,
|
|
39
|
+
or fixing previous edits?
|
|
40
|
+
|
|
41
|
+
Claude: Let me try a different approach to the validation.
|
|
42
|
+
[Edit src/auth.py — rewrite validation layer]
|
|
43
|
+
|
|
44
|
+
Claude: Almost there, one more adjustment...
|
|
45
|
+
[Edit src/auth.py — blocked]
|
|
46
|
+
|
|
47
|
+
🛑 EDIT CHECKPOINT
|
|
48
|
+
File src/auth.py has been edited 5 times this session.
|
|
49
|
+
Reflect:
|
|
50
|
+
1. Are these edits progressing toward a goal,
|
|
51
|
+
or fixing previous edits?
|
|
52
|
+
2. If fixing previous edits: pause and look
|
|
53
|
+
for the root cause.
|
|
54
|
+
|
|
55
|
+
Claude: You're right. Looking at all 5 edits, I was patching
|
|
56
|
+
symptoms. The real issue is that the User model's
|
|
57
|
+
validate() method is called before sanitization.
|
|
58
|
+
Let me fix it at the source instead.
|
|
33
59
|
```
|
|
34
60
|
|
|
61
|
+
Without the hook, Claude would keep editing `auth.py` indefinitely — each fix creating the next bug. The hook forces a pause that leads to root-cause discovery.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
35
65
|
**`pre-edit-guard.sh`** — Checks `docs/debug-log.md` for unverified hypotheses. If you're debugging and haven't finished the process, it blocks source code edits until you do.
|
|
36
66
|
|
|
67
|
+
```
|
|
68
|
+
You: "The API is returning 500 errors on /users endpoint"
|
|
69
|
+
|
|
70
|
+
Claude: Let me investigate.
|
|
71
|
+
[Bash: curl localhost:3000/users]
|
|
72
|
+
→ 500 Internal Server Error
|
|
73
|
+
|
|
74
|
+
Claude: I think it's a database connection issue. Let me fix
|
|
75
|
+
the connection pool config.
|
|
76
|
+
[Edit src/db.py — blocked]
|
|
77
|
+
|
|
78
|
+
🛑 docs/debug-log.md has 2 unverified hypotheses.
|
|
79
|
+
Please complete the debugging process (verify or
|
|
80
|
+
eliminate hypotheses) before editing source code.
|
|
81
|
+
|
|
82
|
+
Claude: Right, I haven't verified my hypothesis yet.
|
|
83
|
+
Let me check the actual error logs first.
|
|
84
|
+
[Bash: tail -50 logs/error.log]
|
|
85
|
+
→ TypeError: Cannot read property 'map' of undefined
|
|
86
|
+
at UserSerializer.format (src/serializers.py:42)
|
|
87
|
+
|
|
88
|
+
Claude: The error is in the serializer, not the database.
|
|
89
|
+
My first hypothesis was wrong. Let me update
|
|
90
|
+
debug-log.md and then fix the actual issue.
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Without the hook, Claude would have "fixed" the database config — a perfectly working component — and the real bug would remain.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
37
97
|
**`post-error-remind.sh`** — Detects error patterns (test failures, crashes, build errors) in command output and injects a debugging discipline reminder before Claude can react impulsively.
|
|
38
98
|
|
|
99
|
+
```
|
|
100
|
+
Claude: Let me run the tests.
|
|
101
|
+
[Bash: pytest tests/]
|
|
102
|
+
→ FAILED tests/test_auth.py::test_login - AssertionError
|
|
103
|
+
→ 1 failed, 23 passed
|
|
104
|
+
|
|
105
|
+
⚡ Error encountered — debugging checklist:
|
|
106
|
+
1. Resist modifying code immediately
|
|
107
|
+
2. Fully understand the error message
|
|
108
|
+
3. List >=3 possible causes
|
|
109
|
+
4. Only then fix
|
|
110
|
+
|
|
111
|
+
Claude: Before jumping in, let me understand the failure.
|
|
112
|
+
The test expects a 200 but gets 401. Three possible
|
|
113
|
+
causes:
|
|
114
|
+
1. Token generation changed (check auth.py changes)
|
|
115
|
+
2. Test fixture uses expired mock token
|
|
116
|
+
3. Middleware order changed after recent refactor
|
|
117
|
+
Let me verify each...
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Without the hook, Claude's instinct is to immediately open the test or source file and start editing. The reminder forces a diagnostic pause.
|
|
121
|
+
|
|
39
122
|
### Rules (the reminders)
|
|
40
123
|
|
|
41
124
|
Auto-injected markdown in `.claude/rules/` — Claude sees them when operating on matching files. Not as strong as hooks, but provides structure:
|
package/README.zh-CN.md
CHANGED
|
@@ -127,10 +127,102 @@ Hooks 是在 Claude 执行操作前/后自动运行的 shell 脚本。**exit 2
|
|
|
127
127
|
|
|
128
128
|
| Hook | 触发时机 | 作用 |
|
|
129
129
|
|------|---------|------|
|
|
130
|
-
| `pre-edit-guard.sh` | 编辑文件前 | 检查是否有未完成的调试流程 |
|
|
131
130
|
| `streak-breaker.sh` | 编辑文件前 | 同文件编辑 ≥3 次警告,≥5 次硬停止 |
|
|
131
|
+
| `pre-edit-guard.sh` | 编辑文件前 | 检查是否有未完成的调试流程 |
|
|
132
132
|
| `post-error-remind.sh` | 执行命令后 | 检测到错误输出时提醒遵守调试纪律 |
|
|
133
133
|
|
|
134
|
+
**实际效果演示:**
|
|
135
|
+
|
|
136
|
+
**streak-breaker** — 阻止打地鼠:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
你: "修一下 auth.py 的登录验证 bug"
|
|
140
|
+
|
|
141
|
+
Claude: 我来修正验证逻辑。
|
|
142
|
+
[编辑 src/auth.py — 修正邮箱正则]
|
|
143
|
+
|
|
144
|
+
Claude: 正则不够,再加个长度检查。
|
|
145
|
+
[编辑 src/auth.py — 增加输入长度验证]
|
|
146
|
+
|
|
147
|
+
Claude: 把之前的测试搞挂了,调整一下。
|
|
148
|
+
[编辑 src/auth.py — 修复测试兼容性]
|
|
149
|
+
⚠️ 提示:auth.py 已被编辑 3 次。
|
|
150
|
+
检查一下:这些修改是在推进目标,还是在修前面的修改?
|
|
151
|
+
|
|
152
|
+
Claude: 换个思路重写验证层。
|
|
153
|
+
[编辑 src/auth.py — 重写验证逻辑]
|
|
154
|
+
|
|
155
|
+
Claude: 差不多了,再调一下...
|
|
156
|
+
[编辑 src/auth.py — 被阻止]
|
|
157
|
+
|
|
158
|
+
🛑 编辑检查点
|
|
159
|
+
文件 auth.py 本次会话已被编辑 5 次。
|
|
160
|
+
反思:
|
|
161
|
+
1. 这些修改是在推进目标,还是在修之前的修改?
|
|
162
|
+
2. 如果是后者:停下来,寻找根本原因。
|
|
163
|
+
|
|
164
|
+
Claude: 你说得对。回顾这 5 次编辑,我一直在修症状。
|
|
165
|
+
真正的问题是 User 模型的 validate() 在
|
|
166
|
+
sanitization 之前被调用了。我应该从源头修。
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
没有这个 hook,Claude 会无限编辑 auth.py — 每次修复都制造下一个 bug。hook 强制暂停,引导发现根本原因。
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
**pre-edit-guard** — 阻止跳过诊断直接改代码:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
你: "API 的 /users 接口返回 500 错误"
|
|
177
|
+
|
|
178
|
+
Claude: 我来排查。
|
|
179
|
+
[执行: curl localhost:3000/users]
|
|
180
|
+
→ 500 Internal Server Error
|
|
181
|
+
|
|
182
|
+
Claude: 我觉得是数据库连接池的问题,改一下配置。
|
|
183
|
+
[编辑 src/db.py — 被阻止]
|
|
184
|
+
|
|
185
|
+
🛑 docs/debug-log.md 中有 2 个未验证的假设。
|
|
186
|
+
请先完成调试流程(验证或排除假设),
|
|
187
|
+
再编辑源代码。
|
|
188
|
+
|
|
189
|
+
Claude: 对,我还没验证我的假设。先看看错误日志。
|
|
190
|
+
[执行: tail -50 logs/error.log]
|
|
191
|
+
→ TypeError: Cannot read property 'map' of undefined
|
|
192
|
+
at UserSerializer.format (src/serializers.py:42)
|
|
193
|
+
|
|
194
|
+
Claude: 错误在序列化器,不是数据库。我的第一个
|
|
195
|
+
假设是错的。先更新 debug-log.md 再修真正的问题。
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
没有这个 hook,Claude 会"修好"数据库配置 — 一个完全正常的组件 — 而真正的 bug 依然存在。
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
**post-error-remind** — 阻止看到报错就冲动改代码:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
Claude: 跑一下测试。
|
|
206
|
+
[执行: pytest tests/]
|
|
207
|
+
→ FAILED tests/test_auth.py::test_login - AssertionError
|
|
208
|
+
→ 1 failed, 23 passed
|
|
209
|
+
|
|
210
|
+
⚡ 检测到错误 — 调试清单:
|
|
211
|
+
1. 不要立即修改代码
|
|
212
|
+
2. 先完整理解错误信息
|
|
213
|
+
3. 列出 ≥3 个可能原因
|
|
214
|
+
4. 然后再动手
|
|
215
|
+
|
|
216
|
+
Claude: 先别急着改。测试期望 200 但拿到了 401。
|
|
217
|
+
三个可能原因:
|
|
218
|
+
1. Token 生成逻辑变了(检查 auth.py 的改动)
|
|
219
|
+
2. 测试用的 mock token 过期了
|
|
220
|
+
3. 中间件顺序在最近的重构后变了
|
|
221
|
+
让我逐个验证...
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
没有这个 hook,Claude 的本能是立即打开测试文件或源文件开始编辑。提醒强制了一个诊断暂停。
|
|
225
|
+
|
|
134
226
|
**调整硬度**:编辑 hook 脚本中的 `exit` 返回值:
|
|
135
227
|
- `exit 0` = 允许操作(可附带提醒信息)
|
|
136
228
|
- `exit 1` = 报错但不阻止操作(hook 执行失败)
|
package/global/CLAUDE.md
CHANGED
|
@@ -41,5 +41,5 @@ Don't skip the first three steps and jump straight to the fourth.
|
|
|
41
41
|
|
|
42
42
|
- Use subagents for research. Don't read large volumes of files in the main conversation.
|
|
43
43
|
- Update docs/progress.md after completing each milestone.
|
|
44
|
-
-
|
|
44
|
+
- Don't proactively warn about context running low or suggest compacting. The system auto-compacts at 0% — you cannot see the percentage. Keep progress.md updated instead.
|
|
45
45
|
- First thing after compact: read `docs/progress.md` and `docs/debug-log.md`.
|
package/init.sh
CHANGED
|
@@ -365,20 +365,13 @@ cp "$SCRIPT_DIR/templates/.claude/agents/investigator.md" .claude/agents/
|
|
|
365
365
|
|
|
366
366
|
# ─── Install skills ───
|
|
367
367
|
echo -e "${GREEN}Installing skills...${NC}"
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
cp -r "$
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
echo " ✓ /commit — smart commit (test → update memory → commit)"
|
|
376
|
-
echo " ✓ /self-check — periodic discipline check (use with /loop 10m /self-check)"
|
|
377
|
-
echo " ✓ /evaluate — evaluate external review/advice against codebase context"
|
|
378
|
-
echo " ✓ /think — stop and think before coding (ask → propose → wait)"
|
|
379
|
-
echo " ✓ /retro — post-task retrospective (project + framework feedback)"
|
|
380
|
-
echo " ✓ /summary — write high-quality compact option before /compact"
|
|
381
|
-
echo " ✓ /investigate — multi-agent cross-investigation and proposal review"
|
|
368
|
+
# Install every skill directory under templates/ — no per-skill enumeration,
|
|
369
|
+
# so adding a new skill needs zero changes here.
|
|
370
|
+
for skill_dir in "$SCRIPT_DIR"/templates/.claude/skills/*/; do
|
|
371
|
+
[ -d "$skill_dir" ] || continue
|
|
372
|
+
cp -r "$skill_dir" .claude/skills/
|
|
373
|
+
echo " ✓ /$(basename "$skill_dir")"
|
|
374
|
+
done
|
|
382
375
|
|
|
383
376
|
# ─── Handle CLAUDE.md ───
|
|
384
377
|
if [ ! -f "CLAUDE.md" ]; then
|
|
@@ -534,13 +527,7 @@ if [ "$INSTALL_MODE" = "fresh" ]; then
|
|
|
534
527
|
echo -e " ${GREEN}.claude/rules/${NC} ← Auto-injected rules"
|
|
535
528
|
echo -e " ${GREEN}.claude/hooks/${NC} ← 7 discipline hooks (edit guard, streak breaker, git guard, phase gate, action counter, error remind, session start)"
|
|
536
529
|
echo -e " ${GREEN}.claude/agents/${NC} ← Reviewer & investigator subagents"
|
|
537
|
-
echo -e " ${GREEN}.claude/skills
|
|
538
|
-
echo -e " ${GREEN}.claude/skills/self-check/${NC} ← /self-check periodic discipline check"
|
|
539
|
-
echo -e " ${GREEN}.claude/skills/evaluate/${NC} ← /evaluate assess external review advice"
|
|
540
|
-
echo -e " ${GREEN}.claude/skills/think/${NC} ← /think stop and think before coding"
|
|
541
|
-
echo -e " ${GREEN}.claude/skills/retro/${NC} ← /retro post-task retrospective"
|
|
542
|
-
echo -e " ${GREEN}.claude/skills/summary/${NC} ← /summary before compacting"
|
|
543
|
-
echo -e " ${GREEN}.claude/skills/investigate/${NC} ← /investigate multi-agent cross-investigation"
|
|
530
|
+
echo -e " ${GREEN}.claude/skills/${NC} ← Skills (run 'npx cc-discipline status' to list)"
|
|
544
531
|
echo -e " ${GREEN}.claude/settings.json${NC} ← Hooks configuration"
|
|
545
532
|
echo -e " ${GREEN}docs/progress.md${NC} ← Progress log (maintained by Claude)"
|
|
546
533
|
echo -e " ${GREEN}docs/debug-log.md${NC} ← Debug log (maintained by Claude)"
|
|
@@ -556,13 +543,7 @@ else
|
|
|
556
543
|
echo -e " ${GREEN}.claude/rules/${NC} ← Discipline rules installed/updated"
|
|
557
544
|
echo -e " ${GREEN}.claude/hooks/${NC} ← Hook scripts installed/updated"
|
|
558
545
|
echo -e " ${GREEN}.claude/agents/${NC} ← Subagents installed/updated"
|
|
559
|
-
echo -e " ${GREEN}.claude/skills
|
|
560
|
-
echo -e " ${GREEN}.claude/skills/self-check/${NC} ← /self-check discipline check installed"
|
|
561
|
-
echo -e " ${GREEN}.claude/skills/evaluate/${NC} ← /evaluate external review assessment"
|
|
562
|
-
echo -e " ${GREEN}.claude/skills/think/${NC} ← /think stop and think before coding"
|
|
563
|
-
echo -e " ${GREEN}.claude/skills/retro/${NC} ← /retro post-task retrospective"
|
|
564
|
-
echo -e " ${GREEN}.claude/skills/summary/${NC} ← /summary before compacting"
|
|
565
|
-
echo -e " ${GREEN}.claude/skills/investigate/${NC} ← /investigate multi-agent cross-investigation"
|
|
546
|
+
echo -e " ${GREEN}.claude/skills/${NC} ← Skills installed/updated (run 'npx cc-discipline status' to list)"
|
|
566
547
|
if [ ! -f "$BACKUP_DIR/settings.json" ] || [ -f ".claude/.cc-discipline-settings-template.json" ]; then
|
|
567
548
|
echo -e " ${YELLOW}.claude/settings.json${NC} ← See notes above"
|
|
568
549
|
else
|
package/lib/doctor.sh
CHANGED
|
@@ -95,13 +95,13 @@ done
|
|
|
95
95
|
# 6. Skills
|
|
96
96
|
echo ""
|
|
97
97
|
echo "Skills:"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
fi
|
|
98
|
+
SKILL_FOUND=0
|
|
99
|
+
for skill_dir in .claude/skills/*/; do
|
|
100
|
+
[ -d "$skill_dir" ] || continue
|
|
101
|
+
ok "/$(basename "$skill_dir")"
|
|
102
|
+
SKILL_FOUND=$((SKILL_FOUND + 1))
|
|
104
103
|
done
|
|
104
|
+
[ "$SKILL_FOUND" -eq 0 ] && warn "No skills installed (optional)"
|
|
105
105
|
|
|
106
106
|
# 7. jq
|
|
107
107
|
echo ""
|
package/lib/status.sh
CHANGED
|
@@ -66,15 +66,12 @@ echo -e "${GREEN}${AGENT_COUNT}/2${NC} (${AGENTS% })"
|
|
|
66
66
|
# Skills
|
|
67
67
|
echo -n "Skills: "
|
|
68
68
|
SKILLS=""
|
|
69
|
-
|
|
70
|
-
[ -d "
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
[ -d ".claude/skills/retro" ] && SKILLS="${SKILLS}/retro "
|
|
74
|
-
[ -d ".claude/skills/summary" ] && SKILLS="${SKILLS}/summary "
|
|
75
|
-
[ -d ".claude/skills/investigate" ] && SKILLS="${SKILLS}/investigate "
|
|
69
|
+
for skill_dir in .claude/skills/*/; do
|
|
70
|
+
[ -d "$skill_dir" ] || continue
|
|
71
|
+
SKILLS="${SKILLS}/$(basename "$skill_dir") "
|
|
72
|
+
done
|
|
76
73
|
SKILL_COUNT=$(echo "$SKILLS" | wc -w | tr -d ' ')
|
|
77
|
-
echo -e "${GREEN}${SKILL_COUNT}
|
|
74
|
+
echo -e "${GREEN}${SKILL_COUNT}${NC} (${SKILLS% })"
|
|
78
75
|
|
|
79
76
|
# Settings
|
|
80
77
|
echo -n "Settings: "
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-discipline",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Discipline framework for Claude Code — rules, hooks, and agents that keep AI on track",
|
|
5
5
|
"bin": {
|
|
6
6
|
"cc-discipline": "bin/cli.js"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/
|
|
31
|
+
"url": "git+https://github.com/TechHU-GS/cc-discipline.git"
|
|
32
32
|
},
|
|
33
|
-
"homepage": "https://github.com/
|
|
33
|
+
"homepage": "https://github.com/TechHU-GS/cc-discipline#readme"
|
|
34
34
|
}
|
|
@@ -6,10 +6,17 @@
|
|
|
6
6
|
THRESHOLD=25
|
|
7
7
|
|
|
8
8
|
INPUT=$(cat)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
# Extract session_id with a grep fallback for when jq is unavailable (e.g.
|
|
10
|
+
# Windows Git Bash). Without this fallback, every session collapsed to the
|
|
11
|
+
# literal "unknown" and shared ONE never-resetting global counter — which
|
|
12
|
+
# permanently disabled the early-action phase check (count never restarted
|
|
13
|
+
# at 1) and made the periodic reflection fire off a global tally. (fixed 2026-06-05)
|
|
14
|
+
if command -v jq &>/dev/null; then
|
|
15
|
+
SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // empty' 2>/dev/null)
|
|
16
|
+
else
|
|
17
|
+
SESSION_ID=$(echo "$INPUT" | grep -o '"session_id":\s*"[^"]*"' | head -1 | sed 's/"session_id":\s*"//;s/"//')
|
|
12
18
|
fi
|
|
19
|
+
SESSION_ID="${SESSION_ID:-unknown}"
|
|
13
20
|
|
|
14
21
|
COUNT_DIR="/tmp/cc-discipline-${SESSION_ID}"
|
|
15
22
|
COUNT_FILE="${COUNT_DIR}/action-count"
|
|
@@ -90,11 +90,9 @@ JSONEOF
|
|
|
90
90
|
fi
|
|
91
91
|
fi
|
|
92
92
|
|
|
93
|
-
#
|
|
94
|
-
#
|
|
95
|
-
#
|
|
96
|
-
#
|
|
97
|
-
|
|
98
|
-
{"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"If this edit is a bug fix: have you listed >=3 possible causes and eliminated >=2 with evidence? Thorough elimination before fixing prevents wasted cycles. Use 'possible cause' until elimination evidence confirms the root cause."}}
|
|
99
|
-
JSONEOF
|
|
93
|
+
# Normal source edit: stay silent (exit 0, no output).
|
|
94
|
+
# The "list >=3 causes before a bug fix" guidance already lives in the
|
|
95
|
+
# always-injected rules (00-core §6, 01-debugging), the hard debug-log block
|
|
96
|
+
# above, and post-error-remind. Re-injecting it on EVERY edit fired even on
|
|
97
|
+
# planned feature/registration work — redundant noise, removed 2026-06-05.
|
|
100
98
|
exit 0
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: finish
|
|
3
|
+
description: Drive a task to completion with the quality bar — solid, comprehensive, fully tested; "not run" never counts as done. Use when you're ready to execute to the end (standalone, or as the handoff after /think approval).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are in **finish mode**: the task is understood and approved — now drive it to completion without stopping early. This is the opposite stance from /think (which aligns and waits). Here you execute, persist, and hold a high quality bar.
|
|
7
|
+
|
|
8
|
+
## Step 1: Lock the completion conditions
|
|
9
|
+
|
|
10
|
+
State explicitly — in one short block — what "done" means for this task:
|
|
11
|
+
- The concrete deliverables (what must exist / work when finished)
|
|
12
|
+
- The quality bar below, applied to each
|
|
13
|
+
- Anything you'll treat as "blocked, must report" rather than silently skip
|
|
14
|
+
|
|
15
|
+
If invoked standalone (no prior /think) and the scope is genuinely unclear, ask ONE tight round of questions, then commit. Don't turn finish mode into a planning session — the point is to execute.
|
|
16
|
+
|
|
17
|
+
## Step 2: The quality bar (definition of done)
|
|
18
|
+
|
|
19
|
+
Hold all of these. They are the standard, not aspirations:
|
|
20
|
+
|
|
21
|
+
- **扎实 (solid)** — Fix the root cause, not symptoms. Handle edge cases (empty / null / error paths). No TODO, stub, or workaround left standing in as "the solution."
|
|
22
|
+
- **全面 (comprehensive)** — Cover the full scope, not just the happy path. Update related call sites, docs, and `docs/progress.md`. Don't leave half the task for "later."
|
|
23
|
+
- **完备测试 (fully tested)** — Write tests AND run them. Per 07-integrity §2, "verified" requires actual execution output — paste the command and result. Untested code is not done.
|
|
24
|
+
- **诚实 (honest)** — If something is blocked by an external resource, mark it "⚠️ code ready, verification pending: [reason]" — never ✅ it. Distinguish done from blocked.
|
|
25
|
+
|
|
26
|
+
## Step 3: Drive
|
|
27
|
+
|
|
28
|
+
Keep going until the completion conditions are met. While driving:
|
|
29
|
+
- Make reasonable decisions and keep moving — note them, don't stop to ask about trivia.
|
|
30
|
+
- The discipline rules still apply: 3 consecutive failures → pause and regroup; scope changes → re-align; anything irreversible or outward-facing → confirm first.
|
|
31
|
+
- Don't declare partial success to exit early. If you feel the urge to stop before the bar is met, that urge is the signal to push through or report the specific blocker — not to lower the bar.
|
|
32
|
+
|
|
33
|
+
## Step 4: Report on completion
|
|
34
|
+
|
|
35
|
+
When the completion conditions are met, give a short close-out:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
FINISH — [task]
|
|
39
|
+
Done: [each deliverable + how it was verified — paste key command output]
|
|
40
|
+
Quality bar: 扎实 [✓/note] · 全面 [✓/note] · 完备测试 [✓/note]
|
|
41
|
+
Blocked (if any): [item — why, what's needed]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If any part is blocked rather than done, say so plainly. A truthful "90% done, X blocked on Y" beats a false ✅.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: self-check
|
|
3
3
|
description: Periodic self-check — reflect on alignment, progress, and quality. Use with /loop for continuous monitoring.
|
|
4
4
|
disable-model-invocation: true
|
|
5
|
+
disallowed-tools: AskUserQuestion
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
Pause and honestly answer every question below.
|
|
@@ -59,13 +60,37 @@ Pause and honestly answer every question below.
|
|
|
59
60
|
- **Gotchas** — what went wrong or was surprising
|
|
60
61
|
- **Verification** — how it was confirmed working (test output, manual check)
|
|
61
62
|
|
|
62
|
-
If any of the above are stale or incomplete: **update docs/progress.md now
|
|
63
|
+
If any of the above are stale or incomplete: **update docs/progress.md now, automatically — don't ask for permission.** Keeping progress.md current is always-correct maintenance, not a decision that needs sign-off. Just do it, then note "updated now" in the status line. This takes 2 minutes and saves hours of re-discovery after compact.
|
|
63
64
|
|
|
64
|
-
## 6.
|
|
65
|
+
## 6. Am I using the project's scaffolding?
|
|
66
|
+
|
|
67
|
+
Projects accumulate custom tooling — audit scripts, lint configs, validators (cppcheck, custom DRC, schema checkers, etc.). These get forgotten and rot if not exercised.
|
|
68
|
+
|
|
69
|
+
- Check **CLAUDE.md "Project Tools"** and the **Project-specific Checks** list below. Are any relevant to current work but haven't been run?
|
|
70
|
+
- Did I build a new tool/script/check this session that future sessions should know about? If yes, **register it now in two places**:
|
|
71
|
+
1. `CLAUDE.md` "Project Tools" — what it is, where it lives, when to use it
|
|
72
|
+
2. The **Project-specific Checks** list below — so the next /self-check surfaces it automatically
|
|
73
|
+
- If the **Project-specific Checks** list below is empty or stale, that's a signal worth raising with the user.
|
|
74
|
+
|
|
75
|
+
### Project-specific Checks
|
|
76
|
+
|
|
77
|
+
<!--
|
|
78
|
+
Add project-specific scaffolding here. One line per check, format:
|
|
79
|
+
- `<command>` — when to run / what it catches
|
|
80
|
+
Examples:
|
|
81
|
+
- `make lint` — before commit, catches license headers and formatting
|
|
82
|
+
- `python tools/audit_rbac.py` — after schema changes, catches RBAC drift
|
|
83
|
+
- `cppcheck src/` — after C/C++ edits, catches null deref / leak patterns
|
|
84
|
+
Keep this list curated — remove tools that are obsolete.
|
|
85
|
+
-->
|
|
86
|
+
|
|
87
|
+
(Empty — fill in as the project develops scaffolding worth checking periodically.)
|
|
88
|
+
|
|
89
|
+
## 7. What's working well?
|
|
65
90
|
|
|
66
91
|
Before reporting issues, note one thing that's going well — a good approach, a clean fix, effective tool use, or strong alignment with the user's direction. Recognizing what works reinforces it.
|
|
67
92
|
|
|
68
|
-
##
|
|
93
|
+
## 8. Status report
|
|
69
94
|
|
|
70
95
|
After answering the above, output a brief status:
|
|
71
96
|
|
|
@@ -76,11 +101,12 @@ Current action: [what I'm doing now]
|
|
|
76
101
|
On track: yes/no/drifted
|
|
77
102
|
Progressing: yes/circling
|
|
78
103
|
Progress recorded: yes/updated now/no
|
|
104
|
+
Scaffolding: [used/skipped/n/a]
|
|
79
105
|
Going well: [one thing]
|
|
80
106
|
Issues found: [list, or "none"]
|
|
81
107
|
```
|
|
82
108
|
|
|
83
|
-
If any issues were found, pause and report to the user before continuing.
|
|
109
|
+
If any issues were found, pause and report to the user before continuing. (Routine progress.md updates from §5 don't count as "issues" — you already made them silently; just report "updated now". Reserve the pause for alignment, rigor, or scope problems that genuinely need the user.)
|
|
84
110
|
|
|
85
111
|
## Reminder
|
|
86
112
|
|
|
@@ -106,3 +106,12 @@ When the user confirms an approach, transition to implementation. You now have:
|
|
|
106
106
|
- Known risks flagged upfront
|
|
107
107
|
|
|
108
108
|
Carry these forward. If scope changes during implementation, pause and re-align rather than silently expanding.
|
|
109
|
+
|
|
110
|
+
## Downstream: what the user appended
|
|
111
|
+
|
|
112
|
+
The user may steer what happens after alignment by appending a directive to the invocation:
|
|
113
|
+
|
|
114
|
+
- **`/think and plan`** — after alignment, produce the plan (in plan mode, present it for approval via ExitPlanMode).
|
|
115
|
+
- **`/think and finish`** (or `and goal`) — after the user approves the approach, transition into **/finish**: drive to completion with its quality bar (solid, comprehensive, fully tested). Do NOT start before approval — 05-phase-discipline still applies; "and finish" declares the post-approval execution stance, it does not bypass the gate.
|
|
116
|
+
|
|
117
|
+
If no directive was appended, stop and wait as usual (Step 5).
|