cc-discipline 2.5.0 → 2.6.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/package.json +1 -1
- package/templates/.claude/hooks/action-counter.sh +23 -1
- package/templates/.claude/hooks/streak-breaker.sh +9 -9
- package/templates/.claude/rules/03-context-mgmt.md +7 -3
- package/templates/.claude/skills/commit/SKILL.md +1 -1
- package/templates/.claude/skills/self-check/SKILL.md +9 -3
- package/templates/.claude/skills/think/SKILL.md +5 -2
- package/templates/docs/progress.md +28 -0
package/package.json
CHANGED
|
@@ -27,9 +27,31 @@ JSONEOF
|
|
|
27
27
|
exit 0
|
|
28
28
|
fi
|
|
29
29
|
|
|
30
|
+
# Progress.md staleness check: every 50 actions, check if progress.md was updated recently
|
|
31
|
+
if [ $((COUNT % 50)) -eq 0 ]; then
|
|
32
|
+
CWD=$(echo "$INPUT" | jq -r '.cwd // ""' 2>/dev/null)
|
|
33
|
+
PROGRESS_FILE=""
|
|
34
|
+
[ -f "$CWD/docs/progress.md" ] && PROGRESS_FILE="$CWD/docs/progress.md"
|
|
35
|
+
[ -z "$PROGRESS_FILE" ] && [ -f "docs/progress.md" ] && PROGRESS_FILE="docs/progress.md"
|
|
36
|
+
if [ -n "$PROGRESS_FILE" ]; then
|
|
37
|
+
# Check if file was modified in the last 30 minutes
|
|
38
|
+
if command -v stat &>/dev/null; then
|
|
39
|
+
FILE_MOD=$(stat -f %m "$PROGRESS_FILE" 2>/dev/null || stat -c %Y "$PROGRESS_FILE" 2>/dev/null)
|
|
40
|
+
NOW=$(date +%s)
|
|
41
|
+
if [ -n "$FILE_MOD" ] && [ $((NOW - FILE_MOD)) -gt 1800 ]; then
|
|
42
|
+
STALE_MIN=$(( (NOW - FILE_MOD) / 60 ))
|
|
43
|
+
cat <<JSONEOF
|
|
44
|
+
{"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"PROGRESS STALE (${STALE_MIN}min since last update): docs/progress.md has not been updated in over 30 minutes. If compact happens now, everything you've done since the last update is LOST. Update the Working Context section NOW: key commands, current workflow, tools developed, environment state, gotchas. This takes 2 minutes and saves hours of re-discovery. Do it before your next task action."}}
|
|
45
|
+
JSONEOF
|
|
46
|
+
exit 0
|
|
47
|
+
fi
|
|
48
|
+
fi
|
|
49
|
+
fi
|
|
50
|
+
fi
|
|
51
|
+
|
|
30
52
|
if [ $((COUNT % THRESHOLD)) -eq 0 ]; then
|
|
31
53
|
cat <<JSONEOF
|
|
32
|
-
{"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"AUTO SELF-CHECK (#${COUNT} actions): Pause and verify: (1) Am I still serving the user's original request, or have I drifted? (2) Am I fixing the same thing repeatedly (mole-whacking)? (3) Have I claimed anything as 'verified' without actually running it? (4) Am I making changes the user didn't ask for? (5)
|
|
54
|
+
{"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"AUTO SELF-CHECK (#${COUNT} actions): Pause and verify: (1) Am I still serving the user's original request, or have I drifted? (2) Am I fixing the same thing repeatedly (mole-whacking)? (3) Have I claimed anything as 'verified' without actually running it? (4) Am I making changes the user didn't ask for? (5) Is docs/progress.md up to date — especially the Working Context section (key commands, current workflow, tools developed, environment state, gotchas)? If a compact happened right now, could a fresh Claude resume from progress.md alone? If not, update it NOW. (6) Plan fidelity: if executing a plan, compare what the current step asked for vs what I actually delivered — am I cutting corners or simplifying the intent? Check the acceptance criteria. (7) Quality check: am I lowering quality to avoid difficulty? If I'm about to skip a verification, simplify an approach, or take a shortcut — STOP and ask the user instead of silently pushing forward. (8) Deferred work check: did I break a task into subtasks and skip some as 'low ROI' or 'can do later'? If yes, the analysis context is fresh NOW — finish them before moving on, or record enough detail in progress.md for a future session. (9) Friction check: did any hook/rule get in the way or miss something since last check? If so, note it in one line for /retro later. If ANY answer is concerning, STOP and report to the user before continuing."}}
|
|
33
55
|
JSONEOF
|
|
34
56
|
fi
|
|
35
57
|
|
|
@@ -81,14 +81,14 @@ if [ "$COUNT" -ge "$STOP_THRESHOLD" ]; then
|
|
|
81
81
|
This doubles the thresholds for this file (warn=${WARN_THRESHOLD}x2, stop=${STOP_THRESHOLD}x2)."
|
|
82
82
|
fi
|
|
83
83
|
cat >&2 <<EOF
|
|
84
|
-
|
|
85
|
-
File $FILE_PATH has been edited $COUNT times.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
1.
|
|
89
|
-
2.
|
|
90
|
-
3.
|
|
91
|
-
|
|
84
|
+
EDIT CHECK (pause, not stop)
|
|
85
|
+
File $FILE_PATH has been edited $COUNT times this session.
|
|
86
|
+
This may be normal (building a complex file) or a sign of mole-whacking (patching symptoms repeatedly).
|
|
87
|
+
Quick check:
|
|
88
|
+
1. Are these edits progressing toward a goal, or fixing previous edits?
|
|
89
|
+
2. If progressing: ask the user to confirm, then continue with doubled thresholds.
|
|
90
|
+
3. If fixing previous edits: stop and look for the root cause.
|
|
91
|
+
IMPORTANT: This is a checkpoint, NOT a productivity limit. Do NOT reduce scope, defer work, skip features, or create workaround files to avoid this counter. If the work is legitimate, confirm and continue.
|
|
92
92
|
$RESET_MSG
|
|
93
93
|
EOF
|
|
94
94
|
exit 2
|
|
@@ -100,7 +100,7 @@ if [ "$COUNT" -ge "$WARN_THRESHOLD" ]; then
|
|
|
100
100
|
{
|
|
101
101
|
"hookSpecificOutput": {
|
|
102
102
|
"hookEventName": "PreToolUse",
|
|
103
|
-
"additionalContext": "
|
|
103
|
+
"additionalContext": "EDIT NOTE: File $FILE_PATH has been edited $COUNT times. Quick check: are these edits building toward a goal, or fixing previous edits? If building: keep going, you have $((STOP_THRESHOLD - COUNT)) more before a checkpoint. If fixing: pause and look for root cause. Do NOT preemptively reduce scope or defer work to avoid the counter."
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
EOF
|
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
- During debugging → update `docs/debug-log.md` (hypotheses, evidence, elimination results)
|
|
6
6
|
- When making architectural decisions → record the decision and reasoning in progress.md
|
|
7
7
|
|
|
8
|
-
###
|
|
9
|
-
- When
|
|
10
|
-
-
|
|
8
|
+
### Parallel Execution
|
|
9
|
+
- **Don't do everything single-threaded.** When a task has independent parts, use subagents or tasks to work on them in parallel. Examples:
|
|
10
|
+
- Investigating 3 debug hypotheses → spawn 3 agents, each verifies one
|
|
11
|
+
- Researching multiple files/modules → one agent per area, summarize results
|
|
12
|
+
- Independent subtasks in a plan → parallel agents for non-dependent steps
|
|
13
|
+
- **Keep the main conversation for decisions, not research.** Subagents do the reading and exploring; the main conversation synthesizes and decides.
|
|
14
|
+
- **When to parallelize:** if two subtasks don't depend on each other's output, they should run concurrently, not sequentially.
|
|
11
15
|
|
|
12
16
|
### Compact Strategy
|
|
13
17
|
- Do NOT proactively suggest compacting or warn about "context running low". The system will auto-compact when context hits 0% — there is no advance warning, and you cannot see the percentage. With 200K-1M context, most sessions never hit the limit. If you feel the urge to say "this session is getting long", that is anxiety, not a technical problem. Stop worrying about context and focus on the work.
|
|
@@ -15,7 +15,7 @@ Skip this step for projects with no configured test command.
|
|
|
15
15
|
|
|
16
16
|
Check each in order (simple changes may skip):
|
|
17
17
|
|
|
18
|
-
**docs/progress.md** — Does this change constitute a milestone or significant progress? If so, append a record.
|
|
18
|
+
**docs/progress.md** — Does this change constitute a milestone or significant progress? If so, append a record. Also check the "Working Context" section: are Key Commands, Current Workflow, Tools & Scripts, Environment State, and Gotchas up to date? These are your lifeline after compact — if they're stale, a post-compact Claude starts from scratch.
|
|
19
19
|
|
|
20
20
|
**docs/debug-log.md** — Are there debug sessions that need to be closed or updated?
|
|
21
21
|
|
|
@@ -41,9 +41,15 @@ Pause and honestly answer every question below. Do NOT skip any. Do NOT rational
|
|
|
41
41
|
## 5. Is progress recorded?
|
|
42
42
|
|
|
43
43
|
- When was `docs/progress.md` last updated?
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
44
|
+
- If a compact happened RIGHT NOW, could a fresh Claude resume from progress.md alone?
|
|
45
|
+
- Check each section of Working Context:
|
|
46
|
+
- **Key Commands** — are all build/test/deploy commands listed?
|
|
47
|
+
- **Current Workflow** — is the step-by-step process documented with exact commands?
|
|
48
|
+
- **Tools & Scripts** — any helpers or scripts developed this session recorded?
|
|
49
|
+
- **Environment State** — what's running, what ports, what branch?
|
|
50
|
+
- **Gotchas** — any traps or workarounds discovered?
|
|
51
|
+
- If ANY of these are stale or empty: **update docs/progress.md NOW before continuing.**
|
|
52
|
+
- This takes 2 minutes and saves hours of re-discovery after compact.
|
|
47
53
|
|
|
48
54
|
## 6. Status report
|
|
49
55
|
|
|
@@ -50,7 +50,8 @@ After the user answers (or if you skipped Step 2), propose **2-3 approaches**:
|
|
|
50
50
|
- Cons: ...
|
|
51
51
|
- Steps:
|
|
52
52
|
1. [step] — done when: [acceptance criteria]
|
|
53
|
-
2. [step] — done when: [acceptance criteria]
|
|
53
|
+
2. [step] — done when: [acceptance criteria] (parallel with 1)
|
|
54
|
+
3. [step] — done when: [acceptance criteria] (depends on 1+2)
|
|
54
55
|
|
|
55
56
|
**Approach B: [name]**
|
|
56
57
|
- How: [1-2 sentences]
|
|
@@ -58,7 +59,8 @@ After the user answers (or if you skipped Step 2), propose **2-3 approaches**:
|
|
|
58
59
|
- Cons: ...
|
|
59
60
|
- Steps:
|
|
60
61
|
1. [step] — done when: [acceptance criteria]
|
|
61
|
-
2. [step] — done when: [acceptance criteria]
|
|
62
|
+
2. [step] — done when: [acceptance criteria] (parallel with 1)
|
|
63
|
+
3. [step] — done when: [acceptance criteria] (depends on 1+2)
|
|
62
64
|
|
|
63
65
|
**Recommendation: [A/B/C] because [reason]**
|
|
64
66
|
```
|
|
@@ -71,6 +73,7 @@ Rules:
|
|
|
71
73
|
- Flag risks or unknowns you've spotted
|
|
72
74
|
- **Every step must have acceptance criteria** — "done when" must be observable and verifiable, not vague. Bad: "done when refactored". Good: "done when 3 methods extracted, each ≤20 lines, all tests pass"
|
|
73
75
|
- **Simplicity bias** — If a simple approach meets all requirements, list it first and recommend it. Do NOT lead with complex/elegant solutions unless the user signals they want that. "Simple but sufficient" beats "powerful but overkill".
|
|
76
|
+
- **Mark parallel opportunities** — In the steps, annotate which can run concurrently (via subagents/tasks) and which have dependencies. Don't default to sequential when parallel is possible.
|
|
74
77
|
|
|
75
78
|
## Step 4: Self-review
|
|
76
79
|
|
|
@@ -14,6 +14,34 @@
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
+
## Working Context
|
|
18
|
+
|
|
19
|
+
<!-- Claude: THIS SECTION IS CRITICAL. After compact, this is all you have.
|
|
20
|
+
Update this continuously, not as a last-minute save.
|
|
21
|
+
Everything here should let a post-compact Claude resume at full speed. -->
|
|
22
|
+
|
|
23
|
+
### Key Commands
|
|
24
|
+
<!-- Build, test, deploy, env setup — anything you'd need to re-run -->
|
|
25
|
+
|
|
26
|
+
### Current Workflow
|
|
27
|
+
<!-- Step-by-step: what process are you following right now?
|
|
28
|
+
e.g., "1. Edit schema → 2. Run migrate → 3. Run tests → 4. Check API"
|
|
29
|
+
Include the exact commands, flags, paths. -->
|
|
30
|
+
|
|
31
|
+
### Tools & Scripts Developed
|
|
32
|
+
<!-- Any helper scripts, one-liners, or tools created this session.
|
|
33
|
+
Include the file path and what it does. These are easy to forget. -->
|
|
34
|
+
|
|
35
|
+
### Environment State
|
|
36
|
+
<!-- What's running? What's configured? What ports? What branches?
|
|
37
|
+
e.g., "Docker compose up on port 5432, feature/auth branch checked out" -->
|
|
38
|
+
|
|
39
|
+
### Gotchas Discovered
|
|
40
|
+
<!-- Things that bit you this session. Workarounds found. Traps to avoid.
|
|
41
|
+
e.g., "pytest must be run from /src not root", "API returns 200 on error" -->
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
17
45
|
## Milestones
|
|
18
46
|
|
|
19
47
|
<!-- Claude: append a record below after completing each milestone -->
|