modscode JA

modscode / Gallery / burn

burn

Rate limits, usage credits and spend above the prompt, with a /burn pane for the last 7 days

Code you can checkTerminal + desktopPaneBandToastBoxButtonSvgText

What it does

  • Draws a pane, a band above the prompt, toasts
  • Adds /burn
  • Hooks agent.spawn, session.measure, session.start, skill.prompt
  • Keeps its own state between turns
  • Calls the network

Good points

  • Starts no processes
  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors

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)

register.tsx
import type { Register } from 'claude-code'

// Drawn like burn by PickleBoxer (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/pickleboxer-burn/
// 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 pane: open it with $.ui.open({ id: 'my-pane', title: "burn" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const percent = '…'
    const name = '…'
    const tokens = '…'
    const name2 = '…'
    const tokens2 = '…'
    const name3 = '…'
    const tokens3 = '…'
    const limitLabel = '…'
    const percentUsed = '…'
    const resets = '…'
    const limitLabel2 = '…'
    const percentUsed2 = '…'
    const limitLabel3 = '…'
    const percentUsed3 = '…'
    const creditsPercent = '…'
    const creditsLabel = '…'
    const weekday = '…'
    const date = '…'
    const weekday2 = '…'
    const date2 = '…'
    const weekday3 = '…'
    const date3 = '…'
    const since = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Box flexDirection="column">
          <Text bold>
            Context
            {" "}
            <Text dimColor>
              no reading yet
            </Text>
            <Text>
              {" "}
              {percent}
              %
            </Text>
          </Text>
          <Box flexDirection="row" gap={1}>
            <Box width={18} flexShrink={0}>
              <Text wrap="truncate">
                {name}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1} overflow="hidden">
              <Text color="cyan" wrap="truncate">
                ████████░░░░░░░░
              </Text>
            </Box>
            <Box width={8} flexShrink={0} justifyContent="flex-end">
              <Text wrap="truncate">
                {tokens}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Box width={18} flexShrink={0}>
              <Text wrap="truncate">
                {name2}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1} overflow="hidden">
              <Text color="cyan" wrap="truncate">
                ████████░░░░░░░░
              </Text>
            </Box>
            <Box width={8} flexShrink={0} justifyContent="flex-end">
              <Text wrap="truncate">
                {tokens2}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Box width={18} flexShrink={0}>
              <Text wrap="truncate">
                {name3}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1} overflow="hidden">
              <Text color="cyan" wrap="truncate">
                ████████░░░░░░░░
              </Text>
            </Box>
            <Box width={8} flexShrink={0} justifyContent="flex-end">
              <Text wrap="truncate">
                {tokens3}
              </Text>
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text bold>
            Limits
          </Text>
          <Text dimColor>
            No reading yet (needs a subscription and one request)
          </Text>
          <Text>
            <Text>
              ○
            </Text>
            {" "}
            {limitLabel}
            <Text bold>
              {percentUsed}
              %
            </Text>
            <Text dimColor>
              {`  resets in ${resets}`}
            </Text>
          </Text>
          <Text>
            <Text>
              ○
            </Text>
            {" "}
            {limitLabel2}
            <Text bold>
              {percentUsed2}
              %
            </Text>
            <Text dimColor>
              {`  resets in ${resets}`}
            </Text>
          </Text>
          <Text>
            <Text>
              ○
            </Text>
            {" "}
            {limitLabel3}
            <Text bold>
              {percentUsed3}
              %
            </Text>
            <Text dimColor>
              {`  resets in ${resets}`}
            </Text>
          </Text>
          <Text>
            <Text>
              ○
            </Text>
            {" "}
            {"credits "}
            <Text bold>
              {creditsPercent}
              %
            </Text>
            <Text dimColor>
              {" "}
              {creditsLabel}
              {" this month"}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text bold>
            Last 7 days
          </Text>
          <Box flexDirection="row" gap={1}>
            <Box width={10} flexShrink={0}>
              <Text wrap="truncate">
                {weekday}
                {" "}
                {date}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1} overflow="hidden">
              <Text color="green" wrap="truncate">
                ████████░░░░░░░░
              </Text>
            </Box>
            <Box width={10} flexShrink={0} justifyContent="flex-end">
              <Text wrap="truncate">
                –
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Box width={10} flexShrink={0}>
              <Text wrap="truncate">
                {weekday2}
                {" "}
                {date2}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1} overflow="hidden">
              <Text color="green" wrap="truncate">
                ████████░░░░░░░░
              </Text>
            </Box>
            <Box width={10} flexShrink={0} justifyContent="flex-end">
              <Text wrap="truncate">
                –
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Box width={10} flexShrink={0}>
              <Text wrap="truncate">
                {weekday3}
                {" "}
                {date3}
              </Text>
            </Box>
            <Box flexGrow={1} flexShrink={1} overflow="hidden">
              <Text color="green" wrap="truncate">
                ████████░░░░░░░░
              </Text>
            </Box>
            <Box width={10} flexShrink={0} justifyContent="flex-end">
              <Text wrap="truncate">
                –
              </Text>
            </Box>
          </Box>
        </Box>
        <Text>
          {"session "}
          <Text bold>
            –
          </Text>
          {" · today "}
          <Text bold>
            –
          </Text>
          {" · 7d"}
          {" "}
          <Text bold>
            –
          </Text>
          {" · month "}
          <Text bold>
            –
          </Text>
        </Text>
        <Box flexDirection="row" gap={2}>
          <Button label="Refresh" hotkey="r" />
          <Button label="Compact" hotkey="c" />
          <Text dimColor>
            ≈ is API-equivalent cost, recorded by burn
            {` since ${since}`}
            . Only credits are billed.
          </Text>
        </Box>
      </Box>
    )
  })

  // 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 modelName = '…'
    const subagents = '…'
    const percent = '…'
    const tokens = '…'
    const percentUsed = '…'
    const limitLabel = '…'
    const resets = '…'
    const percentUsed2 = '…'
    const limitLabel2 = '…'
    const percentUsed3 = '…'
    const limitLabel3 = '…'
    const creditsLabel = '…'
    const skills = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" gap={3} paddingLeft={1}>
          <Box flexDirection="row" gap={1}>
            <Text color="magenta">
              󰚩
            </Text>
            <Text bold>
              {modelName}
            </Text>
            <Text dimColor>
              {"› "}
              {subagents}
            </Text>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Text>
              ○
            </Text>
            <Text bold>
              {percent}
              %
            </Text>
            <Text dimColor>
              ctx
              {` ${tokens}/${tokens}`}
            </Text>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Text>
              ○
            </Text>
            <Text bold>
              {percentUsed}
              %
            </Text>
            <Text dimColor>
              {limitLabel}
              {` ↻${resets}`}
            </Text>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Text>
              ○
            </Text>
            <Text bold>
              {percentUsed2}
              %
            </Text>
            <Text dimColor>
              {limitLabel2}
              {` ↻${resets}`}
            </Text>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Text>
              ○
            </Text>
            <Text bold>
              {percentUsed3}
              %
            </Text>
            <Text dimColor>
              {limitLabel3}
              {` ↻${resets}`}
            </Text>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Text>
              ○
            </Text>
            <Text bold>
              {creditsLabel}
            </Text>
          </Box>
          <Box flexDirection="row" gap={1}>
            <Text dimColor>
              –
              {" session"}
            </Text>
            <Text dimColor>
              –
              {" today"}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="row" gap={1} paddingLeft={1}>
          <Text dimColor>
            skills
          </Text>
          <Text dimColor wrap="truncate">
            {skills}
          </Text>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const percent = '…'
    const skip = '…'
    await $.ui.toast(`Context is ${percent}% full. Run /compact, or press Compact in /burn.`)
    await $.ui.toast(`Not compacted: ${skip}`)
    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 374–484 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Button, Text } = $.ui.resolve(e)
    const usage = await read($, usageAtom)
    const credits = await read($, creditsAtom)
    const stored = await read($, daysAtom)
    const now = (await read($, nowAtom)) || (await $.clock.now())
    const sum = totals(usage?.sessionUsd ?? null, stored, now)
    const today = localDate(now)
    const days = lastSevenDays(stored, now)
    const max = Math.max(...days.map(day => day.usd), 0)
    const barWidth = Math.max(8, Math.min(40, e.props.bodyColumns - LABEL_COLUMNS - PRICE_COLUMNS - 2))
    const since = stored.map(day => day.date).sort()[0]
    const context = usage?.context
    const rows = (await read($, breakdownAtom)) ?? []
    const rowBarWidth = Math.max(8, Math.min(40, e.props.bodyColumns - ROW_COLUMNS - TOKEN_COLUMNS - 2))

    return (
      <Box flexDirection="column" gap={1}>
        {context && (
          <Box flexDirection="column">
            <Text bold>
              Context{' '}
              <Text dimColor>
                {context.tokens === null ? 'no reading yet' : `${tokens(context.tokens)} / ${tokens(context.window)}`}
              </Text>
              {context.percent !== null && <Text color={contextLevel(context.percent)}> {context.percent}%</Text>}
            </Text>
            {rows.map(row => (
              <Box key={row.name} flexDirection="row" gap={1}>
                <Box width={ROW_COLUMNS} flexShrink={0}>
                  <Text dimColor={row.kind !== 'used'} wrap="truncate">
                    {row.name}
                  </Text>
                </Box>
                <Box flexGrow={1} flexShrink={1} overflow="hidden">
                  <Text color={row.kind === 'used' ? 'cyan' : undefined} dimColor={row.kind !== 'used'} wrap="truncate">
                    {bar(row.tokens, context.window, rowBarWidth)}
                  </Text>
                </Box>
                <Box width={TOKEN_COLUMNS} flexShrink={0} justifyContent="flex-end">
                  <Text dimColor={row.kind !== 'used'} wrap="truncate">
                    {tokens(row.tokens)}
                  </Text>
                </Box>
              </Box>
            ))}
          </Box>
        )}

        <Box flexDirection="column">
          <Text bold>Limits</Text>
          {(usage?.limits ?? []).length === 0 && <Text dimColor>No reading yet (needs a subscription and one request)</Text>}
          {(usage?.limits ?? []).map(limit => {
            const resets = resetsIn(limit.resetsAt, now)

            return (
              <Text key={limit.kind}>
                <Text color={level(limit.percentUsed)}>{glyph(limit.percentUsed)}</Text> {limitLabel(limit.kind).padEnd(8)}
                <Text bold>{String(limit.percentUsed).padStart(5)}%</Text>
                <Text dimColor>{resets ? `  resets in ${resets}` : ''}</Text>
              </Text>
            )
          })}
          {credits && (
            <Text key="credits">
              <Text color={level(creditsPercent(credits))}>{glyph(creditsPercent(credits))}</Text> {'credits'.padEnd(8)}
              <Text bold>{String(creditsPercent(credits)).padStart(5)}%</Text>
              <Text dimColor>  {creditsLabel(credits)} this month</Text>
            </Text>
          )}
        </Box>

        <Box flexDirection="column">
          <Text bold>Last 7 days</Text>
          {/* Fixed label and price columns, so the bars line up whatever the amounts are */}
          {days.map(day => (
            <Box key={day.date} flexDirection="row" gap={1}>
              <Box width={LABEL_COLUMNS} flexShrink={0}>
                <Text bold={day.date === today} wrap="truncate">
                  {weekday(day.date)} {day.date.slice(5)}
                </Text>
              </Box>
              <Box key={`day-${day.date}`} flexGrow={1} flexShrink={1} overflow="hidden">
                <Text color="green" wrap="truncate">
                  {bar(day.usd, max, barWidth)}
                </Text>
              </Box>
              <Box width={PRICE_COLUMNS} flexShrink={0} justifyContent="flex-end">
                <Text bold={day.date === today} wrap="truncate">
                  {money(day.usd)}
                </Text>
              </Box>
            </Box>
          ))}
        </Box>

        <Text>
          session <Text bold>{money(sum.session)}</Text> · today <Text bold>{money(sum.today)}</Text> · 7d{' '}
          <Text bold>{money(sum.week)}</Text> · month <Text bold>{money(sum.month)}</Text>
        </Text>

        <Box flexDirection="row" gap={2}>
          <Button key="refresh" label="Refresh" hotkey="r" onPress={() => void refresh($)} />
          <Button key="compact" label="Compact" hotkey="c" onPress={() => void compact($)} />
          <Text dimColor>
            ≈ is API-equivalent cost, recorded by burn{since ? ` since ${since}` : ''}. Only credits are billed.
          </Text>
        </Box>
      </Box>
    )
  })
