All articles

The CLAUDE.md Loading Hierarchy

Claude Code does not read just one CLAUDE.md. It pulls from several, and knowing the order helps you decide where to put each rule.

Files up the tree load at launch

When Claude starts, it loads CLAUDE.md files from the current directory and every parent folder up the tree. It also loads your personal file at ~/.claude/CLAUDE.md. So a rule in a parent folder applies to work in its subfolders too.

Imagine this layout:

~/.claude/CLAUDE.md        # you, everywhere
repo/CLAUDE.md             # the whole repo
repo/apps/web/CLAUDE.md     # just the web app

Start Claude inside repo/apps/web and all three load together. The web-app file adds detail on top of the repo-wide file, which sits on top of your personal one.

Subdirectory files load on demand

Files that live below where you started are different. They load only when Claude actually works with that part of the tree. This keeps the launch context lean: you get the broad rules right away, and the narrow ones arrive when they matter.

What this means for you

Put broad, always-true guidance high up — in your personal file or the repo root. Put specific rules close to the code they describe, in a subfolder's CLAUDE.md. That way each session loads the general context immediately and reaches for the fine detail only when it touches that folder.

Use /memory to see and edit the files that are in play, so you always know what Claude is actually reading.

Comments

Be the first to comment.