Where Claude Code keeps its memory
Claude Code has no single memory directory. It reads CLAUDE.md files from four places, the files they import, a rules folder in the project, and an auto memory folder per repository under ~/.claude/projects/<project>/memory/. Here is every path, what it holds, and which ones load on every turn.
Updated 2026-11-07
Every path, in load order#
| Path | What it is | Loads |
|---|---|---|
C:\Program Files\ClaudeCode\CLAUDE.md (Windows), /etc/claude-code/CLAUDE.md (Linux), /Library/Application Support/ClaudeCode/CLAUDE.md (macOS) | Managed policy, written by an organization | Every session |
~/.claude/CLAUDE.md | Your user instructions, for every project | Every session |
./CLAUDE.md or ./.claude/CLAUDE.md | The project’s instructions, shared through git. ./AGENTS.md can take its place | Every session |
./CLAUDE.local.md | Your own notes for this project, kept out of git | Every session |
Any file named with @path inside one of the above | An import. Up to four hops deep | Every session, with the file that imports it |
./.claude/rules/*.md | Project rules, one topic per file, subfolders allowed | Every session; a rule with a paths field only when Claude touches a matching file |
<subfolder>/CLAUDE.md | Instructions for one part of the project | When Claude works in that subfolder |
~/.claude/projects/<project>/memory/MEMORY.md | The index of auto memory, one line per note | Every session, the start of the file |
~/.claude/projects/<project>/memory/*.md | One auto memory note per file, written by Claude | When Claude opens one |
Source: Anthropic’s memory docs. <project> is derived from the git repository, so every worktree and subfolder of a repo shares one auto memory folder; outside git it is the folder you launched in. autoMemoryDirectory in settings.json moves it, and CLAUDE_CONFIG_DIR moves ~/.claude itself.
Find what loaded in your session#
- Run
/context allin a session. The list under Memory files is every CLAUDE.md and CLAUDE.local.md that loaded at launch. A subfolder file is not there: it loads later, and prints aLoadedline with its path when it does. - Run
/memoryto open the memory files for editing, and to see the auto memory toggle. - Open
~/.claude/projects/and find the folder named after your repository; itsmemory/folder is the auto memory.
Auto memory and the session transcripts are separate. Transcripts live beside the memory folder and are deleted after the cleanupPeriodDays setting; memory stays until you delete it.
What MinniMemoryMCP writes beside them#
MinniMemoryMCP reads only the files above that you tell it Claude Code loads; it searches for nothing. When it compiles a memory, it writes in two places:
| Path | What it holds |
|---|---|
./.claude/OnDemandMemory/ | The sections moved out of the always-loaded part, as <parent>__history.md and <parent>__detail.md |
./.minnimemory/ | The backups of your originals, manifest.json, graph.json and a .gitignore that keeps the backups out of git |
~/.claude/minnimemory/discovery.json | init’s record of where Claude Code loads from, so nothing is asked twice |
~/.claude/minnimemory/ (load log, usage log, hook sessions, undo backups) | Machine-local records the hooks keep: which memory files loaded, which OnDemandMemory files sessions open, what a forced undo discarded |
On a memory folder it sorts in place: AlwaysOnMemory/ and OnDemandMemory/ subfolders, MEMORY.md kept with its link targets updated. undo removes all of it and restores the originals byte for byte. The full list is in the MinniMemoryMCP docs.
$ npm i -g minnimemory
$ minnimemory installWhat carries over between sessions and why it costs tokens is in How Claude Code remembers across sessions.