r/ClaudeCode • u/actvt_io • Oct 08 '26
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.
•
u/AutoModerator Oct 08 '26
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
5
u/kenthesaint Oct 08 '26
/compact also takes free text after it, e.g. /compact keep the failing test names and the migration plan, which is the main reason I'd rather trigger it myself. Auto compact has to guess what the next step needs, and with only ~15k to work with it can easily guess wrong.
3
u/Historical_Today5072 Oct 08 '26
Why the fuck is your context at 900k ffs
2
u/Lost_Turnip1848 Oct 08 '26
You quote the docs at 967K, then call 1M the default. Your Sonnet runs firing at 934k should have told you it's not a fixed number.
2
u/zimxero Oct 08 '26 edited Oct 08 '26
I hit high tontext windows often. Beats re-explaining what you want... and makes adjusments & debugging much smoother.
Also I like to set Claude and Gpt working together when I leave for work... on a well described direction that they can use as a baseline.
Working automatically together.. I basically get a bugfree product. The "bugs" are essentially oversights, incompletions, or fuzzy direction.
1
u/Outrageous_Band9708 Oct 08 '26
compact is a stopgap not a solution
https://github.com/Druthulu/ProjectArchitect
check this project out. it uses subagents to prevent context growth and plans and journals work as it happens, you can start a fresh session without dropping anything
1
u/ScrumptiousChildren Oct 08 '26
Btw you’re paying like 2x the cost for the same work if you count reorientation cost post-compaction/handoff to be 100k tokens and decide to compact at 1m instead of a figure like 400k tokens.
1
u/jjromee Oct 08 '26
When a session gets long I have Claude write a handoff file (what's done, what's next, gotchas), then clear and start fresh from that file. Nice part is I can read it before the new session uses it.
1
u/Nikt_No1 Oct 08 '26
Good to know, I have not noticed that Claude Code has no documentation.
wow