Claude Code memory works through two things that load at the start of every session. CLAUDE.md holds instructions you write. Auto memory holds notes Claude writes itself from your corrections. A new session starts with an empty context window, so anything else you said is not there. claude --continue or claude --resume reopens an old conversation, but only CLAUDE.md and auto memory carry into a fresh one.
| CLAUDE.md files | Auto memory | |
|---|---|---|
| Who writes it | You | Claude |
| What it holds | Instructions and rules | Learnings and patterns |
| Scope | Project, user or organization | Per repository, shared across worktrees |
| Loaded | Every session | Every session (first 200 lines or 25KB) |
Source: Claude Code's memory documentation, read on 9 October 2026. Claude treats both as context, not as enforced configuration.
What carries over into a new session: CLAUDE.md and auto memory
CLAUDE.md: the rules you repeat
- Keep it under 200 lines. Longer files use more context and reduce adherence. Rules for part of the codebase go in
.claude/rules/, which load only when Claude works with matching files. - Imports organize, they do not shrink. Files pulled in with
@path/to/fileload at launch too. - Be specific. The more concise and specific the instruction, the more consistently Claude follows it.
Auto memory: notes Claude writes
Each project gets ~/.claude/projects/<project>/memory/, with a MEMORY.md index and one file per topic.
- Machine-local. All worktrees of the same git repository share it; other machines do not.
- The index has a limit. Only the first 200 lines or 25KB of
MEMORY.mdload. Keep one line per entry, detail in topic files. - You can read and change it. The files are plain Markdown.
/memorylists them and holds the on/off toggle.
How to choose
| You want to... | Use |
|---|---|
| Fix the build and test commands, conventions, off-limits folders | CLAUDE.md |
| Have Claude remember a correction you made once | Auto memory |
| Apply a rule to only some folders | A file in .claude/rules/ |
| Share rules with teammates | Commit the project CLAUDE.md (auto memory stays on your machine) |
| Make sure something never happens | A PreToolUse hook, not memory |
| Share what several agents learn on one project | Crewly remember and recall (below) |
Five-minute setup
- Write a short CLAUDE.md at the project root: build command, test command, conventions, off-limits folders.
- Run
/memoryand check CLAUDE.md is listed and auto memory is on. - Correct Claude once in plain words, such as "we run tests with the
checkscript, nottest", then look in the memory folder for the saved note. - After a week, open
MEMORY.md, delete stale lines and merge duplicates.
When you run several agents
CLAUDE.md and auto memory assume one person and one session. Crewly, the open-source tool we make, adds two skills for a team of agents. remember stores a note with scope agent (personal) or project (shared by every agent on the project). recall searches the saved notes. A new decision can name the old one with --supersedes, so agents stop treating the old one as current. This does not replace CLAUDE.md. Setup: How to run multiple agents in Claude Code.
FAQ
Does Claude Code remember things between sessions?
Yes, through two mechanisms: CLAUDE.md files you write and auto memory Claude writes. Both load at the start of every new conversation. Only they carry into a fresh session; claude --continue or --resume reopens an old conversation instead.
Where does Claude Code store auto memory?
In ~/.claude/projects/<project>/memory/, with a MEMORY.md index. It is machine-local and shared by all worktrees of the same repository.
How big can MEMORY.md be?
The first 200 lines or 25KB load at the start of every conversation. Content beyond that does not, so keep one line per entry.
Sources
How Claude remembers your project, read on 9 October 2026. Crewly memory: the remember and recall skill definitions in the Crewly repository, checked on 9 October 2026.