Mods

smart-compact

Keeps the cache warm, or compacts before it expires.

It comes with the pack and is on from the start.

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.

You are away for
Without smart-compact$3.20$3.20$3.20
Not measured
Opus 5.5
to write it all again when you’re back
Back at the keyboard: ○ cold
With smart-compactKept warm twice, at $0.09$0.09$0.09
Not measured
Opus 5.5
each
Back at the keyboard: ● ready

What 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.

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/.