CLAUDE.md parent directory traversal is a security/privacy concern
Resolved 💬 3 comments Opened Feb 19, 2026 by rdewaele Closed Feb 23, 2026
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 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:
- A setting to disable parent directory traversal entirely (only load
CLAUDE.mdfrom 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.mdfiles 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.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