modscode / Gallery / token-printer
token-printer
Token printer go brrr: Clawd prints tokens while Claude works, and /brrr posts the meme
What it does
- Draws a band above the prompt, a pane, toasts
- Adds /brrr
- Hooks prompt.edit, session.start, turn.complete, turn.start and 1 more
- Keeps its own state between turns
Good points
- No network calls
- Starts no processes
- Written in TypeScript
- Has a desktop-specific branch
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 token-printer by BorjaGM1 (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/borjagm1-token-printer/
// 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 } = $.ui.resolve(e)
const caption = '…'
const ledger = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row" height={3}>
<Box width={40} height={3}>
<Box flexDirection="column" width="100%" height="100%">
<Box flexDirection="row" width="100%" height="5%">
<Box height="100%" />
<Box height="100%" />
<Box height="100%" />
</Box>
<Box flexDirection="row" width="100%" height="5%">
<Box height="100%" />
<Box height="100%" />
<Box height="100%" />
</Box>
<Box flexDirection="row" width="100%" height="5%">
<Box height="100%" />
<Box height="100%" />
<Box height="100%" />
</Box>
</Box>
</Box>
<Box position="absolute" top={1} right={3} flexDirection="column">
<Text color="#D97757" bold>
{caption}
</Text>
<Text dimColor>
{ledger}
</Text>
</Box>
</Box>
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "Token Reserve" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Svg, Text, Button } = $.ui.resolve(e)
const label = '…'
return (
<Box flexDirection="column" gap={1}>
<Svg alt="Clawd at the token printer" isInteractive />
<Text />
<Text />
<Text />
<Text bold>
Tokens per reply
</Text>
<Text dimColor>
No replies printed yet.
</Text>
<Box flexDirection="row">
<Button label={`${label}`} />
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const compact = '…'
const hit = '…'
await $.ui.toast(`🖨️ ${compact} tokens printed. ${hit}`)
await $.ui.toast(`Printer band hidden. /token-reserve brings it back.`)
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.
hooks/register.tsx lines 278–346 · Band
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
if (e.props.hasSurvey || (await read($, isBandHidden))) {
isBandShown = false
return next(e)
}
const [total, list, hasShades, usd] = await Promise.all([read($, printed), read($, runs), read($, isUltra), spent($)])
const last = list.at(-1)
hasPrinted ||= e.props.isWorking
// A resized band is a resized prompt box: the draft wraps anew, so look again.
const width = Math.max(20, e.props.bodyColumns)
if (width !== columns) {
columns = width
noteCaret(draft, caret)
}
const upcoming: Scene = e.props.isWorking ? level : hasDraft ? 'ready' : hasPrinted ? 'idle' : 'drowsy'
// A new scene starts its animation over; a new print level carries on. A
// draft startles Clawd only out of sleep: awake, he just turns to watch.
if ((typeof upcoming === 'number') !== (typeof scene === 'number') || (typeof upcoming !== 'number' && upcoming !== scene)) {
const wasAsleep = isAsleep(scene, tick - sceneStart)
sceneStart = upcoming === 'ready' && !wasAsleep ? tick - SETTLED_TICKS : tick
}
scene = upcoming
isBandShown = true
const t = tick - sceneStart
const caption = scene === 'ready'
? isIntro(t) ? 'Ooh, a prompt!' : 'Printer ready 👀'
: typeof scene === 'number'
? `${WORD[scene]}${hasShades ? ' 😎' : ''}`
: `Printer idle${last === undefined ? '' : ` · last run +${grouped(last)}`}`
const ledger = [`${grouped(total)} printed`, dollars(usd)].filter(Boolean).join(' · ')
const hide = async () => {
await update($, isBandHidden, () => true)
$.ui.toast('Printer band hidden. /token-reserve brings it back.')
}
// Reading `redraw` is what lets the clock redraw the band, and the band alone.
await read($, redraw)
if (e.surface === 'terminal') {
const { Box, Button, Text } = $.ui.resolve(e)
return (
<Box flexDirection="row" gap={1}>
<Text color={ORANGE}>✻ {caption}</Text>
<Text dimColor>{ledger}</Text>
<Button key="hide" label="hide" plain dimColor onPress={hide} />
</Box>
)
}
const { Box, Text } = $.ui.resolve(e)
// Clawd and his printer are boxes, 40 columns by 3 rows (3px pixels on the
// desktop), with the caption pinned over the band's right. No Hide button:
// here the desktop draws it as a pill in the middle; /token-reserve hides.
return (
<Box flexDirection="row" height={3}>
<Box width={40} height={3}>{pixels(Box, frame({ scene, t, hasShades, gaze }))}</Box>
<Box position="absolute" top={1} right={3} flexDirection="column">
<Text color={ORANGE} bold>{caption}</Text>
<Text dimColor>{ledger}</Text>
</Box>
</Box>
)
})hooks/register.tsx lines 70–85 · Band
function pixels(Box: ElementConstructor<BoxProps>, rows: readonly string[]) {
return (
<Box flexDirection="column" width="100%" height="100%">
{rows.map((row, y) => (
<Box key={`r${y}`} flexDirection="row" width="100%" height="5%">
{runsOf(row).filter(([letter], i, all) => letter !== '.' || i < all.length - 1).map(([letter, from, length]) => {
const color = PALETTE[letter]
return color === undefined
? <Box key={`c${from}`} width={`${length}%`} height="100%" />
: <Box key={`c${from}`} width={`${length}%`} height="100%" backgroundColor={color} />
})}
</Box>
))}
</Box>
)
}hooks/register.tsx lines 354–398 · Pane
on('ui.render', { component: 'Pane', requestId: RESERVE }, async ($, e) => {
const [total, list, hasShades, working, hidden, usd, lifetime] = await Promise.all([
read($, printed), read($, runs), read($, isUltra), read($, isPrinting), read($, isBandHidden), spent($), $.store.get('lifetime'),
])
const lines = [
[`${grouped(total)} tokens printed this session`, dollars(usd)].filter(Boolean).join(' · '),
`${list.length} ${list.length === 1 ? 'reply' : 'replies'} · biggest run ${grouped(list.length === 0 ? 0 : Math.max(...list))}`,
`${grouped(Number(lifetime ?? 0))} tokens printed all-time`,
]
const toggle = () => update($, isBandHidden, isHidden => !isHidden)
const label = hidden ? 'Show band' : 'Hide band'
if (e.surface === 'terminal') {
const { Box, Button, Text } = $.ui.resolve(e)
return (
<Box flexDirection="column">
{BLOCK_ART.map(row => (
<Box flexDirection="row">
{row.map(([text, color]) => <Text color={color}>{text}</Text>)}
</Box>
))}
{lines.map(line => <Text>{line}</Text>)}
{list.length > 0 && <Text color={ORANGE}>{sparkline(list)}</Text>}
<Button key="band" label={label} onPress={toggle} />
</Box>
)
}
const { Box, Button, Svg, Text } = $.ui.resolve(e)
return (
<Box flexDirection="column" gap={1}>
<Svg {...strip(working ? level : 'idle', hasShades, 2)} alt="Clawd at the token printer" isInteractive />
{lines.map(line => <Text>{line}</Text>)}
<Text bold>Tokens per reply</Text>
{list.length > 0
? <Svg {...chart(list)} alt={`Tokens per reply, oldest first: ${list.map(grouped).join(', ')}`} isInteractive />
: <Text dimColor>No replies printed yet.</Text>}
<Box flexDirection="row">
<Button key="band" label={label} onPress={toggle} />
</Box>
</Box>
)
})Licence text (MIT)
MIT License Copyright (c) 2026 Borja 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
remembers
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 fe657fad2e63 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.hooks/register.tsx |
| Parses | Every file parses as TypeScript or JavaScript.3 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.its repository's .claude-plugin/marketplace.json does not list it: no install line to give |
| 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.starts no programs |
| Reads and sends | Whether it both reads files or environment variables and reaches the network.reaches no network |
| 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's .claude-plugin/marketplace.json does not list it, so there is no install line to give. Read it as code, or follow its author's README.
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 "borjagm1-token-printer" 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