[FEATURE] Add setting to exclude files from memory loading
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
- Working in a shared codebase where the committed
CLAUDE.mdincludes@pyproject.toml - That file is 8k+ tokens and not needed for my workflow
- I can't modify the shared
CLAUDE.mdwithout affecting teammates - With
memory.excludein.claude/settings.local.json, I could suppress it locally - 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).
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