hooks/register.tsx lines 486–567 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const usage = await read($, usageAtom)
    const credits = await read($, creditsAtom)
    const now = (await read($, nowAtom)) || (await $.clock.now())

    if (e.props.hasSurvey || !usage) {
      return next(e)
    }

    const agent = await read($, agentAtom)
    const skills = await read($, skillsAtom)
    const elements = $.ui.resolve(e)
    const { Box, Text } = elements
    const isCompact = e.props.bodyColumns < 100
    const sum = totals(usage.sessionUsd, await read($, daysAtom), now)

    // Svg draws only on Desktop, so the terminal gets a pie glyph instead
    const icon = (percent: number, kind: Kind | null, color = level(percent)) =>
      e.surface === 'desktop' && 'Svg' in elements ? (
        <elements.Svg source={ring(percent, color, kind, currencySymbol(credits?.currency ?? 'USD'))} alt={`${percent}%`} width={22} height={22} />
      ) : (
        <Text color={color}>{(isNerd ? nerdIcon(kind, credits?.currency ?? 'USD') : null) ?? glyph(percent)}</Text>
      )
    const context = usage.context
    const below = await next(e)

    return (
      <Box flexDirection="column">
        <Box flexDirection="row" gap={3} paddingLeft={1}>
          {agent && (
            <Box key="agent" flexDirection="row" gap={1}>
              {isNerd && e.surface !== 'desktop' && <Text color="magenta">{NERD_AGENT}</Text>}
              <Text bold>{modelName(agent.model, isCompact)}</Text>
              {agent.subagents.length > 0 && <Text dimColor>› {agent.subagents.join(', ')}</Text>}
            </Box>
          )}
          {context.percent !== null && (
            <Box key="context" flexDirection="row" gap={1}>
              {icon(context.percent, 'context', contextLevel(context.percent))}
              <Text bold>{context.percent}%</Text>
              <Text dimColor>
                ctx{!isCompact && context.tokens !== null ? ` ${tokens(context.tokens)}/${tokens(context.window)}` : ''}
              </Text>
            </Box>
          )}
          {usage.limits.map(limit => {
            const resets = resetsIn(limit.resetsAt, now)

            return (
              <Box key={limit.kind} flexDirection="row" gap={1}>
                {icon(limit.percentUsed, kindOf(limit.kind))}
                <Text bold>{limit.percentUsed}%</Text>
                <Text dimColor>
                  {limitLabel(limit.kind)}
                  {resets && !isCompact ? ` ↻${resets}` : ''}
                </Text>
              </Box>
            )
          })}
          {credits && (
            <Box key="credits" flexDirection="row" gap={1}>
              {icon(creditsPercent(credits), 'credits')}
              <Text bold>{creditsLabel(credits, true)}</Text>
            </Box>
          )}
          <Box key="spend" flexDirection="row" gap={1}>
            <Text dimColor>{money(sum.session)} session</Text>
            {!credits && !isCompact && <Text dimColor>{money(sum.today)} today</Text>}
          </Box>
        </Box>
        {skills.length > 0 && (
          <Box key="skills" flexDirection="row" gap={1} paddingLeft={1}>
            {isNerd && e.surface !== 'desktop' ? <Text color="yellow">{NERD_SKILLS}</Text> : <Text dimColor>skills</Text>}
            <Text dimColor wrap="truncate">
              {skills.join(', ')}
            </Text>
          </Box>
        )}
        {below}
      </Box>
    )
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 PickleBoxer

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

networkdrives Clauderemembers

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 c2f5169605c7 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 readEvery module hooks/hooks.json names was read.hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.2 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo 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 openNetwork 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 drawsThe 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, with its own branch for the desktop
Install lineWhether 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 WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks
NetworkWhether every fetch names its https host in the code.https://api.anthropic.com
ProgramsWhether 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 sendsWhether 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 sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn 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 PickleBoxer/burn
/plugin install burn@burn

This installs the marketplace's latest commit, which may not be the one read here (c2f5169605c7). 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 "pickleboxer-burn" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs