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.