spend-bar
A bar above the prompt showing:
- Usage limits, by how the account is billed:
- on a subscription, the session (5h) and weekly limits, with time until each resets — amber above 70%, red above 90%
- on an Enterprise or Team seat with usage-based billing, which has no 5h or weekly windows, the month's extra-usage spend against its limit (
month $412/$1800), read from the desktop app's get_usage tool at session start, hourly and after a turn once the reading is 10 minutes old or missing (so a failed read at session start, while the app is still connecting, is retried) — amber from 75%, red from 90%, with a toast as it crosses each. The terminal has no such tool, so it shows no month figure. Personal plans (Free, Pro, Max) never show it, even with extra usage turned on
- behind a gateway, its spend limit (
spend 40%)
- Session cost, as
/cost totals it — amber from $25, red from $50
- Prompt cache status, counted down from the last model response — amber in the last fifth of the TTL, red once expired
- Context usage, as a percentage of the window — amber above 20%, red above 30%
- A ↓ (Compact) button, hotkey
c while the bar has focus, that runs /compact in the chat, as the session rail does. It reads ↓… while any compaction runs (automatic ones too) and is dimmed and inactive below 30% context. It turns amber from 40% context, the point to compact by
- A $ (Optimize spend) button, hotkey
o, that scores this session and the past week from the usage stats below and asks Claude for suggestions. It looks at the share of tokens sent above 40% context, turns over 50 requests, shell calls per request, repeated reads by kind, tool results over 20k characters as the model read them (and by the tool's own record), cache rewrites over 100k tokens, the estimated and billed cost, the subagents' share of it and their spend by agent type and model, the most used shell commands and the most common shell errors, and the fixed overhead below
Toasts warn about the patterns that cost the most:
- one main-thread turn reaches 40 model requests, since each request resends the whole context
- the session's cost reaches each multiple of the session cost warning ($25, $50, ...)
- a request after the prompt cache expired rewrites 100k tokens or more, with its estimated cost — after a break, a large session is cheaper to continue from a short handoff note in a new session
- the month's extra usage crosses 75% and 90% of its limit
Values under their thresholds are plain dim text; values past them become pills (rounded SVG pills on the desktop app, coloured labels in the terminal).
Options, in the config menu: Prompt cache TTL (1h default for subscriptions and Enterprise seats, 5m for most API keys), Compact warning (40% by default), Long turn warning (40 requests by default), Session cost warning ($25 by default) and Idle cache rewrite warning (100,000 tokens by default); 0 turns any warning off.
Enforce options
Warnings only tell you. These two options tell Claude, by adding a note to what the model reads (you do not see it), and are off (0) by default:
- Context gate (
contextGatePercent): when a new turn starts with context at or above this share, Claude is told to say in one line, before new work, that you should /compact or hand off to a fresh session (a short handoff note is cheaper). Once per crossing; it re-arms when context falls back under the limit. Slash commands, prompts typed into a running turn and prompts sent by plugins get no note.
- Long-turn brake (
turnRequestBrake): when the main-thread turn reaches this many model requests, Claude is told, with the next tool results, to stop, summarize what is done and what is left, and ask before continuing. Set it above Long turn warning so the toast comes first. A model can ignore the note; nothing is aborted.
Weekly spend review
/spend-review reads the last 7 days of spend-bar's own event logs (and the 7 before, for comparison) and asks Claude to compare this week with the one before: estimated cost by day, the share of tokens sent at high context, long turns, repeated reads, cache rewrites, subagent share and spend by agent type, the most common shell errors, and the fixed overhead below. It sends metadata only, never prompt text. The $ button gives the shorter review of this session and the past week.
If another plugin already has a command or skill named spend-review (oec-toolkit does), the engine refuses the name and spend-bar registers /spend-bar-review instead. Before 0.9.2 that refusal ended spend-bar's session start, so no event log was written for the session: its lines, the overhead line included, were dropped, and only the daily totals were kept.