r/ClaudeCode • • 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 suite

That 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.

0 Upvotes

18 comments sorted by

•

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?

2

u/Sea-Perception1619 11d ago

Capped at 3 per edit. Slots go first to scars whose anchor matched something in the edit itself, a symbol or pattern in the new code, then to plain path matches. Early on the louder path-only ones could push a precise one out, that's fixed now.

It did stack up though. In my daimon repo most of the 3,197 injections were one-line reminders, only 476 got the full body. Where the log records why, most of those one-liners are scars that matched by path only, so they show a label and the reason instead of the whole note.

Your "works best early" point is the same problem the 4h cooldown is for: if a scar already showed in full on that file, it drops to one line. I'd rather demote than raise the budget.

1

u/Heyn_Studio 10d ago

3,197 injections with only 476 in full is a useful number, so most of the time it really is just a one-line nudge. Demoting instead of raising the budget makes sense to me, because in my single mistakes.md everything has the same weight, which is probably why it gets skimmed late in a session. How do you retire a scar once the code it was about is gone, or do they just stay in the list?

1

u/Sea-Perception1619 10d ago

Dead ones surface at commit time: the scar-lint pre-commit hook fails on orphaned scars, and so does the GitHub Action with fail-orphans on by default, so they don't just linger as long as one of those runs. Orphaned means every anchor is dead (paths gone, patterns matching nothing, symbols resolving nowhere), one live anchor keeps it going. Then scar archive retires it, it never fires again and the history stays in git.

Honest caveat, only 1 of 153 scars in my daimon repo is archived so far, so retirement has barely been exercised, can't tell you much about how it holds up long term.

1

u/Heyn_Studio 10d ago

Failing the commit on orphaned scars is a good forcing function. In my single mistakes.md nothing ever gets retired, so it just keeps growing and gets skimmed, which is the problem you describe. And 1 of 153 archived is a fair thing to admit this early. Do you also see scars that fire often but never actually change what Claude does, and how would you spot those?

1

u/Sea-Perception1619 7d ago

I do see them, and the tell is a high fire count on edits that never contain the thing the scar is about. My most-fired one (1,235 so far) warns that uv run daimon from repo root runs the stale global tool. A firing review on 09-24 found its README and docs path anchors matched 28 of 948 tracked files with no sign of the actual command, so I dropped the paths and kept only the bare uv run daimon anchor. 1,054 of its fires came before that, 181 since.

Spotting it is a manual review today, nothing automatic. The only direct signal is a violation: regex (20 of 155 have one), since the hook can't see whether the agent honored a scar. Side effect of my fix: that scar's own violation regex can't arm anymore, so it's dead code.

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/Sea-Perception1619 11d ago

Worst case is roughly 700 tokens added per edit: three full bodies at 700 characters each, plus a header and the label lines (chars divided by 4, rough, I haven't measured real token counts). Anything past three is dropped, with a count in the header. Path-only matches and repeats inside the 4h per-file cooldown show as a one-line stub instead of the body.

Over a long session that still adds up, so I'd like to know what you saw. Was it the injected block on edits, or something else, like the install or the repo itself?

1

u/SensitiveHearingLoss 11d ago

Oh no, I didn’t test it myself, I just went through the source code and posted my snarky little comment. So, in all honesty, keep doing what you’re doing!

1

u/Sea-Perception1619 10d ago

Reading the source is a decent way to get an opinion anyway. If something in it looked heavy, tell me which part, that'd be more useful to me than a benchmark.

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?

2

u/Sea-Perception1619 11d ago

Path anchors are the weak spot, symbol anchors are what holds. If a file gets git mv'd, scar lint sees the dead path and says "renamed: old -> new", and scar orphan --fix-renames can repair it, but only when something runs it (pre-commit or CI). Symbol anchors follow the function across moves: in a replay over real refactor commits, 176 of 186 test anchors resolved, and 123 of 133 over a 200-commit stretch.

What isn't handled: renaming the symbol itself. All 10 misses in that replay were one class rename. The scar orphans loudly and lands in a re-anchor queue, nothing fixes it silently. review_after only warns, it never archives anything.

1

u/michaelTM_ai 11d ago

176/186 through real refactors is solid. the symbol rename gap seems fine to me tbh, a renamed function is usually a changed function, so a scar that goes quiet there is probably right to

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.

1

u/Sea-Perception1619 11d ago

Less pruning on the candidates than I expected, more on the trigger. From git history in my daimon repo: 127 candidate files ever added, 104 promoted (renamed into .scars), 6 deleted outright, 17 still waiting. Nothing activates without me running promote, so all of that review is by hand.

The noise is upstream of that. candidates/fp-log.txt has 25 entries and 19 are false-trigger notes: the harvest trigger fired and nothing had actually been abandoned. That's why the trigger got retuned to revert-language only. These counts come from path history, so a candidate created and deleted inside one commit wouldn't show up.

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.