Skip to content

[FEATURE] Provide way to exclude parent CLAUDE.md files from auto-loading in subdirectories #20880

Description

@alex-klyuev

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

When working in a subdirectory of a large monorepo, Claude Code recursively loads all parent CLAUDE.md files into context with no way to opt out. This causes large irrelevant documentation to consume context tokens unnecessarily, thereby degrading performance and usefulness of Claude Code.

Per the memory documentation:

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.

This behavior is problematic for monorepos with multiple teams/tech stacks where parent-level documentation is irrelevant to subdirectory work.

Example Scenario

monorepo/
├── CLAUDE.md (40k+ chars - Go microservices docs)
├── services/
│   ├── ui-app/          # Frontend app
│   │   ├── CLAUDE.md    # Frontend-specific docs
│   │   └── packages/
│   │       └── app/     # <- Working directory
│   │           └── CLAUDE.md

Currently loaded: All 3 CLAUDE.md files, including backend Go service documentation that's irrelevant to the working directory.

Desired: Only load the 2 UI-related CLAUDE.md files, excluding the one in root directory.

Proposed Solution

The ideal solution is some sort of setting or configuration knob to customize CLAUDE.md loading, that can be checked in to main repo (something akin to a .gitignore).

Alternative Solutions

Tried denying permission to read from CLAUDE.md in .claude/settings.json - this doesn't work as this controls tool uses by Claude Code but not auto-loading CLAUDE.md into the context window.

Priority

High - Significant impact on productivity

Feature Category

Configuration and settings

Use Case Example

No response

Additional Context

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions