
Stop Fighting Context Compaction: Use /compact with a Focus Note in Claude Code
Chris Harper
2 min read
Jun 21, 2026 · 12:16 UTC
TL;DR: Use /compact focus on [key decisions] instead of bare /compact — the focus note steers what survives compression; check /context first so you compact at the right moment.
When Claude Code auto-compacts — or when you run /compact manually — it summarizes the entire conversation into a compressed representation. The problem with bare /compact: Claude picks what to summarize, and it often loses the specific decisions, schema choices, and API contracts you negotiated earlier in the session.
The fix is a single addition to the command:
/compact focus on the database schema decisions, the payment API contract, and the rate-limit approach we decided on
Claude now biases the summary toward what you named. What you didn't name gets compressed harder. This takes 10 seconds and substantially improves whether you can pick up mid-session without re-explaining context.
Check /context first. Run /context anytime to see a live token breakdown: system prompt, CLAUDE.md, tools, conversation history, skills. Aim to compact at 40–50% window usage, before quality degrades. Waiting until 80% means Claude is already compensating and the resulting summary will be less precise.
Set a proactive threshold. Add to your shell profile:
export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=40
This fires auto-compact at 40% instead of the default ~80%, keeping context consistently fresh without manual intervention.
When to /clear instead. If the task is completely done and you're starting something unrelated, /clear is cleaner — it resets to a fresh context with just CLAUDE.md and tools loaded. Rule of thumb: /compact to stay in the same task, /clear to start a new one.
Quick diagnostic: did you compact too late? Claude starts hedging ("I should double-check the earlier decision...") or re-explaining steps it should remember — both are signs context quality has degraded. Compact earlier next time.
Sources: How Claude Code works — Anthropic, Context buffer management — claudefa.st