SLOPSHOPPER

usage-band

Always-on band above the prompt: context fill and rate-limit windows

bandprompttimer
v0.2.9MITupdated 2026-10-17zexion7873/usage-band/plugin
A shopper browsing a rack in a slop shop
Preview · a replayed session in a sandbox
claude · ~/work/app · usage-band
› fix the failing auth test and add an audit log call ⏺ Read(src/auth.ts) ⎿ Read 6 lines ⏺ Update(src/auth.ts) ⎿ Added 2 lines, removed 1 line ⏺ Bash(bun test) ⎿ 3 pass, 1 fail ● Done. refresh now rejects expired claims and logs an audit event. ✻ Worked for 42s · done 4:20 PM ⟨Claude Code's own drawing⟩ ctx 49% (97k/200k) · 5h 31% (NaNm) · $0.42 ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Band
⟨Claude Code's own drawing⟩ ctx 49% (97k/200k) · 5h 31% (NaNm) · $0.42
README

📶 usage-band

CI: check

<img src="docs/band.svg" width="746" title="Drawn by the mod's own bar() from sample figures — not a screenshot." alt="The usage band, drawn by the mod's own bar() from sample figures rather than a screenshot: ctx at 42% with 84k of 200k tokens and a red tick at the 80% auto-compact point, 5h at 67% in amber with 1h48m to reset and its pace tick at 64% drawn white where the fill covers it, wk at 89% in red with 2d21h to reset and its pace tick at 59% likewise white, then cache 83% and $1.23.">

Context fill and every rate-limit window, always on, right above the Claude Code prompt — in the desktop app's Code tab as well as the terminal.

License: MIT Surface: desktop | terminal Network: none

No status-line script. No network requests. No model calls. One mod reading Claude Code's own session usage.


🚀 Install

🤖 Hand it to your agent

Paste this and walk away:

Fetch and follow https://raw.githubusercontent.com/zexion7873/usage-band/main/llms-install.md

It installs from the CLI and verifies the install. Recipe in llms-install.md.

🧑 Or type it yourself

From inside a Claude Code terminal session:

/plugin marketplace add zexion7873/usage-band
/plugin install usage-band@usage-band

Pick the user scope. The band appears in that session at once. Installed at the user scope, it also loads in sessions the desktop app starts — the desktop Code tab cannot run /plugin itself, so install from a terminal once.

[!IMPORTANT] Requirements: a Claude Code build with function-hook plugins (mods). CI validates and tests against Claude Code 2.1.291; older builds are unmeasured.


📊 What it shows

| | Item | Meaning | |:-:|------|---------| | 🧠 | ctx | Context window fill, tokens/window beside it. A red tick marks where auto-compact triggers, white where the fill has passed it. | | ⏱️ | 5h, wk | Each rate-limit window: percent used and time until it resets. A grey tick marks the share of the window already elapsed, white where the fill has passed it — a fill past the tick is burning faster than an even pace. Once a window has moved since your last message, +N% says how far — in the terminal line, and in the window's card on the desktop. The windows are the account's, so every session on it counts toward that step, not only this one. | | 💳 | spend | The spend limit, when the account has one. | | ♻️ | cache N% | Cache reads as a share of all input tokens in the last response. | | 💵 | $N.NN | Session cost at API token prices. On a subscription this is not what you are billed — your plan counts against the 5h / wk limits. |

Percent turns amber at 60% and red at 85%.

🖥️ Desktop and terminal

On the desktop each meter is a bar. Hover it for a card with its detail, which a screen reader also reads:

  • ctx: the compact point and the five largest context categories. Their sizes are a local estimate (~) and can differ from /context, which counts them exactly. Each square marks a rank the way /context colours its own — blue, orange, green, amber, then grey — so where the two rankings differ, a category's colour differs too.
  • A rate-limit window: how far it moved since your last message, when it moved, how much of the window has elapsed, where it ends up if the rest of it burns at the rate so far — in amber when that runs it out before the reset — and the local time it resets.

The terminal draws the headline figures as one line of text:

ctx 42% (84k/200k) · 5h 67% (1h48m) · wk 89% (2d21h) · cache 83% · $1.23

In a terminal too narrow for all of it, the line stays one line and ends in …; the cost goes first, then the cache.

Reset countdowns and pace ticks keep moving while the session sits idle — the band redraws once a minute rather than waiting for the next response. A window whose reset passes while the session sits idle reads reset until the next response brings its new figure.

