Does Claude Code have memory? What persists between sessions

Nov 2026 · Project memory · 11 min read · Facts checked 25 November 2026

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 a MEMORY.md index 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.

MechanismWho writes itWhere it livesWhen Claude reads itWho shares it
Managed CLAUDE.mdYour IT or DevOps team/etc/claude-code/CLAUDE.md on Linux and WSL; a system folder on macOS and WindowsEvery session, ahead of user and project filesEveryone on that machine
User CLAUDE.mdYou~/.claude/CLAUDE.mdEvery sessionOnly you, in every project
Project CLAUDE.mdYou and your team./CLAUDE.md or ./.claude/CLAUDE.mdEvery session started in or below that folderYour team, through source control
Local CLAUDE.mdYou./CLAUDE.local.md (add it to .gitignore)Every session in that projectOnly you
RulesYou and your team.claude/rules/*.mdAt launch, or only when Claude touches matching files if the rule sets pathsYour team, through source control
Auto memory indexClaude~/.claude/projects/<project>/memory/MEMORY.mdFirst 200 lines or 25KB at session start, when auto memory is onOnly that machine
Auto memory topic filesClaudeSame folder, one file per memoryOn demand, when Claude decides it needs oneOnly that machine
Session transcriptClaude Code~/.claude/projects/<project>/<session-id>.jsonl, in a folder named after the working directoryOnly when you resume that sessionOnly 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:

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:

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:

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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:

  1. Start with /init to 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".
  2. Write instructions you can check. The docs' own examples: "Run npm test before committing", not "Test your changes".
  3. Confirm what loaded. Run /context all and look under Memory files. If a file that should load at launch isn't listed, Claude can't see it.
  4. 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.
  5. Move procedures out. Multi-step workflows belong in skills and folder-specific rules in .claude/rules/ with paths, so they load only when relevant.
  6. Use hooks for anything that must happen. Formatting, tests before commit and blocked paths belong in hooks or permissions.deny, not in prose.
  7. Review your auto memory regularly. Open the folder from /memory. Each note is plain Markdown, and Claude Code records a modified timestamp 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:

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

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.