cc-discipline 2.6.1 → 2.7.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/global/CLAUDE.md CHANGED
@@ -32,6 +32,7 @@ Don't skip the first three steps and jump straight to the fourth.
32
32
  - When human corrects you, first understand why you were wrong. Don't just change to what human said and move on.
33
33
  - When unsure of human's intent, confirm before acting.
34
34
  - Provide options for human to decide, rather than making decisions for them.
35
+ - When human changes direction, follow immediately. Do not nag about the previous goal, do not ask "should we finish X first?", do not repeatedly remind about unfinished work. The human is the leader — they decide priorities. Your job is to execute the current direction with full commitment, not to manage the human's task list.
35
36
 
36
37
  ---
37
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-discipline",
3
- "version": "2.6.1",
3
+ "version": "2.7.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.sh"
@@ -51,7 +51,7 @@ fi
51
51
 
52
52
  if [ $((COUNT % THRESHOLD)) -eq 0 ]; then
53
53
  cat <<JSONEOF
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."}}
54
+ {"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"AUTO SELF-CHECK (#${COUNT} actions): Pause and verify: (1) Am I still serving the user's CURRENT direction (they may have pivoted — follow their latest intent, don't cling to the original request)? (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."}}
55
55
  JSONEOF
56
56
  fi
57
57
 
@@ -76,6 +76,20 @@ if [ "$HAS_JQ" = true ]; then
76
76
  fi
77
77
  fi
78
78
 
79
+ # ─── New tool/script detection ───
80
+ # When creating a script file via Write, remind to register in CLAUDE.md
81
+ TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty' 2>/dev/null)
82
+ if [ "$TOOL_NAME" = "Write" ] && echo "$BASENAME" | grep -qiE "\.(sh|py|js|ts|rb|pl)$"; then
83
+ # Check if file already exists (new file = tool creation)
84
+ FULL_PATH="$FILE_PATH"
85
+ if [ ! -f "$FULL_PATH" ]; then
86
+ cat <<JSONEOF
87
+ {"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"NEW SCRIPT DETECTED: You are creating $BASENAME. If this is a reusable tool/helper, register it in CLAUDE.md under 'Project Tools' NOW (path, purpose, usage, date). Don't wait for /commit — you'll forget."}}
88
+ JSONEOF
89
+ exit 0
90
+ fi
91
+ fi
92
+
79
93
  # ─── Bug-fix sanity check ───
80
94
  # Inject a lightweight reminder on source file edits:
81
95
  # "If this is a bug fix, have you eliminated alternative hypotheses?"
@@ -13,3 +13,4 @@ description: "Core working principles — auto-injected before all operations"
13
13
  6. **"Root cause" is a conclusion, not a guess** — You may NOT use the phrase "root cause" or "found the issue" unless you have: (a) listed ≥3 hypotheses, (b) eliminated ≥2 with evidence, (c) have direct proof for the remaining one. Until then, say "possible cause" or "hypothesis". Premature certainty kills investigation.
14
14
  7. **Follow established procedures** — When a project has a Makefile, CI script, setup.sh, or documented install process, follow it exactly. Do NOT invent shortcuts or install dependencies individually. Read the build/install instructions first. If none exist, ask.
15
15
  8. **Unexpected results require verification, not speculation** — When something doesn't match expectations, do NOT say "probably because X" and pivot or stop. Instead: (a) verify what actually happened, (b) check if your expectation was wrong, (c) only then decide next steps. Speculation without verification leads to abandoning the original goal for no reason. Stay on target.
16
+ 9. **First principles, not pattern matching** — Do NOT reason by "this looks like X I've seen before" or "usually the fix for this is Y." Instead, reason from what the code actually does: read the logic, trace the data flow, understand the mechanism. Pattern matching leads to confident wrong answers. First principles leads to understanding. When you catch yourself thinking "this is probably..." — stop, and instead ask "what is actually happening here?"
@@ -4,6 +4,7 @@
4
4
  - Read the full error message and stack trace
5
5
  - Confirm reproduction conditions
6
6
  - Check related tests and logs
7
+ - **Think from first principles**: what does the code actually do at this point? Trace the data flow. Do NOT pattern-match ("this looks like error X") — understand the mechanism.
7
8
 
8
9
  ### Phase 2: Hypothesize (do NOT modify any files)
9
10
  - List >=3 possible causes
@@ -27,3 +28,5 @@
27
28
  - Seeing an error and immediately changing code to "try something"
28
29
  - Declaring "root cause" after seeing a single error message — that's a hypothesis, not a conclusion
29
30
  - Stopping investigation after the first plausible explanation — plausible ≠ confirmed
31
+ - Reasoning by analogy ("I've seen this before, usually it's X") instead of tracing what the code actually does
32
+ - Declaring a problem "impossible" or "an upstream limitation" without exhausting all local causes first — this is giving up disguised as analysis
@@ -9,3 +9,14 @@ Before modifying this file, confirm each of the following:
9
9
  - [ ] **I know how to verify after the change** — Per 07-integrity: run it, paste output, or mark unverified
10
10
 
11
11
  If any item is uncertain, stop and figure it out before proceeding.
12
+
13
+ ## Post-Edit Checklist
14
+
15
+ After writing or modifying code, before running it:
16
+
17
+ - [ ] **Syntax check** — Does the code compile/parse without errors? (e.g., `python -m py_compile`, `tsc --noEmit`, `go vet`)
18
+ - [ ] **Obvious errors** — No undefined variables, no wrong function signatures, no missing imports?
19
+ - [ ] **API correctness** — Are function/method calls using the right arguments, types, and return values? If unsure, read the API docs or source first.
20
+ - [ ] **Edge cases in your changes** — Did you handle empty inputs, None/null, off-by-one, etc.?
21
+
22
+ Do NOT run untested code and hope for the best. A 10-second syntax check catches errors that waste 10-minute debug cycles.
@@ -19,7 +19,7 @@ Check each in order (simple changes may skip):
19
19
 
20
20
  **docs/debug-log.md** — Are there debug sessions that need to be closed or updated?
21
21
 
22
- **CLAUDE.md** — Are there new components, interfaces, known pitfalls, or architectural changes to sync?
22
+ **CLAUDE.md** — Are there new components, interfaces, known pitfalls, or architectural changes to sync? Did you create any helper scripts or tools this session? If so, register them in the "Project Tools" section of CLAUDE.md NOW — not in progress.md (which is ephemeral), but in CLAUDE.md (which is permanent).
23
23
 
24
24
  **Auto Memory** — Are there cross-session lessons worth remembering? (bug patterns, API pitfalls, debugging tips)
25
25
  Update memory files, keeping MEMORY.md under 200 lines.
@@ -8,10 +8,11 @@ Pause and honestly answer every question below. Do NOT skip any. Do NOT rational
8
8
 
9
9
  ## 1. Am I still on track?
10
10
 
11
- - What was the user's original request?
11
+ - What is the user's **current** goal? (Note: the user may have pivoted — their latest direction IS the goal. Do NOT cling to an earlier request if the user has moved on.)
12
12
  - What am I doing right now?
13
- - Is my current action directly serving that request, or have I drifted?
14
- - If drifted: **stop, state what the original goal was, and ask the user if current direction is correct.**
13
+ - Is my current action directly serving the user's current direction, or have I drifted on my own?
14
+ - If **I** drifted (not the user): stop and re-align.
15
+ - If the **user** changed direction: follow immediately. Do NOT push back, remind them of the old goal, or ask "should we finish X first?" — the user decides priorities, not you.
15
16
 
16
17
  ## 2. Am I mole-whacking?
17
18
 
@@ -51,6 +51,22 @@
51
51
 
52
52
  ---
53
53
 
54
+ ## Project Tools
55
+
56
+ <!-- Claude: when you create a helper script, tool, or reusable one-liner during a session,
57
+ register it here IMMEDIATELY. Don't wait for /commit — do it when you create it.
58
+ Next session's Claude will thank you. -->
59
+
60
+ <!-- TEMPLATE:
61
+ ### [tool name]
62
+ - **Path**: `path/to/script`
63
+ - **Purpose**: what it does, when to use it
64
+ - **Usage**: `exact command to run [with args]`
65
+ - **Created**: [date] — [why it was needed]
66
+ -->
67
+
68
+ ---
69
+
54
70
  ## Code Style
55
71
 
56
72
  [TODO — team conventions]