What Claude Code Remembers Between Sessions
A beginner’s map of what Claude Code remembers: CLAUDE.md, auto memory, resumed chats, limits and quick fixes
By Alek Perak, founder of TokenRip
When Claude Code seems to forget, identify what is missing: a standing instruction, a saved preference, a previous conversation or the state of unfinished work. Each belongs in a different place. Adding everything to one large instruction file makes the next diagnosis harder.
What Claude Code remembers between sessions
Claude Code carries knowledge forward in two ways (Claude Code docs (https://code.claude.com/docs/en/memory)):
- CLAUDE.md: instructions you write, like build commands, conventions and rules.
- Auto memory: notes Claude saves from your corrections and preferences.
Both arrive as context, not as enforced rules. If something must happen every time, use a hook instead.
The conversation itself doesn’t load into a new session. To reopen a past chat on the same machine, run claude — continue for the latest one or claude — resume to pick one.
How is CLAUDE.md different from auto memory?
CLAUDE.md is what you tell Claude. Auto memory is what Claude tells itself.
- Who writes it: CLAUDE.md: You; Auto memory: Claude
- What it holds: CLAUDE.md: Rules, commands, conventions; Auto memory: Preferences, corrections, decisions
- How much loads: CLAUDE.md: The whole file; Auto memory: First 200 lines or 25KB of MEMORY.md
- Scope: CLAUDE.md: Organization, user, project or local; Auto memory: One repo, one machine
- Default: CLAUDE.md: Always on; Auto memory: On in local sessions
Claude doesn’t save something every session. When it does, you’ll see “Saved 2 memories” or “Recalled 2 memories.”
Where do Claude Code memory files live?
Each layer has its own file:
- User: ~/.claude/CLAUDE.md. Only you, every project.
- Project: ./CLAUDE.md or ./.claude/CLAUDE.md. Shared through git.
- Local: ./CLAUDE.local.md. Gitignored, only you, this project.
- Managed: a system path your IT team deploys.
- Auto memory: ~/.claude/projects/<project>/memory/. A MEMORY.md index plus one file per memory.
These are plain files. You can open, edit or delete them any time.
How to set up CLAUDE.md as a beginner
Start small and grow it. Here’s a simple path:
- Run /init in your project. Claude drafts a CLAUDE.md for you.
- Cut it down. Keep build commands, test commands and must-follow rules.
- Point to detail. Use @path/to/file to import a file, up to four hops deep.
- Add folder rules. A CLAUDE.md in a subfolder loads when Claude works there.
- Scope by file type. A file in .claude/rules/ with paths frontmatter loads only for matching files.
Our own files at TokenRip stay near 150 lines. Each one covers the basics and then names the file to open for a given kind of task, like testing.
Should you keep auto memory on?
That’s your call, and it’s easy to change. You can turn it off with the toggle in /memory, with “autoMemoryEnabled”: false in settings, or with CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.
Get Alek Perak’s stories in your inbox
Join Medium for free to get updates from this writer.
We keep it off at TokenRip. We prefer decisions that carry a date and a reason, so we can tell what still holds. We also like a smaller context window. If you’re solo and want Claude to learn your habits, leaving it on is reasonable. Open the memory folder now and then and delete notes that are out of date.
What is the Claude Code memory limit?
Auto memory loads the first 200 lines or 25KB of its index, whichever comes first. Topic files load only when needed. CLAUDE.md has no hard cap, but you get a warning in /status when a file runs long.
Why does Claude Code seem to forget things?
Usually a file didn’t load, or the rule is too vague. Check in this order:
- Run /context and look under Memory files. If a file isn’t there, Claude can’t see it.
- Look for conflicts between files. Make rules specific: “use 2-space indentation,” not “format code nicely.”
- Check chat-only rules. A rule you gave only in chat can get lost after /compact. Put it in the project-root CLAUDE.md, which Claude re-reads from disk.
- Check AGENTS.md. If it’s ignored, a CLAUDE.md on the path is usually why.
How to keep work in progress between sessions
Rules live in CLAUDE.md, but the task in progress needs a file too. Keep a plan and a short notes file with decisions and why. Add one line to CLAUDE.md: “Read docs/notes.md first and update it before you stop.”
A shared file can record task ownership. If several agents claim work at once, you also need a reliable rule or mechanism for resolving simultaneous claims.
Disclosure: I’m the founder of TokenRip, a shared workspace for that next step. Claude Code and your other agents load the same pinned decisions, files and open tasks, and every change records why. TokenRip doesn’t read your CLAUDE.md or auto memory, and build commands stay in the repo. See https://tokenrip.com.
Reproduce the missing-context problem
Suppose a fresh session runs the wrong test command. Put the correct command in the project instruction file, start another session from the same directory and ask which file supplied that command. Then check the actual command it proposes. If the file loaded but the command is still wrong, look for conflicting instructions; if it never loaded, investigate the path. Change one thing at a time so you can tell what fixed the problem.






