Claude Code memory: the CLAUDE.md hierarchy and /memory
Claude Code concatenates CLAUDE.md from managed policy, your home dir, the project, then CLAUDE.local.md. Inspect it with /memory and @path imports.
On this page6 sections
Every Claude Code session loads several CLAUDE.md files and concatenates them into context —
they don’t override each other. The load order tells you which instruction Claude reads last, and
/memory shows what’s in play. This is about how the files combine; for writing one well, see
set up a CLAUDE.md.
1. Know the load order
Claude loads these broadest to most specific, so each appears in context after the one before:
1. Managed policy (Linux/WSL: /etc/claude-code/CLAUDE.md)
2. User (~/.claude/CLAUDE.md)
3. Project (./CLAUDE.md or ./.claude/CLAUDE.md)
4. Local (./CLAUDE.local.md, gitignored)
What it does: managed policy loads first and can’t be excluded by individual settings. Its path
is C:\Program Files\ClaudeCode\CLAUDE.md (Windows) or
/Library/Application Support/ClaudeCode/CLAUDE.md (macOS).
2. It’s concatenation, not override
All files are joined from the top of the directory tree down to your working directory, and
within a folder CLAUDE.local.md is appended after CLAUDE.md. Nothing wins outright: if a user
rule and a project rule contradict, Claude may follow either, so keep them consistent.
3. View and edit with /memory
/memory
What it does: lists your CLAUDE.md and CLAUDE.local.md locations across user and project
scopes, opens any one in your editor (creating it if missing), and toggles auto memory. To
confirm what actually loaded this session, run /context and read the Memory files list.
4. Pull in files with @path imports
See @README for an overview and @docs/style.md for conventions.
What it does: @path expands another file into context at launch. Paths are relative to the
importing file, and imports can nest up to four hops deep. An import that resolves outside your
working directory prompts for approval the first time.
5. Where AGENTS.md fits
Claude reads a repo’s AGENTS.md as project instructions only when no
CLAUDE.md or CLAUDE.local.md sits in your working directory or above it. When both exist,
CLAUDE.md wins, so an @AGENTS.md import inside a CLAUDE.md loads both. The
glossary has the short version.
If it fails
- A file isn’t being followed: run
/context; if it’s missing from Memory files, Claude can’t see it. A subdirectoryCLAUDE.mdloads on demand, not at launch. - AGENTS.md ignored: a
CLAUDE.mdorCLAUDE.local.mdon the path takes over. Remove it, or set Project instructions toclaude-md-and-agents-mdin/config. - External import won’t load: you declined the external-import approval, so it stays disabled for the project until you re-approve it.
Source: How Claude remembers your project.