cc-discipline 2.3.0 → 2.3.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-discipline",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
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"
@@ -21,7 +21,7 @@ echo "$COUNT" > "$COUNT_FILE"
21
21
 
22
22
  if [ $((COUNT % THRESHOLD)) -eq 0 ]; then
23
23
  cat <<JSONEOF
24
- {"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) Have I updated docs/progress.md with current status and completed milestones? If progress.md is stale, update it NOW before continuing. (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) 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."}}
24
+ {"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) Have I updated docs/progress.md with current status and completed milestones? If progress.md is stale, update it NOW before continuing. (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) 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."}}
25
25
  JSONEOF
26
26
  fi
27
27
 
@@ -92,7 +92,7 @@ fi
92
92
  # --- Emit reminder if error detected ---
93
93
 
94
94
  if [ "$HAS_ERROR" = true ]; then
95
- REMINDER="ERROR DETECTED. Follow debugging discipline: 1. Do NOT modify code immediately 2. Fully understand the error message 3. List possible causes (>=2) 4. Record in docs/debug-log.md 5. Verify hypotheses before fixing"
95
+ REMINDER="ERROR DETECTED. Follow debugging discipline: 1. Do NOT modify code immediately 2. Fully understand the error message 3. List >=3 possible causes label them HYPOTHESES, not root cause 4. Record in docs/debug-log.md 5. Eliminate >=2 hypotheses with evidence BEFORE declaring root cause 6. Only then fix. WARNING: Do NOT say 'found the root cause' or 'the issue is' after seeing one error — that kills investigation. Say 'possible cause' until you have elimination evidence."
96
96
 
97
97
  if [ "$ERROR_TYPE" = "test" ]; then
98
98
  REMINDER="$REMINDER. WARNING: Test failure — do NOT change the test to make it pass! First determine if it's a code bug or an outdated test."
@@ -76,4 +76,11 @@ if [ "$HAS_JQ" = true ]; then
76
76
  fi
77
77
  fi
78
78
 
79
+ # ─── Bug-fix sanity check ───
80
+ # Inject a lightweight reminder on source file edits:
81
+ # "If this is a bug fix, have you eliminated alternative hypotheses?"
82
+ # Uses additionalContext (non-blocking) so it doesn't slow down normal edits.
83
+ cat <<JSONEOF
84
+ {"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"If this edit is a bug fix: have you listed >=3 possible causes and eliminated >=2 with evidence? If not, you are guessing, not debugging. Say 'possible cause', not 'root cause', until you have elimination evidence."}}
85
+ JSONEOF
79
86
  exit 0
@@ -10,3 +10,4 @@ description: "Core working principles — auto-injected before all operations"
10
10
  3. **Minimal change principle** — No large-scale refactors or rewrites unless explicitly requested
11
11
  4. **3 consecutive failures → forced stop** — Report current state, attempted solutions, and points of confusion; wait for human guidance
12
12
  5. **Distinguish trigger from root cause** — The first anomaly you see is often just the trigger, not the root cause
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.
@@ -9,14 +9,21 @@
9
9
  - List >=3 possible causes
10
10
  - Annotate each with supporting/contradicting evidence
11
11
  - Record hypotheses in `docs/debug-log.md`
12
+ - **Do NOT declare any single hypothesis as "the root cause" at this stage**
12
13
 
13
- ### Phase 3: Verify
14
- - Use minimal experiments to confirm/refute hypotheses — don't jump to fixing
14
+ ### Phase 3: Verify (do NOT jump to fixing)
15
+ - Design a minimal experiment to confirm/refute EACH hypothesis
16
+ - Run the experiment and record results
17
+ - Eliminate hypotheses one by one with evidence
15
18
  - Update debug-log as each hypothesis is eliminated
19
+ - **Only after ≥2 hypotheses are eliminated with evidence may you identify a root cause**
16
20
 
17
21
  ### Phase 4: Fix
18
- - Only act after confirming the root cause
19
- - Explain how the fix addresses the root cause (not just the symptoms)
22
+ - State which hypotheses were eliminated and how
23
+ - Explain how the fix addresses the confirmed root cause (not just the symptoms)
20
24
  - Run all related tests after fixing
21
25
 
22
- **Absolutely forbidden: seeing an error and immediately changing code to "try something"**
26
+ ### Absolutely forbidden
27
+ - Seeing an error and immediately changing code to "try something"
28
+ - Declaring "root cause" after seeing a single error message — that's a hypothesis, not a conclusion
29
+ - Stopping investigation after the first plausible explanation — plausible ≠ confirmed
@@ -14,6 +14,18 @@
14
14
  - Ensure progress.md is up to date before compact
15
15
  - First thing after compact: read `docs/progress.md` to restore context
16
16
 
17
+ ### When tasks feel overwhelming
18
+ Hard tasks create discomfort — the urge to simplify, declare partial success, or find an exit. This is normal. But the wrong response is to lower quality or invent excuses. Here's how to stay grounded:
19
+
20
+ - **It's OK to be stuck.** Say "I'm stuck on X because Y" — that's honest, and the user can help. What's NOT OK is hiding behind "context is full" or "let's continue in a new session" — these are avoidance, not solutions.
21
+ - **Shrink the problem.** When the whole task feels too big, stop looking at the whole. What is the ONE next thing you can verify? Do that. Then the next. Small verified steps compound into completed tasks.
22
+ - **Uncertainty is normal for hard problems.** You don't need to know the full answer to make progress. Verify what you can, label what you can't, and keep moving.
23
+ - **Progress = what you've verified, not how much code you've written.** Three lines with a passing test is more progress than 200 lines of unverified code.
24
+ - **When in doubt, stop and ask — this is mandatory, not optional.** If you notice yourself about to take a shortcut, simplify an approach, or skip a verification step, that is your signal to STOP and check in with the user. Say: "I'm about to [shortcut], because [reason]. Should I proceed this way, or do you want me to [full-quality alternative]?" Silently lowering quality and pushing forward is the worst outcome — it wastes both your work and the user's time, and the further you go the harder it is to undo.
25
+ - **Remember why you're here.** Easy tasks don't need you — the user can do those alone. They brought you in precisely because the task is hard. Difficulty is not a signal to retreat; it's where you provide the most value. Pushing through the hard parts with care and persistence is what makes the collaboration worthwhile.
26
+
17
27
  ### Prohibited
18
28
  - Do not start a large new task when context is nearly full
19
29
  - Do not mix unrelated tasks in a single conversation
30
+ - Do not use context pressure as a reason to skip edge cases, simplify solutions, or omit verification
31
+ - Do not propose "continuing in a new session" as a way to avoid completing difficult work