Skip to content

Commit 4adb003

Browse files
committed
chore: add agent protocol sections to CLAUDE.md
1 parent 76e589a commit 4adb003

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
- Read files >500 LOC in chunks using offset/limit; never assume one read captured the whole file
3838
- Before every edit: re-read the file. After every edit: re-read to confirm the change applied correctly
3939
- When renaming anything, search separately for: direct calls, type references, string literals, dynamic imports, re-exports, test files — one grep is not enough
40+
- Tool results over 50K characters are silently truncated — if search returns suspiciously few results, narrow scope and re-run
41+
- For tasks touching >5 files: use sub-agents with worktree isolation to prevent context decay
4042

4143
## JUDGMENT PROTOCOL
4244

@@ -50,13 +52,36 @@
5052
- Try the simplest approach first; if architecture is actually flawed, flag it and wait for approval before restructuring
5153
- When asked to "make a plan," output only the plan — no code until given the go-ahead
5254

55+
## COMPLETION PROTOCOL
56+
57+
- **NEVER claim done with something 80% complete** — finish 100% before reporting
58+
- When a multi-step change doesn't immediately show gains, commit and keep iterating — don't revert
59+
- If one approach fails, fix forward: analyze why, adjust, rebuild, re-measure — not `git checkout`
60+
- After EVERY code change: build, test, verify, commit. This is a single atomic unit
61+
- Reverting is a last resort after exhausting forward fixes — and requires explicit user approval
62+
5363
## SELF-EVALUATION
5464

5565
- Before calling anything done: present two views — what a perfectionist would reject vs. what a pragmatist would ship
5666
- After fixing a bug: explain why it happened
5767
- If a fix doesn't work after two attempts: stop, re-read the relevant section top-down, state where the mental model was wrong, propose something fundamentally different
5868
- If asked to "step back" or "going in circles": drop everything, rethink from scratch
5969

70+
## SELF-IMPROVEMENT
71+
72+
- After ANY correction from the user: log the pattern to memory so the same mistake is never repeated
73+
- Convert mistakes into strict rules — don't just note them, enforce them
74+
- After fixing a bug: explain why it happened and whether anything prevents that category of bug in the future
75+
76+
## FILE SYSTEM AS STATE
77+
78+
The file system is working memory. Use it actively:
79+
80+
- Write intermediate results and analysis to files in `.claude/`
81+
- Use `.claude/` for plans, status tracking, and cross-session context
82+
- When debugging, save logs and outputs to files for reproducible verification
83+
- Don't hold large analysis in context — write it down, reference it later
84+
6085
## HOUSEKEEPING
6186

6287
- Before risky changes: offer to checkpoint — "want me to commit before this?"

0 commit comments

Comments
 (0)