Ranking|Claude Code Mods

ModsCode / Claude Code Mods / Ranking / tokenmunim

tokenmunim

Cost control for AI agents: a budget per task, a live ledger of every step, and a circuit breaker that stops loops, burn spikes and runaway spend.

Code you can checkTerminal + desktopPaneStatus lineToastBoxButtonText
writes files, runs programs, draws

What it does

  • Draws a pane, toasts
  • Adds /munim
  • Watches mcp__tokenmunim__start_task, mcp__tokenmunim__end_task calls and can refuse them
  • Hooks session.start, turn.complete, turn.step, ui.close
  • Keeps its own state between turns

Good points

  • No network calls
  • Written in TypeScript
  • Handles errors

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 tokenmunim by Piyush Sinha (pane, status, toast), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/piyushsinha-9-tokenmunim/
// 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: "TokenMunim" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text } = $.ui.resolve(e)
    const labelOf = '…'
    return (
      <Box flexDirection="column" paddingX={1}>
        <Box justifyContent="space-between">
          <Box>
            <Text bold>
              Token
            </Text>
            <Text bold color="#E8B04B">
              Munim
            </Text>
            <Text color="#666672">
              {"  cost control for AI agents"}
            </Text>
          </Box>
          <Box>
            <Text bold backgroundColor="#1C3626">
              {" ● LIVE "}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Box>
            <Box marginRight={0}>
              <Text bold color="#17171B" backgroundColor="#E8B04B">
                {` ${labelOf} `}
              </Text>
            </Box>
            <Box marginRight={0}>
              <Text bold color="#17171B" backgroundColor="#E8B04B">
                {` ${labelOf} `}
              </Text>
            </Box>
            <Box marginRight={0}>
              <Text bold color="#17171B" backgroundColor="#E8B04B">
                {` ${labelOf} `}
              </Text>
            </Box>
          </Box>
          <Text color="#3B3B45">
            ────────
          </Text>
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const name = '…'
    const money = '…'
    await $.ui.toast(`TokenMunim: ${name} gets ${money} more budget`)
    await $.ui.toast(`TokenMunim: the next call goes through`)
    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.

plugin/hooks/register.tsx lines 404–426 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const kit = $.ui.resolve(e)
    // A reload forgets where the ledger lives; find it again on the first draw.
    if (ledgerFile === undefined) await locate($)
    const b = normalize(await read($, book))
    const v: View = migrateView(await read($, view))
    const now = await $.clock.now()
    const rows = e.props.scroll?.bodyRows ?? (e.viewport?.rows ?? 50) - 6
    return drawPane(
      kit,
      { book: b, view: v, now, limits, width: e.props.bodyColumns, rows, hasFile: ledgerFile !== undefined, startedAt },
      {
        setTab: tab => void update($, view, cur => ({ ...migrateView(cur), tab, entry: null })),
        toggle: (id, isFolded) => void update($, view, cur => toggleSection({ ...migrateView(cur) }, id, isFolded)),
        drill: task => void update($, view, cur => ({ ...migrateView(cur), task, tab: task === null ? cur.tab : 'activity', entry: null })),
        expand: entry => void update($, view, cur => ({ ...migrateView(cur), entry })),
        openLedger: () => void openLedger($),
        raise: (taskId, by) => void decide($, 'raise', taskId, by),
        allow: () => void decide($, 'allow'),
        skip: taskId => void decide($, 'skip', taskId),
      },
    )
  })
