Imports, AGENTS.md and exclusions
Composing memory files across repos and tools.
4 min read · Lesson 5 of 11 in this domain
Imports let you compose memory from several files, which is good for organisation — but it is worth being clear about what they do not do. An @path import is expanded at launch, so splitting one long CLAUDE.md into five imported files leaves exactly the same amount of text in context. If your goal is a smaller context, imports are the wrong tool and path-scoped rules are the right one. Imports are for structure and reuse: sharing a conventions file across repos, or pulling in a file another tool already owns.
@path/to/fileimports a file, expanding it into context at launch. Relative paths resolve against the file containing the import.- Imports can nest to a maximum depth of four hops.
- Import parsing skips code spans and fenced blocks — wrap a path in backticks to mention it literally without importing.
- Splitting into imports helps organisation but does not reduce context, since imported files load at launch anyway. Use path-scoped rules for that.
- Claude Code reads
CLAUDE.md, notAGENTS.md. If your repo uses AGENTS.md, create a CLAUDE.md whose first line is@AGENTS.md. claudeMdExcludestakes glob patterns matched against absolute paths, configurable at any settings layer, with arrays merging across layers. Managed policy CLAUDE.md cannot be excluded.
Renaming AGENTS.md to CLAUDE.md — it breaks the other agent. Import it instead.
Does splitting CLAUDE.md into @imports reduce context usage?
Imports help organisation, not context size. Use path-scoped rules to reduce context.
Your repo already has AGENTS.md. Best approach?
Renaming breaks the other tool; Claude Code reads CLAUDE.md, not AGENTS.md.
Practise this domain with 20%%-weighted questions in the study app.
Open in study appSource: Claude Code Docs — Memory · Independent study aid, not affiliated with or endorsed by Anthropic.