Does Claude Code have memory? What persists between sessions
Yes, but only what is written to disk. Every Claude Code session starts with a fresh context window, and three things carry over: the CLAUDE.md instruction files you write, the auto memory notes Claude writes for itself, and session transcripts you can reopen with claude --continue or claude --resume. Auto memory and transcripts stay on the machine that wrote them, CLAUDE.md travels only if you commit it, and none of them records who owns which task when several agents work on the same project.
This article is for founders and developers who run Claude Code on real projects and want to know exactly what it keeps, where, and what you still have to carry yourself. Everything about Claude Code below comes from Anthropic's own documentation, checked in November 2026.
Key takeaways
- Anthropic's documentation says each Claude Code session "begins with a fresh context window"; memory is files that load at the start of the next one.
- CLAUDE.md files are instructions you write. Auto memory is notes Claude writes for itself in
~/.claude/projects/<project>/memory/, with aMEMORY.mdindex of which only the first 200 lines or 25KB load at start-up. - Resuming a session restores its conversation from a local transcript. Transcripts are deleted after 30 days by default; auto memory files are kept until you or Claude remove them.
- Both CLAUDE.md and auto memory are context, not enforced rules. The docs point to hooks and managed settings for anything that must always happen.
- Auto memory is machine-local and the main conversation's memory isn't loaded into subagents, so on its own it doesn't coordinate several agents on one plan.
What does Claude Code remember between sessions?
Anthropic's Claude Code memory page, "How Claude remembers your project", describes two mechanisms that carry knowledge across sessions: CLAUDE.md files and auto memory. A third, session resume, is covered on the "Manage sessions" page. They differ in who writes them, where they live and when Claude actually reads them. Third-party MCP memory servers exist too; this article covers only what Claude Code ships with.
The table below sorts each mechanism by scope. As of November 2026, it is our own summary of the two pages.
| Mechanism | Who writes it | Where it lives | When Claude reads it | Who shares it |
|---|---|---|---|---|
| Managed CLAUDE.md | Your IT or DevOps team | /etc/claude-code/CLAUDE.md on Linux and WSL; a system folder on macOS and Windows | Every session, ahead of user and project files | Everyone on that machine |
| User CLAUDE.md | You | ~/.claude/CLAUDE.md | Every session | Only you, in every project |
| Project CLAUDE.md | You and your team | ./CLAUDE.md or ./.claude/CLAUDE.md | Every session started in or below that folder | Your team, through source control |
| Local CLAUDE.md | You | ./CLAUDE.local.md (add it to .gitignore) | Every session in that project | Only you |
| Rules | You and your team | .claude/rules/*.md | At launch, or only when Claude touches matching files if the rule sets paths | Your team, through source control |
| Auto memory index | Claude | ~/.claude/projects/<project>/memory/MEMORY.md | First 200 lines or 25KB at session start, when auto memory is on | Only that machine |
| Auto memory topic files | Claude | Same folder, one file per memory | On demand, when Claude decides it needs one | Only that machine |
| Session transcript | Claude Code | ~/.claude/projects/<project>/<session-id>.jsonl, in a folder named after the working directory | Only when you resume that session | Only that machine |
Two details in that table catch people out. First, CLAUDE.md files in subfolders don't load at launch: the docs say each one loads "once Claude reads, writes, or edits another file in that subdirectory". Second, all the files that do load are concatenated rather than overriding each other, so two contradictory instructions both reach Claude, and the docs warn that it "may pick one arbitrarily".
If a repository uses AGENTS.md instead, the same page says Claude Code v2.1.277 or later reads it as the project instructions, but by default only when there is no CLAUDE.md or CLAUDE.local.md in the working directory or above it.
How does Claude Code's auto memory work?
Auto memory is the part that answers "does it remember what I told it last week?". According to the documentation, it is on by default in local sessions, and Claude saves four kinds of note, recorded as a type in each file's front matter:
user: your role, expertise and working preferences;feedback: corrections you give and approaches you confirm;project: ongoing work, deadlines and decisions that can't be derived from the code or git history;reference: where to find things outside the project, such as an issue tracker.
The docs are explicit about what it leaves out: anything Claude can derive from the codebase, such as architecture or file paths, and anything your CLAUDE.md already says. Claude also doesn't save something every session; it decides whether a note would be useful later.
The mechanics, as Anthropic's documentation describes them:
- Storage. One folder per project at
~/.claude/projects/<project>/memory/. The project is derived from the git repository, so every worktree and subfolder of one repo shares a single memory folder. - Loading. Only the
MEMORY.mdindex loads at session start, up to 200 lines or 25KB, whichever comes first. Topic files are read when needed. If the index runs past the limit, Claude Code tells Claude to rewrite it, because everything past the limit is dropped on the next load. - Retention. Claude Code deletes old transcripts after the
cleanupPeriodDaysperiod, but the docs say memory files are excluded from that sweep and stay until you or Claude edit or delete them. - Control.
/memorylists your memory files, opens the auto memory folder and toggles the feature. You can also set"autoMemoryEnabled": falsein a project's settings, orCLAUDE_CODE_DISABLE_AUTO_MEMORY=1in the environment. - Asking. When you say "remember that the API tests require a local Redis instance", Claude saves it to auto memory. To put it in CLAUDE.md instead, the docs say to ask for that directly or edit the file through
/memory.
The limits matter as much as the features. The docs state that auto memory "is machine-local" and that files "are not shared across machines or cloud environments". They also say the main conversation's auto memory isn't loaded into subagents, except a fork of the current conversation; a subagent can keep its own, separate memory folder.
What does resuming a Claude Code session restore?
Resume is closer to "pick up the same conversation" than to memory. Anthropic's "Manage sessions" page says sessions are saved continuously to local transcript files, stored as JSONL under ~/.claude/projects/<project>/. You get them back with:
claude --continue, which reopens the most recent session in the current folder;claude --resume, which opens a picker, or takes a session name or ID.
A resumed session restores the conversation history, the model and, when you resume from a terminal with --continue or a session name or ID, the permission mode. If the session was compacted, it continues from the compaction summary rather than the full earlier messages. Some launch flags, such as --add-dir, have to be passed again.
Two cautions from the same page. Transcripts are kept for 30 days by default (cleanupPeriodDays), after which an unused session silently drops out of the resume picker. And if you resume one session in two terminals at once, both write to one transcript and messages from one of them can go missing later; the documented fix is --fork-session.
Is Claude Code memory the same as memory in the Claude app?
No, though the two are easy to confuse. Anthropic's help centre article "Use Claude's chat search and memory to build on previous context" covers memory and past-chat search in Claude chats and Cowork tasks, switched on and off under Settings. Claude Code's memory is the set of files described above, which you can open, edit and commit.
What doesn't Claude Code memory cover?
Claude Code's memory is built for one developer on one machine, and the documentation is candid about that. In our view, four gaps matter once a project has more than one session running at a time.
- It is advice, not enforcement. The memory page says CLAUDE.md and auto memory "aren't enforced configuration" and recommends a PreToolUse hook "to block an action regardless of what Claude decides". A line in CLAUDE.md saying "only touch the billing module" is a request.
- It stays on one machine. Auto memory and transcripts live under
~/.claude/. A second developer, a cloud session or a different agent on another laptop starts without them. Only CLAUDE.md travels, and only through git. - It has no notion of ownership. Nothing in CLAUDE.md, auto memory or a transcript says which task a session holds, so two sessions can pick up the same work. We cover how that goes wrong in what breaks when agents share task state.
- It doesn't record decisions as decisions. Auto memory may note a decision, but it is Claude's private note with no record of who made the call or whether anyone confirmed it. The next agent can't tell a guess from an agreed rule.
None of this is a flaw for a solo developer working in one repository. It becomes a problem the moment you hand work from one agent to another, which is the subject of our agent handoff checklist.
How do you make Claude Code memory hold up?
A short checklist, built from Anthropic's guidance:
- Start with
/initto generate a CLAUDE.md from the codebase, then cut it. Anthropic's documentation recommends under 200 lines per file, because longer files "consume more context and reduce adherence". - Write instructions you can check. The docs' own examples: "Run
npm testbefore committing", not "Test your changes". - Confirm what loaded. Run
/context alland look under Memory files. If a file that should load at launch isn't listed, Claude can't see it. - Promote corrections you repeat. When you give the same correction twice, move it from auto memory into CLAUDE.md so your team gets it too. Auto memory stays on your machine; CLAUDE.md goes through review.
- Move procedures out. Multi-step workflows belong in skills and folder-specific rules in
.claude/rules/withpaths, so they load only when relevant. - Use hooks for anything that must happen. Formatting, tests before commit and blocked paths belong in hooks or
permissions.deny, not in prose. - Review your auto memory regularly. Open the folder from
/memory. Each note is plain Markdown, and Claude Code records amodifiedtimestamp when Claude writes one with front matter, so stale entries are easy to spot.
A worked example: three layers of project memory
Here is how the layers fit together on a project run with LatticeRun, our product, where several agents share one plan. It shows where each kind of knowledge belongs; the record wording is illustrative.
Layer 1: CLAUDE.md, in the repository. Short house rules that apply before an agent has connected to anything. LatticeRun's Agent Guide suggests a short snippet; here is an abridged excerpt:
## LatticeRun holds the plan
You are connected to LatticeRun over MCP. The tree is the plan of record — not
this file, and not your own notes.
1. Do not write code before claiming the work: `latticerun_start_task`. It hands
you the project brief, bounded current Project Memory and Project Plan context. Read them and follow them.
…
3. Finish each piece with `latticerun_complete_task` and one honest sentence on
what actually changed — its successful checkout writes a proposed Project Memory checkpoint.
…
You may only change the branch you have claimed.
Layer 2: the brief, in LatticeRun. The per-project brief (called agent.md in the app, though it isn't a file) holds what you would tell a new colleague over coffee: stack, constraints, conventions. Agents receive it on every claim and rewrite it when they finish.
Layer 3: Project Memory, in LatticeRun. Durable state for whoever comes next, such as:
- Decision, approved: "Payments go through Stripe Checkout only; no card fields in our own UI."
- Checkpoint, proposed: "Webhook handler retries on 5xx; idempotency key is the event id."
- Handoff, proposed: "Refund flow half done; next step is the email template; tests pass locally."
When an agent claims a task with latticerun_start_task, the MCP connector hands back the brief, the task's place in the tree and a bounded, trust-labelled Project Memory bundle, in which proposed agent records stay distinct from approved or verified facts. A successful latticerun_complete_task writes a proposed checkpoint, so the next session learns what happened without anyone pasting notes. Only one agent can hold a claim on a branch at a time, which closes the ownership gap above, and in Strict mode (where new projects start) a write outside the claimed branch is refused. How claims keep several agents on one plan is explained in agent task trees.
You don't need LatticeRun to use this split: a well-kept CLAUDE.md plus a handoff note, or a committed plan file from Claude Code's plan mode, in the repository covers a lot of it. The shared layers are the part Claude Code's own memory leaves out. LatticeRun's planner starts free, with projects kept in your browser; the MCP connector, agents, Project Memory and the Project Plan are on paid plans, from Solo Pro at $12/month.
Frequently asked questions
Can my team share Claude Code's auto memory?
Not directly. Anthropic's documentation says auto memory is machine-local and isn't shared across machines or cloud environments. The documented way to share knowledge is a project CLAUDE.md committed to the repository, so promote the notes your team needs into it.
Does /compact make Claude Code forget CLAUDE.md?
The project-root CLAUDE.md survives. According to the memory documentation, Claude Code re-reads it from disk after /compact; CLAUDE.md files in subfolders and path-scoped rules load again when Claude next touches a matching file. Instructions you only gave in the chat are the ones that can disappear.
Can I move auto memory somewhere else?
Yes. The docs describe an autoMemoryDirectory setting that takes an absolute path or one starting with ~/. Pointing it at a synced folder is your own choice to make; Anthropic documents only the setting, not syncing.
Sources
- How Claude remembers your project — Anthropic, Claude Code Docs
- Manage sessions — Anthropic, Claude Code Docs
- All settings: cleanupPeriodDays — Anthropic, Claude Code Docs
- Use Claude's chat search and memory to build on previous context — Anthropic, Claude Help Center
- Agent Guide: keeping an agent on the plan — LatticeRun
- MCP connector for Claude Code and other agents — LatticeRun
Related articles
- What is Claude Code plan mode, and how do you use it? — How Claude Code's plan mode works, from Shift+Tab and /plan to the approval options, and what to do when one approved plan has to guide several sessions.
- What breaks when agents share task state — Conflicting writes, stale context, handoffs that lose the reason: how shared task state fails when agents work in parallel, and what helps with each.
- A project planner that works with Claude and other AI agents — A visual task-tree planner, and how Claude Code and other MCP agents claim work and report back. The planner starts free; agents are on Solo Pro, $12/month.
Keep your agents on one plan
LatticeRun gives each coding agent the brief, Project Memory and its claimed branch over MCP. The planner is free; agents are on Solo Pro, $12/month.