Status line¶
Since 0.6.1 the Context Guru band above the prompt shows everything below, the same way, and the install no longer writes a status line. A status line an earlier install wrote by default is removed at the next session start, with one line saying so. The status line is still here for anyone who wants it as well: /context-guru:statusline (or install.sh --statusline) turns it on, and then it stays.
The status line sits under the prompt and answers two questions all the time: how much am I saving, and is my cache about to cost me? It shows nothing in a project that is not routed through the proxy.
The default layout has two lines:
saved $18.60 of $61.40 session · saved $4.20 of $20.50 subagents
cache ● █████░ 4:00 ↻ │ ctx ███░░░░░ 41%
Line 1 is money. Line 2 is the main agent's cache clock and the context bar. The Context Guru band draws the same figures on its second row.
Only savings recorded with each request count: the compaction saving (against the same request uncompacted), the cache split, and the keep-alive credit, which a request gets only when a ping that read the cache kept it warm. Two credits that the dashboard prices when it is read are left out: the estimate for requests recorded before the cache split was measured, and the tool (declaration) filter's saving. So the line can read lower than the dashboard, which adds both. A figure the proxy did not report is left out, never shown as $0.00. The figures are not Claude Code's own cost (its estimate at list prices), which detailed shows as spent.
Every number is about this session. There is no today or lifetime total on the line; the dashboard and /context-guru:insights savings cover longer windows.
On a Claude subscription¶
A subscription does not bill per token. The limit is the 5-hour window. When Claude Code sends rate_limits in its status-line input, the first line shows the window, not money:
| Piece | Meaning | Source |
|---|---|---|
5h 34% |
How much of the 5-hour limit you used. --layout=detailed adds 7d 12%. |
Claude Code's rate_limits.five_hour.used_percentage |
rd |
Tokens compaction kept out of the prompt on later turns that re-send the transcript. They would have been cache reads. | /api/stats replay_tokens (saved_gross − saved_unique) |
wr |
Tokens compaction removed, counted once. Sent as new content, they would have been cache writes. | /api/stats saved_unique |
- The numbers are plain token counts. They are not weighted. Anthropic does not publish how the limit weights reads, writes and fresh input, so the status line does not guess.
- The window starts at
five_hour.resets_atminus 5 hours. The counts cover all traffic through this proxy since then, not only this session. - The counts are the proxy's own token estimates, and cover compaction only. Cachesplit, keep-alive and declaration-filter savings exist only as dollar figures, so they have no token count here.
- A kind with nothing saved is left out. With nothing saved, or no reset time, the line shows
5h 34%only. - No dollar figure shows on a subscription. Each money element of the API-key line:
saved $x of $y sessionandsubagents: replaced by the window counts.↻ $zmanual-ping saving: goes with them.next $a warm · $b cold(opt-in with--show=next): hidden. It is a price, and a subscription is not billed per request.- Per-agent
saved $x of $y(opt-in with--show=agents): dropped. keep-alive 3 pings(detailed): keeps the count, drops the cost.spent(detailed): hidden.- An ended window (
resets_atin the past, before Claude Code sends a new block) shows nothing, and no money. At narrow widths the counts go first.5h 34%stays longest. --layout=detailedwritescompaction saved …, so the line names what the counts cover.- With an API key, Bedrock or Vertex there is no
rate_limits. The money view above stays.
What each piece means¶
| Piece | Meaning |
|---|---|
saved $18.60 of $61.40 session |
The main agent's requests. $61.40 is what they would have cost without context-guru, at your gateway's prices. $18.60 is the saving against that: the same $61.40 minus what was actually paid, including context-guru's own model calls and keep-alive pings. So the saving is always part of the total, never more. |
saved $4.20 of $20.50 subagents |
The same, summed over every other request of the session: sub-agents, teammates, and Claude Code's side requests (the auto-mode classifier, titles), which cost money even though they are not listed as agents. Shown once the session has a request outside the main agent. A narrow terminal drops it first. |
cache ● █████░ 4:00 |
A bar that drains as the prompt cache approaches expiry, and the clock (m:ss, or h:mm:ss from one hour). Time is measured from the end of the last response. |
4:00 ↻ |
The proxy is holding this cache warm with keep-alive pings. The clock is then the time until the cache goes cold if you send nothing: the last planned ping plus the cache lifetime. The bar still drains over the current cache entry, so each ping refills it. ↻ alone, with the normal clock, means the last touch was a ping and none is planned. |
cache ○ cold 3:12 |
The cache expired 3 minutes 12 seconds ago. Drawn dim, never red or amber. The next message pays the rewrite. cache ○ cold alone when the time since is unknown. |
ctx ███░░░░░ 41% |
How full you are, as a share of the model's context limit. Adds ⚠ rewrite near from 85%. |
▲ update v0.3.2 |
A newer proxy release is waiting; shown first so it cannot scroll off. |
⏳ |
The figures are the last ones read. The proxy is slow, or the copy is old. The money, the context bar and the clock stay on screen; the clock is arithmetic on the copy's own timestamps, so it is right at any age. |
The line has no next price, no keep-alive count, no sub-agent clocks and no tip. They moved into the mod. --show=next, --show=agents, --show=ka and --show=tip bring them back.
The cache clock¶
| State | Looks like | Rule |
|---|---|---|
| Warm | green ● |
more than 60 s left (a fifth of the lifetime on the 1 h tier) |
| Expiring | amber ◐ |
60 s to 15 s left |
| Critical | red ◐ 0:09! |
the last 15 s |
| Cold | dim cache ○ cold 3:12 |
expired; counts up how long ago. Never red or amber |
| Pinged | cyan ● 13:40 ↻ |
kept warm by keep-alive or manual pings |
The bar drains over the cache's own lifetime: 5 minutes, or 1 hour on the 1 h tier.
Every state¶
Each render below is the real output of statusline.py (colour removed). The recordings that showed the older lines are gone.
Warm, green, seconds ticking down:
saved $18.60 of $61.40 session · saved $4.20 of $20.50 subagents
cache ● █████░ 4:00 │ ctx ███░░░░░ 41%
Warm on the 1 h cache tier. The bar rescales to the tier's lifetime, and the clock shows h:mm:ss from one hour:
Expiring, amber, the last minute (the last fifth of the lifetime on the 1 h tier):
Critical, red, the last 15 seconds, marked !:
Cold, dim, counting up how long ago it expired. The segment stays on the line, so you see the moment a pause started to cost money:
Held warm by keep-alive pings, cyan, with ↻. The clock is the time until it goes cold if you send nothing:
Proxy offline is cg ✕ proxy offline. A slow proxy shows cg: stats loading… only when there was never any answer. Otherwise it shows the last figures with ⏳. A proxy that does not answer for ten minutes shows cg? not responding, unless a copy of the cache state exists: then the figures stay, with ⏳.
Narrow terminals¶
A line too wide for the terminal sheds, in this order: spend and latency (detailed), keep-alive, the update marker, the subagents phrase, the session label, the context bar. The cache clock is shortened last.
saved $18.60 of $61.40 session · saved $4.20 of $20.50 subagents (80 columns)
cache ● █████░ 4:00 │ ctx ███░░░░░ 41%
saved $18.60 of $61.40 session (62 columns)
cache ● █████░ 4:00 │ ctx ███░░░░░ 41%
saved $18.60 of $61.40 (28 columns)
cache ● 4:00 │ ctx 41%
Layouts¶
| Layout | Shows |
|---|---|
minimal |
one line: saved, cache (saved $18.60 of $61.40 │ cache ● █████░ 4:00; cold is cache ○ cold) |
balanced (default) |
update, saved, cache, context |
detailed |
balanced plus spent $4.10 · $2.73/h · up 1h30m (the rate appears after 5 minutes), the keep-alive count in plain words (keep-alive 3 pings · $0.04), a slow-upstream note (only when upstream averages 3 s or more) and the least-used tool or skill |
Switch without editing settings, and keep the choice across renders:
auto forgets the choice. A remembered layout wins over the flag in the installed command. To change the installed command instead, re-run /context-guru:statusline with --layout=minimal|balanced|detailed. Hide or show single elements with --hide=a,b and --show=a,b (update save spend cache next agents ctx ka latency tools tip), or the environment variables CG_STATUSLINE_LAYOUT, CG_STATUSLINE_HIDE, CG_STATUSLINE_SHOW and CG_STATUSLINE_COLUMNS. next, agents, ka and tip are off by default: the mod shows them.
The layouts spark, strip, heat, fill and watch are retired. They moved into the mod's pane (below). A flag that names one falls back to balanced. A remembered choice that names one is ignored, and the installed layout applies. Neither gives an error.
Opt-in elements¶
These are off in every layout. Turn one on with --show=<name> in the installed command.
| Element | Shows | Where it lives by default |
|---|---|---|
next |
next $0.03 warm · $0.30 cold (next $0.30 once cold; next $0.30 if cold on a proxy that predates the warm figure) |
the mod's band |
agents |
agents reviewer active ● 4:58 saved $1.20 of $6.00 · Explore ◐ 0:51 · 1 cold |
the mod's band and pane |
ka |
keep-alive 3 pings · $0.04, after the first ping (also in detailed) |
none: plain words, no ka |
tip |
the weekly tip, as its own last line | the mod's band |
The status line cannot follow the agent you select in Claude Code's agents list. Claude Code does not pass the selected agent to the command (checked against Claude Code 2.1.296). With --show=agents the line lists every agent by the name the list shows. The proxy tells agents apart by the x-claude-code-agent-id header. A request it grouped by prompt instead (a side request, such as the auto-mode classifier) is not an agent and is not listed.
The weekly tip names each of /context-guru:save-more and /context-guru:remove-mcp-and-skills (of the ones your plugin has) that has not run in the last 7 days. The commands record their runs in last-run.json in the plugin's state directory. The status line and the mod only read that file, so the tip costs no network call. A command that has never run counts from the first time the status line saw the install, so a new install sees no tip in its first week. Turn it off with python3 "<plugin dir>/scripts/statusline.py" --set-tips=off.
The mod: band and pane¶
Claude Code can load the plugin as a mod. It draws a calm band above the prompt and a pane. The mod never reads the network itself. It runs scripts/cg.py, which uses the same on-disk cache, TTLs and back-off as the status line, so the two never ask the proxy twice when both are on.
Where each fact is:
| Fact | Where |
|---|---|
| the price of the next message, warm and cold; Ping; the dashboard link | band, row 1 |
▲ update, saved $x of $y (session, subagents), ↻ $x pings, the main cache clock, context fill |
band, row 2 (the status line's figures) |
| sub-agent caches | band (row 3) and pane |
| the weekly tip, or one command and what it does, rotating | band (row 4) |
| spark, strip, heat, fill | pane |
The band¶
At most four rows. Each row needs one spare row of room, so a short band keeps row 1 and drops the others from the bottom.
◆ next message $0.06 · $0.78 if cold [ Ping ] hide dashboard ↗
saved $18.60 of $61.40 session · saved $4.20 of $20.50 subagents │ cache ● █████░ 3:59 │ ctx █░░░░░░░ 9%
└ agents ● Explore 5m ◐ code-reviewer <1m ○ planner
try /context-guru:insights — see where your money goes
- Row 1.
◆, then the price of the next message: warm in green, cold dim. Then Ping (keyp), a smallhide, and last the dashboard link (dashboard ↗,dash ↗below 80 columns). It is last because a terminal without hyperlink support prints the address after the label: then the link wraps to its own line and the rest of the row stays whole. The pane header has the link too. - Cold cache. The row changes to
◆ ○ cache cold · next message $0.78. The price is amber. There is no Ping: a ping cannot help a cache that is gone. - Subscription, with learned weights. On a Claude subscription the next message shows the share of the 5-hour limit it uses, warm and cold:
next message ≈0.1% of 5h · ≈1.5% if cold(#1095). The warm share is green, the cold share dim. A cold cache shows○ cache cold · next message ≈1.5% of 5h, in amber. Below 80 columns the row readsnext 5h ≈0.1% · ≈1.5% cold, so it fits 60 columns. The pane shows both shares and how many requests the weights come from. - The weights. They are the dashboard's learned 5-hour weights (
GET /api/me/fivehour-weights). The band uses them only when the fit passed its checks (ok), with a learned cache-read weight and at least one learned cache-write weight. - The figures. Warm share = cached prefix tokens × the read weight. Cold share = the same tokens × the write weight for this entry's tier: 1-hour when the entry is on the 1-hour tier, 5-minute when it is on the 5-minute tier. The band uses only a weight the fit learned. When the fit did not learn the entry's write tier, the cold figure stays in tokens (
90.0k wr). When the tier is not known, the band uses the write tier the fit learned (5-minute when it learned both). - Rounding. One decimal below 10% (
≈1.5%), none from 10% (≈12%), and<0.1%for a tiny share.≈marks an estimate. - Freshness.
cg.pyreads the weights at most once a minute and keeps them on disk. The endpoint fits once per 15 minutes. After a failed read,cg.pyuses its last copy only while that copy is under 15 minutes old. - Subscription, without learned weights. When there are no weights, the fit fails its checks, or the read fails, the next message shows tokens, the unit of the saving, not dollars. It shows one figure, for the state the cache is in now. A warm cache reads the cached prefix:
next message 90.0k rd, in green. A cold cache writes it again:○ cache cold · next message 90.0k wr, in amber. The band does not show both: they are the same prefix, so the pair said nothing about the cost. The pane shows the same figure, in the same color. When the proxy has no figure for the current state, the band shows nonext messagelabel. - Ping off. When the server says it cannot ping, the button is replaced by a dim reason, such as
ping off: on next sessionorping off: not supported(ping off: not supportedmeans extended thinking, or a route Ping does not support). Below 80 columns it shows onlyping off, so the row fits one line. A reason that is only a timing artefact (no entry, right after a reply) or unknown shows nothing in the band. If the server does not say (an older server), the button stays. The pane and the toast keep the full text. - Row 2, the status line's figures. The same elements, rules and colours as the status line's default layout:
saved $x of $y session,· saved $z of $q subagentsonce another thread exists,↻ $x pingsonce a manual ping saved something, the cache clock (it counts every second, cyan with↻while pings hold it, dimcache ○ cold 1:07:04counting up once cold), andctx(the engine's own context figures, the proxy's while its copy is fresh).⏳marks a copy over a minute old. On a Claude subscription the money gives way to5h 34% · this session saved 85.0k wr · cost 40.0k rd: only this session's tokens, not every session's in the window. See The band's tokens on a subscription.▲ update v0.6.1leads the row when a release you have not declined exists. A saving never reads below$0.00: a session that has not yet earned back its first requests or a ping showssaved $0.00. When the row is too wide it drops, in this order, the subagents phrase, thesessionlabel (and▲ update), then the bars; the figures stay. With no data at all, the band says what the status line says:cg ✕ proxy offlinewhen nothing answers,cg: stats loading…when the proxy is too slow. A proxy that answers with an error shows nothing. - Row 3, sub-agents. On by default. One chip per named agent that made a request in the last 30 minutes, most recent first, at most four, then
+N.●green is warm,◐amber is the last minute, cyan with↻is kept warm by pings, dim○is cold. Theakey, or the pane button, turns the row off and on. - Row 4, a command to try. The weekly tip when
/context-guru:save-moreor/context-guru:remove-mcp-and-skillshas not run for 7 days (the status line's rule:last-run.json, and a new install waits a week). Otherwise one of/context-guru:insights,/context-guru:save-moreand/context-guru:remove-mcp-and-skillswith four or five words on what it does, the next one every 12 seconds. - Hide.
hideremoves the band for the session./context-guru, or the pane's Show the band again button, brings it back.
The band's tokens on a subscription¶
The band's token figure is not the status line's rd / wr. It comes from /api/stats tokens (see Savings in tokens), read for this session since the window's start.
- Every feature counts: compaction, the cache split, the keep-alive rescue and the 1-hour cache. The status line's
rd / wrcounts compaction only. savedlists the tokens the requests did not send or write.costlists the tokens the changes made them pay. A feature can save in one tier and pay in another: the keep-alive rescue saves a cache write and pays cache reads.costleaves out the keep-alive pings. A ping is not agent traffic, so its own billed tokens are not incost, though on a subscription they also count toward the 5-hour limit.- One figure per tier. The band never adds tiers into one number. Labels:
wr5-minute cache write,wr1h1-hour cache write,rdcache read,infresh input. They show in that order. - A tier at 0 is left out.
cost …shows only when a tier was paid. With nothing in any tier, the row shows5h 34%only. - Requests the proxy did not measure in tokens (
tokens_unmeasured_requests: rows from before the measure, or rows it could not price) count as nothing here. The band does not say how many there are. - A proxy older than this field has no
tokens. The band then shows that proxy's compaction-onlysaved 1.2M rd / 85.0k wr.
The pane¶
/context-guru opens it. Sections that have no data are left out.
◆ Context Guru
open dashboard ↗
saved $22.80 of $81.90 this session
NEXT MESSAGE
if the cache is warm $0.06
if it is cold $0.78 (90k tokens in the cached prefix)
● cache warm, about 4m left
[ Ping now ]
AGENTS
● Explore 5m saved $1.20
◐ code-reviewer <1m
○ planner cold
Hide agents in the band a
SAVED LATELY
$4.20 today · last 14 days ▁▂▂▃▄▄▅▅▆▇▇██▅
CACHE HITS
■■■■✖■■▨▨■■■■■■■■■■■
last 20 requests · ■ hit ▨ partial ✖ miss
$1.40 lost today
MISSES BY HOUR
0h ░▒ █░ ··············· 24h
darker means more misses in that hour
CONTEXT
▒▒▒▒▒▒▒███████░░░░░░░░░░░░░░░░░░░░ 41%
▒ always loaded 20% · █ conversation 21% · ░ free · full in 58m · a miss now costs $1.20
SAVE MORE
tip /context-guru:save-more hasn't run in 7+ days — finds a cheaper config
/context-guru:insights see where the money goes
/context-guru:save-more find a cheaper configuration
/context-guru:remove-mcp-and-skills drop MCP servers and skills you never use
The data for the four mode sections comes from scripts/cg.py panedata, with the same math the old status line modes used. The pane is the one place that repeats the money, as one summary line.
Refresh and the one-second clock¶
Claude Code redraws the status line on every message and, if you ask, on a timer. The installer writes "refreshInterval": 1 next to the command, so the clock ticks every second (the minimum Claude Code accepts). A value you set yourself is kept when the status line is re-installed, so an install made earlier with a longer interval keeps it. To get the one-second clock on an existing install, set it by hand in the settings file that holds the status line:
and start a new session. Older Claude Code versions ignore the key and redraw only on events. The clock is arithmetic on a timestamp the proxy supplies, so a redraw needs no new network read. A render takes about 55 ms warm and 90 ms on a cold cache. The cost is one short process per second per open session. If that matters, set a larger refreshInterval (for example 5); the clock then moves every 5 seconds.
Render time¶
Every layout returns in about 0.4 s at worst, Python start-up included (the slowest run in the table took 0.43 s). The render has a 0.36 s budget. Only the session's totals (/api/stats?lean=1&session=…) are waited for, and the cache state is read in parallel under the same deadline. A timeout shows the last numbers with ⏳, never "proxy offline".
Measured on this host, which is loaded and shared with production: 50 runs per cell, wall milliseconds, median / 95th percentile / maximum. "Slow" is a server that sleeps 5 seconds on every request.
| layout | healthy, warm cache | healthy, cold cache | slow proxy | proxy down |
|---|---|---|---|---|
| minimal | 53 / 59 / 64 | 89 / 97 / 97 | 389 / 398 / 399 | 92 / 98 / 106 |
| balanced | 51 / 60 / 66 | 89 / 104 / 133 | 390 / 397 / 401 | 94 / 105 / 110 |
| detailed | 57 / 66 / 70 | 93 / 103 / 110 | 389 / 395 / 398 | 91 / 101 / 104 |
The same harness on the status line before this work:
| layout | healthy, warm cache | healthy, cold cache | slow proxy | proxy down |
|---|---|---|---|---|
| minimal | 42 / 59 / 63 | 80 / 89 / 93 | 682 / 691 / 692 | 76 / 90 / 91 |
| balanced | 44 / 53 / 54 | 80 / 91 / 99 | 679 / 729 / 751 | 75 / 82 / 86 |
| detailed | 45 / 52 / 60 | 79 / 89 / 98 | 678 / 703 / 713 | 83 / 126 / 146 |
The slow-proxy case went from about 680 ms to about 390 ms. Healthy renders are about 10 ms slower than before, from the extra elements (agents, spend).
Per-agent names, the keep-alive plan and the session and subagents money (which removed the lifetime read) cost nothing measurable. Interleaved runs of the previous release ("before") and this one ("after") against the same server, with three named sub-agents on disk, 50 runs each, median / 95th percentile / maximum in milliseconds:
| layout | scenario | before | after |
|---|---|---|---|
| minimal | warm | 50 / 56 / 61 | 50 / 56 / 62 |
| minimal | cold | 79 / 86 / 95 | 80 / 89 / 100 |
| minimal | slow | 386 / 391 / 394 | 388 / 392 / 397 |
| minimal | down | 87 / 96 / 106 | 82 / 94 / 159 |
| balanced | warm | 52 / 56 / 59 | 52 / 56 / 58 |
| balanced | cold | 84 / 102 / 238 | 83 / 100 / 174 |
| balanced | slow | 387 / 393 / 407 | 387 / 396 / 417 |
| balanced | down | 84 / 91 / 94 | 79 / 85 / 94 |
| detailed | warm | 50 / 57 / 62 | 53 / 59 / 60 |
| detailed | cold | 83 / 88 / 90 | 86 / 93 / 95 |
| detailed | slow | 387 / 396 / 425 | 388 / 396 / 413 |
| detailed | down | 88 / 96 / 106 | 84 / 95 / 102 |
Reading the names opens only the files of the agents the proxy lists (at most 24, 4 KB each). With 5,000 agent files in the session the render takes under 0.1 s.
Colour and plain terminals¶
Colours are the basic ANSI set plus dim, so they follow your terminal theme on light and dark backgrounds. NO_COLOR=1 or TERM=dumb removes the colour; the clock, bar and symbols still carry the state. The status line has no ASCII mode: its bars and symbols are Unicode. --layout=minimal keeps to one short line.
Turn it on, off, or change it¶
/context-guru:statusline installs it (or install.sh --statusline), changes the layout, or turns it off with settings.py off, which restores whatever status line you had before. It never sends a keep-alive ping; it only reads.