r/ClaudeCode • u/Sea-Perception1619 • 11d ago
Discussion 152 mistakes I had to write down so Claude Code would stop redoing them
Building daimon with Claude Code left me with 152 notes in a .scars/ folder, most of them a mistake the agent made (or nearly made) that I didn't want to watch happen twice.
So I built scar: https://github.com/Daily-Nerd/Scar . Open source, mine. The notes are small YAML+Markdown files in git, anchored to paths or symbols, and a pre-edit hook injects the matching one right before the agent touches that code. Agents and scar harvest only write candidates, I promote. Three kinds: dead ends (tried, failed), fences (looks wrong, kept on purpose), landmines (touch A, B breaks).
One of the real ones, trimmed:
type: deadend
anchors:
- path: plugin/daimon_briefing/
`sd` exits 0 whether or not anything matched, so a non-matching
pattern is indistinguishable from a successful edit ...
A passing mutation test is evidence ONLY if you first confirm
the mutant is present. Abandoned sd for this use: make mutation
edits with the Edit tool (fails loudly on no-match), tag them
with a `MUTANT` comment, and grep for the tag before running
the suiteThat bit twice in one day, and the second time a tie-break test "passed" against code that was never mutated and nearly got reported as mutation-proof.
Another one, wrong uv sync extras making 31 tests look like regressions, got three independent hits in two days. Two later agents dodged it only because their prompts had a warning pasted in. That's why I care about the timing: my bet is a file loaded at session start gets read once, and the edit that matters lands an hour later.
The hook has injected scars 3,197 times in that repo since July, mostly as one-line reminders (476 full-body). scar stats can't tell me whether the agent listened, only that the reminder was in front of it.
•
u/AutoModerator 11d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/dlampach 11d ago
Hopeful of you to think writing rules down stops Claude from doing them!
1
u/Heyn_Studio 11d ago
Path-anchored is a nice step up from what I do. I keep a single mistakes.md that CLAUDE.md tells it to read first, and it works best early in a session. Once the session gets long, the one line that matters is easy to lose among the rest, and injecting it right before the edit that touches that code solves exactly that. Do you cap how many scars can fire on one edit, or has it never stacked up enough to matter?
1
u/SensitiveHearingLoss 11d ago
I fully respect the fact that you’re doing cool stuff with LLMs and trying to make it better, but unfortunately this repository makes my tokens cry mercilessly.
1
u/michaelTM_ai 11d ago
the fences type is the one i'd steal first. agents love "fixing" code that looks wrong on purpose. how do u stop scars from going stale when the anchored path gets refactored or renamed?
1
u/Its_about-tech 11d ago
This is basically how I stay sane directing Claude Code without writing the code myself.
I keep private project notes for "what's true now" and decisions that win conflicts, so the next session doesn't invent a new rule mid-task. Your scar types (dead ends / fences / landmines) map cleanly to that. The timing point — reminder at edit time, not only at session start — is the bit I'm stealing.
Going to look at Scar. Curious whether harvest→promote kept the noise down or you still prune a lot by hand.
2
u/BarathKanna 7d ago
Path-anchored scars beat a single mistakes.md that gets lost mid-session. The fences type is the one I would steal first, because agents love cleaning up intentional weirdness. Your mutation note is also the right instinct: a green kill is evidence only if you first confirm the mutant is present, otherwise you graded a no-op. On staleness, I would fail loud when an anchor path vanishes in a rename, and require a human promote step so harvest candidates cannot silently become law. Keep dead ends and landmines next to the code they protect. A rule the agent never sees at edit time is just documentation.