cc-discipline 2.10.3 → 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/init.sh +9 -28
- package/lib/doctor.sh +6 -6
- package/lib/status.sh +5 -8
- package/package.json +1 -1
- 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 +3 -2
- package/templates/.claude/skills/think/SKILL.md +9 -0
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
|
@@ -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,7 +60,7 @@ 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
65
|
## 6. Am I using the project's scaffolding?
|
|
65
66
|
|
|
@@ -105,7 +106,7 @@ Going well: [one thing]
|
|
|
105
106
|
Issues found: [list, or "none"]
|
|
106
107
|
```
|
|
107
108
|
|
|
108
|
-
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.)
|
|
109
110
|
|
|
110
111
|
## Reminder
|
|
111
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).
|