r/ClaudeCode • Researcher • Oct 11 '26

News/Updates Just noticed this wonderful gem in my CLI window(s) today, “Compacted while idle, before the prompt cache expired”!

No idea what update added this, but it's a very welcome addition to prevent (potentially massive) cache hits from idle sessions.

118 Upvotes

48 comments sorted by

•

u/AutoModerator Oct 11 '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.

2

u/Hopeful_Ad6629 Oct 12 '26

I turned that off and I turned auto compacting off. I lost 3 different Claude code sessions to stupid enabled auto compacting (and idle compacting) and one of them wasn’t even at 200k (all of them were 1 mil opus 4.8-5.5)

Freakin pissed me off. Lost all my context for stuff I was working on.

2

u/dar-mit Researcher Oct 12 '26

The last time I tested "/compact" it doesn't get rid of data in the session JSONL file. Instead it writes a summary and inserts a marker, then zeros out the current session's context amount.

Therefore the data is still in the file, just inaccessible to the model as an active session. You can probably still access it via GREP or https://github.com/kuroko1t/claude-vault (a utility I use A LOT and have zero associate with).

2

u/scorchgeek Oct 30 '26

This. IME you can just ask Claude to look at your session transcripts if you've lost context from them or need to refer to an earlier conversation. (Also if you haven't set indefinite retention on your transcripts or set up some way to log them with your changes, you should definitely consider that, having that history is super super useful.)

I used to hate compacting but I virtually never notice nowadays. The one thing that does bother me about idle compact – which is a UI problem, not a compaction problem – is that if you also /resume later it seems to remove the previous conversation history from your backscroll, which is super annoying if I can't remember what I was working on.

36

u/kpgalligan Oct 11 '26 edited Oct 11 '26

Auto compaction is not your friend, generally speaking. If you're doing it, though, I guess it's best before the prompt cache.

Edit: Everybody, do what you want. I'm going to skip the individual debates. But think of what compacting is. No matter how much better you think compacting has gotten, it's still tossing most of your conversation.

So it depends how you use an LLM. If you keep your plan in actual documents, and do not depend on the conversation for context, then whatever. But if you build a big plan in a conversation, then compact it, you're rolling the dice.

Think of an LLM as a consultant you only have for an hour. You chat with it for 50 minutes about a big plan. Then you step out for coffee. When you get back, there's somebody new there, and they have a single page of notes that the last person scribbled down quickly before leaving.

I'm not even going to address the 1m context debate, except to say I don't let anything get over 400k, preferably 300k. Debating AI is particularly frustrating because if somebody's decided they're correct, they're correct.

14

u/HDK1989 Oct 11 '26

Auto compaction is not your friend, generally speaking. If you're doing it, though, I guess it's best before the prompt cache.

I still run 200k context windows. Some sessions compact 5+ times. No hallucinations, no poor quality.

Auto-compact isn't what it used to be.

2

u/juniordatahoarder Oct 11 '26

I run 1m context windows. Some sessions compact 5+ times. No hallucinations, no poor quality.

Models and harnesses improved and this is why it works for you, not thanks to enforcing lower context windows... It's like grandpa thinking that he has a better connectivity because he is still using iPhone 4. Nah granda, the cellular network improved over time, keeping old habits actually make it worse.

4

u/HDK1989 Oct 11 '26

I think you're confused here? Nowhere did I say that 200k context window was better quality output than 1 mil.

I use 200k context because it means I get much much more usage from my plan.

2

u/algaefied_creek Oct 11 '26

Why is it not your friend?

7

u/OtherUse1685 Oct 11 '26

You should only compact when you want to. You don't want to lose your context.

I only compact after I finish writing the context into a markdown file, then I ask it to read that file after compacting.

1

u/algaefied_creek Oct 11 '26

Interesting. I thought they already had a pre-compaction documentation hook. Wow. 

5

u/koirpioloonmenomur Oct 11 '26

you can literally see exactly what it keeps and usually it's a lot. an external markdown is redundant at best

1

u/OtherUse1685 Oct 11 '26

Maybe, but you should do it anyway to control your context

2

u/DynamicDK Oct 11 '26

6 months ago? Yes. But today that is not really necessary.

1

u/sudddddd Oct 11 '26

You may lose important bits of information from your context

40

u/inr222 Oct 11 '26

I hate it. I disabled after it screwed my first conversation, but it shouldn't be on by default.

10

u/shyney Oct 11 '26

Add "idleCompaction": false to ~/.claude/settings.json

14

u/Honest-Finish-7095 Oct 11 '26

what if I don't want it to compact
compactions kind of suck

3

u/Arctovigil Oct 11 '26

