[FEATURE] Add setting to exclude files from memory loading

Resolved 💬 3 comments Opened Mar 8, 2026 by axelson Closed Mar 12, 2026

Preflight Checklist

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

Problem Statement

When a project's CLAUDE.md references files via @filename syntax (e.g., @pyproject.toml), those files are automatically loaded into context as memory at startup. There's currently no way to exclude specific files from memory loading without modifying the committed CLAUDE.md file. The permissions.deny setting with Read() patterns blocks the Read tool but does not prevent auto-loading at startup.

Proposed Solution

Add a memory.exclude (or similar) setting configurable in .claude/settings.local.json to exclude specific files from being loaded as memory:

{
  "memory": {
    "exclude": [
      "./pyproject.toml",
      "./CLAUDE.md"
    ]
  }
}

This should respect existing settings precedence so local settings override shared settings.

Alternative Solutions

The only current workaround is modifying the committed CLAUDE.md directly, which is not viable in a shared codebase. Using permissions.deny with Read() patterns was attempted but does not affect memory auto-loading at startup.

I really don't want to have to carry changes to the committed CLAUDE.md as local changes that I have to continuously remember (or continuously instruct Claude) to not commit.

Priority

High - Significant impact on productivity

Feature Category

Configuration and settings

Use Case Example

  1. Working in a shared codebase where the committed CLAUDE.md includes @pyproject.toml
  2. That file is 8k+ tokens and not needed for my workflow
  3. I can't modify the shared CLAUDE.md without affecting teammates
  4. With memory.exclude in .claude/settings.local.json, I could suppress it locally
  5. This would reduce context token usage without touching shared config

Additional Context

Note: this is a re-filing of https://github.com/anthropics/claude-code/issues/20172 because that was closed with a message saying " If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant."

Related closed issues for reference: #11759, #15396 (those are about deduplicating @ context and CLAUDE.local.md — distinct from this request, which is about selectively suppressing auto-loaded memory files the user doesn't control).

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