Problem
Claude Code recursively walks up the directory tree from the working directory to / and reads every CLAUDE.md it finds. This behavior is not configurable.
This is a security and privacy concern:
-
Unintended context leakage: Starting Claude Code in ~/projects/foo/bar/ silently loads CLAUDE.md from ~/projects/foo/, ~/projects/, ~/, etc. — directories the user never explicitly pointed Claude at. In a workspace with multiple unrelated projects under a shared parent, this leaks instructions and context from one project into another.
-
No user awareness: There is no indication that parent CLAUDE.md files were loaded. The user has no way to know that files outside their working directory are influencing Claude's behavior.
-
No opt-out: The traversal is hardcoded. There is no setting to disable or limit it.
Expected behavior
At minimum, provide a configuration option to control this behavior. Possible approaches:
- A setting to disable parent directory traversal entirely (only load
CLAUDE.md from the working directory)
- A setting to limit traversal to the git repository root
- A setting to set an explicit boundary (e.g., stop at a specific directory)
- Display which
CLAUDE.md files were loaded at startup so the user is aware
Current behavior
Claude Code unconditionally recurses from cwd up to (but not including) /, loading every CLAUDE.md and CLAUDE.local.md it encounters.
Problem
Claude Code recursively walks up the directory tree from the working directory to
/and reads everyCLAUDE.mdit finds. This behavior is not configurable.This is a security and privacy concern:
Unintended context leakage: Starting Claude Code in
~/projects/foo/bar/silently loadsCLAUDE.mdfrom~/projects/foo/,~/projects/,~/, etc. — directories the user never explicitly pointed Claude at. In a workspace with multiple unrelated projects under a shared parent, this leaks instructions and context from one project into another.No user awareness: There is no indication that parent
CLAUDE.mdfiles were loaded. The user has no way to know that files outside their working directory are influencing Claude's behavior.No opt-out: The traversal is hardcoded. There is no setting to disable or limit it.
Expected behavior
At minimum, provide a configuration option to control this behavior. Possible approaches:
CLAUDE.mdfrom the working directory)CLAUDE.mdfiles were loaded at startup so the user is awareCurrent behavior
Claude Code unconditionally recurses from
cwdup to (but not including)/, loading everyCLAUDE.mdandCLAUDE.local.mdit encounters.