smart-compact
Keeps the cache warm, or compacts before it expires.
The moment
You step away for lunch with a long session open.
Without smart-compact
While you’re gone, the conversation’s cache expires: after an hour on a subscription, after five minutes on an API key. Your next prompt then writes the whole conversation to the cache again, at a higher price. For a session of 400k tokens that is $3.20$3.20$3.20
Not measured
Opus 5.5, just to pick up where you left off.
With smart-compact
A few minutes before the cache expires, smart-compact does whichever costs less: it keeps the cache warm with one cheap request, or it compacts the conversation while the cache is still warm. Small sessions it leaves alone. The status line tells you whether your session is ready or has gone cold.
Choose how long you are away, and smart-compact’s own rules decide what happens.
● ready · cold in 57m● ready · cold in 57mNot measured
Opus 5.5 to write it all again when you’re backBack at the keyboard:
○ coldNot measured
Opus 5.5 eachBack at the keyboard:
● readyNot measured
Opus 5.5 to write it all again when you’re backBack at the keyboard:
○ coldNot measured
Opus 5.5 each, then compacted while warm for about $0.87about $0.87About $0.87
Not measured
Opus 5.5Back at the keyboard:
◌ compactedWhat it saves
This one is worked out from prices rather than measured. For that session, letting the cache expire costs $3.20$3.20$3.20
Not measured
Opus 5.5, one keep-alive $0.09$0.09$0.09
Not measured
Opus 5.5, and compacting about $0.87about $0.87About $0.87
Not measured
Opus 5.5, plus whatever detail the summary loses.
Every measurement for smart-compact
The dot is the measured change, the bar around it the 95% range, the upright line no change. Left of the line is cheaper or fewer.
- Away from an idle 400k-token session: let the cache expire, re-cache on returnworked out from list prices, not measured$3.20Not measured. Opus 5.5
- One keep-alive for the same session: a cheap read resets the cache's clockworked out from list prices, not measured$0.09Not measured. Opus 5.5
- Compacting the same session while its cache is still warmworked out from list prices, not measuredabout $0.87Not measured. Opus 5.5
Where it doesn’t help
A small session has little to save, so it does nothing there. If your computer sleeps past the moment to act, it can’t act, and it marks the cache as cold.
Turn it on or off
/cache shows the live figures and the plan. strategy: keepalive never compacts, and /mods smart-compact off turns it off. Every option is in the README; the code is in smart-compact/.