🎯 Use cases

  • Compact on your terms. Before starting a long task, compare the desktop ctx fill with its red tick. Close to the tick, run /compact or start a fresh session now, instead of having auto-compact fire halfway through the work.
  • Pace a rate-limit window. On the desktop, when the 5h fill runs past its tick, you are spending faster than an even pace and will hit the limit before it resets. The countdown beside it says how long the rest has to last.
  • See usage in the desktop app at all. In the Code tab, where status-line meters never run, glance above the prompt instead of opening the usage panel.

🖥️ Desktop and terminal

A statusLine command never runs in the desktop Code tab, so every status-line usage meter is invisible there. usage-band is a mod — a plugin of function hooks — and draws into the prompt area itself, which both surfaces render.

It steps aside while Claude Code shows a survey above the prompt, and keeps whatever other plugins drew beneath it.


🔧 How it works

flowchart LR
    Start["session.start, /clear, /resume, /branch<br/>usage + breakdown"]
    Measure["session.measure<br/>after every turn"]
    Step["turn.step<br/>ctx after every response"]
    Compact["session.compact<br/>size it leaves"]
    State[("usage atom<br/>plugin state")]
    Render["ui.render · AbovePrompt"]
    Desk["🖥️ desktop<br/>SVG bars"]
    Term["⌨️ terminal<br/>one line of text"]
    Clock["every 60 s"]

    Start --> State
    Measure --> State
    Step --> State
    Compact --> State
    State --> Render
    Render --> Desk
    Render --> Term
    Clock -.->|"invalidate"| Render

Every figure comes from Claude Code's own session usage, read locally. The mod writes no files, opens no ports, and makes no network requests or model calls — claude plugin validate plugin prints every engine call it makes.


🩺 Troubleshooting

