# Where Claude Code keeps its memory

> Source: https://minniai.com/learn/claude-code-memory-directory (canonical HTML page)

[Guides](https://minniai.com/learn)


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](https://code.claude.com/docs/en/memory). `<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 all` in 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 a `Loaded` line with its path when it does.
- Run `/memory` to open the memory files for editing, and to see the auto memory toggle.
- Open `~/.claude/projects/` and find the folder named after your repository; its `memory/` 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](https://minniai.com/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](https://minniai.com/minnimemorymcp/docs#files).

install it for Claude Code

```
$ npm i -g minnimemory
$ minnimemory install
```

What carries over between sessions and why it costs tokens is in [How Claude Code remembers across sessions](https://minniai.com/learn/claude-code-memory-across-sessions).

Try MinniMemoryMCP

Free, runs on your computer, and every change can be undone. Two commands install it for Claude Code; the [docs](https://minniai.com/minnimemorymcp/docs) cover Codex and the rest.

install it for Claude Code

```
$ npm i -g minnimemory
$ minnimemory install
```

## More guides

- [How to reduce Claude Code token usage](https://minniai.com/learn/reduce-claude-code-token-usage) Where the tokens go each turn, and eight ways to spend fewer.

Updated 2026-11-16 · Minni AI

- [Claude Code usage limit reached: what to do, and how to hit it less](https://minniai.com/learn/claude-code-usage-limit-reached) What each limit message means, what to do now, and how to send less every turn.

Updated 2026-11-16 · Minni AI

- [CLAUDE.md too long: what Claude Code does with it, and how to split it](https://minniai.com/learn/claude-md-too-long) What a long CLAUDE.md costs, the real size limits, and four ways to cut it.

Updated 2026-11-16 · Minni AI

- [Claude Code context window keeps filling up: why it compacts, and what to do](https://minniai.com/learn/claude-code-context-window-full) What fills the window, what compaction keeps, and how to compact less often.

Updated 2026-11-16 · Minni AI

- [How to reduce Codex token usage](https://minniai.com/learn/reduce-codex-token-usage) Where Codex spends tokens, and seven ways to spend fewer.

Updated 2026-11-16 · Minni AI

- [Codex usage limits: why they drain and how to use fewer tokens](https://minniai.com/learn/codex-usage-limits) How the windows work, how to check what is left, and what uses the allowance up.

Updated 2026-11-11 · Minni AI

- [AGENTS.md too large: what Codex cuts off and how to split it](https://minniai.com/learn/agents-md-too-large) The 32 KiB cap, how to see which files load, and five ways back under it.

Updated 2026-11-11 · Minni AI

- [How to lower a Claude Code or Codex API bill](https://minniai.com/learn/lower-claude-code-codex-api-bill) What a coding agent bills on an API key, and the levers that move it.

Updated 2026-11-16 · Minni AI

- [Why Claude Code sessions get expensive](https://minniai.com/learn/why-claude-code-sessions-get-expensive) Every turn re-sends the whole session. What makes that grow.

Updated 2026-11-05 · Minni AI

- [Claude Code memory: CLAUDE.md vs MinniMemoryMCP](https://minniai.com/learn/claude-code-memory-claude-md-vs-minnimemorymcp) What belongs in CLAUDE.md, and splitting the rest out by hand or with a tool.

Updated 2026-11-16 · Minni AI

- [MinniMemoryMCP vs Mem0, Zep, supermemory and Letta](https://minniai.com/learn/minnimemorymcp-vs-mem0-zep-supermemory-letta) Four tools add memory to an agent. MinniMemoryMCP cuts what the agent already loads. When each fits.

Updated 2026-11-16 · Minni AI

- [How Claude Code remembers across sessions](https://minniai.com/learn/claude-code-memory-across-sessions) What carries over between sessions, what does not, and how to keep it small.

Updated 2026-11-16 · Minni AI

- [How to run a coding agent on free, open models](https://minniai.com/learn/run-a-coding-agent-on-free-open-models) What a free key gets you, what a local model can do, and where the tokens go.

Updated 2026-10-25 · Minni AI

- [Get a free NVIDIA API key for a coding agent](https://minniai.com/learn/free-nvidia-api-key-for-a-coding-agent) Where the key comes from, where to keep it, and how to run a coding agent on it.

Updated 2026-11-07 · Minni AI

- [What a Windows PC optimization agent should and should not touch](https://minniai.com/learn/what-a-pc-optimization-agent-should-touch) The settings worth changing, the ones that are placebo, and the ones that break things.

Updated 2026-10-25 · Minni AI

---

Index for agents: https://minniai.com/llms.txt. Doing a task: https://minniai.com/agents.md
