CounterpartsGuideClaude Code memoryDirectory

A guide to memory in Claude Code

Does Claude Code remember between sessions?

Updated · checked against Anthropic’s Claude Code docs

Partly. Every Claude Code session starts with a fresh context window, so a new session doesn’t see your earlier conversations. Two things do carry over: CLAUDE.md files, instructions you write that load at the start of every session, and auto memory, short notes Claude writes for itself in a folder on your machine. To pick up an earlier conversation itself, resume it with claude --continue or claude --resume.

This guide covers what each of those does, what Claude Code doesn’t remember, and the memory plugins and MCP servers people add, with a short guide to which you might want. Every claim about Claude Code links to its documentation.

Who wrote this: Counterparts, one of the memory systems compared below. We’ve tried to be fair to all of them, and for most coding work you won’t need any of them.

Built in

What Claude Code remembers out of the box

Claude Code has two kinds of memory, and both are plain markdown files on your machine. It can also reopen an old conversation, and it keeps some things through a long session’s summary.

1. CLAUDE.md: instructions you write

A CLAUDE.md file is where you write down what you’d otherwise re-explain: build and test commands, coding standards, how the project is laid out, “always do X” rules. Claude reads it at the start of every session. You can put one in four places, from broadest to most specific:

ScopeWhereWho gets it
Organization/Library/Application Support/ClaudeCode/CLAUDE.md on macOS (set by IT)Everyone on that machine
You~/.claude/CLAUDE.mdJust you, in every project
Project./CLAUDE.md or ./.claude/CLAUDE.mdYour team, through git
You, in this project./CLAUDE.local.md (add it to .gitignore)Just you, in this project
  • Claude Code loads every CLAUDE.md from the folder you start in and every folder above it, and adds them together rather than letting one replace another. A CLAUDE.md in a subfolder loads when Claude reads files there.
  • A CLAUDE.md can pull in other files with @path/to/file imports. Imported files still load at the start, so they help you organize but don’t save space.
  • For bigger projects, files in .claude/rules/ can be scoped to paths like src/api/**/*.ts, so they load only when Claude works on matching files.
  • Run /init and Claude writes a starting CLAUDE.md from your codebase. Anthropic suggests keeping each file under 200 lines: longer files use more context and are followed less reliably.
  • If your repository uses AGENTS.md and has no CLAUDE.md, recent versions of Claude Code read the AGENTS.md instead.

2. Auto memory: notes Claude writes for itself

Auto memory is on by default in local sessions. As it works, Claude decides what would be useful next time and saves it as a short note. There are four kinds: who you are and how you like to work, corrections you gave it and approaches you confirmed, ongoing project work and decisions it can’t see in the code, and where to find things outside the project (an issue tracker, a dashboard). It skips anything it can work out from the code, and anything your CLAUDE.md already says.

  • The notes live in ~/.claude/projects/<project>/memory/: a MEMORY.md index plus one file per note. All worktrees of the same git repository share one folder.
  • At the start of every session Claude Code loads the first 200 lines or 25KB of MEMORY.md, whichever comes first. The notes themselves aren’t loaded; Claude opens them when it needs them.
  • Saying “remember that the API tests need a local Redis” saves it to auto memory. When you see “Saved 2 memories” or “Recalled 2 memories”, that’s this folder being written or read.
  • To turn it off, use the toggle in /memory, set autoMemoryEnabled to false in a project’s settings, or set CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.

3. /memory: see and edit all of it

Type /memory in a session to list your CLAUDE.md files, open any of them in your editor, open the auto memory folder, or switch auto memory on or off. Everything is plain markdown you can read, edit or delete. To check which files actually loaded into the current session, run /context.

4. Resuming a conversation

Claude Code saves every conversation as you go, so you can come back to one. claude --continue reopens the most recent conversation in the current folder; claude --resume opens a list to pick from; /resume switches conversations from inside a session. A resumed session gets back the full history, including tool calls and results.

The transcripts are stored as JSONL files in ~/.claude/projects/<project>/ and deleted after 30 days by default (the cleanupPeriodDays setting). Auto memory files are left out of that cleanup.

5. What survives /compact

When a long session fills up, Claude Code summarizes the conversation to make room. After compaction, the project-root CLAUDE.md and auto memory are read again from disk. An instruction you only ever gave in the chat can get lost in the summary, which is a good reason to put it in CLAUDE.md.

Side by side

CLAUDE.md vs auto memory

In short: CLAUDE.md is what you tell Claude; auto memory is what Claude tells itself. The two work together, and Anthropic’s comparison comes down to this:

