modscode / Gallery / usage-band
usage-band
Rate limits, context, cost and git branch in a band above the prompt
What it does
- Draws a band above the prompt, a pane, toasts
- Adds /usage
- Hooks session.measure, session.start, turn.complete
- Keeps its own state between turns
- Starts processes
Good points
- No network calls
- Small: 256 lines
- Written in TypeScript
- Writes no files
Code to start from
Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.
Starter (register.tsx)
import type { Register } from 'claude-code'
// Drawn like usage-band by Wilson Kinyua (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/wilsonkinyua-usage-band/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
// the band above the prompt; what else goes there is drawn under it
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { Box, Text, Button } = $.ui.resolve(e)
const glyph = '…'
const percent = '…'
const label = '…'
const detail = '…'
const glyph2 = '…'
const percent2 = '…'
const glyph3 = '…'
const percent3 = '…'
const glyph4 = '…'
const percent4 = '…'
const usd = '…'
const branch = '…'
const changes = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row" flexWrap="wrap" alignItems="center" columnGap={3} paddingX={1}>
<Box flexDirection="row" alignItems="center" gap={1}>
<Text>
{glyph}
</Text>
<Text bold>
{percent}
%
</Text>
<Text dimColor>
{`${label} · ${detail}`}
</Text>
</Box>
<Box flexDirection="row" alignItems="center" gap={1}>
<Text>
{glyph2}
</Text>
<Text bold>
{percent2}
%
</Text>
<Text dimColor>
{`${label} · ${detail}`}
</Text>
</Box>
<Box flexDirection="row" alignItems="center" gap={1}>
<Text>
{glyph3}
</Text>
<Text bold>
{percent3}
%
</Text>
<Text dimColor>
{`${label} · ${detail}`}
</Text>
</Box>
<Box flexDirection="row" alignItems="center" gap={1}>
<Text>
{glyph4}
</Text>
<Text bold>
{percent4}
%
</Text>
<Text dimColor>
{"ctx · "}
</Text>
</Box>
<Box flexDirection="row" alignItems="center" gap={1}>
<Text bold color="#3fb950">
{usd}
</Text>
<Text dimColor>
{`${usd} today ${usd} mo`}
</Text>
</Box>
<Box flexDirection="row" alignItems="center" gap={1}>
<Text color="#58a6ff">
{"⎇ "}
{branch}
</Text>
<Text color="#d29922">
±
{changes}
</Text>
</Box>
<Button label="details" plain />
</Box>
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "Usage" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text } = $.ui.resolve(e)
const totalTokens = '…'
const maxTokens = '…'
const percentage = '…'
const name = '…'
const tokens = '…'
const name2 = '…'
const tokens2 = '…'
const name3 = '…'
const tokens3 = '…'
const day = '…'
const usd = '…'
const day2 = '…'
const usd2 = '…'
const day3 = '…'
const usd3 = '…'
return (
<Box flexDirection="column" gap={1}>
<Box flexDirection="column">
<Text bold>
Context
</Text>
<Text dimColor>
{totalTokens}
{" / "}
{maxTokens}
{" tokens ("}
{percentage}
%)
</Text>
<Text>
<Text>
{"■ "}
</Text>
{name}
{": "}
{tokens}
</Text>
<Text>
<Text>
{"■ "}
</Text>
{name2}
{": "}
{tokens2}
</Text>
<Text>
<Text>
{"■ "}
</Text>
{name3}
{": "}
{tokens3}
</Text>
</Box>
<Box flexDirection="column">
<Text bold>
Spend (sessions with this mod loaded)
</Text>
<Text>
{day}
{" "}
{usd}
</Text>
<Text>
{day2}
{" "}
{usd2}
</Text>
<Text>
{day3}
{" "}
{usd3}
</Text>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const LABELS = '…'
const percentUsed = '…'
const countdown = '…'
await $.ui.toast(`${LABELS} limit at ${percentUsed}% · resets in ${countdown}`)
return next(e)
})
}
The mod's own code
Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.
plugins/usage-band/hooks/register.tsx lines 142–186 · Band
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const snapshot = await read($, usage)
if (e.props.hasSurvey || !snapshot) return next(e)
const [branch, sums, at] = await Promise.all([read($, git), read($, totals), read($, now)])
const elements = $.ui.resolve(e)
const { Box, Text, Button } = elements
const meter = (key: string, percent: number, label: string, detail: string) => {
const color = tone(percent)
return (
<Box key={key} flexDirection="row" alignItems="center" gap={1}>
{'Svg' in elements ? (
<elements.Svg source={ring(percent, color)} alt={`${label} ${percent}%`} width={22} height={22} />
) : (
<Text color={color}>{glyph(percent)}</Text>
)}
<Text bold>{Math.round(percent)}%</Text>
<Text dimColor>{detail ? `${label} · ${detail}` : label}</Text>
</Box>
)
}
return (
<Box flexDirection="row" flexWrap="wrap" alignItems="center" columnGap={3} paddingX={1}>
{snapshot.limits.map(limit =>
meter(limit.kind, limit.percentUsed, LABELS[limit.kind] ?? limit.kind, limit.resetsAt ? `resets ${countdown(limit.resetsAt, at)}` : ''),
)}
{snapshot.contextPercent !== undefined && meter('context', snapshot.contextPercent, 'ctx', '')}
{snapshot.sessionUsd !== undefined && (
<Box key="cost" flexDirection="row" alignItems="center" gap={1}>
<Text bold color={GREEN}>{usd(snapshot.sessionUsd)}</Text>
{sums && <Text dimColor>{`${usd(sums.todayUsd)} today ${usd(sums.monthUsd)} mo`}</Text>}
</Box>
)}
{branch && (
<Box key="git" flexDirection="row" alignItems="center" gap={1}>
<Text color="#58a6ff">⎇ {branch.branch}</Text>
{branch.changes > 0 && <Text color={AMBER}>±{branch.changes}</Text>}
</Box>
)}
<Button key="details" label="details" plain onPress={() => $.ui.open({ id: PANE, title: 'Usage' })} />
</Box>
)
})plugins/usage-band/hooks/register.tsx lines 188–229 · Pane
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const { Box, Text } = $.ui.resolve(e)
const [detail, sums] = await Promise.all([$.session.usage({ breakdown: 'summary' }), read($, totals)])
const breakdown = detail.context.breakdown
return (
<Box flexDirection="column" gap={1}>
<Box flexDirection="column">
<Text bold>Context</Text>
{breakdown ? (
<>
<Text dimColor>
{breakdown.totalTokens.toLocaleString()} / {breakdown.maxTokens.toLocaleString()} tokens ({Math.round(breakdown.percentage)}%)
</Text>
{breakdown.categories
.filter(category => category.tokens > 0)
.map(category => (
<Text>
<Text color={category.color}>■ </Text>
{category.name}: {category.tokens.toLocaleString()}
</Text>
))}
</>
) : (
<Text dimColor>No breakdown yet.</Text>
)}
</Box>
<Box flexDirection="column">
<Text bold>Spend (sessions with this mod loaded)</Text>
{sums && sums.days.length > 0 ? (
sums.days.map(([day, value]) => (
<Text>
{day} {usd(value)}
</Text>
))
) : (
<Text dimColor>Nothing recorded yet.</Text>
)}
</Box>
</Box>
)
})Licence text (MIT)
MIT License Copyright (c) 2026 Wilson Kinyua Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
What its code calls
runs programsremembers
The design, read from code
Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.
What its code shows
Read from the source at commit a1b7355ab3f6 on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.
| Decides the listing: code you can check | |
|---|---|
| Entry read | Every module hooks/hooks.json names was read.plugins/usage-band/hooks/register.tsx |
| Parses | Every file parses as TypeScript or JavaScript.1 files parsed |
| All its code is in the mod | Every import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod |
| Readable | No minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs |
| Calls in the open | Network and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open |
| For you to weigh before installing | |
| Where it draws | The terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both |
| Install line | Whether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there |
| Programs on Windows | Whether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks |
| Network | Whether every fetch names its https host in the code.no network |
| Programs | Whether every program it starts is named in the code and is not a shell, an interpreter or a network tool.git (reaches the network) |
| Reads and sends | Whether it both reads files or environment variables and reaches the network.reaches the network, but reads no files and no environment variables |
| Keys in the source | Whether the source holds what looks like an API key or a private key.no keys in the source |
| Licence | An open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT |
This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen
Install it
Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.
Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:
/plugin marketplace add WilsonKinyua/claude-mods/plugin install usage-band@wilson-modsThis installs the marketplace's latest commit, which may not be the one read here (a1b7355ab3f6). Compare them before you install.
Ask Claude about it
With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:
Read the modscode design "wilsonkinyua-usage-band" with its code and make me a pane like itSearch them from Claude: the MCP connector
Similar designs
-
Ask Claude…Fix loginRemoveCopy markdownacme/app · mainCopy linkCopy markdownbuild2h 10mbuild2h 10mbuild2h 10mHosted on uploads.sh, not committed to the repo.They will appear in a comment on the pull request once opened.
-
What it does
- Draws a band above the prompt, a pane
- Adds /progress
- Watches tool calls and can refuse them
- Hooks classic.SessionStart, prompt.compose, prompt.submit, session.start and 2 more
-
Ask Claude…Skins0 Your promptadd rate limiting to the hub api0 Tool rows: finished, running, failedYour prompt Spinner0 Folded group of reads and searches●main · note 3 · note 3 · note 30 Edit diff cardDesktop only; the terminal keeps Claude Code's diff.0 Shell output cardDesktop only.0 Code block cardDesktop only; the terminal keeps Claude Code's markdown.0 TableAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopy0 SpinnerAccent SpinnerSpinnerSpinner… 2h 10m0 Band above the prompt: normal, then nudging to compact█████░░░ 42% build█████░░░ 42% build█████░░░ 42% buildContext is 42% full0 Compact now0 Band above a questionTable BashBashBash0 Turn footer (terminal)3 build in 2h 10m · Grep · +3 −3
-
spending-effort-with-jev: no TypeSafe API key, so effort tips are off. Set it in /plugin.⚠ effort: long run, fuzzy spec → have Claude interview you, then go maxAsk Claude…
-
✦ explain as pick how Claude answers×3 ● build3 ● build3 ● build▸ VideoAsk Claude…
-
Ask Claude…Clawd's shopLevel 3 · Fix loginTinkerer1 coin per 12.4 tokens Claude writes, 100 per level, 25 per badgeTake everything offContextbuildLevel 3buildLevel 3buildLevel 3ContextbuildLevel 3buildLevel 3buildLevel 3ContextbuildLevel 3buildLevel 3buildLevel 3