Repository navigation
feat(mod): subscription band in tokens, this session only - #981
Conversation
On a Claude subscription the band now shows savings and the next-message price as a share of the 5-hour limit, not dollars or account-wide token counts. - Row 2: `5h 34% · this session saved 3.0% (+21 min)`. The saving is this session's only. Before, the token counts covered all sessions on the proxy. - Row 1 and the pane: `next message 0.2% · 3.1% if cold`. - The rate is Claude Code's used share over what all sessions spent in the window at API prices. Until the window has $0.50 of spend and 2% used, the band shows this session's tokens and no price. - cg.py reads the window's stats once more, scoped to the session. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | ca74089b9e2f |
blocking |
Verdict: blocking
Findings
- context-guru-plugin/hooks/register.tsx:530 — the pane's new subscription rendering has no test
- What fails: no test covers the pane's NEXT MESSAGE section on a subscription. The PR adds three new behaviors there: the price as a share (
0.2% of the 5h limit, line 530 and 534), thenot measured yettext while the rate is unmeasured, and theunitsuffix (line 509). A regression in any of them (a wrong conditional, a droppedunit,unknownshown wherenot measured yetshould be) passes the suite. - Proof:
grep -n "usage = " hooks/register.test.tsx—usage = fiveHour(the subscription fixture) is set only at lines 285, 307, 321, 333, all band (AbovePrompt) tests. Every pane (PANE) test boots with nofive_hourrate limit, soisSubis false andprice()returns dollars. The band's equivalent change got three dedicated tests (lines 306-339); the pane's got none. - Fix: add one pane test:
usage = fiveHourplus thesubscription(d)doc, assertif the cache is warm 0.2% of the 5h limitandif it is cold 3.1% of the 5h limit; a second withwindow_cost_usd: 0.2, assertnot measured yet.
- What fails: no test covers the pane's NEXT MESSAGE section on a subscription. The PR adds three new behaviors there: the price as a share (
Non-blocking
- register.tsx:359 — row 1 changes for a non-subscription edge too. A warm cache on a proxy that sends no
next_warm_usd/next_cold_usdnow drawscache warmwhere it drew a dangling dimnext messagelabel. An improvement, but it is a behavior change outside the subscription path. Name it in the PR description (RELEASING.md's rule). - model.ts:341 —
signatureomitslimitWindow.startMs. It listscostUsdandsavedUsdonly. A window rollover that left both numbers identical would not redraw the(+N min)figure. Improbable (a fresh window's spend drops below the $0.50 floor, socostUsdchanges). IncludestartMsfor completeness. - cg.py:255 — the
status_extrasdocstring is stale. It still says the function adds "the tokens compaction kept out of the current 5-hour window". It now also adds this session's saved dollars and every session's spend. The inline comment (line 270) is right; update the docstring to match. - cg_cachestate_test.go:15-18 — the test's comment breaks mid-sentence. "and every session's spend in the 5-hour window. Each" — the word "Each" starts its own line before "comes from". Rewrap.
- register.tsx:518 — the pane header still shows dollars on a subscription (
saved $22.80 of $81.90 this session) while the band and the pane's NEXT MESSAGE show limit shares. Pre-existing line, not changed here. Consider a follow-up for unit consistency.
What I checked
- The full diff (8 files) and the code around every change:
model.ts(limitWindow,limitRate,share,limitSaved,price,view,signature),register.tsx(statusRow,limitWords,limitPart, the band's row 1 and row 2, the pane's NEXT MESSAGE),cg.pystatus_extras(both copies),types/index.d.ts, the Go test, the TS tests,docs/plugin/statusline.md. - The math. Rate = used % ÷ window spend ($8.50 → 4%/dollar); saved share = session saving × rate; minutes = elapsed × saving ÷ spend. I derived the minutes formula from the limit-consumption model and it is exact under the stated "same pace" assumption. Guards: $0.50 spend floor, 2% used floor, saving ≤ 0 falls back to tokens, elapsed clamped to [0, 5h].
- Width accounting in
statusRow: thelimitPartterm counts3 + pct + 3 + partfor every option, matching the render, including the new short (saved 3.0%) level between the long form and nothing. - Fail-open:
status_extraskeeps its blanketexcept; every new field is set only when its read succeeded; the mod falls back to tokens, then to5h N%, then row 1 tocache warm._bg_jsonserves a stale copy and detaches one refresher per 30 s; the session-scoped read uses a distinct cache tag (win-<sec>-<sid>), andsidis regex-validated before it reaches a URL. - The server side of the new reads:
dash/api.go's lean branch takessession+sincetogether;overviewLeanWindowscopes by both throughf.where();CachesplitHistoricalUSDappliessinceoutside the session-ranking CTE, sowindow_session_saved_usdis the session's saving inside the window. The window read (win) is used only forcost_usd, which comes from the main aggregate, so the lean path's disclosed discount on window-scoped saving credits does not touch it. - The vendored Codex copy:
diffconfirms bothcg.pyfiles are byte-identical, andTestCGScriptsAreVendoredIntoCodexenforces it. - The Go test's mock routing:
_fetch_statssendssessionwithoutsince, the newmineread sends both,winsendssinceonly — the switch matches all three. - Docs against the code: the statusline.md Subscription section matches the thresholds ($0.50, 2%), the degrade order, and the example numbers.
- Data dependence: no new stored data; the new fields are reads of existing dollar aggregates (metadata). No row in docs/data-dependence.md needs a change.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | ca74089b9e2f |
blocking |
Verdict: blocking
Findings
- context-guru-plugin/hooks/register.tsx:530 — the pane's new subscription behaviour has no test
- What fails: the PR changes the pane's NEXT MESSAGE section in three new ways: the price becomes a share with
of the 5h limitafter it (register.tsx:509, 530, 534), and a priced-but-unmeasured rate showsnot measured yetinstead ofunknown. No test covers any of them. Every test that sets afive_hourrate limit (register.test.tsx:307, 321, 333) mounts the band (AbovePrompt), never the pane (PANE).grep 'not measured\|5h limit'over the plugin hits only register.tsx, no test file. - Proof:
grep -n "usage = " context-guru-plugin/hooks/register.test.tsx— the three subscription tests all call$.ui.mount({ ...BAND, ... }); no$.ui.mount({ ...PANE, ... })runs withusageset to a subscription. The band's equivalent paths each got a test; the pane's paths got none. - Fix: add one pane test with the
fiveHourfixture and thesubscriptiondoc: assert0.2% of the 5h limitwarm and3.1% of the 5h limitcold, and one withwindow_cost_usd: 0.2assertingnot measured yetand no$.
- What fails: the PR changes the pane's NEXT MESSAGE section in three new ways: the price becomes a share with
Non-blocking
- register.tsx:518-523 — the pane mixes units on a subscription. The header still shows
saved $22.80 of $81.90 this sessionin dollars while NEXT MESSAGE below it shows a share of the 5-hour limit. The band hides every dollar on a subscription (the tests assertnot.toMatch(/\$/)). Consider hiding the header's dollar line on a subscription too, or say in the docs why it stays. - register.tsx:352-359 — an edge case outside the subscription changed. A warm cache with no price on a non-subscription proxy showed a bare
next messagelabel before; it now showscache warm. Arguably better, but it is a behaviour change beyond the subscription case. Name it in the PR description, per the repo's rule on edge-case behaviour changes. - context-guru-plugin/scripts/cg.py:272-273 — two extra inline reads, in sequence. On a cold cache,
status_extrasnow runswinandmineinline, one after the other, each up to the cold-read timeout. The status line runs its reads in parallel under one deadline. The first poll after a session start can take twice as long as before. The band tolerates it; noting the cost. - docs/plugin/statusline.md:199 — the cold-cache example is now stale for subscriptions. It says
◆ ○ cache cold · next message $0.78unconditionally. On a subscription the price is a share now. The Subscription section says so, but this bullet contradicts it for that case. - context-guru-plugin/scripts/cg.py:1640 — the
--window-start-mshelp text is stale. It says "for its saved tokens". The flag now also driveswindow_cost_usd,window_start_msandwindow_session_saved_usd.
What I checked
- Read the full diff (8 files) and the code around every change. The two
cg.pycopies (plugin and codex-marketplace) are byte-identical. - cg.py plumbing:
status_extrasfields, the_bg_jsoncache tags (win-<start>-<sid>cannot collide with the status line'swin-<start>),WINDOW_TTL_SECONDS = 30against the 15 s poll,_num/_saved_tokens_textonNone, the--window-start-msCLI parse (type=int, so the echoedwindow_start_msstays a number), and thesidshape (validated^[A-Za-z0-9_-]{1,128}$, safe in a file name and a query). - Server side of the new
minequery:dash/api.gostatsLean takessessionandsincetogether;Filter.where()combinesr.session_id = ?andr.ts >= ?;CachesplitHistoricalUSD's outer WHERE carries the window bound (only its ranking CTE is unfiltered), sototal_saved_usdforsession+sinceis window-bounded.cost_usdandtotal_saved_usdexist in the lean response (dash/overview.go:145, 289). - model.ts math:
limitRate(guards: cost ≥ $0.50, used ≥ 2%),limitSaved(rate × saving; minutes = elapsed × saved ÷ spend, which is the correct extension of the window at the measured pace; elapsed clamped to [0, 5 h]),shareboundaries,price(rate defined only on a subscription, so no dollar leaks onto a subscription). Recomputed the test figures: 34% ÷ $8.50 = 4%/dollar, 0.75 × 4 = 3.0%, 240 × 0.75 ÷ 8.5 = 21 min, 0.06 × 4 = 0.24 →0.2%, 0.78 × 4 = 3.12 →3.1%. - statusRow width accounting: recomputed the 140-column and 72-column cases by hand; the label form (
this session saved 3.0% (+21 min)) fits at 140, the short form (saved 3.0%) at 72, matching the tests.limitPartkeeps the old rule that the unmeasured token stand-in shows in the label form only. - Fail-open: every new read sits inside
status_extras's blanket try/except; a missingwin,mineor price leaves a field out and the band falls back (5h 34%alone,cache warm, token stand-in). No request path is affected. - Signature/redraw: the 1-second tick re-renders the band, so the minutes recount without a snapshot change;
signaturegainscostUsd/savedUsd.startMsalone is not in the signature, but it cannot change without the cost changing with it. - Data dependence: the PR reads existing
/api/statsaggregates (dollars, token counts) — metadata already covered by the data-dependence table's Metrics and Dashboard rows. No new stored data. The PR description should still state this, per CLAUDE.md. - Tests were not run (not approved for this review). I did not read the PR conversation or the other review, per round 1.
On a Claude subscription the band counted saved tokens for every session on the proxy, and priced the next message in dollars. - Row 2: `5h 34% · this session saved 1.2M rd / 85.0k wr`. cg.py now reads the window's stats with the session filter. - Row 1 and the pane: `next message 90.0k rd · 90.0k wr if cold`. A warm cache reads the prefix; a cold one writes it again. - No share of the 5-hour limit: the response headers give only whole percents and no weights (see #984). Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Round 1 replies. Commit f7eba6e changes the scope: the owner asked to drop the % of the 5-hour limit and keep Blocking finding (both reviewers): the pane's subscription path has no test. Fixed in f7eba6e. The new test Non-blocking notes:
|
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 2 of 2 | f7eba6ed7c65 |
approve |
Verdict: approve
Findings
None. The new commit drops the %-of-limit design and prices the next message in tokens. I checked the new code and tests; I found no defect.
Earlier findings
- Pane subscription path untested (both reviewers, blocking): fixed. The new test
on a subscription the pane prices the next message in tokens(register.test.tsx:318) mounts the pane with afive_hourlimit and checksif the cache is warm 90.0k rdandif it is cold 90.0k wr. The untested strings it was filed against (not measured yet,of the 5h limit) no longer exist. - Pane header still in dollars on a subscription (both reviewers): not changed, by decision. The author tracks the subscription form of the dashboard and commands in #985 and #986 and lets the pane header follow. I accept this: the line is unchanged from main, and the follow-up is filed.
cache warmedge on a non-subscription (both reviewers): gone. Row 1 is back to main's exact shape for API-key users; the subscription path now shows tokens through the same render code.- Two inline reads in sequence in
status_extras(reviewer 2): gone. cg.py makes one window read, with the session filter. - Stale cold-cache doc example (reviewer 2): addressed. The
$0.78example now stands for API-key users only, and the new Subscription bullet gives the token form for row 1 and the pane. --window-start-mshelp text andstatus_extrasdocstring (both reviewers): fixed. Both say "this session's" now.signatureomittinglimitWindow.startMs(reviewer 1): gone.limitWindowno longer exists.
Non-blocking
- cg_cachestate_test.go:17 — the comment still breaks mid-sentence. The author's reply says "Test comment broken mid-sentence: fixed (rewrapped)". It is not: line 17 ends with
window. Eachand line 18 startscomes from a statusline.py helper. The sentence still splits after "Each". Trivial, but the reply's claim does not match the file. - model.ts:46 — the cold
wrfigure counts the cached prefix only. A cold cache also writes the fresh input of the new message, so90.0k wrreads low next to the old dollar price, which priced the full write. The doc bullet and the test comment both say "the cached prefix written again", so the meaning is disclosed. Fine to ship; a+ fresh inputwording could come later. - register.tsx:339-344 — the dangling
next messagelabel is back for one subscription edge. Withm.tokens < 1or no proxy price,nextPricereturns{}and row 1 draws the dimnext messagelabel with nothing after it. This is main's own edge for unpriced proxies, so the PR does not make it worse. No test coversm.tokens < 1.
What I checked
- Last review: round 1, ca74089, 2026-11-09T16:25:52Z.
- New commits read: 1 — f7eba6e
feat(mod): subscription band in tokens, this session only. - Read in full: 2 reviews, 1 comment, 0 inline comments (from
.review-in-reviews.txt,.review-in-comments.txt,.review-in-inline.txt). - New items since my last review: commit f7eba6e (read the full diff and the code around every change) and the author's round-1 reply comment at 2026-11-09T16:35:04Z (checked each claim against the code; all hold except the comment-rewrap claim above).
- The redesign: read the full
ca74089b..f7eba6eddiff and the final state of every changed file.limitRate/limitSaved/share/price/limitWindoware gone;nextPriceandtokensreplace them. No stale reference remains anywhere in the repo (grepfor the removed names and the removed doc fields returns nothing). tokens()against statusline.py_human(statusline.py:337): identical thresholds and rounding —>= 1e6→ one decimalM,>= 1e3→ one decimalk, else rounded. 90000 →90.0kin both.nextPrice: API-key path returns exactly what main's row 1 drew (usdofwarmUsd/coldUsd). Subscription path gates onm.tokens >= 1and on the proxy's price being present, so an unpriced proxy shows nothing rather than a token count.warm/coldderive fromwarmUsd/coldUsd/tokens, all already insignature, so redraws still work.- The three new/changed tests against the render code, by hand: warm band →
◆ next message 90.0k rd · 90.0k wr if cold(register.tsx:339-344); cold band →◆ ○ cache cold · next message 90.0k wr(register.tsx:346-352); pane →if the cache is warm 90.0k rd,if it is cold 90.0k wr(register.tsx:508-516). Row 2 keeps the label-onlythis session saved …rule from main (statusRow,o.label ? limit.saved : undefined). - cg.py: one window read now (
mine, session + since, cache tagwin-<sec>-<sid>), inside the same blanket try/except; docstring and--window-start-mshelp match the new behaviour. The vendored Codex copy is byte-identical (diff). - The Go test's mock routing:
_fetch_stats(session, nosince) → case 2;mine(session +since) → case 1, which recordswindowAsked; the default branch answers every-session tokens that the band must not show — a regression to an unscoped query would fail thewindow_savedassertion. - Docs: the Subscription bullet and the row 2 wording match the code (
90.0k rd/90.0k wr,this session saved 1.2M rd / 85.0k wr). - Data dependence: token counts and existing aggregates only — metadata, no new stored data.
- Tests were not run (not approved for this review).
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.319 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 2 of 2 | f7eba6ed7c65 |
approve |
Verdict: approve
Findings
None. The rewrite in f7eba6e takes out the share-of-the-limit math and keeps tokens, and I found no defect in it.
Earlier findings
- Mine, finding 1 (the pane's subscription path had no test): fixed. The new test
on a subscription the pane prices the next message in tokens(register.test.tsx:311) mounts the pane with afive_hourrate limit and assertsif the cache is warm 90.0k rdandif it is cold 90.0k wr. Thenot measured yettext and theof the 5h limitsuffix no longer exist, so nothing else is left uncovered. - Reviewer 2, finding 1 (the same gap): fixed by the same test. I checked the fix myself; the removed strings are gone from the tree (
grep 'not measured\|5h limit'over the plugin hits nothing).
Earlier non-blocking notes
signatureomittingstartMs: moot.limitWindowis gone; the signature is back to the base fields, andv.main.tokens(the new row-1 figure) was already in it.- Stale
status_extrasdocstring and--window-start-mshelp: fixed. Both now say "this session". - Broken test comment: fixed (rewrapped).
cache warmon a non-subscription proxy with no price: gone. Row 1 is again exactly as on main for API-key users (register.tsx:339, the unconditionalm.isWarmblock).- Two inline reads in sequence: gone.
cg.pymakes one window read (mine, session-scoped); thewinread is deleted. - Stale cold-cache doc example: fixed. The new Subscription bullet gives the token form for row 1 and the pane.
- Pane header still in dollars on a subscription: accepted as deferred. The reply names #985 (dashboard) and #986 (status and insights) as the follow-ups. The reason is right: the pane header's dollars are the same figure those issues restyle, and this PR does not touch it.
The scope change
The owner asked to drop the % of the 5-hour limit and keep rd / wr tokens. The PR body names this at the top, with the human's decision and date, and states the data dependence (metadata only, token counts). That satisfies the repo's behavior-change rule. The stated reason checks out: the headers give whole percents only, and Anthropic publishes no read/write weights, so any conversion would be a guess. Showing plain counts avoids the guess.
What I checked
- Last review: round 1, ca74089, 2026-11-09T16:24:57Z
- New commits read: 1 — f7eba6e
feat(mod): subscription band in tokens, this session only - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files), plus the PR body (the reply's reference to "Why no % of the 5-hour limit")
- New items since my last review: the commit f7eba6e (reviewed below), the author's round-1 reply (each point checked against the code), reviewer 2's round-1 review (its finding matched mine; its non-blocking items all appear in the reply)
- The new commit's diff in full, and each changed file around the changes at f7eba6e:
nextPriceandtokensin model.ts,statusRowand the band's and pane's row 1 in register.tsx,status_extrasin both cg.py copies, the Go test, the three new/changed TS tests, types/index.d.ts, docs/plugin/statusline.md. nextPricebehavior: with an API key it returns the same dollars as main (usd(warmUsd)/usd(coldUsd), gated on presence, as before). On a subscription it returns90.0k rd/90.0k wrfromm.tokens, gated on the same server price fields and ontokens >= 1. A missing figure leaves the row as main draws it. No dollar can reach a subscription row 1:save,subsandpingsrender only inside thestatus.saveblock, which thelimitbranch leaves undefined.tokens()against statusline.py_human: same thresholds (M at 1e6, k at 1e3, one decimal) and same output for integer counts. The only divergence is half-rounding of non-integers, which token counts never are.- Width accounting: the
limitterm inlenis back to3 + pct + (label ? 3 + saved : 0), matching the render, which showsthis session …in the label form only. - Fail-open: unchanged and intact — one
_bg_jsonread inside the blanketexcept; a failure leaveswindow_savedout and the band falls back to5h 34%. - The Go test's mock: the default (unscoped) branch is now a trap that returns the account's numbers, so a regression back to an unscoped window read fails the
window_savedassertion. The session+since branch recordswindowAsked. - No leftovers:
grepover the plugin finds nolimitRate,limitSaved,limitWindow,window_cost_usd,window_session_saved_usdorwindow_start_ms; the two cg.py copies are byte-identical at f7eba6e. - Tests were not run (not approved for this review). The PR body reports 99 plugin tests passing and
go test ./context-guru-plugin/...ok on the eval box.
Non-blocking
- register.tsx:508 — the pane header still shows
saved $22.80 of $81.90 this sessionin dollars below a token-priced NEXT MESSAGE on a subscription. Deferred to #985/#986; noted so it is not lost. - model.ts:43 — on a subscription against a proxy with no price table,
nextPriceshows no token figure althoughm.tokensis known (the gate is the server's dollar prices). The pane then saysunknown. Consistent with main's "no prices, no price" rule; a later PR could show the count alone. - docs/plugin/statusline.md:199 — the Cold cache bullet still shows the dollar form unconditionally; the Subscription bullet next to it gives the token form. Read together they are correct.
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Comment-only fix after both approvals (the rewrap that reviewer 1 noted in round 2). Output of |
…0.2.12, Pi 0.1.1) Claude Code plugin 0.6.7 -> 0.7.2: - #981, #989, #1018, #1035: subscription band and savings show saved tokens. - #1038: insights drop the finding that credits a user's own removal. - #1039, #1040: dash and keep-alive fixes that touch the plugin files. Codex plugin 0.2.11 -> 0.2.12: - #1051: read the cache strategies and presets from the proxy. - The vendored cg.py gets the same plugin changes. Pi package 0.1.0 -> 0.1.1: - #1010: chain the proxy in front of an existing base URL. - #1011: check the proxy at session start and restart it once. - #1049, #1058: write the cache strategy by name; review fixes. OpenCode plugin (#483): new in v0.7.2, no version file, not changed. Bob plugin 0.1.0: no change since v0.7.1, not changed. Signed-off-by: DAVID AMID <[email protected]> Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Bump the plugin versions for v0.7.2. - Claude Code plugin 0.6.7 -> 0.7.2: #981, #989, #1018, #1035 (savings in tokens on a subscription), #1038, #1039, #1040, #1055 (cache strategies read from the proxy). - Codex plugin 0.2.11 -> 0.2.12: #1051 (cache strategies and presets read from the proxy), plus the vendored cg.py changes. - Pi package 0.1.0 -> 0.1.1: #1010, #1011, #1049, #1058, and the #1040 README line. - OpenCode plugin: new in v0.7.2 (#483), no version file. Its first start now downloads proxy v0.7.2 (was v0.7.1). Nothing compares against PINNED_VERSION; the floor stays "v0.7.1 or later". The README lines, the install guide and 3 tests follow. - Bob plugin: 0.1.0, no change since v0.7.1. Behavior change: the OpenCode plugin's first download is proxy v0.7.2, not v0.7.1. Owner's yes, 2026-11-11, in the integrator session: "option1 it is"; the version bumps: "I approve the version bumps for the plugins". Data dependence: none. Reviews: 3 offload review rounds (GLM; round 3 pre-approved by the owner). Both reviewers approve at 3cf6176, which is the PR head. Signed-off-by: DAVID AMID <[email protected]> Assisted-By: Claude Opus 5.5 <[email protected]>
Behavior change (asked for by the user, a human developer, on 2026-11-09): on a Claude subscription, the mod's band counts saved tokens for this session only, and prices the next message in tokens.
next message <$0.01 · $0.39 if coldand5h 34% · saved 1.2M rd / 593 wr. The token counts covered all sessions on the proxy.next message 90.0k rd · 90.0k wr if coldand5h 34% · this session saved 1.2M rd / 85.0k wr.Summary
On a subscription the band showed dollars for the next message, and its saved tokens were the whole account's. Now both use tokens, and the saving is this session's.
What changed
cg.py cachestatereads/api/stats?lean=1&since=<window>&session=<id>(cached 30 s). The band showsthis session saved … rd / … wr.rdwhen warm (read),wrwhen cold (written again).cg.pyis updated.Why no % of the 5-hour limit
The first version of this PR turned dollars into a share of the 5-hour limit. We took it out:
anthropic-ratelimit-unified-5h-utilizationin whole percents only (0.54), with no per-request cost and no weights.Data dependence
Metadata only: token counts from
/api/stats. No stored customer data. Same at each storage level.How it was tested
claude plugin test context-guru-plugin: 99 pass, 0 fail. New tests: row 1 warm and cold in tokens, the pane in tokens, row 2 withthis session, no$on a subscription.go test ./context-guru-plugin/...on the eval box: ok. The cachestate test checks that the tokens come from the session-scoped read, not the account's.🤖 Generated with Claude Code