[DOCS] `--add-dir` can load CLAUDE.md from additional directories (new in 2.1.20, undocumented)
Documentation Type
Missing documentation (feature not documented)
Documentation Location
https://code.claude.com/docs/en/memory
Section/Topic
"How Claude looks up memories" section, and related documentation in cli-reference.md, iam.md, and settings.md
Current Documentation
The memory.md page documents CLAUDE.md loading behavior:
Claude Code reads memories recursively: starting in the cwd, Claude Code recurses up to (but not including) the root directory / and reads any CLAUDE.md or CLAUDE.local.md files it finds.
The cli-reference.md documents --add-dir:
Add additional working directories for Claude to access (validates each path exists as a directory)
The iam.md documents working directories:
During startup: Use --add-dir <path> CLI argument Files in additional directories follow the same permission rules as the original working directory - they become readable without prompts, and file editing permissions follow the current permission mode.
None of these mention the new ability to load CLAUDE.md files from additional directories.
What's Wrong or Missing?
Claude Code 2.1.20 added a new feature:
Added support for loading CLAUDE.md files from additional directories specified via --add-dir flag (requires setting CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1)
This feature allows users to load CLAUDE.md memory files from directories specified via --add-dir, not just the current working directory and its parent chain. However:
A. Missing environment variable documentation
The environment variable CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD is not documented anywhere.
B. Missing behavior documentation
The memory.md page does not explain that additional directories can serve as memory sources when this environment variable is enabled.
C. Missing cross-references
The cli-reference.md and iam.md pages documenting --add-dir do not mention this memory-loading capability.
Suggested Improvement
In memory.md ("How Claude looks up memories" section)
Add after the existing paragraph about recursive memory loading:
Additional directory memories
When you add directories with --add-dir, /add-dir, or additionalDirectories in settings, Claude can optionally load CLAUDE.md files from those directories as well.
To enable this feature, set the environment variable:
export CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1
With this enabled, any CLAUDE.md or CLAUDE.local.md files found in additional directories are loaded alongside your project memories.
<Note>
This feature is opt-in to maintain backward compatibility. Without the environment variable, additional directories only extend file access—they don't contribute to memory.
</Note>
In cli-reference.md (--add-dir row)
Update the description to:
Add additional working directories for Claude to access. When CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 is set, also loads CLAUDE.md files from these directories. See memory documentation.
In iam.md ("Working directories" section)
Add after the existing bullet points:
<Tip>
Set CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 to also load CLAUDE.md memory files from additional directories. See memory documentation for details.
</Tip>
In settings.md (environment variables section if exists, or add one)
Document the environment variable:
| Variable | Description |
|----------|-------------|
| CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD | When set to 1, loads CLAUDE.md files from additional directories specified via --add-dir, /add-dir, or additionalDirectories setting |
Impact
High - Prevents users from using a feature
Additional Context
Affected Pages:
| Page | Issue |
|------|-------|
| https://code.claude.com/docs/en/memory | Missing section on additional directory memory loading |
| https://code.claude.com/docs/en/cli-reference | --add-dir description incomplete |
| https://code.claude.com/docs/en/iam | Working directories section missing memory loading tip |
| https://code.claude.com/docs/en/settings | Environment variable not documented |
Total scope: 4 pages affected
Version introduced: Claude Code 2.1.20
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