> memory & settings
Two mechanisms carry knowledge across Claude Code's fresh-every-session context: CLAUDE.md files you write, and auto memory Claude writes itself. Both load at the start of every session. Settings.json is the third layer — configuration that is enforced by the client rather than interpreted. This section covers the file hierarchy for all three, the @ import syntax, and how scopes stack so you know which instruction or setting actually wins.
// memory & settings
5 commands$ ~/.claude/CLAUDE.md$ /memory$ See @README.md for the project overview.$ ~/.claude/settings.json$ { "env": { "AWS_PROFILE": "dev", "DISABLE_AUTOUPDATER": "1" } }// faq
Where do I put CLAUDE.md and which one wins?
CLAUDE.md loads from four scopes, broadest to most specific: managed policy (org-wide), user (~/.claude/CLAUDE.md), project (./CLAUDE.md or ./.claude/CLAUDE.md, committed to git), and local (./CLAUDE.local.md, gitignored). All discovered files are concatenated, with more specific scopes read last, so a project rule overrides a user rule on conflict. Files in subdirectories load on demand when Claude reads files there.
What's the difference between CLAUDE.md and auto memory?
You write CLAUDE.md with instructions and rules; Claude writes auto memory with learnings it discovers, like build commands and debugging insights. Auto memory lives per-repository at ~/.claude/projects/<project>/memory/ and is machine-local. Use CLAUDE.md to guide behavior deliberately, and let auto memory accumulate from your corrections without manual effort.
Why isn't Claude following my CLAUDE.md?
CLAUDE.md is delivered as context, not enforced configuration, so Claude reads it but may not comply with vague or conflicting instructions. Run /context to confirm the file loaded, make instructions specific ("use 2-space indentation" beats "format nicely"), keep files under ~200 lines, and remove contradictions across files. For anything that must always happen, use a hook instead.
How do settings.json files stack?
By precedence: managed policy (highest, can't be overridden), then command-line args, then local (.claude/settings.local.json), then project (.claude/settings.json), then user (~/.claude/settings.json). Most keys override across scopes, but permission rules are the exception — allow, ask, and deny arrays merge across every scope. Run /status to see which files loaded.