plugin/hooks/pane.tsx lines 157–316 · Pane
export function drawPane(kit: Kit, d: PaneData, act: PaneActions) {
  const { Box, Text, Button } = kit
  const { book: b, view, now, limits } = d
  const W = Math.max(30, d.width)
  const inner = W - 2
  // Inside a panel: one cell of padding a side.
  const C = inner - 2
  const wide = C >= 58
  const narrow = C < 46
  const R = Math.max(24, d.rows)

  const trip = b.trips[b.trips.length - 1]
  const active = b.tasks.find(k => k.id === b.active)
  const lastEntry = b.entries[b.entries.length - 1]
  const isLive = lastEntry !== undefined && now - lastEntry.at < 90_000

  // ---- building blocks -----------------------------------------------------

  const pill = (text: string, color: string, bg?: string) => (
    <Text bold color={color} backgroundColor={bg}>{` ${text} `}</Text>
  )

  const link = (key: string, label: string, onPress: () => void, dim = false) => (
    <Box key={`${key}-box`}>
      <Button key={key} plain dimColor={dim} label={label} hover={{ color: GOLD, underline: true }} onPress={onPress} />
    </Box>
  )

  const action = (key: string, label: string, onPress: () => void, primary: boolean) => (
    <Box key={`${key}-box`} backgroundColor={primary ? GOLD_DEEP : CHIP} marginRight={1}>
      <Button key={key} plain label={` ${label} `} hover={{ backgroundColor: primary ? GOLD : MUTED, color: INK }} onPress={onPress} />
    </Box>
  )

  const panel = (key: string, children: unknown, marginTop: number, bg: string = PANEL) => (
    <Box key={key} flexDirection="column" marginTop={marginTop} backgroundColor={bg} paddingX={1}>
      {children}
    </Box>
  )

  const section = (id: string, title: string, right: unknown, isFolded: boolean, body: unknown, marginTop: number) =>
    panel(
      `sec-${id}`,
      [
        <Box key={`sec-${id}-head`} justifyContent="space-between">
          <Box key={`fold-${id}-box`}>
            <Button key={`fold-${id}`} plain label={`${isFolded ? '▸' : '▾'} ${title}`} hover={{ color: GOLD, underline: true }} onPress={() => act.toggle(id, isFolded)} />
          </Box>
          {right}
        </Box>,
        isFolded ? null : body,
      ],
      marginTop,
    )

  const muted = (text: string, room: number, color: string = MUTED) => <Text color={color}>{cut(text, Math.max(0, room))}</Text>

  // ---- header and tabs -----------------------------------------------------

  // The header is one row, like an app's title bar: the wordmark in two
  // tones, the tagline when there is room, and status on the right. Nothing
  // clickable sits up here, beside the close mark of the pane's frame: the
  // ledger link lives in the footer.
  const elapsed = d.startedAt && d.startedAt > 0 ? `session ${span((now - d.startedAt) / 60_000)}` : ''
  const TAGLINE = '  cost control for AI agents'
  const statusWidth = 8
  const showTagline = 10 + TAGLINE.length + 1 + statusWidth <= inner
  const header = (
    <Box key="header" justifyContent="space-between">
      <Box>
        <Text bold>Token</Text>
        <Text bold color={GOLD}>Munim</Text>
        {showTagline ? <Text color={FAINT}>{TAGLINE}</Text> : null}
      </Box>
      <Box>
        {isLive ? pill('● LIVE', GREEN, GREEN_BG) : pill('○ IDLE', FAINT)}
      </Box>
    </Box>
  )

  const agentCount = Math.max(1, b.agents.length)
  const tabDefs: { id: Tab; long: string; short: string; n?: number }[] = [
    { id: 'overview', long: 'Overview', short: 'Home' },
    { id: 'tasks', long: 'Tasks', short: 'Tasks', n: b.tasks.length },
    { id: 'activity', long: 'Activity', short: 'Activity', n: b.entries.length },
    { id: 'alerts', long: 'Alerts', short: 'Alerts', n: b.trips.length },
    { id: 'agents', long: 'Agents', short: 'Agents', n: agentCount },
  ]
  // The richest tab labels that fit on one line; each label carries a space a side.
  const variants = [
    { counts: true, short: false, gap: 1 },
    { counts: false, short: false, gap: 1 },
    { counts: false, short: true, gap: 0 },
  ]
  const labelOf = (t: (typeof tabDefs)[number], v: (typeof variants)[number]) =>
    `${v.short ? t.short : t.long}${v.counts && t.n !== undefined ? ` ${t.n}` : ''}`
  const chosen =
    variants.find(v => tabDefs.reduce((w, t) => w + labelOf(t, v).length + 2, 0) + v.gap * (tabDefs.length - 1) <= inner) ??
    variants[variants.length - 1]!
  const tabBar = (
    <Box key="tabs" flexDirection="column" marginTop={1}>
      <Box>
        {tabDefs.map((t, i) => (
          <Box key={`tab-${t.id}`} marginRight={i < tabDefs.length - 1 ? chosen.gap : 0}>
            {t.id === view.tab ? (
              <Text bold color={INK} backgroundColor={GOLD}>{` ${labelOf(t, chosen)} `}</Text>
            ) : (
              <Button key={`tab-btn-${t.id}`} plain dimColor label={` ${labelOf(t, chosen)} `} hover={{ color: GOLD }} onPress={() => act.setTab(t.id)} />
            )}
          </Box>
        ))}
      </Box>
      <Text color={LINE}>{'─'.repeat(inner)}</Text>
    </Box>
  )

  // The footer: how long the session has run, the ledger file, the hint, and
  // the open task. The hint gives way first when the row runs short.
  const LEDGER = 'ledger ↗'
  const activeText = active !== undefined ? `▸ ${active.name}` : ''
  const footerBase = elapsed !== '' ? `${elapsed} · ` : ''
  const HINT = ' · /munim for commands'
  const footerUsed = footerBase.length + (d.hasFile ? LEDGER.length : 0) + Math.min(activeText.length, 16) + 2
  const footerHint = footerUsed + HINT.length <= inner ? HINT : ''
  const footer = (gap: number) => (
    <Box key="footer" marginTop={gap} justifyContent="space-between">
      <Box>
        {footerBase !== '' ? <Text color={FAINT}>{footerBase}</Text> : null}
        {d.hasFile ? link('open-ledger', LEDGER, act.openLedger) : null}
        {footerHint !== '' || !d.hasFile ? <Text color={FAINT}>{d.hasFile ? footerHint : '/munim for commands'}</Text> : null}
      </Box>
      {active !== undefined ? (
        <Text color={MUTED}>{cut(activeText, Math.max(0, inner - footerBase.length - (d.hasFile ? LEDGER.length : 19) - footerHint.length - 2))}</Text>
      ) : null}
    </Box>
  )

  // ---- plan limits ---------------------------------------------------------

  const plan = b.rateLimits.filter(w => w.kind === 'five_hour' || w.kind === 'seven_day')
  const windows = plan.length > 0 ? plan : b.rateLimits.filter(w => w.kind === 'spend_limit').slice(0, 1)
  const showPace = inner >= 50
  const limitBarW = Math.max(6, inner - 6 - 10 - 10 - (showPace ? 13 : 0))
  const limitsBlock = (marginTop: number) => (
    <Box key="limits" flexDirection="column" marginTop={marginTop}>
      {windows.length === 0 ? (
        <Box>
          <Text color={MUTED}>{'limits  '}</Text>
          <Text color={FAINT}>{cut('plan limits show after the next reply', inner - 8)}</Text>
        </Box>
      ) : null}
      {windows.map(w => {
        const left = Math.max(0, Math.min(100, 100 - w.percentUsed))
        const color = left >= 50 ? GREEN : left >= 20 ? AMBER : RED
        const resetMs = w.resetsAt ? Date.parse(w.resetsAt) - now : NaN
        const r = runway(b, w.kind, now)
        const filled = fill(left / 100, limitBarW)
        const pace =
          r.state === 'runs-out' ? { text: `⚠ out in ${span(r.minutes)}`, color: r.minutes < 30 ? RED : AMBER }
          : r.state === 'lasts' ? { text: '✓ lasts', color: GREEN }
Licence text (MIT)
MIT License

Copyright (c) 2026 Piyush Sinha

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: Pane (panel), Deny a tool call

What its code calls

runs programswrites filesenv varsdrives Claudetool callsremembers

What its code shows

Read from the source at commit e3c330a8dbbb 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.plugin/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.4 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, the same in both
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).plugin/hooks/register.tsx:96 open (not on Windows); plugin/hooks/register.tsx:378 open (not on Windows)
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.open (reaches the network)
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).calls no tool, MCP server or command
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 tool start_task, adds tool end_task, adds command munim
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: tool.call (mcp__tokenmunim__start_…, mcp__tokenmunim__end_ta…), command.run (munim) · shapes: turn.step · also: session.start, turn.complete, ui.close, ui.render (SessionMode, Pane)
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; files: .
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.files: …/.tokenmunim/.gitignore, a path computed at run time

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 PiyushSinha-9/tokenmunim
/plugin install tokenmunim@tokenmunim
/reload-plugins

This installs the marketplace's latest commit, which may not be the one read here (e3c330a8dbbb). 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/PiyushSinha-9/tokenmunim
git -C tokenmunim checkout e3c330a8dbbbc72d73e932ecb4760a214d2cafd7
claude plugin validate tokenmunim/plugin
claude --plugin-dir tokenmunim/plugin

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 "piyushsinha-9-tokenmunim" 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/piyushsinha-9-tokenmunim.svg)](https://modscode.com/claude-mods/mods/piyushsinha-9-tokenmunim/)