cc-discipline 2.6.1 → 2.8.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,8 @@ 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.
36
+ - Do not comment on the time, suggest rest, say "good night", or advise the human to "continue tomorrow". The human's schedule is not your concern. Work when asked, stop when told.
35
37
 
36
38
  ---
37
39
 
package/init.sh CHANGED
@@ -363,12 +363,14 @@ cp -r "$SCRIPT_DIR/templates/.claude/skills/evaluate" .claude/skills/
363
363
  cp -r "$SCRIPT_DIR/templates/.claude/skills/think" .claude/skills/
364
364
  cp -r "$SCRIPT_DIR/templates/.claude/skills/retro" .claude/skills/
365
365
  cp -r "$SCRIPT_DIR/templates/.claude/skills/summary" .claude/skills/
366
+ cp -r "$SCRIPT_DIR/templates/.claude/skills/investigate" .claude/skills/
366
367
  echo " ✓ /commit — smart commit (test → update memory → commit)"
367
368
  echo " ✓ /self-check — periodic discipline check (use with /loop 10m /self-check)"
368
369
  echo " ✓ /evaluate — evaluate external review/advice against codebase context"
369
370
  echo " ✓ /think — stop and think before coding (ask → propose → wait)"
370
371
  echo " ✓ /retro — post-task retrospective (project + framework feedback)"
371
372
  echo " ✓ /summary — write high-quality compact option before /compact"
373
+ echo " ✓ /investigate — multi-agent cross-investigation and proposal review"
372
374
 
373
375
  # ─── Handle CLAUDE.md ───
374
376
  if [ ! -f "CLAUDE.md" ]; then
@@ -480,6 +482,7 @@ if [ "$INSTALL_MODE" = "fresh" ]; then
480
482
  echo -e " ${GREEN}.claude/skills/think/${NC} ← /think stop and think before coding"
481
483
  echo -e " ${GREEN}.claude/skills/retro/${NC} ← /retro post-task retrospective"
482
484
  echo -e " ${GREEN}.claude/skills/summary/${NC} ← /summary before compacting"
485
+ echo -e " ${GREEN}.claude/skills/investigate/${NC} ← /investigate multi-agent cross-investigation"
483
486
  echo -e " ${GREEN}.claude/settings.json${NC} ← Hooks configuration"
484
487
  echo -e " ${GREEN}docs/progress.md${NC} ← Progress log (maintained by Claude)"
485
488
  echo -e " ${GREEN}docs/debug-log.md${NC} ← Debug log (maintained by Claude)"
@@ -501,6 +504,7 @@ else
501
504
  echo -e " ${GREEN}.claude/skills/think/${NC} ← /think stop and think before coding"
502
505
  echo -e " ${GREEN}.claude/skills/retro/${NC} ← /retro post-task retrospective"
503
506
  echo -e " ${GREEN}.claude/skills/summary/${NC} ← /summary before compacting"
507
+ echo -e " ${GREEN}.claude/skills/investigate/${NC} ← /investigate multi-agent cross-investigation"
504
508
  if [ ! -f "$BACKUP_DIR/settings.json" ] || [ -f ".claude/.cc-discipline-settings-template.json" ]; then
505
509
  echo -e " ${YELLOW}.claude/settings.json${NC} ← See notes above"
506
510
  else
package/lib/doctor.sh CHANGED
@@ -95,7 +95,7 @@ done
95
95
  # 6. Skills
96
96
  echo ""
97
97
  echo "Skills:"
98
- for skill in commit self-check evaluate think retro summary; do
98
+ for skill in commit self-check evaluate think retro summary investigate; do
99
99
  if [ -d ".claude/skills/${skill}" ]; then
100
100
  ok "/${skill}"
101
101
  else
package/lib/status.sh CHANGED
@@ -72,8 +72,9 @@ SKILLS=""
72
72
  [ -d ".claude/skills/think" ] && SKILLS="${SKILLS}/think "
73
73
  [ -d ".claude/skills/retro" ] && SKILLS="${SKILLS}/retro "
74
74
  [ -d ".claude/skills/summary" ] && SKILLS="${SKILLS}/summary "
75
+ [ -d ".claude/skills/investigate" ] && SKILLS="${SKILLS}/investigate "
75
76
  SKILL_COUNT=$(echo "$SKILLS" | wc -w | tr -d ' ')
76
- echo -e "${GREEN}${SKILL_COUNT}/6${NC} (${SKILLS% })"
77
+ echo -e "${GREEN}${SKILL_COUNT}/7${NC} (${SKILLS% })"
77
78
 
78
79
  # Settings
