Each Claude Code session starts with a fresh context window: nothing from yesterday’s conversation carries over on its own. Memory is how knowledge survives between sessions. There are two kinds, and both are plain markdown files on disk that load into context when a session starts.
CLAUDE.md: what you write
A CLAUDE.md file holds what you’d otherwise re-explain every session: build and test commands, conventions, project layout, “always do X” rules. Where you put it sets its scope:
~/.claude/CLAUDE.md: your personal preferences, in every project../CLAUDE.mdor./.claude/CLAUDE.md: the project’s instructions, committed so your whole team gets them../CLAUDE.local.md: your private notes for this one project; add it to.gitignore.
Files in the directory you launch from and the ones above it load at startup, and they are concatenated, not overridden: broader files come first, so the ones closest to where you launched are read last. A CLAUDE.md in a subdirectory loads only when Claude reads files in that folder. Run /init to generate a starter file from your codebase, and /memory to open and edit them.
Auto memory: what Claude writes
Auto memory is the notes Claude keeps for itself: your preferences, corrections you’ve given it, project context it can’t work out from the code. It lives in ~/.claude/projects/<project>/memory/, with a MEMORY.md index whose first 200 lines (or 25KB) load every session; the topic files it points to are read only when needed. When you ask Claude to remember something, this is where it goes. Auto memory is on by default, stays on your machine, and can be switched off from /memory.
The catch
Memory is context, not configuration. Claude reads these files as instructions and usually follows them, but nothing enforces them; if something must never happen, use a hook. Every line also costs context in every session, so the docs suggest keeping each CLAUDE.md under about 200 lines and moving long procedures into skills. If two instructions contradict each other, Claude may pick either, so prune old ones. When an instruction seems ignored, run /context to check that its file actually loaded.