Lower the /autocompact window so compaction happens before context rot
Auto-compact waits until your context is nearly full, which is well past the point where answer quality starts sliding. Set the window lower and compact while the session is still sharp.
The problem
By the time auto-compact fires near the limit, you have already spent turns on a degraded context. Quality drops before the summary arrives, so the compaction preserves work that was already going wrong.
The hack
Run `/autocompact 500k` (or another size) to set how full the context window gets before Claude Code compacts automatically. The value saves to user settings and applies to the current session.
Why it works
Context rot sets in well before the window is full, so the default threshold optimizes for maximum runway rather than maximum quality. Choosing the trigger point yourself means compaction happens while the conversation is still worth summarizing.
Setup
1. Run `/autocompact` with no argument to see the current window. 2. Set a smaller size, for example `/autocompact 500k`. 3. Add `/statusline` and ask it to show the model and context percentage so you can watch the fill level. 4. Use `/context` to see what is actually consuming the window. 5. Pass `--autocompact 500k` at launch, or `auto` to return to the model-tuned default.
Code
# Session-only, without changing saved settings:
claude --autocompact 500k
# Or persist it in settings.json:
{ "autoCompactWindow": 500000 }Prerequisites
Claude Code v2.1.221 or later for /autocompact and --autocompact.
Discussion
No comments yet. Be the first to say whether this worked for you.