Memory that survives restarts
Three layers, what each one is for, and what an always-on agent should own.
Every session starts with a fresh context window. What survives is on disk. There are three places it can live, and an always-on agent needs all three.
CLAUDE.md, which you write
Rules, commands, conventions. You know this one. The parts you may
not be using are .claude/rules/ with a paths:
frontmatter for instructions that only apply to some files, and the fact
that a project-root CLAUDE.md is re-read after /compact, so
it survives compaction while anything you only said in conversation does
not. If an instruction keeps getting lost, that is why, and the fix is
to move it into the file.
Auto memory, which Claude writes
Claude keeps its own notes per repository in
~/.claude/projects/<project>/memory/. A
MEMORY.md index, first 200 lines loaded every session, and
one topic file per memory that it reads on demand. It saves four kinds:
who you are, corrections you gave it, project decisions it cannot derive
from the code, and where to find things outside the repo. It skips
anything already in CLAUDE.md. /memory opens the folder;
everything in it is plain markdown you can edit or delete. When you see
“Saved 2 memories” in the interface, this is what happened. Subagents
can have their own with memory: project in the frontmatter,
kept separate from yours.
A vault of its own, which the agent owns
For everything else, a folder of markdown in git that the agent reads and writes and commits. You run this pattern in the pod vault already. The difference for an always-on agent is that it is the agent’s, not yours. A log it appends to at the end of every task. A folder of things it learned. Decisions with dates. The habit that makes it work is one line in CLAUDE.md: at the end of every task, write what you did and what you learned to the log, then commit.
That habit is also what makes restarts survivable. Session transcripts are local and get cleaned up on a retention schedule; the vault does not.
What not to put in any of them
Secrets. Not in CLAUDE.md, which gets committed. Not in auto memory.
Not in the vault, which syncs and backs up and gets grepped. An agent
that once reads a token from a file has that token in its transcript on
disk, and the only fix at that point is rotation. Keep secrets in the
keychain or an environment file the agent reads by name, and add a
Read deny rule for the file so it cannot open it by
accident. Guardrails has the syntax.
Read more
- Memory and CLAUDE.md, including auto memory and rules
- What survives compaction
- Sessions and where transcripts live
- Karpathy’s LLM wiki gist