Claude Certified Architect – Foundations
CLAUDE.md hierarchy: managed, user, project, local
Claude Code reads four kinds of CLAUDE.md file: managed policy, user (~/.claude/CLAUDE.md), project (./CLAUDE.md or ./.claude/CLAUDE.md) and local (./CLAUDE.local.md). All of them are concatenated into context, not overridden, with files closer to your working directory read last.
The four scopes
Managed policy CLAUDE.md is deployed by IT to a fixed path, such as /Library/Application Support/ClaudeCode/CLAUDE.md on macOS or /etc/claude-code/CLAUDE.md on Linux. It applies to every user on the machine and cannot be excluded by individual settings.
The user file at ~/.claude/CLAUDE.md holds your personal preferences for all projects. The project file at ./CLAUDE.md or ./.claude/CLAUDE.md is committed and shared with the team through source control: build commands, conventions, layout. The local file ./CLAUDE.local.md holds personal notes for one project, such as your sandbox URL, and you add it to .gitignore.
Use /init to generate a starting project file, and run /context to see which files actually loaded under Memory files.
How files load and in what order
Claude Code loads CLAUDE.md and CLAUDE.local.md from your working directory and every directory above it, at launch. Start in foo/bar/ and it loads foo/CLAUDE.md and foo/bar/CLAUDE.md. Content is ordered from the filesystem root down, so foo/bar/CLAUDE.md is read after foo/CLAUDE.md. Within one directory, CLAUDE.local.md is appended after CLAUDE.md.
Files in subdirectories below your working directory do not load at launch. Each one loads when Claude reads, writes or edits a file in that subdirectory.
Because nothing is overridden, two contradicting instructions both reach Claude and it may pick either one. Keep files consistent instead of relying on one to cancel another.
Imports, exclusions and compaction
A CLAUDE.md can pull in other files with @path/to/file. Imported files load at launch, so they help you organise a long file but do not reduce its context cost. Imports can nest up to four hops.
In a large monorepo, claudeMdExcludes in .claude/settings.local.json skips other teams' files by path or glob. Managed policy files cannot be excluded.
After /compact, Claude re-reads the project-root CLAUDE.md from disk. Nested CLAUDE.md files return only when Claude next works with a file in their directory. An instruction given only in chat is gone.
Where the exam catches people
- A subdirectory CLAUDE.md does not replace the root one; both are concatenated, and the closer file is simply read later.
CLAUDE.local.mdis per project; for a preference that applies in every project, use~/.claude/CLAUDE.md.- An
@import does not save context, because imported files load at launch with the file that imports them. - CLAUDE.md shapes behaviour but does not enforce it; to block an action regardless of what Claude decides, use a
PreToolUsehook or apermissions.denyrule.