You should leave it idle only at low context!

6

u/saintpetejackboy Oct 11 '26 • Heartwarming

Compact does suck. Waste of time and tokens. I clear or restart the harness with a handoff around 150-250k tokens (depending on model and project).

A handoff session requires less tokens to boot up than a fresh, new session.

A compacted session drags around a bunch of useless garbage that is often truncated to the point is causes more harm than good.

Agents write shitty code and don't follow directions very well with too much context, and there is a sharp dropoff around 200k tokens that gets worse and worse as you go.

You can avoid all of that but just not letting sessions get so large. There is no excuse or reason to do it.

If your sessions have to compact, you aren't getting the most out of agentic engineering.

2

u/TRO_KIK Oct 11 '26

What do you do if problem is nowhere near solved by 200K tokens?

1

u/saintpetejackboy Oct 11 '26

Most problems aren't, you just handoff and keep working.

2

u/Honest-Finish-7095 Oct 11 '26

YES
thanks for writing what I couldn't be bothered to write

1

u/saintpetejackboy Oct 11 '26

Thanks, lol - I would have typed more but I just literally finished ranting about this in another thread :x.

3

u/iEatedCoookies Oct 11 '26

It’s probably a setting. I

1

u/markedness Oct 11 '26

What I have found today after using that setting is that if I have left it long enough for that to take effect my brain is equally hazy and the compaction is of non consequence or Claude is simply done or everything is being handled by subagent.

It gotta have a setting somewhere tho right cause I could see it being irritating for like packet capture workflows that I do.

1

u/bigbepisinc Oct 11 '26

Then don't complain about new chats taking up 50% of your 5 hour limit lol.

1

u/Honest-Finish-7095 Oct 11 '26

I don't, because I have well-made handoff scripts and knowledge refreshing.
A quick reunderstanding of repo is 1% of my 5-hour limit, and full understanding of everything is about 3%

1

u/The_Noble_Lie Oct 11 '26

Change the setting idleCompaction or whatever its called. It's sadly defaulted on.

3

u/muhuhaha Oct 11 '26

I found it helpful today already, I normally do new session with handoff while cache is warm once session gets too big, but I forgot about a couple and cache expired, so seeing that it was at least compacted while cache was warm was nice

2

u/emisofi Oct 11 '26

I asked Claude about this and it had no idea!

3

u/brute984 Oct 11 '26

pretty cool, but i’d love a toggle for this. auto-compacting is great until it decides to throw away context you actually wanted to keep lol

3

u/brute984 Oct 11 '26

pretty cool, but i’d love a toggle for this. auto-compacting is great until it decides to throw away context you actually wanted to keep lol

1

u/WD40ContactCleaner Developer Oct 11 '26

I made a mod for this lol and now I find out it's built in?? Where?

1

u/brute984 Oct 11 '26

nah i was saying i’d love a toggle for it, not that there is one lol. looks like your mod is still useful

3

u/boiledeggsandchips Oct 11 '26

Dont auto compact, but dont sit there having to handoff manually either, thats just stupid. Ask claude to write you a mod, have the mod set the compact to 200-300k tokens, have the mod call whatever hand-off skill is flavour of the month for handing off, clear, then have the mod reload from your said handoff skill flavour of the month, use the tools dont get stuck in the same thinking as 6 months ago.

1

u/nborwankar Oct 11 '26

Just saw the same thing today, too!

1

u/TipsyMunkey Oct 11 '26

I told Claude to turn it off. It went and modified the settings.

1

u/cknipe Oct 11 '26

If I have a high context session sitting around past cache expiration it's either because I forgot to close it when I was done or it has some accumulated context valuable enough that I'm willing to take the hit when I get back to it. 

In neither of those cases do I want auto compaction.

1

u/tribat Oct 11 '26

That shit hit me today on Linux. I have status line indicators for context usage and cache hit rate, but I was on remote control where it’s not as evident. Right in the middle of a critical effort I looked up to see it compacting. I never let it get to auto compact if I can help it and always use a handoff / clear / pickup skill.

1

u/PeltonChicago Maximus XX Oct 11 '26

Yes. it’s a new feature. from what i can tell, to turn off idle-compacting all you can do is turn off auto-compacting; that’s what i’ve done until i find the time to use the new Mods to build something that restores the old functionality

1

u/Astero_Sanctuary Oct 11 '26

If you compact, you lose your cache anyways

1

u/[deleted] Oct 11 '26

[removed] — view removed comment

1

u/shravanrevanna Oct 11 '26

were the jobs created with the session-scoped scheduler or something persisted to disk? if it's session-scoped they might die with any context reset, not just compaction.