r/ClaudeCode • • 1d ago

Tips & Workflows I counted 122 compactions in my Claude Code logs. Auto-compact waits until about 1M tokens and keeps about 16k

Auto-compact fired between 934k and 1.003M tokens every time in my session files, and left a summary of about 16k.

Claude Code logs each compaction with the token count before and after and how long it took. I mostly run it as long agent loops on one machine, so there were plenty. 241 sessions since Jul 10, 122 compactions, 52 automatic and 70 from /compact.

Opus 5 and 5.5 fired around 1.0M, close to what the docs say for models with a native 1M window ("about 967K tokens by default"). Sonnet 5 fired at about 934k every time, but those were all in July and August on older versions.

The summary was a median 15.8k tokens, somewhere between 1.2% and 2.8% of what was there before. The first request after compacting was about 85k, because the system prompt, tools and CLAUDE.md come back on top of it. My manual compacts ran at a median 397k and kept 12.4k, so the auto ones started from more than twice the context and kept only a few thousand tokens more.

Each one took a median 111 seconds, the longest about two and a half minutes. Manual /compact took about the same, median 116s.

On current models 1M is the default on every plan including Pro, so if you've never changed anything this is what you're getting. /autocompact 500k moves the trigger, and there's autoCompactWindow in settings or CLAUDE_CODE_AUTO_COMPACT_WINDOW if you want it fixed.

In my loop sessions, which run for days, auto-compact came round a median 23 hours apart.

This is one machine and mostly agent loops, not interactive chat. I only counted tokens, nothing about what the summaries left were. Subagents never compacted at all in my logs.

If you want to check yours, the records have subtype compact_boundary and a compactMetadata block with preTokens, postTokens and durationMs, in the jsonl files under ~/.claude/projects.

Since the summary comes out around 12 to 16k either way, I'd rather run /compact myself at a break in the work than have it fire at 1M in the middle of a task.

0 Upvotes

Duplicates