modscode JA

modscode / Gallery / tools-usage

tools-usage

Side pane listing the tools used in the session (built-in, MCP, skill, agent, plugin, hook) with calls and token consumption.

Code you can checkTerminal + desktopPaneBoxButtonText

What it does

  • Draws a pane
  • Adds /tools-usage
  • Watches tool calls
  • Hooks session.append, session.start

Good points

  • No network calls
  • Starts no processes
  • Written in TypeScript
  • 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 tools-usage by Fazzani (pane), as modscode read it from the mod's code:
// https://modscode.com/gallery/fazzani-tools-usage/
// 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: "‹title›" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const heading = '…'
    const sum = '…'
    const calls = '…'
    const total = '…'
    const tokens = '…'
    const kind = '…'
    const compact = '…'
    const kind2 = '…'
    const compact2 = '…'
    const kind3 = '…'
    const compact3 = '…'
    const sort = '…'
    const sortBy = '…'
    const empty = '…'
    const label = '…'
    const source = '…'
    const kind4 = '…'
    const calls2 = '…'
    const compact4 = '…'
    const compact5 = '…'
    const compact6 = '…'
    const errors = '…'
    const label2 = '…'
    const source2 = '…'
    const kind5 = '…'
    const calls3 = '…'
    const compact7 = '…'
    const compact8 = '…'
    const compact9 = '…'
    const errors2 = '…'
    const label3 = '…'
    const source3 = '…'
    const kind6 = '…'
    const calls4 = '…'
    const compact10 = '…'
    const compact11 = '…'
    const compact12 = '…'
    const errors3 = '…'
    const legend = '…'
    const schemas = '…'
    const footer = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" justifyContent="space-between">
          <Text bold color="#D97757">
            {heading}
          </Text>
          <Text>
            <Text bold>
              {`${sum}${calls}`}
            </Text>
            <Text dimColor>
              {" "}
              {calls}
              {" · "}
            </Text>
            <Text bold>
              ≈
              {`${sum}${total}`}
            </Text>
            <Text dimColor>
              {" "}
              {tokens}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row" marginTop={1}>
          <Text>
            ████████
          </Text>
          <Text>
            ████████
          </Text>
          <Text>
            ████████
          </Text>
        </Box>
        <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
          <Text>
            <Text>
              {"■ "}
            </Text>
            <Text>
              {kind}
            </Text>
            <Text dimColor>
              {" "}
              {compact}
            </Text>
          </Text>
          <Text>
            <Text>
              {"■ "}
            </Text>
            <Text>
              {kind2}
            </Text>
            <Text dimColor>
              {" "}
              {compact2}
            </Text>
          </Text>
          <Text>
            <Text>
              {"■ "}
            </Text>
            <Text>
              {kind3}
            </Text>
            <Text dimColor>
              {" "}
              {compact3}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="row" gap={1} marginTop={1}>
          <Text dimColor>
            {sort}
          </Text>
          <Button label={`${sortBy}`} plain />
          <Button label={`${sortBy}`} plain />
          <Button label={`${sortBy}`} plain />
        </Box>
        <Text dimColor>
          ────────
        </Text>
        <Text dimColor>
          {empty}
        </Text>
        <Box flexDirection="column" marginBottom={1}>
          <Box flexDirection="row" justifyContent="space-between">
            <Box flexDirection="row" flexShrink={1}>
              <Text>
                {"◐ "}
              </Text>
              <Text bold wrap="truncate-end">
                {label}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {source}
              </Text>
            </Box>
            <Box flexDirection="row" gap={1}>
              <Text>
                {kind4}
              </Text>
              <Text>
                {calls2}
                ×
              </Text>
              <Text bold>
                {compact4}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" justifyContent="space-between" paddingLeft={2}>
            <Text>
              <Text>
                ▰▰▰▰▰▰▰▰
              </Text>
              <Text dimColor>
                ▱▱▱▱▱▱▱▱
              </Text>
            </Text>
            <Text dimColor>
              ↑
              {compact5}
              {" ↓"}
              {compact6}
              {` ⌂${compact}`}
            </Text>
            <Text color="#F85149">
              ✗
              {errors}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column" marginBottom={1}>
          <Box flexDirection="row" justifyContent="space-between">
            <Box flexDirection="row" flexShrink={1}>
              <Text>
                {"◐ "}
              </Text>
              <Text bold wrap="truncate-end">
                {label2}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {source2}
              </Text>
            </Box>
            <Box flexDirection="row" gap={1}>
              <Text>
                {kind5}
              </Text>
              <Text>
                {calls3}
                ×
              </Text>
              <Text bold>
                {compact7}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" justifyContent="space-between" paddingLeft={2}>
            <Text>
              <Text>
                ▰▰▰▰▰▰▰▰
              </Text>
              <Text dimColor>
                ▱▱▱▱▱▱▱▱
              </Text>
            </Text>
            <Text dimColor>
              ↑
              {compact8}
              {" ↓"}
              {compact9}
              {` ⌂${compact}`}
            </Text>
            <Text color="#F85149">
              ✗
              {errors2}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column" marginBottom={1}>
          <Box flexDirection="row" justifyContent="space-between">
            <Box flexDirection="row" flexShrink={1}>
              <Text>
                {"◐ "}
              </Text>
              <Text bold wrap="truncate-end">
                {label3}
              </Text>
              <Text dimColor wrap="truncate-end">
                {" "}
                {source3}
              </Text>
            </Box>
            <Box flexDirection="row" gap={1}>
              <Text>
                {kind6}
              </Text>
              <Text>
                {calls4}
                ×
              </Text>
              <Text bold>
                {compact10}
              </Text>
            </Box>
          </Box>
          <Box flexDirection="row" justifyContent="space-between" paddingLeft={2}>
            <Text>
              <Text>
                ▰▰▰▰▰▰▰▰
              </Text>
              <Text dimColor>
                ▱▱▱▱▱▱▱▱
              </Text>
            </Text>
            <Text dimColor>
              ↑
              {compact11}
              {" ↓"}
              {compact12}
              {` ⌂${compact}`}
            </Text>
            <Text color="#F85149">
              ✗
              {errors3}
            </Text>
          </Box>
        </Box>
        <Text dimColor>
          ────────
        </Text>
        <Text dimColor>
          {legend}
        </Text>
        <Text dimColor>
          {schemas}
        </Text>
        <Text dimColor>
          {footer}
        </Text>
      </Box>
    )
  })
}

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/tools-usage/hooks/register.tsx lines 227–355 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const m = t()
    const list = (await read($, tools)) ?? []
    const by = await read($, sort)
    const width = Math.max(30, e.props.bodyColumns)
    const isNarrow = width < 48

    const used = list.filter(stat => stat.calls > 0)
    const grand = used.reduce((sum, stat) => sum + total(stat), 0)
    const calls = used.reduce((sum, stat) => sum + stat.calls, 0)
    const definitionsTotal = list.reduce((sum, stat) => sum + stat.defTokens, 0)
    const byKind = KINDS.map(kind => {
      const rows = used.filter(stat => stat.kind === kind)

      return { kind, tokens: rows.reduce((sum, stat) => sum + total(stat), 0), calls: rows.reduce((s, r) => s + r.calls, 0) }
    }).filter(group => group.calls > 0)

    const barWidth = width
    const cells = byKind.map(group => ({
      kind: group.kind,
      cells: grand === 0 ? 0 : Math.max(1, Math.round((group.tokens / grand) * barWidth)),
    }))
    const overflow = cells.reduce((sum, cell) => sum + cell.cells, 0) - barWidth
    const widest = cells.reduce((best, cell) => (cell.cells > (best?.cells ?? -1) ? cell : best), cells[0])
    if (widest && overflow > 0) {
      widest.cells -= overflow
    }

    const max = Math.max(1, ...used.map(total))
    const nameWidth = isNarrow ? width - 16 : width - 30
    const rows = sorted(used, by)

    return (
      <Box flexDirection="column" width={width}>
        <Box flexDirection="row" justifyContent="space-between">
          <Text bold color={ACCENT}>
            {m.heading}
          </Text>
          <Text>
            <Text bold>{calls}</Text>
            <Text dimColor> {m.calls} · </Text>
            <Text bold>≈{compact(grand)}</Text>
            <Text dimColor> {m.tokens}</Text>
          </Text>
        </Box>

        {grand > 0 && (
          <Box flexDirection="row" marginTop={1}>
            {cells.map(cell => (
              <Text color={COLORS[cell.kind]}>{'█'.repeat(Math.max(0, cell.cells))}</Text>
            ))}
          </Box>
        )}
        <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
          {byKind.map(group => (
            <Text>
              <Text color={COLORS[group.kind]}>■ </Text>
              <Text>{group.kind}</Text>
              <Text dimColor> {compact(group.tokens)}</Text>
            </Text>
          ))}
        </Box>

        <Box flexDirection="row" gap={1} marginTop={1}>
          <Text dimColor>{m.sort}</Text>
          {(['tokens', 'calls', 'name'] as const).map(option => (
            <Button
              key={`sort-${option}`}
              label={m.sortBy[option]}
              plain
              dimColor={option !== by}
              onPress={() => update($, sort, () => option)}
            />
          ))}
        </Box>
        <Text dimColor>{'─'.repeat(width)}</Text>

        {rows.length === 0 && <Text dimColor>{m.empty}</Text>}

        {rows.map(stat => {
          const color = COLORS[stat.kind]
          const share = Math.max(1, Math.round((total(stat) / max) * 10))

          return (
            <Box key={`tool-${stat.key}`} flexDirection="column" marginBottom={isNarrow ? 1 : 0}>
              <Box flexDirection="row" justifyContent="space-between">
                <Box flexDirection="row" width={nameWidth} flexShrink={1}>
                  <Text color={color}>{stat.running > 0 ? '◐ ' : '● '}</Text>
                  <Text bold wrap="truncate-end">
                    {stat.label}
                  </Text>
                  {stat.source && (
                    <Text dimColor wrap="truncate-end">
                      {' '}
                      {stat.source}
                    </Text>
                  )}
                </Box>
                <Box flexDirection="row" gap={1}>
                  <Text color={color}>{stat.kind}</Text>
                  <Text>{String(stat.calls).padStart(3)}×</Text>
                  {!isNarrow && <Text bold>{compact(total(stat)).padStart(5)}</Text>}
                </Box>
              </Box>
              <Box flexDirection="row" justifyContent="space-between" paddingLeft={2}>
                <Text>
                  <Text color={color}>{'▰'.repeat(share)}</Text>
                  <Text dimColor>{'▱'.repeat(10 - share)}</Text>
                </Text>
                <Text dimColor>
                  ↑{compact(stat.inTokens)} ↓{compact(stat.outTokens)}
                  {stat.defTokens > 0 ? ` ⌂${compact(stat.defTokens)}` : ''}
                </Text>
                {stat.errors > 0 && <Text color="#F85149">✗{stat.errors}</Text>}
              </Box>
            </Box>
          )
        })}

        <Text dimColor>{'─'.repeat(width)}</Text>
        <Text dimColor>{m.legend}</Text>
        {definitionsTotal > 0 && (
          <Text dimColor>{m.schemas(compact(definitionsTotal))}</Text>
        )}
        <Text dimColor>{m.footer}</Text>
      </Box>
    )
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 Heni Fazzani

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

env varstool calls

What its code shows

Read from the source at commit 6a268fb607b9 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.plugins/tools-usage/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).runs no program a Windows PC lacks
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.starts no programs
Reads and sendsWhether it both reads files or environment variables and reaches the network.reaches no 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

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 Fazzani/claude-mods
/plugin install tools-usage@claude-mods

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

Search them from Claude: the MCP connector

Similar designs