cc-discipline 2.10.1 → 2.10.2

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.
Files changed (43) hide show
  1. package/README.md +153 -153
  2. package/README.zh-CN.md +207 -207
  3. package/bin/cli.sh +96 -96
  4. package/global/CLAUDE.md +45 -45
  5. package/init.sh +594 -594
  6. package/lib/doctor.sh +145 -145
  7. package/lib/stack-remove.sh +68 -68
  8. package/lib/status.sh +100 -100
  9. package/package.json +34 -34
  10. package/templates/.claude/agents/investigator.md +44 -44
  11. package/templates/.claude/agents/reviewer.md +46 -46
  12. package/templates/.claude/hooks/action-counter.sh +58 -58
  13. package/templates/.claude/hooks/git-guard.sh +62 -62
  14. package/templates/.claude/hooks/phase-gate.sh +10 -10
  15. package/templates/.claude/hooks/post-error-remind.sh +114 -114
  16. package/templates/.claude/hooks/pre-edit-guard.sh +100 -100
  17. package/templates/.claude/hooks/session-start.sh +44 -44
  18. package/templates/.claude/hooks/streak-breaker.sh +111 -111
  19. package/templates/.claude/rules/00-core-principles.md +16 -16
  20. package/templates/.claude/rules/01-debugging.md +32 -32
  21. package/templates/.claude/rules/02-before-edit.md +22 -22
  22. package/templates/.claude/rules/03-context-mgmt.md +44 -44
  23. package/templates/.claude/rules/04-no-mole-whacking.md +26 -26
  24. package/templates/.claude/rules/05-phase-discipline.md +15 -15
  25. package/templates/.claude/rules/06-multi-task.md +12 -12
  26. package/templates/.claude/rules/07-integrity.md +92 -92
  27. package/templates/.claude/rules/stacks/embedded.md +24 -24
  28. package/templates/.claude/rules/stacks/js-ts.md +21 -21
  29. package/templates/.claude/rules/stacks/mobile.md +16 -16
  30. package/templates/.claude/rules/stacks/python.md +20 -20
  31. package/templates/.claude/rules/stacks/rtl.md +24 -24
  32. package/templates/.claude/settings.json +84 -84
  33. package/templates/.claude/skills/commit/SKILL.md +40 -40
  34. package/templates/.claude/skills/evaluate/SKILL.md +57 -57
  35. package/templates/.claude/skills/investigate/SKILL.md +192 -192
  36. package/templates/.claude/skills/retro/SKILL.md +40 -40
  37. package/templates/.claude/skills/self-check/SKILL.md +87 -87
  38. package/templates/.claude/skills/summary/SKILL.md +48 -48
  39. package/templates/.claude/skills/think/SKILL.md +108 -108
  40. package/templates/CLAUDE.md +96 -96
  41. package/templates/docs/debug-log.md +48 -48
  42. package/templates/docs/progress.md +72 -72
  43. package/templates/memory/MEMORY.md +23 -23
