SLOPSHOPPER

usage-band

Always shows context, rate-limit and cost usage above the prompt

bandprocesstimer
v0.1.2no licenseupdated 2026-10-11bhargava-gumpula/claude-mods/usage-band
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 5h ██░░░░░ 31% (NaNm) $0.42 💩 0 tokens 👌 on pace ⟨Claude Code's own drawing⟩ ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── › ? for shortcuts

Draws

Band
5h ██░░░░░ 31% (NaNm) $0.42 💩 0 tokens 👌 on pace ⟨Claude Code's own drawing⟩
README

claude-mods

Mods for Claude Code (terminal and the desktop Code tab).

ModWhat it does
usage-bandA band above the prompt: 5h and 7d limits as bars with time to reset, session cost with a mood emoji, total session tokens, and a pacing hint
chat-rosterA floating org-chart window for the sidebar group of the chat you're in: the orchestrator on top, the group's chats below, running subagents under their chat. Filled = working, hover a dot for its title, a flash runs along the lines when messages pass. Shown only while Claude is in front; opens when a chat starts
cube/cube, /cube 2, /cube 4: random-state scrambles (the WCA method, via cubing.js)
handoff/handoff [focus]: runs the project's checks, writes the dev log entry and HANDOFF.md update, commits (never pushes), and summarizes
streakYour streak of days in a row using Claude Code in the status line (streak 🔥 3 days); /streak adds your longest streak and total days
elevenlabs-call📞 Call Claude Code above the prompt puts the chat you are in on a live ElevenLabs voice call through your mic and speakers (no browser), with an animated orb. What you say is typed into the chat; the agent handles small talk and reads back a short summary of each reply. Hang up from the band or say bye. Needs the claude-voice bridge
prompt-cleanupFixes typos in what you type before Claude reads it (Haiku; skips commands, code and long pastes)
 5h ████░░░ 52% (1h 30m)     7d ██░░░░░ 23% (3d 5h)     $1.23   💩     6.1M tokens     👌 on pace

Cost emoji: 💩 $0–$5 · 😒 >$5 · 🥱 >$10 · 😮‍💨 >$25 · 🫪 >$50 · 😛 >$100 · 🤑 >$500 · 🙀 >$1000. Pacing: 🚀 spend freely (under an hour to reset, 70% or less used) · 🐢 slow down (15+ points ahead of the clock) · 👌 on pace · 🛑 nearly out (90%+).

Needs: python3 (usage-band tokens, chat-roster, streak), Xcode command line tools for swiftc (chat-roster builds its window on first use, macOS only), node and npm (cube installs cubing.js on first use).

Install

In a Claude Code terminal session, one line per mod you want:

/plugin install usage-band --marketplace bhargava-gumpula/claude-mods
/plugin install chat-roster --marketplace bhargava-gumpula/claude-mods
/plugin install cube --marketplace bhargava-gumpula/claude-mods
/plugin install handoff --marketplace bhargava-gumpula/claude-mods
/plugin install prompt-cleanup --marketplace bhargava-gumpula/claude-mods
/plugin install streak --marketplace bhargava-gumpula/claude-mods
/plugin install elevenlabs-call --marketplace bhargava-gumpula/claude-mods

Answer y to add the marketplace, then pick the user scope.