QuestionCLAUDE.mdAuto memory
Who writes itYouClaude
What’s in itInstructions and rulesThings it learned: your preferences, your corrections
ScopeOrganization, you, or a projectOne repository, shared across its worktrees
LoadedEvery sessionEvery session (first 200 lines or 25KB of the index)
Good forCoding standards, workflows, project layoutPreferences, corrections, context the code doesn’t show

Neither is enforced. Claude treats both as context and tries to follow them, and vague or conflicting instructions get followed less reliably. For something that must happen every time, like a check before each commit, Anthropic points to hooks instead.

The edges

What Claude Code doesn’t remember

  • Your earlier conversations, in a new session. A new session sees only what’s in CLAUDE.md and auto memory. The conversation itself comes back only if you resume it.
  • Anything past the top of the index. Only the first 200 lines or 25KB of MEMORY.md load at the start. Claude Code reminds Claude to keep the index short, and anything past the limit is dropped from the next load.
  • Anything on another computer. Auto memory is machine-local: it isn’t shared across machines or with cloud sessions. A project CLAUDE.md committed to git is the exception, because it travels with the repository.
  • Old transcripts, after 30 days. By default, conversations older than that are deleted, so they can no longer be resumed.
  • Nothing fades or grows on its own. Notes stay exactly as written until you or Claude edit or delete them. Keeping them current is up to Claude’s judgement and yours.
  • It’s memory for the work. Auto memory’s four kinds of note are about you as someone to work with, the project, and where things are. It isn’t built to give Claude a memory of its own.

Add-ons

Memory plugins and MCP servers for Claude Code

Claude Code can connect to outside tools through MCP servers (added with claude mcp add), and plugins can bundle skills, hooks and MCP servers (installed with /plugin install). Memory systems use these to plug in. Here are the ones in our directory, each in a sentence or two, with what to keep in mind. Each one’s directory page goes further, including how it compares with the way human memory works.

claude-mem

A Claude Code plugin that takes notes on your coding sessions for you. A second, hidden AI watches each step and writes short notes about what was built, fixed or learned; the newest notes are laid out at the start of your next session, and Claude can search the rest.

Where it lives
Your machine (cloud sync optional)
Keep in mind
Notes are kept as written: nothing merges or corrects them, so an outdated note sits beside the newer one. The note-taker is an extra AI working alongside every session, and anonymous usage stats are on by default.

Mem0

A memory layer, mainly for developers adding memory to their own apps. Another AI reads the conversation and saves short facts (“prefers TypeScript”), then finds the relevant ones later. It also has plugins for Claude Code and other editors.

Where it lives
Mem0's cloud, or your own server
Keep in mind
Its Claude Code plugin sends your session text to Mem0’s cloud (with secrets removed). The richer features, like merging duplicates and replacing outdated facts, are on the paid cloud.

Supermemory

A memory service that turns chats, notes and files into short facts linked to what it already knows, so a new fact can replace or extend an old one. Mainly for developers; people also use it through its Claude Code plugin and MCP server.

Where it lives
Supermemory's cloud, or your own machine
Keep in mind
The memory engine’s source code isn’t public, and its connectors and MCP server are on the cloud only.

Cognee

Open-source memory that turns documents, code and chats into a knowledge graph your agents can search. It has a Claude Code plugin, and it can run entirely on your machine with no AI key.

Where it lives
Your machine, your server, or Cognee Cloud
Keep in mind
It’s knowledge memory for agents and teams. When two facts disagree it flags them rather than settling which one is true.

Zep

Memory that keeps facts on a timeline: when each became true and when it stopped, so an agent can ask what’s true now or what was true in March. Graphiti is its open-source engine; both have MCP servers.

Where it lives
Zep's cloud, or your own graph database (Graphiti)
Keep in mind
It’s built for developers making agents and apps: your app asks it for context, and nothing comes back on its own.

Letta

An AI agent that keeps its own memory as files it edits itself, with every edit saved, and tidies them up between conversations. It comes as its own coding CLI, desktop app and SDK.

Where it lives
Letta's cloud, or your machine
Keep in mind
It’s a whole agent, not a memory you add to the one you already use. Its Claude Code plugin is labelled a demo, not for production.

Counterparts

Gives Claude its own memory of the relationship: what it learned about you, your work together, and itself, in its own words. Memories fade unless they come up again. More below.

Where it lives
Your machine, one file
Keep in mind
It isn’t a work memory: no tasks, code conventions or project docs. Claude Code only, for one person, not a team.

Claude Code’s built-in memory has its own page in the directory too, and the comparison puts them all side by side.

By what you need

Which should you use?

