Auto memory vs CLAUDE.md in Claude Code: what's the difference? (Aug 2026)

Who writes it, where it's stored, how much loads — with a debug checklist for when CLAUDE.md isn't followed.

Source for this article

Based on `code.claude.com/docs/en/memory`, fetched 2026-08-05.

Who writes what

CLAUDE.md: instructions you write. Auto memory: notes Claude writes itself from your corrections. Both load as context, not enforced config — use a PreToolUse hook to force behavior.

CLAUDE.md locations, in load order

Managed policy (org-wide) → user (`~/.claude/CLAUDE.md`) → project (`./CLAUDE.md`) → local (`./CLAUDE.local.md`, gitignored).

Auto memory basics

On by default. Toggle via `/memory`, or `autoMemoryEnabled: false` per project, or `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1`.

{
  "autoMemoryEnabled": false
}

Storage and the 200-line rule

Stored at `~/.claude/projects/<project>/memory/`, shared across worktrees. `MEMORY.md` loads only its first 200 lines or 25KB at session start; detail moves to topic files.

What survives /compact

Project-root CLAUDE.md is re-read from disk after compaction. Nested CLAUDE.md files are not auto-reinjected — they reload only when Claude reads files in that subdirectory.

If CLAUDE.md isn't being followed

Run `/context` to confirm it actually loaded, make instructions concrete and verifiable, and check for contradicting rules across files.

FAQ

Which takes priority, CLAUDE.md or auto memory?
Neither — both load as context at session start. Use a PreToolUse hook to force behavior deterministically.
Where is auto memory stored?
`~/.claude/projects/<project>/memory/`, with MEMORY.md as the index and detail in topic files.
Can I disable auto memory?
Yes — via `/memory`, per-project `autoMemoryEnabled: false`, or `CLAUDE_CODE_DISABLE_AUTO_MEMORY=1`.
Why did instructions disappear after /compact?
Project-root CLAUDE.md reloads after compaction; nested CLAUDE.md files don't reinject automatically.