Coding tip
Auto-compact your Claude at 250k
Claude Code can hold a million tokens and every reply drags all of them along. Compact at 250k and let subagents do the reading.
Auto-compact your Claude at 250k context window. Just ask your Claude to do it or send it this post. Why would he need to know more?
On a 1M model Claude Code compacts at about 967k tokens by default. Until then every reply carries the old stack traces, the dead ends and the log spam from two hours ago.
The setting
Put this in ~/.claude/settings.json. If you already have an env block, add the line to it.
{
"env": {
"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "25"
}
}
The number is a percentage of the auto-compact window, so 25 lands at roughly 250k on a 1M model. It can only make compaction come earlier. Values above the default are ignored.
Compact by hand
Type /compact to compact right now. You can tell it what to keep, like /compact keep the plan and the open todos. For the same instructions every time, add a # Compact instructions section to your CLAUDE.md.
If you turned auto-compact off at some point, switch it back on in /config.
Subagents do the reading
Also always work with subagents. A subagent gets its own context window. It reads the whole src folder or a 9,000 line log, and only its final answer comes back to your main Claude, so your main context stays light.
Ask for it in plain words: “use a subagent to read the deploy logs and tell me why it failed”.
*PS: I have a very dutch accent so this is not my real voice.
Sources
Claude Code docs: environment variables; default auto-compact thresholds; when context fills up; subagents.

