Claude Code auto memory: what it saves and how to use it
Auto memory is Claude's own notebook. It is separate from the CLAUDE.md files you write, and it is kept on this machine rather than in your repository.
Last checked against Anthropic's documentation on November 26, 2026. By the Omniscio team. Updated .
What auto memory is
Auto memory lets Claude accumulate knowledge across sessions without you writing anything. As it works, Claude saves notes for itself and records each note's kind in a type field in the file's frontmatter.
| Type | What it holds |
|---|---|
user | Your role, expertise and working preferences |
feedback | Corrections you give Claude and approaches you confirm |
project | Ongoing work, deadlines and decisions Claude cannot derive from the code or git history |
reference | Where to find information outside the project, such as an issue tracker or dashboard |
Claude skips anything it can derive from the codebase, such as architecture, file paths or debugging fixes. It also skips anything your CLAUDE.md files already say.
Claude does not save something every session. It decides what is worth remembering based on whether the information would be useful in a future conversation.
How auto memory differs from instruction files, and where each CLAUDE.md scope loads, is on the CLAUDE.md guide.
Where the files live
Each project gets its own memory directory at ~/.claude/projects/<project>/memory/. The <project> path is derived from the git repository, so all worktrees and subdirectories within the same repo share one directory. Outside a git repo, the project root is used instead.
The directory holds a MEMORY.md index and one topic file per memory:
~/.claude/projects/<project>/memory/
├── MEMORY.md # Index, one line per memory, loaded at session start
├── user_role.md # One memory
├── feedback_testing.md # One memory
└── ... # Any other topic files Claude createsClaude reads and writes files in this directory throughout your session, using MEMORY.md to keep track of what is stored where.
Auto memory is machine-local. Files are not shared across machines or cloud environments.
If you set CLAUDE_CODE_PROJECT_DIR_NAME with CLAUDE_CONFIG_DIR also set, Claude Code uses that name as the <project> directory under the config directory's projects/ folder instead, whichever repository you launch it in. That requires Claude Code v2.1.234 or later.
The folder name is derived from the repository path rather than typed by you. Open /memory to see the exact folder for the current project.
Turn auto memory on or off
Auto memory is on by default in local sessions. Outside Claude Tag sessions, a session in a self-hosted environment runs with auto memory off by default.
To toggle it, open /memory in a session and use the auto memory toggle, which saves autoMemoryEnabled to your user settings at ~/.claude/settings.json.
The toggle turns auto memory off but does not turn it back on in two places: a background session, and a session that another Claude Code session started, such as when Claude runs claude through its Bash tool. The toggle there reads off · can't be turned on here; use a session started outside Claude Code. To turn auto memory back on, run claude directly in your terminal and use the /memory toggle in that session.
To turn it off for a single project, set autoMemoryEnabled in that project's .claude/settings.json:
When several settings files set it, the usual settings precedence decides which one wins, and the settings.json location guide covers that order.
{
"autoMemoryEnabled": false
}To disable auto memory with an environment variable, set CLAUDE_CODE_DISABLE_AUTO_MEMORY=1.
Store it somewhere else
To store auto memory in a different location, set autoMemoryDirectory in your settings.json. It is read from any settings scope: user, project, local, policy, or --settings.
{
"autoMemoryDirectory": "~/my-custom-memory-dir"
}The value must be an absolute path or start with ~/.
When you set it in a project's .claude/settings.json or .claude/settings.local.json, Claude Code honors it under the same workspace trust rule as hooks there. While permissions.blockReadsOutsideWorkingDirectories is on, Claude Code loads no auto memory from a directory a repository-supplied settings file chooses and saves none to it, wherever that directory sits.
What loads at session start, and the size limit
While auto memory is on, the first 200 lines or 25KB of MEMORY.md, whichever comes first, load at session start. Claude keeps MEMORY.md concise by moving detailed notes into separate topic files.
After Claude writes to MEMORY.md, Claude Code measures the file against the 200-line and 25KB read limits. If the file is near a limit, Claude Code reminds Claude to shorten it: keep one line per entry, move detail into topic files, and merge or drop stale entries.
If the file is over a limit, the write still succeeds, but Claude Code returns an error telling Claude to rewrite the index, because everything past the limit is dropped on the next load.
Claude Code does not load topic files such as user_role.md or feedback_testing.md at startup. Claude reads them on demand with its standard file tools when it needs the information.
The main conversation's auto memory is not loaded into subagents; the exception is a fork, which inherits the parent conversation and system prompt. A subagent's own auto memory, enabled with the subagent memory field, is a separate directory.
Claude Code deletes old session transcripts after the cleanupPeriodDays retention period, but it excludes the memory files in the memory directory from that retention sweep. MEMORY.md and topic files stay until you or Claude edits or deletes them.
Read and edit what Claude saved
Auto memory files are plain markdown you can edit or delete at any time. Run /memory to browse and open memory files from within a session.
Claude reads and writes memory files during your session. Messages such as Saved 2 memories or Recalled 2 memories mean Claude is updating or reading from ~/.claude/projects/<project>/memory/.
When Claude writes a memory file that begins with YAML frontmatter, Claude Code records the write time in a modified frontmatter field as an ISO 8601 timestamp. The timestamp shows how current the fact is, both to you and to Claude when it reads the memory back.
Common mistakes
- Expecting one memory folder per checkout. Worktrees and subdirectories of the same repository share one memory directory, because the project path comes from the repository.
- Expecting memory to sync to a second computer. The files are machine-local and are not shared across machines or cloud environments.
- Turning it on with the toggle inside a background session. That toggle can turn auto memory off there but cannot turn it back on; start
claudein your own terminal instead. - Writing a large index. Only the first 200 lines or 25KB of
MEMORY.mdload, so detail belongs in topic files that Claude reads on demand. - Confusing memory with CLAUDE.md. Claude skips anything your CLAUDE.md files already say, which keeps the two from duplicating each other.
How to confirm it is working
/memorylists the memory file locations and offers to open the auto memory folder.~/.claude/projects/<project>/memory/MEMORY.mdexists and holds one line per memory. Runls ~/.claude/projects/<project>/memory/to list the folder.- A session that learned a preference shows a
Savedmessage, and a later session in the same repository shows aRecalledmessage or reads a topic file.
Where these answers come from
- Anthropic's memory page, the auto memory section, read November 26, 2026: the four note types, what Claude skips, the default on and off states, the toggle, the settings keys, the loading limits, the cleanup exclusion and the audit steps.
- The same page, storage location, read November 26, 2026: the memory directory layout, the shared directory for worktrees, the machine-local rule and
CLAUDE_CODE_PROJECT_DIR_NAME.
Common questions
Is auto memory on by default?
It is on by default in local Claude Code sessions. Outside Claude Tag sessions, a session in a self-hosted environment runs with it off by default, and the /memory toggle cannot turn it on inside a background session or one that another session started.
Where does Claude Code store auto memory?
In ~/.claude/projects/<project>/memory/, with a MEMORY.md index and one topic file per memory. All worktrees and subdirectories of the same git repository share that one directory.
Does auto memory sync between computers?
No. Auto memory is machine-local. Files are not shared across machines or cloud environments, so a note saved on one computer is not available on another.
How big can MEMORY.md get?
Claude Code loads the first 200 lines or 25KB of MEMORY.md at session start, whichever comes first. A write past the limit still succeeds, but Claude Code returns an error telling Claude to rewrite the index because everything past the limit is dropped on the next load.