SymptomCheck
No band at allclaude plugin list should show usage-band@usage-band as loaded. A session picks up plugins only when it starts, so open a new one after installing or updating. Mods also need a recent Claude Code — see Requirements. The band draws in a terminal session (an editor's integrated terminal included) and the desktop app's Code tab; the VS Code extension's panel and the mobile app draw none.
Band missing for a momentIt steps aside while Claude Code shows a survey above the prompt, and draws nothing until the session has started.
No 5h / wk / spendOnly the windows Claude Code reports for your account are drawn; spend appears only with a spend limit.
A figure looks wrongCompare it with Claude Code's own usage panel, then open a bug with both values and where you ran it.

🧹 Uninstall

/plugin uninstall usage-band@usage-band

The mod writes nothing to disk of its own, so there is nothing else to clean up.


🛠️ Develop

claude plugin validate --strict plugin
claude plugin test plugin

CONTRIBUTING.md has the dev loop and the traps worth knowing first; AGENTS.md has the rest.


⚖️ Disclaimer

Unofficial community project. Not affiliated with, endorsed by, or sponsored by Anthropic.

Source 3 files
hooks/register.tsx 327 lines
1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register, SessionContextBreakdown, SessionContextUsage, SessionCost, SessionRateLimit } from 'claude-code'
3
4import type { UsageBand, UsageBandDetail, UsageBandLimit } from '../types'
5import { BAR, bar, clampPct, COMPACT_TICK, PACE_TICK, tone } from './bar'
6
7const usage = atom({ plugin: 'usage-band', key: 'usage' } as const, null)
8
9
10const LABELS: Record<string, string> = { five_hour: '5h', seven_day: 'wk', spend_limit: 'spend' }
11const WINDOW_MS: Record<string, number> = { five_hour: 5 * 3_600_000, seven_day: 7 * 86_400_000 }
12
13const TEXT_COLOR = { calm: undefined, hot: 'warning', over: 'error' } as const
14
15// The desktop /context panel colours categories by rank, whatever their theme key: literals sampled from that panel.
16const CONTEXT_SWATCH = ['#3987e5', '#d95926', '#189e71', '#c98502']
17const CONTEXT_SWATCH_REST = '#97958d'
18
19const DAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
20// Under this share of the window elapsed, a straight-line forecast swings on every response.
21const MIN_FORECAST_PCT = 10
22
23const duration = (ms: number) => {
24  const minutes = Math.max(0, Math.round(ms / 60000))
25  const days = Math.floor(minutes / 1440)
26  const hours = Math.floor((minutes % 1440) / 60)
27  return days > 0 ? `${days}d${hours}h` : hours > 0 ? `${hours}h${minutes % 60}m` : `${minutes}m`
28}
29
30const untilReset = (resetsAt: string | undefined, now: number) =>
31  resetsAt === undefined ? '' : duration(Date.parse(resetsAt) - now)
32
33const clockTime = (at: Date) => `${String(at.getHours()).padStart(2, '0')}:${String(at.getMinutes()).padStart(2, '0')}`
34
35// Local time of the reset; the weekday only when it is a day or more away.
36const resetClock = (resetsAt: string, now: number) => {
37  const at = new Date(resetsAt)
38  return at.getTime() - now >= 86_400_000 ? `${DAYS[at.getDay()]} ${clockTime(at)}` : clockTime(at)
39}
40
41const line = (text: string, isWarning = false) => ({ text, isWarning })
42
43// Where the window ends up if the rest of it burns at the rate so far; running out before the reset is a warning.
44const forecast = (limit: SessionRateLimit, now: number) => {
45  const span = WINDOW_MS[limit.kind]
46  if (span === undefined || limit.resetsAt === undefined || limit.percentUsed >= 100) return undefined
47  const left = Date.parse(limit.resetsAt) - now
48  const elapsed = span - left
49  if (left <= 0 || elapsed < (span * MIN_FORECAST_PCT) / 100) return undefined
50  const atReset = (limit.percentUsed * span) / elapsed
51  return atReset < 100
52    ? line(`at this speed: ${Math.round(atReset)}% at reset`)
53    : line(`at this speed: all used in ${duration((elapsed * (100 - limit.percentUsed)) / limit.percentUsed)}`, true)
54}
55
56// Share of the window already elapsed: usage above it is ahead of an even burn.
57const pace = (limit: SessionRateLimit, now: number) => {
58  const span = WINDOW_MS[limit.kind]
59  if (span === undefined || limit.resetsAt === undefined) return undefined
60  return Math.round(clampPct(100 * (1 - (Date.parse(limit.resetsAt) - now) / span)))
61}
62
63const tokens = (n: number) =>
64  n >= 1_000_000 ? `${+(n / 1_000_000).toFixed(1)}M` : n >= 1000 ? `${Math.round(n / 1000)}k` : `${n}`
65
66const detailOf = (breakdown: SessionContextBreakdown | undefined, window: number): UsageBandDetail | undefined => {
67  if (breakdown === undefined) return undefined
68  const api = breakdown.apiUsage
69  const read = api?.cache_read_input_tokens ?? 0
70  const input = api === null ? 0 : read + api.input_tokens + api.cache_creation_input_tokens
71  return {
72    compactPercent:
73      breakdown.isAutoCompactEnabled && breakdown.autoCompactThreshold !== undefined
74        ? Math.round((breakdown.autoCompactThreshold / window) * 100)
75        : undefined,
76    cacheHitPercent: input > 0 ? Math.round((read / input) * 100) : undefined,
77    contextParts: breakdown.categories
78      .filter(c => c.kind === 'used')
79      .sort((a, b) => b.tokens - a.tokens)
80      .slice(0, 5)
81      .map(c => ({ name: c.name, tokens: c.tokens })),
82  }
83}
84
85// Typed at a terminal, through Remote Control, or by the desktop app (an SDK host). An unknown kind leaves the step unshown, never wrong.
86const YOUR_MESSAGE = new Set(['composer', 'bridge', 'sdk'])
87
88// From the reading at your last message: a measure also fires each time a window crosses a whole point mid-turn.
89// A window that reset since then has no step from it to show.
90const withDeltas = (limits: SessionRateLimit[], before: UsageBandLimit[] | undefined): UsageBandLimit[] =>
91  limits.map(limit => {
92    const base = before?.find(b => b.kind === limit.kind && b.resetsAt === limit.resetsAt)?.base
93    return base === undefined ? limit : { ...limit, base, delta: limit.percentUsed - base }
94  })
95
96const snapshot = (
97  context: SessionContextUsage,
98  rateLimits: UsageBandLimit[],
99  cost: SessionCost | undefined,
100  detail: UsageBandDetail | undefined,
101): UsageBand => ({
102  contextPercent: context.percent,
103  contextTokens: context.tokens,
104  contextWindow: context.window,
105  rateLimits,
106  costUsd: cost?.usd,
107  detail,
108})
109
110const withContext = (prev: UsageBand, tokens: number): UsageBand => ({
111  ...prev,
112  contextTokens: tokens,
113  contextPercent: Math.round(clampPct((100 * tokens) / prev.contextWindow)),
114})
115
116const seed = async ($: EngineInterface) => {
117  const { context, rateLimits, cost } = await $.session.usage({ breakdown: 'summary' })
118  await update($, usage, () => snapshot(context, rateLimits, cost, detailOf(context.breakdown, context.window)))
119}
120
121export const register: Register = on => {
122  on('session.start', async ($, e, next) => {
123    await seed($)
124    // Reset countdowns and pace ticks read the clock while drawing; without this an idle session freezes them.
125    $.clock.every(60_000, () => $.ui.invalidate('ui.render'))
126    return next(e)
127  })
128
129  // No session.start follows these, and /clear empties the session's state: without this the band vanishes until the next response.
130  // Not compact: usage() there still holds the fill the compaction removed (session.compact writes it).
131  on('classic.SessionStart', { source: ['clear', 'resume', 'fork'] }, async ($, e, next) => {
132    await seed($)
133    return next(e)
134  })
135
136  on('session.measure', async ($, e, next) => {
137    await update($, usage, prev => snapshot(e.context, withDeltas(e.rateLimits, prev?.rateLimits), e.cost, prev?.detail))
138    // Second write so a failed breakdown leaves the headline figures current.
139    if (e.changed.includes('context')) {
140      const { context } = await $.session.usage({ breakdown: 'summary' })
141      const detail = detailOf(context.breakdown, e.context.window)
142      await update($, usage, prev => prev && { ...prev, detail })
143    }
144    return next(e)
145  })
146
147  // Not at turn.start: a background agent's report starts a main turn of its own, which would reset the step to 0.
148  on('prompt.submit', async ($, e, next) => {
149    if (YOUR_MESSAGE.has(e.origin.kind))
150      await update($, usage, prev => prev && { ...prev, rateLimits: prev.rateLimits.map(l => ({ ...l, base: l.percentUsed })) })
151    return next(e)
152  })
153
154  on('session.compact', async ($, e, next) => {
155    const result = await next(e)
156    // usage() keeps the last response's fill until a new response lands, and the next measure waits for the turn's end.
157    if (result.skip !== undefined || result.tokensAfter === undefined || e.agentId !== undefined || e.trigger === 'precompute')
158      return result
159    const after = result.tokensAfter
160    await update($, usage, prev => prev && withContext(prev, after))
161    const { context } = await $.session.usage({ breakdown: 'summary' })
162    const detail = detailOf(context.breakdown, context.window)
163    await update($, usage, prev => prev && { ...prev, detail })
164    return result
165  })
166
167  // session.measure waits for the turn's end; a long turn would otherwise hold ctx at its starting fill.
168  on('turn.step', async function* ($, e, next) {
169    const result = yield* next(e)
170    const u = result.usage
171    if (u === null || e.agentId !== undefined) return result
172    const fill = u.input_tokens + u.cache_read_input_tokens + u.cache_creation_input_tokens
173    await update($, usage, prev => prev && withContext(prev, fill))
174    return result
175  })
176
177  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
178    const below = await next(e)
179    const current = await read($, usage)
180    if (e.props.hasSurvey || current === null) return below
181
182    const now = await $.clock.now()
183    const detail = current.detail
184    const ctxPercent = current.contextPercent ?? 0
185    const ctxDetail =
186      current.contextTokens === undefined ? '' : `${tokens(current.contextTokens)}/${tokens(current.contextWindow)}`
187    const meters = [
188      {
189        key: 'ctx',
190        label: 'ctx',
191        title: `ctx: ${ctxPercent}% used`,
192        percent: ctxPercent,
193        detail: ctxDetail,
194        moved: '',
195        extra: detail?.compactPercent === undefined ? [] : [line(`auto-compact: at ${detail.compactPercent}%`)],
196        // The summary breakdown is a local estimate; /context counts with the token-count API.
197        parts: (detail?.contextParts ?? []).map((p, rank) => ({
198          name: p.name,
199          size: tokens(p.tokens),
200          color: CONTEXT_SWATCH[rank] ?? CONTEXT_SWATCH_REST,
201        })),
202        marks: detail?.compactPercent === undefined ? [] : [{ percent: detail.compactPercent, color: COMPACT_TICK }],
203      },
204      ...current.rateLimits.map(limit => {
205        const label = LABELS[limit.kind] ?? limit.kind
206        // A reading only moves when a response lands, so an idle session can sit past a reset with the old fill.
207        if (limit.resetsAt !== undefined && Date.parse(limit.resetsAt) <= now) {
208          return {
209            key: limit.kind,
210            label,
211            title: `${label}: reset`,
212            percent: 0,
213            detail: 'reset',
214            moved: '',
215            extra: [line(`reset at ${clockTime(new Date(limit.resetsAt))}`), line('new number after your next message')],
216            parts: [],
217            marks: [],
218          }
219        }
220        const reset = untilReset(limit.resetsAt, now)
221        const paceAt = pace(limit, now)
222        const ahead = forecast(limit, now)
223        // The engine reports one decimal; the CLI's own notice floors it, and floor never shows 100% early.
224        const used = Math.floor(limit.percentUsed)
225        // Readings come whole (seen on 2.1.300) or with a decimal; a whole step reads +1%, not +1.0%.
226        const step = Math.round((limit.delta ?? 0) * 10) / 10
227        const moved = step > 0 ? `+${step}%` : ''
228        return {
229          key: limit.kind,
230          label,
231          // Plain words: many readers of the card do not have English as a first language.
232          title: `${label}: ${used}% used`,
233          percent: used,
234          detail: reset,
235          // The desktop shows it in the card only: two more figures on the row push the cost onto a second line.
236          moved,
237          extra: [
238            ...(moved === '' ? [] : [line(`since your last message: ${moved}`)]),
239            ...(paceAt === undefined ? [] : [line(`time passed: ${paceAt}%`)]),
240            ...(ahead === undefined ? [] : [ahead]),
241            ...(limit.resetsAt === undefined ? [] : [line(`reset: ${resetClock(limit.resetsAt, now)}`)]),
242          ],
243          parts: [],
244          marks: paceAt === undefined ? [] : [{ percent: paceAt, color: PACE_TICK }],
245        }
246      }),
247    ]
248    const cache = detail?.cacheHitPercent === undefined ? '' : `cache ${detail.cacheHitPercent}%`
249    const cost = current.costUsd === undefined ? '' : `$${current.costUsd.toFixed(2)}`
250
251    if (e.surface === 'terminal') {
252      const { Box, Text } = $.ui.resolve(e)
253      return (
254        <Box flexDirection="column">
255          {below}
256          {/* One Text, cut at the edge: a row of Texts wraps each meter in a column of its own once the line overflows. */}
257          <Text wrap="truncate-end">
258            {meters.map((m, i) => (
259              <Text key={m.key}>
260                <Text dimColor>{i > 0 ? ' · ' : ''}{m.label} </Text>
261                <Text color={TEXT_COLOR[tone(m.percent)]} dimColor={tone(m.percent) === 'calm'}>{m.percent}%</Text>
262                {m.moved && <Text> {m.moved}</Text>}
263                <Text dimColor>{m.detail && ` (${m.detail})`}</Text>
264              </Text>
265            ))}
266            {cache && <Text dimColor> · {cache}</Text>}
267            {cost && <Text dimColor> · {cost}</Text>}
268          </Text>
269        </Box>
270      )
271    }
272
273    const { Box, Text, Svg } = $.ui.resolve(e)
274    return (
275      <Box flexDirection="column">
276        {below}
277        {/* Without wrap a narrow pane (split view) squeezes the meters until their text overlaps.
278            One wrap row: a nested one took a whole line once it overflowed, pushing the cost onto a line alone. */}
279        <Box flexDirection="row" flexWrap="wrap" alignItems="center" columnGap={2} rowGap={1}>
280          {meters.map(m => (
281            <Box key={m.key} flexDirection="row" alignItems="center" gap={1}>
282              <Text dimColor>{m.label}</Text>
283              <Svg
284                source={bar(m.percent, m.marks)}
285                alt={[m.title, ...m.extra.map(l => l.text), ...m.parts.map(p => `${p.name} about ${p.size}`)].filter(Boolean).join(' · ')}
286                width={BAR.width}
287                height={BAR.tick}
288              />
289              {tone(m.percent) === 'calm' ? (
290                <Text dimColor>{m.percent}%</Text>
291              ) : (
292                <Text color={TEXT_COLOR[tone(m.percent)]}>{m.percent}%</Text>
293              )}
294              {m.detail && <Text dimColor>{m.detail}</Text>}
295              {m.extra.length + m.parts.length > 0 && (
296                // The desktop pops an absolute hover reveal above its keyed Box as a bordered card, whatever the offsets.
297                <Box position="absolute" top={0} left={0} display="none" hover={{ display: 'flex' }} flexDirection="column">
298                  <Text>{m.title}</Text>
299                  {m.extra.map(l =>
300                    l.isWarning ? (
301                      <Text key={l.text} color="warning">{l.text}</Text>
302                    ) : (
303                      <Text key={l.text} dimColor>{l.text}</Text>
304                    ),
305                  )}
306                  {m.parts.map(p => (
307                    <Text key={p.name}>
308                      <Text color={p.color}>■ </Text>
309                      <Text dimColor>{`${p.name} ~${p.size}`}</Text>
310                    </Text>
311                  ))}
312                </Box>
313              )}
314            </Box>
315          ))}
316          {cache && <Text dimColor>{cache}</Text>}
317          {cost && (
318            <Box flexDirection="row" flexGrow={1} justifyContent="flex-end">
319              <Text dimColor>{cost}</Text>
320            </Box>
321          )}
322        </Box>
323      </Box>
324    )
325  })
326}
327
hooks/bar.ts 27 lines
1// No 'claude-code' import here: tools/make-hero.mts runs this file under plain node.
2export const tone = (percent: number) => (percent >= 85 ? 'over' : percent >= 60 ? 'hot' : 'calm')
3
4// The bar is drawn as an image: theme keys don't reach it, so colors are literal (sampled from the app's usage panel).
5const FILL = { calm: '#4177d0', hot: '#bf882e', over: '#c04742' } as const
6export const PACE_TICK = '#9c9c9c'
7export const COMPACT_TICK = '#c04742'
8export const BAR = { width: 80, height: 8, tick: 12 }
9
10export const clampPct = (p: number) => Math.min(100, Math.max(0, p))
11const at = (percent: number) => Math.round((clampPct(percent) / 100) * BAR.width)
12
13// A tick the fill has passed turns white across the fill: grey on amber or red on red disappears just when it matters.
14const tick = (percent: number, color: string, fill: number) => {
15  const x = Math.min(BAR.width - 2, Math.max(0, at(percent) - 1))
16  // Only a tick the fill covers whole: one level with the fill's end, or on an empty bar, has not been passed.
17  if (x + 2 > at(fill)) return `<rect x="${x}" width="2" height="${BAR.tick}" fill="${color}"/>`
18  const stub = (BAR.tick - BAR.height) / 2
19  return `<rect x="${x}" width="2" height="${stub}" fill="${color}"/><rect x="${x}" y="${stub}" width="2" height="${BAR.height}" fill="#fff"/><rect x="${x}" y="${BAR.tick - stub}" width="2" height="${stub}" fill="${color}"/>`
20}
21
22export const bar = (percent: number, marks: { percent: number; color: string }[]) => {
23  const r = BAR.height / 2
24  const y = (BAR.tick - BAR.height) / 2
25  return `<svg xmlns="http://www.w3.org/2000/svg" width="${BAR.width}" height="${BAR.tick}"><rect y="${y}" width="${BAR.width}" height="${BAR.height}" rx="${r}" fill="#888" fill-opacity="0.25"/><rect y="${y}" width="${at(percent)}" height="${BAR.height}" rx="${r}" fill="${FILL[tone(percent)]}"/>${marks.map(m => tick(m.percent, m.color, percent)).join('')}</svg>`
26}
27
types/index.d.ts 25 lines
1export type UsageBandLimit = { kind: string; percentUsed: number; resetsAt?: string; base?: number; delta?: number }
2
3export type UsageBandPart = { name: string; tokens: number }
4
5export type UsageBandDetail = {
6  compactPercent?: number
7  cacheHitPercent?: number
8  contextParts: UsageBandPart[]
9}
10
11export type UsageBand = {
12  contextPercent?: number
13  contextTokens?: number
14  contextWindow: number
15  rateLimits: UsageBandLimit[]
16  costUsd?: number
17  detail?: UsageBandDetail
18}
19
20declare module 'claude-code' {
21  interface PluginState {
22    'usage-band': { usage: UsageBand | null }
23  }
24}
25