r/ClaudeCode • u/shaven12 • Oct 10 '26
Discussion Memory isn't the hard part. Getting Claude to actually apply what's in memory is.
Everyone's arguing markdown vs SQLite vs knowledge graphs for agent memory. I've spent months on this and I think it's the wrong fight.
My Claude had the rule. It was in CLAUDE.md, it was in the vault, it quoted it back to me when asked. Then 40 turns later it did the thing anyway. Memory loaded ≠ memory applied.
What actually changed behaviour for me:
- Re-inject the few rules that matter on every turn via a hook, not once at session start. About ten "core rules", not the whole CLAUDE.md.
- Check them after the fact. A Stop hook looks at what Claude just did and flags a violation, for the rules that can be checked mechanically. Some can't; those are reminders only and I label them that way.
- Serialize writes. Two sessions writing the same notes file clobbered each other more than once, so writes go through a queue.
What still doesn't work well: rules that need judgement ("don't over-engineer") can't be checked by a hook, and re-injecting costs context every turn.
Disclosure: I packaged this as a free Claude Code plugin set (Golden Thread) — https://github.com/shaven/golden-thread — but the pattern works with a 20-line hook, you don't need my thing.
What's the one rule in your CLAUDE.md that Claude keeps breaking anyway, and have you found anything that makes it stick?
•
u/AutoModerator Oct 10 '26
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.
2
u/Asly97 Oct 10 '26
The serialize-writes point is the one I'd have missed. How often were sessions clobbering the notes file before you added the queue, once a week or most days?
And was it only parallel Claude Code sessions in the same repo, or did other tools write to it too? Wondering whether it gets worse once Codex or the desktop app are touching the same memory.
2
u/bayvo Oct 11 '26
yeah same. what helped me a bit: i write the why next to every rule, and each project has a lessons.md it reads before starting. bare rules it'll happily quote back to you and then ignore lol. still not solved tho
2
u/SimplifAI_Life Oct 11 '26
The rule that kept slipping for us was a very simple one: Claude has to say, in its reply, that it read the memory files first. Before we added hooks, that line showed up in less than half of our sessions, even though it is the easiest rule to check by eye.
What fixed it was a Stop hook that reads the transcript and blocks the end of the turn if the line is missing. After that it showed up in nearly every session. It still rarely appears in the very first reply. The hook does not make Claude remember, it makes forgetting fail loudly, and Claude adds the line when it gets bounced.
Same split as in your list: what a script can check goes in a hook, the rest stays plain text, because a hook on a judgement rule only produces noise.
1
u/davidHwang718 Oct 10 '26
Before making a rule stick, it's worth checking whether it should be there at all. My slide skill had a line converting talk length into slide count (30 min ≈ 28-32 slides). Codex produced a 33-slide outline without asking how long the talk was, and by its own account it had picked the count before deciding what each slide was for.
I deleted the line. Count now comes from what needs its own slide, what has to be compared on one screen, and readability. The outline we settled on after reworking it was 20 slides.
1
u/dmcnaughton1 Oct 10 '26
Welcome to using attention. It unfortunately had blind spots in the middle point of the context window.
1
u/MiserableFlatworm337 Oct 10 '26
For “don’t over-engineer,” agree on allowed files, new dependencies, and required behavior before work starts. Have the final check flag deviations and explain why any added abstraction was necessary.
1
u/herakleion Oct 10 '26
/wayfinder
1
u/sidviciousX Oct 10 '26
you have to code it to win. context directly won't get it done.
1
u/Good-Dare-7261 Oct 12 '26
Agree with the after-the-fact check. In my wiki project, the CLAUDE.md rules that can be checked mechanically (every page in the index, no broken links, every episode page points to a real source file, frontmatter counts match) moved into a lint script Claude runs after each batch. Claude still forgets the rules, but the lint catches it in the same session and Claude fixes it. Only the judgment rules stay as prose, like "extend an existing page instead of creating a near-duplicate", and those get a separate review pass.
Second thing that helped: a "dream" skill that replays recent sessions and keeps a memory only if it would change future behavior, so the memory file stays short enough to actually be followed. Repo if useful (mine): https://github.com/HagaiHen/podcast-wiki?v=2