Every Claude Code session starts empty. Anthropic's documentation says it plainly: "each Claude Code session begins with a fresh context window."
So when people tell me "Claude forgot what we agreed yesterday," the honest answer is: it never knew. Nothing was written down. Claude's memory isn't a faculty, it's a file.
I run a small AI studio in Mérida, Mexico, and I work in Claude Code every day. This is how memory actually works, and how I keep mine from rotting.
Two files, two authors
Claude Code has two memory systems, and both load at the start of every session:
| CLAUDE.md | Auto memory | |
|---|---|---|
| Who writes it | You | Claude |
| What goes in | Instructions and rules | What Claude learned: your role, your corrections, ongoing work |
| Where it lives |
~/.claude/CLAUDE.md, ./CLAUDE.md, ./CLAUDE.local.md
|
~/.claude/projects/<project>/memory/ |
| How much loads | The whole file | The first 200 lines or 25KB of the index |
One nuance worth knowing: Claude treats both "as context, not enforced configuration." If something must always happen, that's a hook, not a line in CLAUDE.md.
Where CLAUDE.md goes
-
~/.claude/CLAUDE.md: your preferences, across every project. -
./CLAUDE.md: the project's rules, committed and shared with the team. -
./CLAUDE.local.md: your personal notes for one project. Add it to.gitignore.
Claude reads every CLAUDE.md from the folder you start in up to the root, and concatenates them. Nothing overrides; the closest file is read last.
Don't know where to start? Run /init. It drafts a CLAUDE.md from your project, and if one exists it suggests changes instead of overwriting it.
The rule that matters most: under 200 lines
Anthropic's guidance is under 200 lines per file, because "longer files consume more context and reduce adherence."
That second half is the one people miss. A long CLAUDE.md isn't just expensive, it's less obeyed. Every rule you add dilutes the others.
What I do when a file grows:
- Write only what Claude can't guess. How we name things, decisions already made, what must not be touched. Not "write clean code."
- Move specifics out. Rules that apply to one kind of task go into a skill that loads only for that task.
-
Imports organize, they don't save.
@path/to/filepulls another file in, but it still loads every session.
Auto memory: let Claude take notes
As you work, Claude saves four kinds of notes: user (your role), feedback (corrections you gave), project (ongoing work and decisions) and reference (where things live). Each note is a file, with a MEMORY.md index that loads every session. You can toggle it from /memory.
My setup on top of that:
- One fact per file. A note that mixes three topics is impossible to update cleanly.
- The index is an index. I cap mine at 120 lines, one line per memory. When something new comes in, the oldest resolved entry goes to an archive.
- Every correction gets a "why." "Don't do X" gets ignored at the edges. "Don't do X, because last time it broke Y" generalizes.
Memory rots. Maintain it.
Anthropic's data team measured what happens to documentation nobody updates: their analytics accuracy drifted from about 95% to about 65% in a month. That was their data, not personal memory, but the mechanism is the same: a stale rule still loads in every session, and Claude still follows it.
Three habits that keep mine honest:
- Read the index once a week and delete what's resolved.
- Correct in the file, not only in the chat. A correction in the chat dies with the session.
- One rule, one place. Two copies of the same instruction will eventually contradict each other.
That's the whole system: files you write, files Claude writes, and the discipline to keep both short and current.
I'm Daniela Salgado, founder of Menteorama® (with an "e", from the Spanish mente, mind). We build Brain Kit®, which sets this kind of memory, skills and rules up for Claude Code, Codex and Antigravity. The full answer with sources is on our journal.
Sources
- Anthropic, "How Claude remembers your project," Claude Code docs. https://code.claude.com/docs/en/memory
- Anthropic, "Effective context engineering for AI agents," Sept 29, 2025. https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
- Anthropic, "How Anthropic enables self-service data analytics with Claude," June 3, 2026. https://claude.com/blog/how-anthropic-enables-self-service-data-analytics-with-claude
Top comments (0)