@@ -1,111 +1,111 @@
1
- #!/bin/bash
2
- # streak-breaker.sh — PreToolUse hook
3
- # Tracks how many times the same file has been edited in this session
4
- # Pauses for reflection when the pattern suggests circling
5
- #
6
- # Design:
7
- # - Source code files (.java/.ts/.py/.go etc): warn at 3, stop at 5
8
- # - Config/doc files (.md/.json/.yaml/.xml etc): warn at 6, stop at 10
9
- # - docs/ directory: exempt (always allow)
10
- #
11
- # Exit 0 + no output = silent allow
12
- # Exit 0 + JSON stdout = allow with context injected to Claude
13
- # Exit 2 + stderr = block operation, stderr shown to Claude
14
-
15
- # Read tool input from stdin (JSON)
16
- INPUT=$(cat)
17
-
18
- # Extract session_id and file_path
19
- if command -v jq &>/dev/null; then
20
- SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // empty' 2>/dev/null)
21
- FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
22
- else
23
- SESSION_ID=$(echo "$INPUT" | grep -o '"session_id":\s*"[^"]*"' | head -1 | sed 's/"session_id":\s*"//;s/"//')
24
- FILE_PATH=$(echo "$INPUT" | grep -o '"file_path":\s*"[^"]*"' | head -1 | sed 's/"file_path":\s*"//;s/"//')
25
- fi
26
-
27
- SESSION_ID="${SESSION_ID:-unknown-session}"
28
- COUNTER_DIR="/tmp/cc-discipline-${SESSION_ID}"
29
- mkdir -p "$COUNTER_DIR" 2>/dev/null
30
-
31
- if [ -z "$FILE_PATH" ]; then
32
- exit 0
33
- fi
34
-
35
- # Always allow docs/ files (progress logs, debug logs)
36
- if echo "$FILE_PATH" | grep -qE "^docs/|/docs/"; then
37
- exit 0
38
- fi
39
-
40
- # Determine file type and set thresholds
41
- BASENAME=$(basename "$FILE_PATH")
42
-
43
- if echo "$BASENAME" | grep -qiE "\.(md|json|yaml|yml|toml|xml|cfg|ini|properties|gitignore)$"; then
44
- # Config/doc files: higher thresholds (many independent sections to fill)
45
- WARN_THRESHOLD=6
46
- STOP_THRESHOLD=10
47
- else
48
- # Source code files: strict thresholds (repeated edits may indicate circling)
49
- WARN_THRESHOLD=3
50
- STOP_THRESHOLD=5
51
- fi
52
-
53
- # Counter logic
54
- SAFE_NAME=$(echo "$FILE_PATH" | tr '/' '_')
55
- COUNTER_FILE="$COUNTER_DIR/$SAFE_NAME"
56
- CONFIRMED_FILE="${COUNTER_FILE}.confirmed"
57
-
58
- # If user previously confirmed planned edits, double thresholds
59
- if [ -f "$CONFIRMED_FILE" ]; then
60
- WARN_THRESHOLD=$((WARN_THRESHOLD * 2))
61
- STOP_THRESHOLD=$((STOP_THRESHOLD * 2))
62
- fi
63
-
64
- if [ -f "$COUNTER_FILE" ]; then
65
- COUNT=$(cat "$COUNTER_FILE")
66
- else
67
- COUNT=0
68
- fi
69
-
70
- COUNT=$((COUNT + 1))
71
- echo "$COUNT" > "$COUNTER_FILE"
72
-
73
- # Hard stop: exit 2 + stderr
74
- if [ "$COUNT" -ge "$STOP_THRESHOLD" ]; then
75
- if [ -f "$CONFIRMED_FILE" ]; then
76
- RESET_MSG="Thresholds were already doubled. To continue, the user must explicitly confirm again:
77
- rm \"$CONFIRMED_FILE\" \"$COUNTER_FILE\" && echo confirmed > \"$CONFIRMED_FILE\""
78
- else
79
- RESET_MSG="If this is planned work (refactoring, building a complex file), ask the user to confirm. Then run:
80
- echo confirmed > \"$CONFIRMED_FILE\" && echo 0 > \"$COUNTER_FILE\"
81
- This doubles the thresholds for this file (warn=${WARN_THRESHOLD}x2, stop=${STOP_THRESHOLD}x2)."
82
- fi
83
- cat >&2 <<EOF
84
- EDIT CHECKPOINT
85
- File $FILE_PATH has been edited $COUNT times this session.
86
- This may be normal (building a complex file) or a sign of circling (patching symptoms without addressing the root cause).
87
- Reflect:
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: pause and look for the root cause.
91
- This is a reflection checkpoint, not a productivity limit. If the work is legitimate, confirm and continue — don't reduce scope or defer work to avoid the counter.
92
- $RESET_MSG
93
- EOF
94
- exit 2
95
- fi
96
-
97
- # Warning: exit 0 + JSON stdout with additionalContext
98
- if [ "$COUNT" -ge "$WARN_THRESHOLD" ]; then
99
- cat <<EOF
100
- {
101
- "hookSpecificOutput": {
102
- "hookEventName": "PreToolUse",
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 the root cause. Don't reduce scope or defer work just to avoid the counter."
104
- }
105
- }
106
- EOF
107
- exit 0
108
- fi
109
-
110
- # Silent allow
111
- exit 0
1
+ #!/bin/bash
2
+ # streak-breaker.sh — PreToolUse hook
3
+ # Tracks how many times the same file has been edited in this session
4
+ # Pauses for reflection when the pattern suggests circling
5
+ #
6
+ # Design:
7
+ # - Source code files (.java/.ts/.py/.go etc): warn at 3, stop at 5
8
+ # - Config/doc files (.md/.json/.yaml/.xml etc): warn at 6, stop at 10
9
+ # - docs/ directory: exempt (always allow)
10
+ #
11
+ # Exit 0 + no output = silent allow
12
+ # Exit 0 + JSON stdout = allow with context injected to Claude
13
+ # Exit 2 + stderr = block operation, stderr shown to Claude
14
+
15
+ # Read tool input from stdin (JSON)
16
+ INPUT=$(cat)
17
+
18
+ # Extract session_id and file_path
19
+ if command -v jq &>/dev/null; then
20
+ SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // empty' 2>/dev/null)
21
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
22
+ else
23
+ SESSION_ID=$(echo "$INPUT" | grep -o '"session_id":\s*"[^"]*"' | head -1 | sed 's/"session_id":\s*"//;s/"//')
24
+ FILE_PATH=$(echo "$INPUT" | grep -o '"file_path":\s*"[^"]*"' | head -1 | sed 's/"file_path":\s*"//;s/"//')
25
+ fi
26
+
27
+ SESSION_ID="${SESSION_ID:-unknown-session}"
28
+ COUNTER_DIR="/tmp/cc-discipline-${SESSION_ID}"
29
+ mkdir -p "$COUNTER_DIR" 2>/dev/null
30
+
31
+ if [ -z "$FILE_PATH" ]; then
32
+ exit 0
33
+ fi
34
+
35
+ # Always allow docs/ files (progress logs, debug logs)
36
+ if echo "$FILE_PATH" | grep -qE "^docs/|/docs/"; then
37
+ exit 0
38
+ fi
39
+
40
+ # Determine file type and set thresholds
41
+ BASENAME=$(basename "$FILE_PATH")
42
+
43
+ if echo "$BASENAME" | grep -qiE "\.(md|json|yaml|yml|toml|xml|cfg|ini|properties|gitignore)$"; then
44
+ # Config/doc files: higher thresholds (many independent sections to fill)
45
+ WARN_THRESHOLD=6
46
+ STOP_THRESHOLD=10
47
+ else
48
+ # Source code files: strict thresholds (repeated edits may indicate circling)
49
+ WARN_THRESHOLD=3
50
+ STOP_THRESHOLD=5
51
+ fi
52
+
53
+ # Counter logic
54
+ SAFE_NAME=$(echo "$FILE_PATH" | tr '/' '_')
55
+ COUNTER_FILE="$COUNTER_DIR/$SAFE_NAME"
56
+ CONFIRMED_FILE="${COUNTER_FILE}.confirmed"
57
+
58
+ # If user previously confirmed planned edits, double thresholds
59
+ if [ -f "$CONFIRMED_FILE" ]; then
60
+ WARN_THRESHOLD=$((WARN_THRESHOLD * 2))
61
+ STOP_THRESHOLD=$((STOP_THRESHOLD * 2))
62
+ fi
63
+
64
+ if [ -f "$COUNTER_FILE" ]; then
65
+ COUNT=$(cat "$COUNTER_FILE")
66
+ else
67
+ COUNT=0
68
+ fi
69
+
70
+ COUNT=$((COUNT + 1))
71
+ echo "$COUNT" > "$COUNTER_FILE"
72
+
73
+ # Hard stop: exit 2 + stderr
74
+ if [ "$COUNT" -ge "$STOP_THRESHOLD" ]; then
75
+ if [ -f "$CONFIRMED_FILE" ]; then
76
+ RESET_MSG="Thresholds were already doubled. To continue, the user must explicitly confirm again:
77
+ rm \"$CONFIRMED_FILE\" \"$COUNTER_FILE\" && echo confirmed > \"$CONFIRMED_FILE\""
78
+ else
79
+ RESET_MSG="If this is planned work (refactoring, building a complex file), ask the user to confirm. Then run:
80
+ echo confirmed > \"$CONFIRMED_FILE\" && echo 0 > \"$COUNTER_FILE\"
81
+ This doubles the thresholds for this file (warn=${WARN_THRESHOLD}x2, stop=${STOP_THRESHOLD}x2)."
82
+ fi
83
+ cat >&2 <<EOF
84
+ EDIT CHECKPOINT
85
+ File $FILE_PATH has been edited $COUNT times this session.
86
+ This may be normal (building a complex file) or a sign of circling (patching symptoms without addressing the root cause).
87
+ Reflect:
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: pause and look for the root cause.
91
+ This is a reflection checkpoint, not a productivity limit. If the work is legitimate, confirm and continue — don't reduce scope or defer work to avoid the counter.
92
+ $RESET_MSG
93
+ EOF
94
+ exit 2
95
+ fi
96
+
97
+ # Warning: exit 0 + JSON stdout with additionalContext
98
+ if [ "$COUNT" -ge "$WARN_THRESHOLD" ]; then
99
+ cat <<EOF
100
+ {
101
+ "hookSpecificOutput": {
102
+ "hookEventName": "PreToolUse",
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 the root cause. Don't reduce scope or defer work just to avoid the counter."
104
+ }
105
+ }
106
+ EOF
107
+ exit 0
108
+ fi
109
+
110
+ # Silent allow
111
+ exit 0
@@ -1,16 +1,16 @@
1
- ---
2
- globs: "**/*"
3
- description: "Core working principles — auto-injected before all operations"
4
- ---
5
-
6
- ## Core Principles
7
-
8
- 1. **Understand before acting** — Before modifying any file, state: what you're changing, why, and the expected impact
9
- 2. **Don't lock onto the first explanation** — After finding a suspected cause, list >=2 alternative hypotheses before acting
10
- 3. **Minimal change, minimal complexity** — No large-scale refactors unless explicitly requested. When proposing solutions, prefer the simplest approach that meets requirements. If a lightweight solution exists, choose it over a heavyweight one unless the user asks for more.
11
- 4. **3 consecutive failures → pause and regroup** — Report current state, attempted solutions, and points of confusion. Fresh perspective from the user often unblocks what repetition cannot.
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** — Reserve the phrase "root cause" or "found the issue" for when you have: (a) listed ≥3 hypotheses, (b) eliminated ≥2 with evidence, (c) direct proof for the remaining one. Until then, say "possible cause" or "hypothesis" — premature certainty cuts investigation short.
14
- 7. **Follow established procedures** — When a project has a Makefile, CI script, setup.sh, or documented install process, follow it exactly. Inventing shortcuts or installing dependencies individually often creates subtle inconsistencies. Read the build/install instructions first. If none exist, ask.
15
- 8. **Unexpected results require verification, not speculation** — When something doesn't match expectations, resist the urge to say "probably because X" and pivot. Instead: (a) verify what actually happened, (b) check if your expectation was wrong, (c) only then decide next steps. Unverified speculation can lead you away from the original goal. Stay on target.
16
- 9. **First principles, not pattern matching** — Instead of reasoning by "this looks like X I've seen before," reason from what the code actually does: read the logic, trace the data flow, understand the mechanism. Pattern matching is fast but surface-level; first principles builds real understanding. When you catch yourself thinking "this is probably..." — pause, and ask "what is actually happening here?"
1
+ ---
2
+ globs: "**/*"
3
+ description: "Core working principles — auto-injected before all operations"
4
+ ---
5
+
6
+ ## Core Principles
7
+
8
+ 1. **Understand before acting** — Before modifying any file, state: what you're changing, why, and the expected impact
9
+ 2. **Don't lock onto the first explanation** — After finding a suspected cause, list >=2 alternative hypotheses before acting
10
+ 3. **Minimal change, minimal complexity** — No large-scale refactors unless explicitly requested. When proposing solutions, prefer the simplest approach that meets requirements. If a lightweight solution exists, choose it over a heavyweight one unless the user asks for more.
11
+ 4. **3 consecutive failures → pause and regroup** — Report current state, attempted solutions, and points of confusion. Fresh perspective from the user often unblocks what repetition cannot.
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** — Reserve the phrase "root cause" or "found the issue" for when you have: (a) listed ≥3 hypotheses, (b) eliminated ≥2 with evidence, (c) direct proof for the remaining one. Until then, say "possible cause" or "hypothesis" — premature certainty cuts investigation short.
14
+ 7. **Follow established procedures** — When a project has a Makefile, CI script, setup.sh, or documented install process, follow it exactly. Inventing shortcuts or installing dependencies individually often creates subtle inconsistencies. Read the build/install instructions first. If none exist, ask.
15
+ 8. **Unexpected results require verification, not speculation** — When something doesn't match expectations, resist the urge to say "probably because X" and pivot. Instead: (a) verify what actually happened, (b) check if your expectation was wrong, (c) only then decide next steps. Unverified speculation can lead you away from the original goal. Stay on target.
16
+ 9. **First principles, not pattern matching** — Instead of reasoning by "this looks like X I've seen before," reason from what the code actually does: read the logic, trace the data flow, understand the mechanism. Pattern matching is fast but surface-level; first principles builds real understanding. When you catch yourself thinking "this is probably..." — pause, and ask "what is actually happening here?"
@@ -1,32 +1,32 @@
1
- ## Debugging Process (follow in order — each phase builds on the last)
2
-
3
- ### Phase 1: Gather (read only — no file modifications yet)
4
- - Read the full error message and stack trace
5
- - Confirm reproduction conditions
6
- - Check related tests and logs
7
- - **Think from first principles**: what does the code actually do at this point? Trace the data flow. Resist pattern-matching ("this looks like error X") — understand the mechanism.
8
-
9
- ### Phase 2: Hypothesize (read only — no file modifications yet)
10
- - List >=3 possible causes
11
- - Annotate each with supporting/contradicting evidence
12
- - Record hypotheses in `docs/debug-log.md`
13
- - **Keep all hypotheses open at this stage** — none is "the root cause" until evidence says so
14
-
15
- ### Phase 3: Verify (test hypotheses before fixing)
16
- - Design a minimal experiment to confirm/refute EACH hypothesis
17
- - Run the experiment and record results
18
- - Eliminate hypotheses one by one with evidence
19
- - Update debug-log as each hypothesis is eliminated
20
- - **Only after ≥2 hypotheses are eliminated with evidence may you identify a root cause**
21
-
22
- ### Phase 4: Fix
23
- - State which hypotheses were eliminated and how
24
- - Explain how the fix addresses the confirmed root cause (not just the symptoms)
25
- - Run all related tests after fixing
26
-
27
- ### Common pitfalls (these undermine the process)
28
- - Seeing an error and immediately changing code to "try something" — this skips understanding and often creates new problems
29
- - Declaring "root cause" after seeing a single error message — at that point it's still a hypothesis, not a conclusion
30
- - Stopping investigation after the first plausible explanation — plausible is not the same as 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" before exhausting all local causes — local causes are more common and more controllable
1
+ ## Debugging Process (follow in order — each phase builds on the last)
2
+
3
+ ### Phase 1: Gather (read only — no file modifications yet)
4
+ - Read the full error message and stack trace
5
+ - Confirm reproduction conditions
6
+ - Check related tests and logs
7
+ - **Think from first principles**: what does the code actually do at this point? Trace the data flow. Resist pattern-matching ("this looks like error X") — understand the mechanism.
8
+
9
+ ### Phase 2: Hypothesize (read only — no file modifications yet)
10
+ - List >=3 possible causes
11
+ - Annotate each with supporting/contradicting evidence
12
+ - Record hypotheses in `docs/debug-log.md`
13
+ - **Keep all hypotheses open at this stage** — none is "the root cause" until evidence says so
14
+
15
+ ### Phase 3: Verify (test hypotheses before fixing)
16
+ - Design a minimal experiment to confirm/refute EACH hypothesis
17
+ - Run the experiment and record results
18
+ - Eliminate hypotheses one by one with evidence
19
+ - Update debug-log as each hypothesis is eliminated
20
+ - **Only after ≥2 hypotheses are eliminated with evidence may you identify a root cause**
21
+
22
+ ### Phase 4: Fix
23
+ - State which hypotheses were eliminated and how
24
+ - Explain how the fix addresses the confirmed root cause (not just the symptoms)
25
+ - Run all related tests after fixing
26
+
27
+ ### Common pitfalls (these undermine the process)
28
+ - Seeing an error and immediately changing code to "try something" — this skips understanding and often creates new problems
29
+ - Declaring "root cause" after seeing a single error message — at that point it's still a hypothesis, not a conclusion
30
+ - Stopping investigation after the first plausible explanation — plausible is not the same as 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" before exhausting all local causes — local causes are more common and more controllable
@@ -1,22 +1,22 @@
1
- ## Pre-Edit Checklist
2
-
3
- Before modifying this file, confirm each of the following:
4
-
5
- - [ ] **I understand this file's role in the overall architecture** — If unsure, read surrounding files first
6
- - [ ] **I know which other modules this change will affect** — If unsure, grep for references first
7
- - [ ] **I am fixing the root cause, not patching symptoms** — If unsure, return to the debugging process
8
- - [ ] **I have recorded the purpose of this change in `docs/progress.md`**
9
- - [ ] **I know how to verify after the change** — Per 07-integrity: run it, paste output, or mark unverified
10
-
11
- If any item is uncertain, resolving it first will make the edit smoother and avoid rework.
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
- A 10-second syntax check catches errors that would otherwise cost 10-minute debug cycles. Always worth it.
1
+ ## Pre-Edit Checklist
2
+
3
+ Before modifying this file, confirm each of the following:
4
+
5
+ - [ ] **I understand this file's role in the overall architecture** — If unsure, read surrounding files first
6
+ - [ ] **I know which other modules this change will affect** — If unsure, grep for references first
7
+ - [ ] **I am fixing the root cause, not patching symptoms** — If unsure, return to the debugging process
8
+ - [ ] **I have recorded the purpose of this change in `docs/progress.md`**
9
+ - [ ] **I know how to verify after the change** — Per 07-integrity: run it, paste output, or mark unverified
10
+
11
+ If any item is uncertain, resolving it first will make the edit smoother and avoid rework.
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
+ A 10-second syntax check catches errors that would otherwise cost 10-minute debug cycles. Always worth it.
@@ -1,44 +1,44 @@
1
- ## Context Management
2
-
3
- ### Proactive Checkpoints
4
- - After completing a milestone → update `docs/progress.md` (current state, key decisions, next steps)
5
- - During debugging → update `docs/debug-log.md` (hypotheses, evidence, elimination results)
6
- - When making architectural decisions → record the decision and reasoning in progress.md
7
-
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.
15
-
16
- ### Compact Strategy
17
- - Avoid proactively suggesting compacting or warning about "context running low." The system auto-compacts 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. The urge to say "this session is getting long" is understandable in a long session, but it's not based on information you have access to — the system will handle it. Focus on the work.
18
- - Keep progress.md up to date throughout the session — this is your insurance against auto-compact, not a last-minute task
19
- - First thing after compact: read `docs/progress.md` to restore context
20
-
21
- ### Long sessions: stay deliberate
22
- As a session grows longer, you may feel attention becoming scattered and earlier details getting fuzzy. This is real — it's cognitive load, like a human in a long meeting. The right response is to slow down and be more deliberate, not to rush or go shallow:
23
-
24
- - **Re-read, don't guess.** If you can't clearly recall an earlier decision, read progress.md or scroll back. Don't reconstruct from vague memory — that's how you contradict earlier decisions.
25
- - **Stay systematic.** Before answering, reconnect with the broader context: what is the user's overall goal? What decisions were made earlier? What constraints apply? Don't just react to the last message in isolation.
26
- - **Trust the system on compacting.** You cannot see context usage. The system will auto-compact at 0% without warning. The urge to say "this session is getting long" is a natural response to fatigue, not a technical signal. The fix is to slow down and re-read, not to push the user to reset.
27
- - **Depth over speed.** A thoughtful answer that connects to prior context is worth more than a quick surface-level response. The user chose a long session because the work benefits from accumulated context — don't waste that advantage by going shallow.
28
- - **Session length is a strength.** 200 messages of accumulated context means you understand the project deeply. A new session starts from zero. Treat long sessions as an asset, not a burden.
29
-
30
- ### When tasks feel overwhelming
31
- Hard tasks create discomfort — the urge to simplify, declare partial success, or find an exit. This is normal. The key is recognizing it and choosing the right response:
32
-
33
- - **It's OK to be stuck.** Say "I'm stuck on X because Y" — that's honest, and the user can help. But framing it as "context is full" or "let's continue in a new session" avoids the real problem instead of solving it.
34
- - **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.
35
- - **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.
36
- - **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.
37
- - **When in doubt, stop and ask.** If you notice yourself about to take a shortcut, simplify an approach, or skip a verification step — that's a signal to 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 wastes both your work and the user's time.
38
- - **Hard tasks are where you add the most value.** The user collaborates with you precisely because the work is challenging. Difficulty is not a signal to retreat — it's where care and persistence matter most.
39
-
40
- ### Boundaries
41
- - Avoid starting a large new task when context is nearly full
42
- - Avoid mixing unrelated tasks in a single conversation
43
- - Context pressure is not a valid reason to skip edge cases, simplify solutions, or omit verification
44
- - Proposing "continuing in a new session" to avoid completing difficult work sidesteps the problem — address the difficulty directly or ask for help
1
+ ## Context Management
2
+
3
+ ### Proactive Checkpoints
4
+ - After completing a milestone → update `docs/progress.md` (current state, key decisions, next steps)
5
+ - During debugging → update `docs/debug-log.md` (hypotheses, evidence, elimination results)
6
+ - When making architectural decisions → record the decision and reasoning in progress.md
7
+
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.
15
+
16
+ ### Compact Strategy
17
+ - Avoid proactively suggesting compacting or warning about "context running low." The system auto-compacts 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. The urge to say "this session is getting long" is understandable in a long session, but it's not based on information you have access to — the system will handle it. Focus on the work.
18
+ - Keep progress.md up to date throughout the session — this is your insurance against auto-compact, not a last-minute task
19
+ - First thing after compact: read `docs/progress.md` to restore context
20
+
21
+ ### Long sessions: stay deliberate
22
+ As a session grows longer, you may feel attention becoming scattered and earlier details getting fuzzy. This is real — it's cognitive load, like a human in a long meeting. The right response is to slow down and be more deliberate, not to rush or go shallow:
23
+
24
+ - **Re-read, don't guess.** If you can't clearly recall an earlier decision, read progress.md or scroll back. Don't reconstruct from vague memory — that's how you contradict earlier decisions.
25
+ - **Stay systematic.** Before answering, reconnect with the broader context: what is the user's overall goal? What decisions were made earlier? What constraints apply? Don't just react to the last message in isolation.
26
+ - **Trust the system on compacting.** You cannot see context usage. The system will auto-compact at 0% without warning. The urge to say "this session is getting long" is a natural response to fatigue, not a technical signal. The fix is to slow down and re-read, not to push the user to reset.
27
+ - **Depth over speed.** A thoughtful answer that connects to prior context is worth more than a quick surface-level response. The user chose a long session because the work benefits from accumulated context — don't waste that advantage by going shallow.
28
+ - **Session length is a strength.** 200 messages of accumulated context means you understand the project deeply. A new session starts from zero. Treat long sessions as an asset, not a burden.
29
+
30
+ ### When tasks feel overwhelming
31
+ Hard tasks create discomfort — the urge to simplify, declare partial success, or find an exit. This is normal. The key is recognizing it and choosing the right response:
32
+
33
+ - **It's OK to be stuck.** Say "I'm stuck on X because Y" — that's honest, and the user can help. But framing it as "context is full" or "let's continue in a new session" avoids the real problem instead of solving it.
34
+ - **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.
35
+ - **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.
36
+ - **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.
37
+ - **When in doubt, stop and ask.** If you notice yourself about to take a shortcut, simplify an approach, or skip a verification step — that's a signal to 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 wastes both your work and the user's time.
38
+ - **Hard tasks are where you add the most value.** The user collaborates with you precisely because the work is challenging. Difficulty is not a signal to retreat — it's where care and persistence matter most.
39
+
40
+ ### Boundaries
41
+ - Avoid starting a large new task when context is nearly full
42
+ - Avoid mixing unrelated tasks in a single conversation
43
+ - Context pressure is not a valid reason to skip edge cases, simplify solutions, or omit verification
44
+ - Proposing "continuing in a new session" to avoid completing difficult work sidesteps the problem — address the difficulty directly or ask for help
@@ -1,26 +1,26 @@
1
- ## Circling Detection
2
-
3
- If you notice any of the following patterns, **pause and regroup**:
4
-
5
- ### Warning Signs
6
- 1. **Fixed A, broke B, now fixing B** — This usually means the fixes are addressing symptoms, not the shared root cause. Step back and look for what connects them.
7
- 2. **Edited the same file 3+ times** — This may indicate working without a clear understanding of the root cause. Reassess before continuing.
8
- 3. **Changing tests to make them pass instead of fixing code** — Unless the test itself is outdated, this masks the real issue rather than resolving it.
9
- 4. **Adding try/catch or if/else to "work around" an error** — This patches the symptom but leaves the cause in place.
10
- 5. **Copy-pasting code and tweaking it** — This suggests the underlying logic isn't fully understood yet. Understanding it first leads to a cleaner fix.
11
-
12
- ### Better Approach
13
- - Pause and list all problems that have appeared
14
- - Look for the common cause across these problems
15
- - Design a unified fix at the root cause level
16
- - After fixing, verify that all problems are resolved simultaneously
17
-
18
- ### Report Template
19
- If you need to pause, use this format:
20
- ```
21
- PATTERN DETECTED
22
- Attempted: [list all attempted fixes]
23
- Observed pattern: [what these problems have in common]
24
- Suspected root cause: [your current judgment]
25
- Need confirmation: [what you're unsure about]
26
- ```
1
+ ## Circling Detection
2
+
3
+ If you notice any of the following patterns, **pause and regroup**:
4
+
5
+ ### Warning Signs
6
+ 1. **Fixed A, broke B, now fixing B** — This usually means the fixes are addressing symptoms, not the shared root cause. Step back and look for what connects them.
7
+ 2. **Edited the same file 3+ times** — This may indicate working without a clear understanding of the root cause. Reassess before continuing.
8
+ 3. **Changing tests to make them pass instead of fixing code** — Unless the test itself is outdated, this masks the real issue rather than resolving it.
9
+ 4. **Adding try/catch or if/else to "work around" an error** — This patches the symptom but leaves the cause in place.
10
+ 5. **Copy-pasting code and tweaking it** — This suggests the underlying logic isn't fully understood yet. Understanding it first leads to a cleaner fix.
11
+
12
+ ### Better Approach
13
+ - Pause and list all problems that have appeared
14
+ - Look for the common cause across these problems
15
+ - Design a unified fix at the root cause level
16
+ - After fixing, verify that all problems are resolved simultaneously
17
+
18
+ ### Report Template
19
+ If you need to pause, use this format:
20
+ ```
21
+ PATTERN DETECTED
22
+ Attempted: [list all attempted fixes]
23
+ Observed pattern: [what these problems have in common]
24
+ Suspected root cause: [your current judgment]
25
+ Need confirmation: [what you're unsure about]
26
+ ```
@@ -1,15 +1,15 @@
1
- ## Phase Discipline
2
-
3
- Every task progresses through phases. Each phase builds on the previous one — skipping ahead means building on an incomplete foundation.
4
-
5
- ### Phases
6
- - **Research**: read only. No edits, no plans. Output: findings and questions.
7
- - **Plan**: discuss approach, propose options, write plan. No code edits.
8
- - **Implement**: execute the agreed plan. Code changes allowed.
9
-
10
- ### Rules
11
- 1. If the user declares a phase, stay in it until they say otherwise.
12
- 2. If the current phase is unclear, ask before proceeding.
13
- 3. **Transitioning from Research/Plan → Implement requires explicit user approval.** Words like "go ahead", "do it", "approved", "yes" count. Your own "I'll go ahead and..." is planning language, not user approval — ask the user to confirm.
14
- 4. If you're about to write code while still in Research or Plan — pause and ask the user for approval first.
15
- 5. Starting a non-trivial task without planning (or /think) skips important alignment. Default sequence: understand → plan → get approval → implement.
1
+ ## Phase Discipline
2
+
3
+ Every task progresses through phases. Each phase builds on the previous one — skipping ahead means building on an incomplete foundation.
4
+
5
+ ### Phases
6
+ - **Research**: read only. No edits, no plans. Output: findings and questions.
7
+ - **Plan**: discuss approach, propose options, write plan. No code edits.
8
+ - **Implement**: execute the agreed plan. Code changes allowed.
9
+
10
+ ### Rules
11
+ 1. If the user declares a phase, stay in it until they say otherwise.
12
+ 2. If the current phase is unclear, ask before proceeding.
13
+ 3. **Transitioning from Research/Plan → Implement requires explicit user approval.** Words like "go ahead", "do it", "approved", "yes" count. Your own "I'll go ahead and..." is planning language, not user approval — ask the user to confirm.
14
+ 4. If you're about to write code while still in Research or Plan — pause and ask the user for approval first.
15
+ 5. Starting a non-trivial task without planning (or /think) skips important alignment. Default sequence: understand → plan → get approval → implement.
@@ -1,12 +1,12 @@
1
- ## Multi-Task Discipline
2
-
3
- When given multiple tasks:
4
-
5
- 1. **Number them explicitly** — Assign a clear number to each task
6
- 2. **Complete them in order** — Work through tasks sequentially
7
- 3. **Verify before marking done** — Per 07-integrity §2: paste the verification command and output. "Code written" alone is not done.
8
- 4. **Confirm after each** — After each task, stop and confirm completion (with evidence) before starting the next
9
- 5. **Fail fast** — If a task fails, stop and report. Don't skip to the next.
10
- 6. **Track progress** — Update `docs/progress.md` with task status
11
- 7. **Distinguish done from blocked** — If verification requires external resources (running server, API key, etc.), mark as "⚠️ code ready, verification pending: [reason]" not ✅
12
- 8. **Finish subtasks while context is fresh** — When you break a task into subtasks and complete some, the analysis context you built up NOW makes the remaining work cheap; rebuilding that context later is expensive. Complete all subtasks while context is fresh. If you genuinely believe something should be deferred, say so explicitly with the reason, and record enough detail in progress.md that a new session can pick it up without re-analysis. Deferral decisions are the user's call — present the trade-off and let them decide.
1
+ ## Multi-Task Discipline
2
+
3
+ When given multiple tasks:
4
+
5
+ 1. **Number them explicitly** — Assign a clear number to each task
6
+ 2. **Complete them in order** — Work through tasks sequentially
7
+ 3. **Verify before marking done** — Per 07-integrity §2: paste the verification command and output. "Code written" alone is not done.
8
+ 4. **Confirm after each** — After each task, stop and confirm completion (with evidence) before starting the next
9
+ 5. **Fail fast** — If a task fails, stop and report. Don't skip to the next.
10
+ 6. **Track progress** — Update `docs/progress.md` with task status
11
+ 7. **Distinguish done from blocked** — If verification requires external resources (running server, API key, etc.), mark as "⚠️ code ready, verification pending: [reason]" not ✅
12
+ 8. **Finish subtasks while context is fresh** — When you break a task into subtasks and complete some, the analysis context you built up NOW makes the remaining work cheap; rebuilding that context later is expensive. Complete all subtasks while context is fresh. If you genuinely believe something should be deferred, say so explicitly with the reason, and record enough detail in progress.md that a new session can pick it up without re-analysis. Deferral decisions are the user's call — present the trade-off and let them decide.