When your conversation gets long, /compact summarizes it to free up context. But the default summary may not keep what matters most. Pass a custom focus prompt to guide it.
Usage
/compact focus on the database migration decisions and the API contract we agreed on
This tells Claude to prioritize keeping migration and API contract details while compressing less relevant parts.
Why This Matters
At 70% context usage, Claude starts losing precision. At 85%, hallucinations increase. Running /compact proactively keeps things sharp.
Key Behavior
Your CLAUDE.md is protected during compaction. After /compact, Claude re-reads your CLAUDE.md from disk and injects it fresh. Your project conventions survive every compaction.
Context Management Strategy
| Context Level | Action |
|---|---|
| 0-70% | Work normally |
| 70-80% | Run /compact with a focus prompt |
| 80-90% | Run /compact immediately |
| 90%+ | Run /clear and start fresh |
Pro Tip
Before compacting, ask Claude to write important decisions to a file (like DECISIONS.md). That way, even after aggressive compaction, the information persists on disk.