Skip to content
Claude Certified Architect – Foundations (CCAR-F) Exam Prep

Lesson 13 of 30 · 7 min

x
13/30

CLAUDE.md Hierarchy

Video lesson: CCAR-F 13/30: CLAUDE.md Hierarchy

Where files live

LevelPathShared with
Managed policymacOS /Library/Application Support/ClaudeCode/CLAUDE.md; Linux/WSL /etc/claude-code/CLAUDE.md; Windows C:\Program Files\ClaudeCode\CLAUDE.mdAll users on the machine (IT-managed)
User~/.claude/CLAUDE.mdYou, every project
Project./CLAUDE.md or ./.claude/CLAUDE.mdThe team (commit it)
Local./CLAUDE.local.md (add to .gitignore)You, this project

How they load

  • CLAUDE.md and CLAUDE.local.md in the working directory and every directory above it load at launch.
  • Files are concatenated, not overriding each other, ordered from filesystem root down to the working directory.
  • Files in subdirectories below the working directory load on demand, once Claude reads, writes or edits a file in that subdirectory.
  • claudeMdExcludes (glob patterns, any settings layer) skips files, useful in monorepos. Managed policy files cannot be excluded.
  • Extra directories added with --add-dir load their CLAUDE.md, .claude/CLAUDE.md, .claude/rules/*.md and CLAUDE.local.md.

Imports

@path/to/file inside a CLAUDE.md pulls that file in at launch. Relative paths resolve relative to the file containing the import, not the working directory. Imports can nest to a maximum of four hops. Code spans and fenced blocks are not parsed, so ` @README ` stays literal. A path with spaces needs backslash-escaped spaces; quoted paths are not imported.

Commands

  • /init generates a starting CLAUDE.md from your codebase (suggests improvements if one exists).
  • /memory views and edits memory files.

Writing guidance (verified, from the docs)

  • Target under 200 lines per file; longer files cost context and reduce adherence.
  • Be specific and concise; contradictory instructions across files can lead Claude to pick one arbitrarily.
  • Move instructions relevant to only part of the codebase into path-scoped rules (3.3); move multi-step procedures into skills (3.2).

It guides; it does not enforce

CLAUDE.md is context, not enforced configuration. To block an action regardless of what Claude decides, use a PreToolUse hook (see Domain 1.4 and 1.5). Subagents receive project CLAUDE.md unless omitClaudeMd is set.

AGENTS.md (verified, version-sensitive)

If a repo has AGENTS.md and no CLAUDE.md in or above the working directory, Claude Code reads AGENTS.md. If both exist, only the CLAUDE.md files load (unless the CLAUDE.md imports AGENTS.md). Reading AGENTS.md directly needs a recent version.

Auto memory vs CLAUDE.md

CLAUDE.md is written by you; auto memory is notes Claude writes (first 200 lines or 25 KB loaded each session). Both are context, not guarantees.

Exam traps

  • Treating CLAUDE.md as a security control.
  • Expecting a child CLAUDE.md to override the parent. They concatenate.
  • Imports resolved from the working directory instead of the importing file.
  • A giant CLAUDE.md holding path-specific rules or procedures.
  • Putting personal preferences in the shared file instead of CLAUDE.local.md or ~/.claude/CLAUDE.md.

References

  1. How Claude remembers your project — checked Oct 16, 2026

Check your understanding

  • Personal sandbox URLs for one project, not committed?Show answer

    Answer

    ./CLAUDE.local.md, gitignored.
  • Do subdirectory CLAUDE.md files load at launch?Show answer

    Answer

    No, on demand when Claude touches files there.
  • How do you guarantee .env is never edited?Show answer

    Answer

    A PreToolUse hook (or permission deny rule), not CLAUDE.md.
Previous

Progress is saved in this browser.

Next Lesson