Does Claude Code remember previous sessions?

The short answer is: some of it, by three different mechanisms, none of which is a record of what you actually did. That distinction is the whole of the answer, so it is worth spending four minutes on rather than four weeks of re-explaining.

The three things that do carry across

CLAUDE.md

Instructions you write, loaded at the start of every session. Excellent for standing rules — build commands, conventions, architecture. It is what you decided should always be true, not a record of anything.

Auto memory

Notes Claude writes itself, per repository, on by default. It stores your preferences and corrections. The index file loads every session; the detail files load only when Claude reaches for them.

--continue and --resume

Reopen a recent session in the current directory. For "I closed the terminal an hour ago", this is the right tool and nothing improves on it.

So the honest answer to the question is not "no". It has been "no" in a lot of writing about this, and that stopped being true.

What none of them carry

All three keep conclusions. None keeps the work.

Consider a Tuesday afternoon spent on a connection pooler. You try four configurations, three fail for different reasons, and the fourth works because transaction pooling rewrites the session and breaks named prepared statements. Six weeks later:

  • CLAUDE.md has it only if you stopped and wrote it down, which you did not, because you were debugging.
  • Auto memory may hold "prefers the direct connection" — a preference, not a reason. It deliberately skips what it judges derivable from the codebase.
  • --continue cannot reach it. The session is not recent and may not be in this directory.

The three failed attempts are the valuable part, and they are the part with no mechanism.

Four more limits worth knowing

One tool

All of it is Claude Code's. A session you ran in Codex, Cursor or Gemini CLI is invisible to every one of these mechanisms, and to Claude.

One machine

Auto memory is machine-local by design. Your laptop and your desktop do not share it.

Thirty days

Transcripts are deleted after cleanupPeriodDays, 30 by default. The raw record of what happened has an expiry date; auto memory is excluded from that sweep, the transcripts are not.

You have to ask

Resuming is deliberate. Mid-task, Claude cannot go and check whether it has solved this before, because nothing gives it a way to look.

Closing the gap

The transcripts are already on disk. Indexing them turns the record into something searchable, and registering the index as an MCP server is what lets the assistant search it without being asked:

mid-conversation, unprompted
> have we hit this pooler error before?
  recall_search returns the Tuesday session, including the
  three attempts that failed and why

Use it alongside the built-ins rather than instead of them. CLAUDE.md is still the right place for standing rules, and --continue is still the right way to reopen this morning's session. See what --continue does not do.

Questions

Does Claude Code remember previous conversations?

Partly. Three mechanisms carry things across: CLAUDE.md files you write, auto memory that Claude writes itself per repository, and --continue or --resume which reopen a recent session in the current directory. All three preserve conclusions. None of them preserves the work that produced the conclusions, and none of them can be searched by the assistant mid-task.

Where does Claude Code store its memory?

Auto memory lives in ~/.claude/projects/<project>/memory/, as a MEMORY.md index plus one file per topic. CLAUDE.md files live in the project, in ~/.claude/ and at a managed policy path. Session transcripts are separate, in ~/.claude/projects/<project>/<uuid>.jsonl.

How long does Claude Code keep session transcripts?

Thirty days by default. Anthropic's documentation states that clients store transcripts locally in plaintext under ~/.claude/projects/ for 30 days to enable session resumption, and that the period is set by cleanupPeriodDays. The auto memory directory is excluded from that cleanup; the transcripts are not.

Can Claude Code see sessions from Cursor, Codex or Gemini CLI?

No. Every built-in memory mechanism is scoped to Claude Code. Each tool writes its own transcripts in its own format in its own directory, and none of them reads another's. An index that reads all six formats is what makes one history span them.

Is auto memory the same as a memory MCP server?

No. Auto memory is notes Claude chooses to write about your preferences and corrections, per repository, on your machine. A memory MCP server is a tool the assistant can call. They answer different questions and work together.

Why does Claude forget things inside one long session?

That is compaction rather than memory. When a session outgrows the context window it is summarised and the conversation continues from the summary, which keeps conclusions and drops reasoning. The full transcript stays on disk.