Tell Compaction What To Keep
When a long conversation gets squeezed, the agent decides what survives — and may drop exactly what you needed. One line in CLAUDE.md fixes it forever: 'when compacting, always preserve the list of changed files and my requirements'. Works in every session, no reminders, and /compact accepts the same guidance inline.
Why it works
When a long conversation gets squeezed, the agent decides what survives — and its guess can drop exactly the requirement you stated once, three hours ago. One line in CLAUDE.md turns the guess into an instruction, permanently: every compaction in every session preserves YOUR named essentials. It's the cheapest insurance in the entire toolchain: one sentence, written once.
How to do it
- Open CLAUDE.md (or say: 'add this line to CLAUDE.md').
- Add the preserve-line naming YOUR essentials: changed files, stated requirements, agreed decisions.
- Tune it to your work: data folks add 'the query and its parameters'; writers add 'tone decisions'.
- It now applies to every compaction — manual or automatic — without being asked.
- For one-off needs, the inline form works too: '/compact keep the file list.'
- After the next compaction, verify once: ask about a preserved item; confirm it survived.
Copy this
Add to CLAUDE.md: "When compacting this conversation, always preserve: the list of files changed so far, my stated requirements, and any decisions we agreed on."
What to watch for
- The line preserves CATEGORIES, not everything — 'preserve all context' is self-defeating; compaction exists because everything doesn't fit.
- Long interview sessions and data runs are where the unprotected loss hurts most; if you do those, this line isn't optional.
Sources