CLAUDE.md files
ACLAUDE.md file is a Markdown file whose content is injected verbatim into Claude’s system prompt at the start of each session. Use it to document project conventions, preferred commands, architecture decisions, and anything Claude should always know about your project.
File locations
Claude Code walks up the directory tree from the current working directory, loading everyCLAUDE.md it finds:
Files higher in the tree are loaded first. Project-level files take precedence in the final assembled prompt.
CLAUDE.md files are loaded lazily via
loadMemoryPrompt() — not at startup — so changes take effect on the next session without restarting Claude Code.Excluding specific files
UseclaudeMdExcludes in settings.json to skip loading specific CLAUDE.md files. Patterns are matched against absolute paths using picomatch:
Auto-memory system
The auto-memory system gives Claude a persistent, file-based memory directory where it can store structured notes across conversations. Unlike CLAUDE.md (which you author), auto-memory is maintained by Claude itself.Storage location
By default, auto-memory lives at:CLAUDE_COWORK_MEMORY_PATH_OVERRIDEenvironment variable — full-path overrideautoMemoryDirectoryin settings (user/local/policy only; not project settings for security)- Default derived from git root
MEMORY.md entrypoint
The memory directory usesMEMORY.md as an index file. It must be kept concise — only the first 200 lines (or 25 KB) are loaded into context. Individual memory entries live in separate topic files and are linked from MEMORY.md.
Memory types
Claude organizes memories into four types:
Each memory file uses YAML frontmatter:
What NOT to save in memory
The auto-memory system is for information that is not derivable from the current project state. Do not save:- Code patterns, architecture, or project structure — Claude can read the files
- Git history or recent changes —
git logis authoritative - Debugging solutions — the fix is in the code and commit messages
- Anything already in CLAUDE.md files
- Ephemeral task state or in-progress work
Enabling and disabling auto-memory
Auto-memory is enabled by default. To disable it:- settings.json
- Environment variable
CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 wins over autoMemoryEnabled: false in settings. Set it to 0 or false to force-enable auto-memory even when the settings file disables it.- Bare/simple mode (
--bareorCLAUDE_CODE_SIMPLE=1) - Remote sessions without
CLAUDE_CODE_REMOTE_MEMORY_DIRset
Creating a CLAUDE.md
1
Create the file
Create a
CLAUDE.md at your project root or inside .claude/:2
Document project conventions
Add sections that Claude should always know:
3
Open it in the /memory editor
Run
/memory in Claude Code to open the interactive memory file selector. From there you can open and edit any CLAUDE.md file using your $EDITOR.4
Verify it is loaded
Start a new Claude Code session and ask: “What do you know about this project?” — Claude should reflect the content of your CLAUDE.md.
/memory slash command
The/memory command opens a UI for selecting and editing memory files. It shows all discoverable CLAUDE.md files for the current project and lets you open them in your configured editor ($VISUAL or $EDITOR).