Source 2 files
hooks/register.tsx 156 lines
1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, Register, SessionUsage } from 'claude-code'
3
4import type { Usage } from '../types'
5
6const usage = atom({ plugin: 'usage-band', key: 'usage' } as const, null)
7
8const tokens = atom({ plugin: 'usage-band', key: 'tokens' } as const, 0)
9
10// Bumped every refresh so the countdowns redraw even when nothing else moved.
11const tick = atom({ plugin: 'usage-band', key: 'tick' } as const, 0)
12
13export const REFRESH_MS = 60_000
14
15const LABELS: Record<string, string> = { five_hour: '5h', seven_day: '7d', spend_limit: 'spend' }
16
17export const slim = (u: Pick<SessionUsage, 'rateLimits' | 'cost'>): Usage => ({
18  limits: u.rateLimits.map(({ kind, percentUsed, resetsAt }) => ({ kind, percentUsed, resetsAt })),
19  usd: u.cost?.usd,
20})
21
22const minsUntil = (iso: string | undefined, now: number) =>
23  iso ? Math.max(0, Math.round((Date.parse(iso) - now) / 60000)) : undefined
24
25const until = (iso: string | undefined, now: number) => {
26  const mins = minsUntil(iso, now)
27  if (mins === undefined) return ''
28  if (mins >= 1440) return ` (${Math.floor(mins / 1440)}d ${Math.floor((mins % 1440) / 60)}h)`
29  return mins >= 60 ? ` (${Math.floor(mins / 60)}h ${mins % 60}m)` : ` (${mins}m)`
30}
31
32const WIDTH = 7
33
34// Solid blocks, the empty part drawn dim.
35export const bar = (pct: number) => {
36  const filled = Math.min(WIDTH, Math.max(0, Math.round((pct / 100) * WIDTH)))
37  return { filled: '█'.repeat(filled), empty: '░'.repeat(WIDTH - filled) }
38}
39
40const MOODS: [number, string][] = [
41  [1000, '🙀'],
42  [500, '🤑'],
43  [100, '😛'],
44  [50, '🫪'],
45  [25, '😮‍💨'],
46  [10, '🥱'],
47  [5, '😒'],
48  [0, '💩'],
49]
50
51export const mood = (usd: number) => MOODS.find(([over]) => usd > over)?.[1] ?? '💩'
52
53export const compact = (n: number) =>
54  n >= 1e9 ? `${(n / 1e9).toFixed(1)}B` : n >= 1e6 ? `${(n / 1e6).toFixed(1)}M` : n >= 1e3 ? `${(n / 1e3).toFixed(1)}k` : `${n}`
55
56// Pacing against the 5-hour window: unused capacity is lost at reset, so spend
57// freely near a reset with headroom; otherwise compare use with time elapsed.
58export const pace = (pct: number, minsLeft: number) => {
59  const expected = ((300 - minsLeft) / 300) * 100
60  if (pct >= 90) return { text: '🛑 nearly out', color: 'error' }
61  if (minsLeft <= 60 && pct <= 70) return { text: '🚀 spend freely', color: 'success' }
62  if (pct > expected + 15) return { text: '🐢 slow down', color: 'warning' }
63  return { text: '👌 on pace', color: 'subtle' }
64}
65
66const tone = (pct: number) => (pct >= 90 ? 'error' : pct >= 70 ? 'warning' : 'success')
67
68export const items = (u: Usage, now: number, spent = 0) => [
69  ...u.limits.map(l => ({
70    key: l.kind,
71    label: LABELS[l.kind] ?? l.kind,
72    bar: bar(l.percentUsed),
73    color: tone(l.percentUsed),
74    text: `${l.percentUsed}%${until(l.resetsAt, now)}`,
75  })),
76  ...(u.usd === undefined ? [] : [{ key: 'cost', bar: undefined, color: 'subtle', text: `$${u.usd.toFixed(2)}   ${mood(u.usd)}` }]),
77  { key: 'tokens', bar: undefined, color: 'subtle', text: `${compact(spent)} tokens` },
78  ...u.limits
79    .filter(l => l.kind === 'five_hour')
80    .flatMap(l => {
81      const left = minsUntil(l.resetsAt, now)
82      return left === undefined ? [] : [{ key: 'pace', bar: undefined, ...pace(l.percentUsed, left) }]
83    }),
84]
85
86// Sums the whole session's transcripts, earlier turns and subagents included.
87// ponytail: rescans the transcripts each time (~1-2 s on a huge session); skips a
88// refresh while one is still running rather than piling up.
89let counting = false
90const recount = async ($: EngineInterface) => {
91  if (counting) return
92  counting = true
93  try {
94    const ran = await $.process.run(['python3', '-I', `${$.plugin.root}/hooks/tokens.py`, await $.session.id()])
95    const n = Number(ran.stdout.trim())
96    if (ran.exitCode === 0 && Number.isFinite(n)) await update($, tokens, () => n)
97  } finally {
98    counting = false
99  }
100}
101
102export const refresh = async ($: EngineInterface) => {
103  const next = slim(await $.session.usage())
104  const prev = await read($, usage)
105  if (JSON.stringify(prev) !== JSON.stringify(next)) await update($, usage, () => next)
106  await update($, tick, n => n + 1)
107  await recount($)
108}
109
110export const register: Register = on => {
111  on('session.start', async ($, e, next) => {
112    const ran = await next(e)
113    await refresh($)
114    // Limits, cost, tokens and the time-to-reset all move between events: redraw once a minute.
115    // A failed refresh is swallowed so one bad read never ends the interval.
116    $.clock.every(REFRESH_MS, () => refresh($).catch(() => undefined))
117    return ran
118  })
119
120  on('session.measure', async ($, e, next) => {
121    await update($, usage, () => slim(e))
122    await recount($)
123    return next(e)
124  })
125
126  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
127    // Other mods (the chat org chart) draw in this band too: keep theirs to the right of ours.
128    const below = await next(e)
129    const u = await read($, usage)
130    if (u === null || e.props.hasSurvey) return below
131
132    const { Box, Text } = $.ui.resolve(e)
133    await read($, tick)
134    const now = await $.clock.now()
135    return (
136      <Box flexDirection="row" alignItems="center">
137        <Box flexDirection="row" columnGap={5} paddingX={1}>
138          {items(u, now, await read($, tokens)).map(i => (
139            <Box key={i.key} flexDirection="row" columnGap={1}>
140              {'label' in i ? <Text dimColor>{i.label}</Text> : null}
141              {i.bar ? (
142                <Text>
143                  <Text color={i.color}>{i.bar.filled}</Text>
144                  <Text dimColor>{i.bar.empty}</Text>
145                </Text>
146              ) : null}
147              <Text dimColor>{i.text}</Text>
148            </Box>
149          ))}
150        </Box>
151        {below}
152      </Box>
153    )
154  })
155}
156
types/index.d.ts 11 lines
1export type Usage = {
2  limits: { kind: string; percentUsed: number; resetsAt?: string }[]
3  usd?: number
4}
5
6declare module 'claude-code' {
7  interface PluginState {
8    'usage-band': { usage: Usage | null; tokens: number; tick: number }
9  }
10}
11