Option to exempt CLAUDE.md / auto-memory from compaction

Resolved 💬 6 comments Opened Apr 6, 2026 by tsubasa-rsrch Closed Jun 16, 2026

Problem

Long CLAUDE.md files lose fidelity after compaction because they are compressed along with regular conversation messages. Instructions that were clear at session start become vague or missing after compaction, causing the model to forget project conventions, coding styles, or workflow rules.

This is a common source of "Claude forgot my instructions" reports, but users often don't realize compaction is the cause.

Current behavior

  • .claude/rules/ files: exempt from compaction (re-injected fresh each turn)
  • CLAUDE.md files: compressed during compaction (treated as regular system-reminder messages)
  • Auto-memory (~/.claude/projects/*/memory/): compressed during compaction

Proposed solution

An option to exempt CLAUDE.md and/or auto-memory files from compaction, similar to how rules files are handled. This could be:

  1. A settings flag: "compactionExempt": ["CLAUDE.md", "memory"]
  2. Or simply treating CLAUDE.md the same as rules (always re-injected at full fidelity)

Use case

Projects with detailed CLAUDE.md (workflow instructions, API conventions, team agreements, project context) where compaction degrades instruction-following quality mid-session. This is especially noticeable in long sessions where multiple compactions occur.

Workaround

Currently, moving critical instructions from CLAUDE.md to .claude/rules/ preserves them through compaction. But this splits project documentation across two locations with different semantics, which is not ideal.

View original on GitHub ↗

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