Start with what’s built in. Most people asking how to give Claude Code memory need a good CLAUDE.md and auto memory left on.

  • Claude should follow my project’s rules every time. Write a CLAUDE.md (start with /init) and commit it so your team gets it too. Put rules for one part of the code in .claude/rules/.
  • I keep correcting the same thing. Leave auto memory on, or say “remember that …”. If it’s a rule, add it to CLAUDE.md.
  • I want to carry on yesterday’s conversation. claude --continue, or claude --resume to pick one.
  • I want notes on every past session, written for me. claude-mem does this automatically.
  • I’m building an app or agent that needs memory of its users. These are developer building blocks: Mem0 plugs into almost any stack; Zep keeps track of when facts changed; Supermemory takes chats and files and keeps a profile of each person; Cognee builds a knowledge graph from documents and code and can run fully on your machine.
  • I want a long-lived agent with a memory of its own. Letta, which is its own agent rather than an add-on to Claude Code.
  • I want Claude to remember who it is with me. Counterparts, below.

Ours, plainly

Where Counterparts fits

Counterparts isn’t a work memory. It doesn’t track your tasks, code conventions or project docs; CLAUDE.md and auto memory already cover much of that.

It’s for something else: the AI’s own memory of who it’s becoming with you. At the end of each session Claude writes down what it learned, in its own words, as notes rather than transcripts. Those memories fade unless they come up again, and each session opens with a short “who I am, who you are, where we left off” that it wrote itself. It keeps a journal of your time together, and what it believes about you changes only slowly, with the history of what it used to think kept.

Everything lives on your machine in one SQLite file you can read, export or delete. No API keys and no accounts; nothing leaves your machine except through Claude Code itself. It’s free and open source (MIT), works with Claude Code, and is for one person and one AI, not a team.

It’s early. It has been its author’s daily memory on macOS since September 2026; Linux and Node pass a smoke test but have no daily user yet. You need bun 1.3 or newer (or Node 22.15 or newer):

bun add -g counterparts
counterparts

counterparts walks you through setup; then restart Claude Code. More on the home page, in its directory entry, and in the README.

FAQ

Questions people ask

Does Claude Code remember previous conversations?

Not in a new session. Each Claude Code session starts with a fresh context window, so it doesn’t see earlier chats. What carries over is your CLAUDE.md files and Claude’s auto memory notes. To pick up an earlier conversation itself, run claude --continue to reopen the most recent one in the current directory, or claude --resume to choose one from a list.

Where does Claude Code store its memory?

On your machine, as plain files. Project instructions live in ./CLAUDE.md or ./.claude/CLAUDE.md, personal ones in ~/.claude/CLAUDE.md. Auto memory lives in ~/.claude/projects/<project>/memory/, with a MEMORY.md index and one file per note. Conversation transcripts are saved as ~/.claude/projects/<project>/<session-id>.jsonl.

What’s the difference between CLAUDE.md and auto memory?

You write CLAUDE.md: instructions and rules, like build commands and coding standards, loaded at the start of every session. Claude writes auto memory: things it learned, like your preferences and corrections you gave it. The first 200 lines or 25KB of its MEMORY.md index load each session, and Claude opens the rest when it needs them.

How do I make Claude Code remember something?

Ask it. Saying something like “remember that the API tests need a local Redis” saves it to auto memory. For a rule you want written down as an instruction, ask Claude to add it to CLAUDE.md, or open the file yourself with /memory.

How do I see, edit, or turn off Claude Code’s memory?

Run /memory in a session. It lists your CLAUDE.md files, opens the auto memory folder, and has a toggle to turn auto memory off. Every memory is a markdown file you can edit or delete. You can also set autoMemoryEnabled to false in a project’s settings, or set the environment variable CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.

Does Claude Code’s memory sync across computers?

Auto memory doesn’t: it stays on the machine where it was written and isn’t shared with other machines or cloud sessions. A project CLAUDE.md that you commit to git travels with the repository, so everyone who clones it gets the same instructions.

Do I need a memory plugin or MCP server for Claude Code?

For most coding work, no. A good CLAUDE.md and auto memory cover project rules, conventions and your preferences. People add a memory system when they want something the built-ins don’t do: automatic notes on every past session (claude-mem), memory for an app they’re building (Mem0, Zep, Supermemory, Cognee), a long-lived agent of its own (Letta), or an AI with its own memory of who it is with you (Counterparts).

Is Counterparts a replacement for CLAUDE.md or auto memory?

No. Counterparts isn’t a work memory: it doesn’t track tasks, code conventions or project docs. It gives Claude its own memory of the relationship: what it learned about you, your work together, and itself, written in its own words.