Repository navigation
Savings ledger 4/6: savings setting, stretch tracking and server wiring - #32
Merged
Merged
Conversation
This was referenced Oct 31, 2026
3 tasks
cris005
force-pushed
the
savings/04-engine
branch
2 times, most recently
from
November 2, 2026 03:59
bdbc692 to
03de60c
Compare
…ring Adds the `savings` setting (default on; picker, `/cache-manager savings on|off`, plugin option) and the `modelsDevPrices` option. The keepalive engine tracks idle stretches, charges each ping at the TTL it fired on, and reports a rescue when a return sent past the original expiry plus a 30 s margin reads the cache warm; on `hybrid` only the part past the prefix counts. Snapshots carry `showSavings` and the ledger readout. The server builds the PriceBook, models.dev fallback and ledger, prefetches prices off the request path, and sweeps settings and ledger keys of deleted sessions in one pass.
cris005
force-pushed
the
savings/04-engine
branch
from
November 2, 2026 03:59
03de60c to
0b61441
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Part 4 of 6. This is where the ledger starts counting. The sidebar rows come in #33.
The
savingssetting/cache-manager savings on|off, and as a plugin option. Turning it off hides the rows, but the ledger keeps counting.modelsDevPricesoption: new, default off. It turns on the models.dev price fallback.What counts as a save
An idle stretch counts as one avoided cache rewrite when all three hold:
Every ambiguous case counts less:
hybrid: only the part past the long-lived prefix counts. The prefix is the largest 1h write on Claude, or the first primary context on GPT-5.6+. If the prefix size is unknown, no save is counted.Wiring
showSavingsandsavings. The readout loads only for managed, non-child sessions with savings shown.split,modelandreportedModelto the engine.PriceBook, models.dev fallback and ledger.void prices.prefetch(), so nothing on the request path waits for a price.session/andledger/keys of deleted sessions.Testing
Before release
costdeclared on a custom provider's model inopencode.jsonccomes back fromctx.model.list().Stack created with GitHub Stacks CLI • Give Feedback 💬