Ranking|Claude Code Mods

ModsCode / Claude Code Mods / Ranking / usage-quota

usage-quota

Know your Claude limits before they hit you (Live band above the Claude Code prompt): 5 Hour and Weekly usage (whole account) with a live usage forecast against limit resets, context window usage, one-click Compact and per-session Auto com…

Code you can checkTerminal + desktopBandStatus lineToastBoxButtonInputSvgText
network, draws

What it does

  • Draws a band above the prompt, the status line, toasts
  • Adds /quota
  • Hooks prompt.edit, session.measure, session.start, turn.complete and 3 more
  • Keeps its own state between turns
  • Calls the network

Good points

  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors
  • Writes no files

Code to start from

A starter ModsCode writes from the drawing it read, and the mod's own lines that draw, where there are any.

Starter (register.tsx)

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

// Drawn like usage-quota by Anant Raghunath (band, status, toast), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/anantraghunath-usage-quota/
// 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, Svg, Button, Input } = $.ui.resolve(e)
    const switchSvg = '…'
    const drawnAt = '…'
    const percent = '…'
    const at = '…'
    const stale = '…'
    const label = '…'
    const note = '…'
    const label2 = '…'
    const note2 = '…'
    const label3 = '…'
    const note3 = '…'
    const tokens = '…'
    const name = '…'
    const name2 = '…'
    const tokens2 = '…'
    const name3 = '…'
    const tokens3 = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="column">
          <Box>
            <Text bold color="#8b90a0" wrap="wrap">
              {" "}
            </Text>
          </Box>
          <Box>
            <Box flexDirection="row" alignItems="center" columnGap={1} flexShrink={0} flexWrap="wrap">
              <Box width={4} height={1} overflow="hidden">
                <Box position="absolute" top={0} left={0} width={4} height={1} borderStyle="round" borderColor="#00000000" />
                <Box position="absolute" top={0} left={0} width={4} height={1} alignItems="center" justifyContent="center">
                  <Svg alt="Auto compact on" source={`${switchSvg}`} width={30} height={20} />
                </Box>
                <Box position="absolute" top={0} left={0}>
                  <Button label="   " plain />
                </Box>
              </Box>
              <Text color="#8b90a0">
                Auto compact
              </Text>
              <Box flexDirection="row" alignItems="center">
                <Box width={4} overflow="hidden">
                  <Box width={6} flexShrink={0}>
                    <Input value={`${drawnAt}`} submitLabel="​" />
                  </Box>
                </Box>
                <Text color="#8b90a0">
                  %
                </Text>
              </Box>
              <Box marginLeft={2}>
                <Button label="Compact" />
              </Box>
              <Button label="▲" plain />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="row" alignItems="center" columnGap={1}>
          <Box flexShrink={1}>
            <Text color="#fbbf24" wrap="wrap">
              {`Context is already at ${percent}%, past ${at}%. Auto compact:`}
            </Text>
          </Box>
          <Box flexDirection="row" columnGap={1} flexWrap="wrap" flexShrink={0}>
            <Button label="Now" />
            <Button label="After my next compact" />
          </Box>
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="column" width="50%">
            <Text color="#8b90a0" wrap="wrap">
              Usage limits show after the first reply.
            </Text>
            <Text color="#fbbf24" wrap="wrap">
              {stale}
            </Text>
            <Box flexDirection="column">
              <Box flexDirection="row">
                <Box width={8} flexShrink={0}>
                  <Text bold wrap="truncate-end">
                    {label}
                  </Text>
                </Box>
                <Box flexDirection="row">
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                  </Box>
                </Box>
                <Box marginLeft={2} flexShrink={0}>
                  <Text bold>
                    {`${percent}%`}
                  </Text>
                </Box>
              </Box>
              <Text color="#8b90a0" wrap="wrap">
                {note}
              </Text>
              <Text>
                {" "}
              </Text>
            </Box>
            <Box flexDirection="column">
              <Box flexDirection="row">
                <Box width={8} flexShrink={0}>
                  <Text bold wrap="truncate-end">
                    {label2}
                  </Text>
                </Box>
                <Box flexDirection="row">
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                  </Box>
                </Box>
                <Box marginLeft={2} flexShrink={0}>
                  <Text bold>
                    {`${percent}%`}
                  </Text>
                </Box>
              </Box>
              <Text color="#8b90a0" wrap="wrap">
                {note2}
              </Text>
              <Text>
                {" "}
              </Text>
            </Box>
            <Box flexDirection="column">
              <Box flexDirection="row">
                <Box width={8} flexShrink={0}>
                  <Text bold wrap="truncate-end">
                    {label3}
                  </Text>
                </Box>
                <Box flexDirection="row">
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                  </Box>
                </Box>
                <Box marginLeft={2} flexShrink={0}>
                  <Text bold>
                    {`${percent}%`}
                  </Text>
                </Box>
              </Box>
              <Text color="#8b90a0" wrap="wrap">
                {note3}
              </Text>
              <Text>
                {" "}
              </Text>
            </Box>
          </Box>
          <Text>
            {" "}
          </Text>
          <Box flexDirection="column" width="50%">
            <Box flexDirection="row">
              <Box>
                <Text>
                  {" "}
                </Text>
              </Box>
              <Box>
                <Text>
                  {" "}
                </Text>
              </Box>
              <Box>
                <Text>
                  {" "}
                </Text>
              </Box>
            </Box>
            <Box flexDirection="row" justifyContent="space-between" columnGap={2}>
              <Box flexDirection="row">
                <Text bold>
                  Context
                </Text>
                <Box marginLeft={2}>
                  <Text bold>
                    {`${percent}% used`}
                  </Text>
                </Box>
              </Box>
              <Text color="#8b90a0">
                {`${tokens} free of ${tokens}`}
              </Text>
            </Box>
            <Box flexDirection="row" justifyContent="space-between">
              <Text>
                {name}
              </Text>
              <Text color="#8b90a0">
                {tokens}
              </Text>
            </Box>
            <Box flexDirection="row" justifyContent="space-between">
              <Text>
                {name2}
              </Text>
              <Text color="#8b90a0">
                {tokens2}
              </Text>
            </Box>
            <Box flexDirection="row" justifyContent="space-between">
              <Text>
                {name3}
              </Text>
              <Text color="#8b90a0">
                {tokens3}
              </Text>
            </Box>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const message = '…'
    const skip = '…'
    const percent = '…'
    const at = '…'
    await $.ui.status(`usage-quota: ${message}`)
    await $.ui.toast(`Auto compact was skipped: ${skip}`)
    await $.ui.toast(`Context is still at ${percent}% after compacting, past your ${at}%: auto compact waits until it drops below`)
    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 1031–1190 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey || !(await read($, isOn))) return next(e)
    const snap = await read($, snapshot)
    if (!snap) return next(e)

    const table = $.ui.resolve(e)
    const { Box, Text, Button, Input } = table
    const Svg = e.surface === 'desktop' && 'Svg' in table ? table.Svg : undefined
    usePalette(e.surface === 'desktop' && (await read($, theme)) === 'light' ? LIGHT : DARK)
    const width = Math.max(20, e.props.bodyColumns)
    const now = await $.clock.now()
    // both windows always, once there is any reading: one the reading lacks is not running
    const known = snap.limits.length === 0 ? [] : Object.keys(WINDOWS).map(kind => snap.limits.find(l => l.kind === kind) ?? { kind, percentUsed: 0 })
    const list = known.map(l => forecast(l, now, snap.pace?.[l.kind])).filter((f): f is Forecast => f !== null)
    const head = headline(list, now)
    // free as /context has it: the window less what is used and the autocompact buffer
    const buffer = snap.categories.find(c => c.kind === 'buffer')?.tokens ?? 0
    const free = Math.max(0, snap.window - snap.tokens - buffer)
    // highest first, as /context lists them: used categories, then the buffer, then free space
    const rank = (c: Category) => (c.kind === 'used' ? 0 : c.kind === 'buffer' ? 1 : 2)
    const shown = snap.categories
      .map((c, i) => ({ ...c, color: colorOf(c, i) }))
      .sort((a, b) => rank(a) - rank(b) || b.tokens - a.tokens)

    const limits = [...list].sort((a, b) => order(a.kind) - order(b.kind))
    // say so when the figures are old: the service refused and no reply has come since
    const age = snap.limitsAt === undefined ? 0 : now - snap.limitsAt
    const stale =
      snap.limitsError && age >= 2 * 60_000 && limits.length > 0
        ? `usage check ${snap.limitsError} – figures from ${duration(age)} ago`
        : snap.limitsError && limits.length === 0
          ? `usage check ${snap.limitsError}`
          : undefined
    const collapsed = await read($, isCollapsed)
    const auto = await read($, autoCompact)
    const ask = await read($, autoAsk)
    const tick = await read($, fieldTick)
    const drawnAt = (await read($, fieldText)) ?? `${auto.at ?? AT_DEFAULT}`
    const submitAt = (value: string) => commitAt($, value)
    const toggleAuto = () => {
      const flipped = { isOn: !auto.isOn, at: auto.at ?? AT_DEFAULT }
      void saveAuto($, flipped).then(() =>
        flipped.isOn ? askIfPast($, flipped.at) : update($, autoAsk, () => null),
      )
    }
    // Laid out to the width the chat gives the band, down to the desktop's narrowest
    // chat: what fits side by side stays side by side; past that it stacks, and text
    // wraps rather than cuts off.
    // The header: the headline beside the controls when both fit, else the controls
    // on a row of their own beneath it
    // (the desktop's letters are narrower than its cells: about 0.8 of one)
    const CONTROLS = 40
    // the terminal draws its own hide control ([-]) over the band's top-right
    // corner: the first row keeps clear of it
    const HOST_HIDE = Svg ? 0 : 4
    const isHeadBeside = width >= (head?.text.length ?? 0) * (Svg ? 0.8 : 1) + CONTROLS + HOST_HIDE
    // the windows and the context side by side, or one above the other
    const isSplit = width >= 84
    const column = isSplit ? Math.floor((width - 4) / 2) : width
    // the limit bars fill their column: less the label (8) and the % (2 + 4)
    const cells = Math.max(6, column - 14)
    // collapsed: the three bars in one row, or each on a row of its own
    const isOneRow = width >= 72
    // the context's two figures on one line, or the free count on the next
    const isContextLine = column >= 38
    // the question and its two answers on one line when they fit, else the answers
    // beneath: measured from the words themselves (the desktop draws text narrower than
    // a cell each, as the headline's check allows), each button's chrome and the gaps
    const ASK_LABELS = ['Now', 'After my next compact']
    const askWords = (ask ? `Context is already at ${ask.percent}%, past ${ask.at}%. Auto compact:`.length : 0) + ASK_LABELS.join('').length
    const isAskLine = width >= askWords * (Svg ? 0.8 : 1) + ASK_LABELS.length * (Svg ? 3 : 4) + 3

    const controls = (
      <Box flexDirection="row" alignItems="center" columnGap={1} flexShrink={0} flexWrap="wrap">
        {/* auto compact: the switch (the press), its name, the % field beside it,
            then a wide gap so the field reads as the switch's, not Compact's */}
        {Svg ? (
          <Box key="autoSwitch" width={SWITCH_CELLS} height={1} overflow="hidden">
            {/* three layers, each the box's full size, so all share one centre: the
                rounded light (unlit: an invisible border), the pill, the press */}
            <Box position="absolute" top={0} left={0} width={SWITCH_CELLS} height={1} borderStyle="round" borderColor={CLEAR} hover={{ backgroundColor: SWITCH_LIT, borderColor: SWITCH_LIT }} />
            <Box position="absolute" top={0} left={0} width={SWITCH_CELLS} height={1} alignItems="center" justifyContent="center">
              <Svg alt={`Auto compact ${auto.isOn ? 'on' : 'off'}`} source={switchSvg(auto.isOn)} width={SWITCH_W} height={SWITCH_H} />
            </Box>
            {/* a chromeless button over all of it takes the click */}
            <Box position="absolute" top={0} left={0}>
              <Button key="auto" label={'   '} plain hover={{ backgroundColor: CLEAR }} onPress={toggleAuto} />
            </Box>
          </Box>
        ) : (
          <Button key="auto" label={auto.isOn ? '●' : '○'} plain onPress={toggleAuto} />
        )}
        <Text color={auto.isOn ? undefined : MUTED}>Auto compact</Text>
        {auto.isOn ? (
          // the field (3 digits) sets itself once typing pauses; a plain % right after it
          <Box flexDirection="row" alignItems="center">
            {/* the field's Enter chip can't be turned off: the field is drawn wider than
                its box and the box clips the chip away */}
            <Box width={4} overflow="hidden">
              <Box width={6} flexShrink={0}>
                <Input
                  key={`autoAt${tick}`}
                  value={drawnAt}
                  submitLabel={'\u200b'}
                  onInput={value => typedAt($, value)}
                  onSubmit={value => submitAt(value)}
                />
              </Box>
            </Box>
            <Text color={MUTED}>%</Text>
          </Box>
        ) : Svg ? (
          // off: the field's room is kept, unseen, so the switch sits at the very same
          // spot and draws pixel for pixel as when on
          <Box flexDirection="row" alignItems="center">
            <Box width={4} />
            <Text color={CLEAR}>%</Text>
          </Box>
        ) : null}
        <Box key="compactBox" marginLeft={isHeadBeside ? 2 : 0}>
          <Button key="compact" label="Compact" hover={{ backgroundColor: COMPACT_LIT }} onPress={() => compactNow($)} />
        </Box>
        <Button
          key="collapse"
          label={collapsed ? '▲' : '▼'}
          plain
          onPress={async () => {
            // from the state, not this closure's value (an older draw's); saved for
            // the other chats first, so the half-second read never undoes the press
            const now = !(await read($, isCollapsed))
            await storeSet($, 'collapsed', now)
            await update($, isCollapsed, () => now)
          }}
        />
      </Box>
    )
    const gap = Svg ? 0.5 : 1
    const headText = <Text bold color={head ? ink(head.color) : MUTED} wrap="wrap">{head?.text ?? ' '}</Text>

    // one bar: an Svg on the desktop, coloured cells on the terminal
    const bar = (alt: string, segments: { color: string; share: number }[], barCells: number, marker?: number, f?: Forecast) =>
      Svg ? (
        <Box width={barCells} height={1} alignItems="center">
          <Svg alt={alt} source={barSvg(segments, barCells * 8, marker)} height={BAR_PX} />
        </Box>
      ) : f ? (
        <Box flexDirection="row" width={barCells}>
          {cellRuns(f, barCells).map(run => (
            <Box width={run.width} backgroundColor={run.color}>
              <Text> </Text>
            </Box>
          ))}
        </Box>
      ) : (
        <Box flexDirection="row" width={barCells} overflow="hidden">
          {segments.map(seg => {
            const total = segments.reduce((sum, s) => sum + s.share, 0) || 1
            return (
              <Box backgroundColor={seg.color} flexGrow={Math.min(10000, Math.max(seg.share > 0 ? 1 : 0, Math.round((seg.share / total) * 1000)))} flexShrink={1}>
                <Text> </Text>
Licence text (MIT)
MIT License

Copyright (c) 2026 Anant Raghunath

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.

How to build this: Band above the prompt, Add a slash command

What its code calls

networkruns programsreads filesenv varsrememberscalls tools

What its code shows

Read from the source at commit 5444bb3fdf52 on 2026-10-11. 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.1 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).hooks/register.tsx:827 defaults (not on Windows)
NetworkWhether every fetch names its https host in the code.https://api.anthropic.com (with the session's own Anthropic credential)
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.reg, defaults
Reads and sendsWhether it both reads something of yours (files, environment variables, the transcript, settings) and reaches outside (the network, an MCP server, another session, telemetry).reads environment variables, files and reaches the network
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
Settings hooksHooks declared in hooks/hooks.json or plugin.json beside the module: a command (a shell when it has no args), an HTTP request, an MCP tool or a model prompt at an event. They run outside $.no settings hooks: its function hooks alone
Servers it shipsMCP servers (a program, or a URL; a headersHelper is a shell command; a .mcpb bundle is unpacked at run time), LSP servers, monitors (a shell command for the whole session) and bin/ (on the PATH of the Bash tool).ships no MCP or LSP server, no monitor, no bin/
Skills, commands, agentsWhat its Markdown declares beyond text: allowed-tools granted for the turn, hooks added when a skill is invoked, a command run before Claude reads the skill.no skills, commands, agents or workflows
Tools and MCPWhether every tool it calls through $.tool.call and $.mcp.call is named in the code, and none is a shell (Bash through the tool runs a shell without $.process).command.run: /compact
Asks of the modelCompletions it runs ($.model.complete, fork, classify), subagents it spawns, prompts it submits as you, and the tools, commands and agents it adds.adds command quota
Events it hooksBy what a hook there can do: gates (refuse a tool call, a prompt, a setting, another plugin), shapes (what the model reads: the system prompt, tool descriptions, each request), reads (your input, the events of the settings hooks, every event with *), and the rest.gates: command.run (quota) · reads: ui.press (AbovePrompt), prompt.edit · also: session.start, session.measure, ui.focus (AbovePrompt), turn.start (+2) · timers: clock.after, clock.every
Reads, by nameThe environment variables and files it names, and whether it reads the transcript, settings.json, the prompt box or the mouse selection.env: HOME, USERPROFILE, CLAUDE_CONFIG_DIR, APPDATA; files: …/plugins/store, …/…, a path computed at run time
Writes, by nameThe files and environment variables it names, and whether it changes settings, the prompt box, the clipboard, the conversation (a row the model reads) or another session.writes no files, environment variables, settings or conversation rows

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 its code (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

From its marketplace

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 anantraghunath/claude-code-usage-quota-mod
/plugin install usage-quota@claude-code-usage-quota-mod
/reload-plugins

This installs the marketplace's latest commit, which may not be the one read here (5444bb3fdf52). Compare them before you install. /reload-plugins loads it into a session that is already open.

Try the commit ModsCode read

No marketplace needed. In a terminal, clone the repository, check out the commit read, validate the mod, and load it for one session:

git clone https://github.com/anantraghunath/claude-code-usage-quota-mod
git -C claude-code-usage-quota-mod checkout 5444bb3fdf523e561f397355055c11dc95224ace
claude plugin validate claude-code-usage-quota-mod
claude --plugin-dir claude-code-usage-quota-mod

The validate line lists the events the mod hooks and what it asks Claude Code to do, without running it. The last line loads the mod for this session only and writes nothing to your settings. If the author has rewritten history, the commit may no longer exist.

Ask Claude about it

With the ModsCode connector added, Claude can read this mod's code and what it reaches, and build on them. Ask it like this:

Read the ModsCode mod "anantraghunath-usage-quota" with its code and make me one like it

Search them from Claude: the MCP connector

Similar mods

Badge for your README

If this is your mod, paste this into your README. It links to this page.

README.md
[![ModsCode](https://modscode.com/badge/anantraghunath-usage-quota.svg)](https://modscode.com/claude-mods/mods/anantraghunath-usage-quota/)