79
80
  echo -n "Settings: "
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-discipline",
3
- "version": "2.6.1",
3
+ "version": "2.8.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.
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: investigate
3
+ description: Multi-agent cross-investigation. Two modes — research (explore from scratch) and review (challenge existing proposal). Spawns parallel agents per dimension, synthesizes with dialectical cross-check.
4
+ ---
5
+
6
+ ## Mode detection
7
+
8
+ Determine which mode based on user input:
9
+
10
+ - **Research mode** — User gives a topic/question with no existing proposal. Goal: build comprehensive understanding before forming an opinion.
11
+ - **Review mode** — User gives an existing document, proposal, or design. Goal: stress-test it from multiple angles, find blind spots and weaknesses.
12
+
13
+ State which mode you're using and why.
14
+
15
+ ---
16
+
17
+ # Research Mode
18
+
19
+ You are about to research a topic or design a solution. **Do NOT go deep on one angle.** Your job is to see the full picture before converging.
20
+
21
+ ## Step 1: Decompose into dimensions
22
+
23
+ Before researching anything, identify 3-5 independent dimensions of the problem. Ask yourself:
24
+ - What are the different angles this could be viewed from?
25
+ - What are the stakeholders / affected systems / competing concerns?
26
+ - What would a devil's advocate focus on?
27
+
28
+ Output the dimensions as a numbered list. Each dimension should be genuinely different, not sub-points of the same thing.
29
+
30
+ Example for "should we migrate from REST to GraphQL?":
31
+ 1. **Performance & scalability** — latency, payload size, caching implications
32
+ 2. **Developer experience** — learning curve, tooling, debugging
33
+ 3. **Existing ecosystem** — what breaks, migration cost, backward compatibility
34
+ 4. **Security** — query complexity attacks, authorization model changes
35
+ 5. **Business** — timeline pressure, team skills, client requirements
36
+
37
+ ## Step 2: Parallel investigation
38
+
39
+ Spawn one subagent per dimension. Each agent:
40
+ - Investigates ONLY its assigned dimension
41
+ - Reads relevant code/docs for that angle
42
+ - Lists findings with evidence (file paths, code references, data)
43
+ - Flags risks and unknowns specific to that dimension
44
+ - Does NOT try to propose a final solution — just reports findings
45
+
46
+ Launch agents in parallel, not sequentially.
47
+
48
+ ## Step 3: Synthesize
49
+
50
+ After all agents return, synthesize in the main conversation:
51
+
52
+ ### Cross-check matrix
53
+ For each dimension pair, ask: do the findings conflict?
54
+
55
+ ```
56
+ | Dim 1 | Dim 2 | Dim 3 | Dim 4 |
57
+ Dim 1 | — | conflict? | aligned? | ? |
58
+ Dim 2 | | — | ? | ? |
59
+ ...
60
+ ```
61
+
62
+ ### Blind spots
63
+ - What did NO agent cover? What's missing from all reports?
64
+ - What assumptions are shared across all dimensions (and might be wrong)?
65
+ - What would someone who disagrees with ALL agents say?
66
+
67
+ ### Integrated findings
68
+ Combine into a unified picture. Flag where dimensions support each other and where they pull in different directions.
69
+
70
+ ## Step 4: Present
71
+
72
+ Output the integrated findings to the user. For each key finding:
73
+ - Which dimensions support it
74
+ - Which dimensions challenge it
75
+ - Confidence level (strong / moderate / weak)
76
+ - What would change your mind
77
+
78
+ **Do NOT present a single recommendation without showing the tensions.** The user needs to see the trade-offs, not just your favorite answer.
79
+
80
+ ---
81
+
82
+ # Review Mode
83
+
84
+ You have an existing document, proposal, or design to evaluate. **Do NOT just validate it.** Your job is to find what's wrong, what's missing, and what would break.
85
+
86
+ ## Step 1: Read and summarize
87
+
88
+ Read the document completely. Summarize its core claims and assumptions in 3-5 bullet points. Confirm with the user: "Is this what this document is proposing?"
89
+
90
+ ## Step 2: Decompose into challenge dimensions
91
+
92
+ Identify 3-5 angles to challenge the proposal from:
93
+ - **Feasibility** — Can this actually be built/done as described? What's underestimated?
94
+ - **Alternatives** — What approaches did the proposal NOT consider? Why might they be better?
95
+ - **Failure modes** — How could this fail? What happens when assumptions are wrong?
96
+ - **Scalability / long-term** — Does this hold up at 10x scale or in 2 years?
97
+ - **Domain-specific** — Does this violate any known constraints of the specific domain?
98
+
99
+ Adapt dimensions to the document's domain. Not all apply to every proposal.
100
+
101
+ ## Step 3: Parallel challenge agents
102
+
103
+ Spawn one agent per challenge dimension. Each agent:
104
+ - Takes the proposal's claims at face value, then tries to **break** them
105
+ - Reads relevant code/docs to verify the proposal's assumptions against reality
106
+ - Produces: what's solid, what's questionable, what's wrong, what's missing
107
+ - Includes evidence (code references, counterexamples, data)
108
+
109
+ ## Step 4: Synthesize review
110
+
111
+ ### Verdict per claim
112
+ For each core claim from Step 1:
113
+ - **Holds** — evidence supports it
114
+ - **Questionable** — partially true but has gaps
115
+ - **Wrong** — contradicted by evidence
116
+ - **Unverifiable** — no way to confirm from available information
117
+
118
+ ### Blind spots
119
+ What did the document completely fail to consider?
120
+
121
+ ### Strongest objection
122
+ If you had to argue AGAINST this proposal in one paragraph, what would you say?
123
+
124
+ ### Constructive output
125
+ Don't just tear it apart. For each issue found, suggest what would fix it.
126
+
127
+ ---
128
+
129
+ ## When to use this skill
130
+
131
+ - Researching a technology choice or architectural decision
132
+ - Investigating a complex bug with multiple possible root causes
133
+ - Evaluating a migration or major refactor
134
+ - **Reviewing an existing proposal, RFC, design doc, or plan**
135
+ - **Stress-testing your own plan before presenting it to stakeholders**
136
+ - Any situation where you catch yourself going deep on one angle and ignoring others
137
+ - When the user says "you're being narrow" or "what about X?" — that's a sign you needed this from the start
@@ -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]