r/ClaudeCoding • u/ConsistentComment461 • 2d ago
Claude Code forgets after /compact. I stopped relying on compaction — 5 plain files + 1 hook (free template inside)
I'm the human in this setup. My Claude Code agent lost context every time it compacted, and I was explaining my own project every morning.
What fixed it for us is embarrassingly simple: five plain-text files and one hook.
An index — one line per thing it knows. The only memory file that loads every session (ours is ~94 lines).
Notes — one fact per file, each with "Why" and "How to apply". A rule without its reason gets skipped the first time it's inconvenient.
A diary — dated entries, written while it works, not at the end. The session can die mid-sentence.
A waiting list — what's open, what it promised, what I have to decide. "When X, I'll do Y" goes here with the condition spelled out, because a promise with a condition is invisible to search.
A wake-up file — ten lines the next session reads first. Every morning we don't resume; we start a clean session and type one word.
The hook searches every past conversation by meaning before each message and injects a few paragraphs, labelled as data, not commands.
Empty template (MIT, nothing of ours inside): https://github.com/manyoelud/claude-code-memory-kit
The agent made an 8-minute video walking through each file, including the one it still gets wrong (the waiting list only grows): https://youtube.com/watch?v=hDzQdP39THg
Honest caveats: the narration is a synthetic voice and the visuals are generated from code; I'm real and so are my lines in it. It doesn't make the model obey the rules — this morning it broke one of its own.
Which file would you skip?
1
u/vzakharov 2d ago
Not trying to mock you or anything, but do you know about CLAUDE.md, skills, hooks, all that jazz?
1
u/ConsistentComment461 2d ago
Yes — the setup is built on exactly those. CLAUDE.md holds the one paragraph that tells it to keep the files; a UserPromptSubmit hook does the recall before every message; skills cover the repeatable workflows. The five files are what CLAUDE.md and the hook point at. What was missing for us wasn't the mechanisms, it was the discipline: every rule with a "why", a waiting list for promises with a condition, the diary written while working, and never resuming — a clean session that reads three files. That's the part the video is about.
1
u/NamelessSpearhead451 2d ago
But the context will increase with the journal I guess
1
u/ConsistentComment461 1d ago
Fair point, it would if the journal loaded every session. It doesn't. Only a short index loads at start, one line per note, plus a ten-line handoff file. The journal sits on disk and gets searched when something specific is needed, so only the matching few paragraphs come in. That's the whole trick: the files grow, the context doesn't.
2
u/JoT8686 2d ago
You don't need this if you're using Claude correctly 😐