CLAUDE.md Imports And Rules
Definition
The mechanisms for composing memory: @path imports that inline other files into a CLAUDE.md, and path-scoped .claude/rules/*.md files that load instructions only for matching paths.
Key points
- Imports:
@path(relative or absolute) pulls another file's content in; imports resolve up to a max 4 hops deep. Imports inside code spans/fences are skipped. claudeMd(managed scope only) inlines managed content;claudeMdExcludesis a glob array that can exclude memory files — but cannot exclude managed policy.- AGENTS.md is not read directly — bridge it with a CLAUDE.md containing
@AGENTS.md. - Rules:
.claude/rules/*.mdwithpaths:frontmatter globs load only when the working path matches. User rules load before project rules, so project rules win on conflict. - These are the composition layer on top of the CLAUDE.md Hierarchy concatenation.
Why it matters for the exam
- D3 (20% of scored content) can test the 4-hop import limit, that AGENTS.md needs an
@importbridge, and that rules are path-scoped with project-over-user precedence.
Common gotchas
@importchains deeper than 4 hops stop resolving.@pathinside a fenced code block or inline code span is not imported — a frequent trap.claudeMdExcludescannot strip the managed policy file.
See also
Sources
Referenced by
Practice questions optional · AI
Generate fresh practice questions about this concept with AI. These are not vault-verified.