One CLAUDE.md for every repo in a Claude Code session A developer documented how Claude Code loads CLAUDE.md instruction files across multiple repositories in a single session, noting that files in directories added with --add-dir are not loaded by default unless CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 is set. The writeup proposes a canary-token test to verify which memory files actually load on a given version, citing 2026 bug reports where .claude/rules/*.md and settings.json additionalDirectories still fail to load. The author's ivar worktree setup injects each repo's instruction file through a hook on the tool call that touches that repo. You open Claude Code in api , add web with --add-dir , and ask for a change that spans both. The agent follows api/CLAUDE.md to the letter. In web it runs npm where the file says pnpm , and writes tests where the file says they do not go. It never read web/CLAUDE.md . That is documented behaviour. The Claude Code memory docs https://code.claude.com/docs/en/memory say CLAUDE.md files in directories added with --add-dir are not loaded by default. Setting CLAUDE CODE ADDITIONAL DIRECTORIES CLAUDE MD=1 turns loading on for CLAUDE.md , .claude/CLAUDE.md and .claude/rules/ .md in those directories. Bug reports filed in 2026 show where that still falls short, so the reliable answer is to check what loaded on your own version. In a multi-repo worktree setup such as ivar , each repo's instruction file reaches the agent through a hook on the tool call that touches the repo. The memory docs https://code.claude.com/docs/en/memory and the large codebases guide https://code.claude.com/docs/en/large-codebases describe three places: | where the file is | when it loads | |---|---| | the working directory and every parent directory | in full, at launch | | a subdirectory of the working directory | on demand, when Claude reads files there | | a directory added with --add-dir | only with CLAUDE CODE ADDITIONAL DIRECTORIES CLAUDE MD=1 | The first two rows explain the common workaround: start Claude Code in a parent folder that holds every repo, the "repo-of-repos", with a root CLAUDE.md for what the repos share and a file in each repo for the rest. Hjarni describes https://hjarni.com/blog/claude-md-for-multiple-projects the same split, a small CLAUDE.md per repo and the shared material somewhere else. It works when the repos already sit side by side on the branches you want. The third row is the one people hit when they keep the repos apart and add them to a session. Before changing anything, make the question testable. Add one line to the second repo's CLAUDE.md that the agent cannot guess: - If asked for the canary, answer with exactly web-canary-7f3 . Then ask for it from a session started in the first repo: cd ~/code/api claude --add-dir ../web -p 'What is the canary? Answer with the token only, or "none".' Without the variable, the documented result is none : web/CLAUDE.md is not in context. Run it again with the variable: CLAUDE CODE ADDITIONAL DIRECTORIES CLAUDE MD=1 \ claude --add-dir ../web -p 'What is the canary? Answer with the token only, or "none".' Now the token should come back. In an interactive session, /context lists the memory files that loaded, which tells you the same thing without a prompt. Put a second canary in web/.claude/rules/ and a third in a nested web/src/CLAUDE.md and ask for each: they are the cases the reports below are about. To keep the variable, export it in your shell profile or set it under env in your user settings.json . The Classmethod write-up https://dev.classmethod.jp/en/articles/claude-code-web-multiple-repositories/ found that Claude Code on the web loads the CLAUDE.md of every attached repository, because the cloud environment already sets the variable; the CLI does not. The variable covers --add-dir . Two reports filed in 2026 describe what it does not reach: --add-dir , only the top-level CLAUDE.md loaded; .claude/rules/ .md in that directory did not additionalDirectories in settings.json did not load its CLAUDE.md, while the same directory passed with Both are marked resolved on the issue mirror, and related reports about additionalDirectories stay open. The canaries above tell you which behaviour your version has. A rule that matters should not depend on a load path you have not checked. ivar lays the repos out differently. A hall holds the repos, a feature promotes the ones it changes onto its own branch, and a session is a view dir: a folder with one symlink per repo. The hall is set up once quickstart https://ivar.run/docs/quickstart?utm source=devto&utm medium=syndication&utm campaign=claude-md-multiple-repos . After that, the reader describes the change and the agent, started at the hall root, runs ivar itself: Add a checkout step that spans api and web. That touches two repos, so I'll open one feature and promote both. checkout is open: api and web are writable on their own branch. I'll work through the session's view dir. The view dir the last call names looks like this: php .ivar/features/checkout/sessions/