modscode JA

modscode / Gallery / cctop

cctop

htop for Claude Code: context, rate limits, speed, cost and subagents, live.

Code you can checkTerminal + desktopPaneBandToastBoxButtonText

What it does

  • Draws a pane, a band above the prompt, toasts
  • Adds /cctop
  • Watches tool calls
  • Hooks agent.spawn, prompt.submit, session.measure, session.start and 5 more
  • Keeps its own state between turns

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 cctop by ilkayGkbdk (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/ilkaygkbdk-cctop/
// 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: "cctop" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const shortPath = '…'
    const fmtDuration = '…'
    const label = '…'
    const used = '…'
    const right = '…'
    const used2 = '…'
    const used3 = '…'
    const used4 = '…'
    const used5 = '…'
    const fmtUsd = '…'
    const sparkline = '…'
    const filter = '…'
    const name = '…'
    const fmtTokens = '…'
    const percent = '…'
    const name2 = '…'
    const fmtTokens2 = '…'
    const name3 = '…'
    const fmtTokens3 = '…'
    const labelOf = '…'
    const type = '…'
    const state = '…'
    const fmtTokens4 = '…'
    const tools = '…'
    const now = '…'
    const value = '…'
    const value2 = '…'
    const value3 = '…'
    const state2 = '…'
    const fmtDuration2 = '…'
    const fmtTokens5 = '…'
    const tools2 = '…'
    const now2 = '…'
    const value4 = '…'
    const value5 = '…'
    const value6 = '…'
    const state3 = '…'
    const fmtDuration3 = '…'
    const fmtTokens6 = '…'
    const tools3 = '…'
    const now3 = '…'
    const value7 = '…'
    const value8 = '…'
    const value9 = '…'
    const sort = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" justifyContent="space-between">
          <Text>
            {` cctop 0.1.1 · … · ${shortPath} · up ${fmtDuration}`}
          </Text>
          <Text color="green">
            {"● streaming "}
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text bold>
            {` ${label}`}
          </Text>
          <Text>
            [
          </Text>
          <Text>
            {used}
          </Text>
          <Text>
            {"        "}
          </Text>
          <Text>
            ]
          </Text>
          <Text>
            {` ${right}`}
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text bold>
            {` ${label}`}
          </Text>
          <Text>
            [
          </Text>
          <Text>
            {used2}
          </Text>
          <Text>
            {"        "}
          </Text>
          <Text>
            ]
          </Text>
          <Text>
            {` ${right}`}
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text bold>
            {` ${label}`}
          </Text>
          <Text>
            [
          </Text>
          <Text>
            {used3}
          </Text>
          <Text>
            {"        "}
          </Text>
          <Text>
            ]
          </Text>
          <Text>
            {` ${right}`}
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text bold>
            {` ${label}`}
          </Text>
          <Text>
            [
          </Text>
          <Text>
            {used4}
          </Text>
          <Text>
            {"        "}
          </Text>
          <Text>
            ]
          </Text>
          <Text>
            {` ${right}`}
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text bold>
            {` ${label}`}
          </Text>
          <Text>
            [
          </Text>
          <Text>
            {used5}
          </Text>
          <Text>
            {"        "}
          </Text>
          <Text>
            ]
          </Text>
          <Text>
            {` ${right}`}
          </Text>
        </Box>
        <Box flexDirection="row" gap={2}>
          <Text bold>
            {` ${fmtUsd}`}
          </Text>
          <Text color="cyan">
            {sparkline}
          </Text>
          <Text dimColor>
            {filter}
          </Text>
        </Box>
        <Text>
          {" "}
        </Text>
        <Box flexDirection="column">
          <Text bold>
            {" CONTEXT MAP  (stale)"}
          </Text>
          <Box flexDirection="row" gap={2}>
            <Box flexDirection="column" marginLeft={1}>
              <Box flexDirection="row">
                <Text>
                  ████████
                </Text>
                <Text>
                  ████████
                </Text>
                <Text>
                  ████████
                </Text>
              </Box>
              <Box flexDirection="row">
                <Text>
                  ████████
                </Text>
                <Text>
                  ████████
                </Text>
                <Text>
                  ████████
                </Text>
              </Box>
              <Box flexDirection="row">
                <Text>
                  ████████
                </Text>
                <Text>
                  ████████
                </Text>
                <Text>
                  ████████
                </Text>
              </Box>
            </Box>
            <Box flexDirection="column" marginLeft={0}>
              <Box flexDirection="row" gap={1}>
                <Text>
                  □
                </Text>
                <Text>
                  {name}
                </Text>
                <Text>
                  {fmtTokens}
                </Text>
                <Text dimColor>
                  {`${percent}%`}
                </Text>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Text>
                  □
                </Text>
                <Text>
                  {name2}
                </Text>
                <Text>
                  {fmtTokens2}
                </Text>
                <Text dimColor>
                  {`${percent}%`}
                </Text>
              </Box>
              <Box flexDirection="row" gap={1}>
                <Text>
                  □
                </Text>
                <Text>
                  {name3}
                </Text>
                <Text>
                  {fmtTokens3}
                </Text>
                <Text dimColor>
                  {`${percent}%`}
                </Text>
              </Box>
            </Box>
          </Box>
        </Box>
        <Text>
          {" "}
        </Text>
        <Box flexDirection="column">
          <Text bold inverse>
            {"  ID   AGENT          STATE    TIME   TOKENS  TOOLS  NOW"}
          </Text>
          <Box flexDirection="column">
            <Box flexDirection="row">
              <Button plain label={`▶ ${labelOf}`} />
              <Text>
                {` ${type} `}
              </Text>
              <Text>
                {state}
              </Text>
              <Text>
                {fmtDuration}
              </Text>
              <Text>
                {fmtTokens4}
              </Text>
              <Text>
                {tools}
                {" "}
              </Text>
              <Text wrap="truncate-end">
                {now}
              </Text>
            </Box>
            <Text dimColor wrap="truncate-end">
              {value}
            </Text>
            <Text dimColor wrap="truncate-end">
              {value2}
            </Text>
            <Text dimColor wrap="truncate-end">
              {value3}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row">
              <Button plain label={`▶ ${labelOf}`} />
              <Text>
                {` ${type} `}
              </Text>
              <Text>
                {state2}
              </Text>
              <Text>
                {fmtDuration2}
              </Text>
              <Text>
                {fmtTokens5}
              </Text>
              <Text>
                {tools2}
                {" "}
              </Text>
              <Text wrap="truncate-end">
                {now2}
              </Text>
            </Box>
            <Text dimColor wrap="truncate-end">
              {value4}
            </Text>
            <Text dimColor wrap="truncate-end">
              {value5}
            </Text>
            <Text dimColor wrap="truncate-end">
              {value6}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box flexDirection="row">
              <Button plain label={`▶ ${labelOf}`} />
              <Text>
                {` ${type} `}
              </Text>
              <Text>
                {state3}
              </Text>
              <Text>
                {fmtDuration3}
              </Text>
              <Text>
                {fmtTokens6}
              </Text>
              <Text>
                {tools3}
                {" "}
              </Text>
              <Text wrap="truncate-end">
                {now3}
              </Text>
            </Box>
            <Text dimColor wrap="truncate-end">
              {value7}
            </Text>
            <Text dimColor wrap="truncate-end">
              {value8}
            </Text>
            <Text dimColor wrap="truncate-end">
              {value9}
            </Text>
          </Box>
        </Box>
        <Text>
          {" "}
        </Text>
        <Box flexDirection="row" gap={1}>
          <Text dimColor>
            {" Tab Select"}
          </Text>
          <Button hotkey="s" plain label={`Sort:${sort}`} />
          <Button hotkey="x" plain label="Stop agent" />
          <Button hotkey="a" plain label="Abort turn" />
          <Button hotkey="c" plain label="Compact" />
          <Button hotkey="q" plain role="dismiss" label="Quit" />
        </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 ctx = '…'
    const mini = '…'
    const percent = '…'
    const tokPerSec = '…'
    const fmtUsd = '…'
    const running = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" gap={2}>
          <Text bold>
            cctop
          </Text>
          <Text>
            {`CTX ${ctx}% ${mini}`}
          </Text>
          <Text>
            {`WK ${percent}%`}
          </Text>
          <Text>
            {`WK ${percent}%`}
          </Text>
          <Text>
            {`WK ${percent}%`}
          </Text>
          <Text dimColor>
            {`${tokPerSec} tok/s`}
          </Text>
          <Text>
            {fmtUsd}
          </Text>
          <Text color="cyan">
            {`⑂ ${running} agent`}
          </Text>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    await $.ui.toast(`cctop: select a running subagent first (Tab), then x.`)
    await $.ui.toast(`cctop: no turn is running.`)
    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 302–327 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    lastColumns = e.props.bodyColumns
    await ensureMapTimer($)
    const now = await $.clock.now()
    return Panel($.ui.resolve(e), {
      meters: await read($, metersA),
      agents: await read($, agentsA),
      spark: await read($, sparkA),
      map: await read($, mapA),
      ui: await read($, uiA),
      startedAt: await read($, startedAtA),
      cwd: await $.session.cwd(),
      now,
      columns: e.props.bodyColumns,
      cfg,
    }, {
      onSelect: id => void doSelect($, id),
      onSort: () => void doSort($),
      onStop: () => void askStop($),
      onAbort: () => void askAbort($),
      onConfirm: () => void doConfirm($),
      onCancel: () => void doCancel($),
      onCompact: () => void doCompact($),
      onClose: () => void doClose($),
    })
  })
hooks/view/Panel.tsx lines 37–101 · Pane
export const Panel = (ui: ElementTable, d: PanelData, act: PanelHandlers) => {
  const { Box, Text, Button } = ui
  const m = d.meters
  const barWidth = Math.max(10, Math.min(36, d.columns - 40))
  const ctxPercent = m.ctxPercent ?? 0
  const confirmText =
    d.ui.confirm === null ? undefined
    : d.ui.confirm.kind === 'stop' ? `Stop ${labelOf(d.agents, d.ui.confirm.agentId)}? Its next tool calls will be denied.`
    : 'Abort the current turn?'

  return (
    <Box flexDirection="column">
      <Box flexDirection="row" justifyContent="space-between">
        <Text>{` cctop 0.1.1 · ${m.model !== undefined ? shortModel(m.model) : '…'} · ${shortPath(d.cwd)} · up ${fmtDuration(d.now - d.startedAt)}`}</Text>
        {m.isStreaming ? <Text color="green">● streaming </Text> : <Text dimColor>○ idle </Text>}
      </Box>
      {m.ctxWindow !== undefined && m.ctxWindow > 0 &&
        Meter(ui, {
          label: 'CTX', percent: ctxPercent, width: barWidth, level: levelOf(ctxPercent, d.cfg.ctxWarnPercent),
          right: `${fmtTokens(m.ctxTokens ?? 0)}/${fmtTokens(m.ctxWindow)} ${ctxPercent}%${d.map?.autoCompactPercent !== undefined ? `   compact @ ${d.map.autoCompactPercent}%` : ''}`,
        })}
      {m.rate.map(r =>
        Meter(ui, {
          label: rateLabel(r.kind), percent: r.percent, width: barWidth,
          level: levelOf(r.percent, r.kind === 'five_hour' ? d.cfg.rateWarnPercent : 90),
          right: `${String(Math.round(r.percent)).padStart(3)}%   ${r.resetsAt !== undefined ? `resets ${fmtReset(r.resetsAt, d.now)}` : ''}`,
        }),
      )}
      {Meter(ui, {
        label: 'SPD', percent: m.peakTokPerSec > 0 ? (m.tokPerSec / m.peakTokPerSec) * 100 : 0, width: barWidth, level: 'ok',
        right: `${m.tokPerSec} tok/s`,
      })}
      {m.costUsd !== undefined && (
        <Box flexDirection="row" gap={2}>
          <Text bold>{` ${fmtUsd(m.costUsd)}`}</Text>
          <Text color="cyan">{sparkline(d.spark)}</Text>
          <Text dimColor>
            {[m.turnCostUsd !== undefined ? `last turn ${fmtUsd(m.turnCostUsd)}` : '', m.cacheShare !== undefined ? `cache ${m.cacheShare}%` : ''].filter(Boolean).join(' · ')}
          </Text>
        </Box>
      )}
      <Text> </Text>
      {ContextMapView(ui, d.map, d.columns)}
      <Text> </Text>
      {ProcessList(ui, { rows: d.agents, ui: d.ui, now: d.now, columns: d.columns }, act.onSelect)}
      <Text> </Text>
      {confirmText !== undefined ? (
        <Box flexDirection="row" gap={1}>
          <Text color="yellow" bold>{` ${confirmText}`}</Text>
          <Button key="yes" hotkey="y" variant="primary" label="Yes" onPress={act.onConfirm} />
          <Button key="no" hotkey="n" label="No" onPress={act.onCancel} />
        </Box>
      ) : (
        <Box flexDirection="row" gap={1}>
          <Text dimColor> Tab Select</Text>
          <Button key="sort" hotkey="s" plain label={`Sort:${d.ui.sort}`} onPress={act.onSort} />
          <Button key="stop" hotkey="x" plain label="Stop agent" onPress={act.onStop} />
          <Button key="abort" hotkey="a" plain label="Abort turn" onPress={act.onAbort} />
          <Button key="compact" hotkey="c" plain label="Compact" onPress={act.onCompact} />
          <Button key="close" hotkey="q" plain role="dismiss" label="Quit" onPress={act.onClose} />
        </Box>
      )}
    </Box>
  )
}
hooks/view/Meter.tsx lines 7–21 · Pane
export const Meter = (ui: ElementTable, p: { label: string; percent: number; width: number; right: string; level: Level }) => {
  const { Box, Text } = ui
  const fill = bar(p.percent, p.width)
  const used = fill.trimEnd()
  return (
    <Box flexDirection="row">
      <Text bold>{` ${p.label.padEnd(5)}`}</Text>
      <Text>[</Text>
      <Text color={COLOR[p.level]}>{used}</Text>
      <Text>{' '.repeat(p.width - used.length)}</Text>
      <Text>]</Text>
      <Text>{` ${p.right}`}</Text>
    </Box>
  )
}
hooks/view/ContextMap.tsx lines 9–44 · Pane
export const ContextMapView = (ui: ElementTable, map: MapSnapshot | null, columns: number) => {
  const { Box, Text } = ui
  if (map === null) return <Text dimColor> CONTEXT MAP  measuring…</Text>
  const showGrid = columns >= GRID_MIN_COLUMNS
  const nameWidth = columns >= 100 ? 24 : 18
  return (
    <Box flexDirection="column">
      <Text bold>{` CONTEXT MAP${map.isStale ? '  (stale)' : ''}`}</Text>
      <Box flexDirection="row" gap={2}>
        {showGrid && (
          <Box flexDirection="column" marginLeft={1}>
            {map.grid.map(row => (
              <Box flexDirection="row">
                {runsOf(row).map(run => (
                  <Text color={run.color} dimColor={map.isStale}>
                    {(run.isFilled ? '█' : '░').repeat(run.count)}
                  </Text>
                ))}
              </Box>
            ))}
          </Box>
        )}
        <Box flexDirection="column" marginLeft={showGrid ? 0 : 1}>
          {map.categories.map(c => (
            <Box flexDirection="row" gap={1}>
              <Text color={c.color}>{c.kind === 'free' ? '□' : '■'}</Text>
              <Text>{c.name.slice(0, nameWidth).padEnd(nameWidth)}</Text>
              <Text>{fmtTokens(c.tokens).padStart(6)}</Text>
              <Text dimColor>{`${c.percent}%`.padStart(4)}</Text>
            </Box>
          ))}
        </Box>
      </Box>
    </Box>
  )
}
hooks/view/ProcessList.tsx lines 9–38 · Pane
export const ProcessList = (ui: ElementTable, p: { rows: AgentRow[]; ui: UiState; now: number; columns: number }, onSelect: (id: string) => void) => {
  const { Box, Text, Button } = ui
  const rows = sortRows(p.rows, p.ui.sort, p.now)
  const nowWidth = Math.max(10, p.columns - 56)
  return (
    <Box flexDirection="column">
      <Text bold inverse>{'  ID   AGENT          STATE    TIME   TOKENS  TOOLS  NOW'.padEnd(Math.max(0, p.columns - 1))}</Text>
      {rows.map(row => {
        const isSelected = row.id === p.ui.selected
        const isOver = row.state === 'done' || row.state === 'stopped'
        return (
          <Box flexDirection="column">
            <Box flexDirection="row">
              <Button key={`row-${row.id}`} plain label={`${isSelected ? '▶' : ' '} ${labelOf(p.rows, row.id).padEnd(4)}`} onPress={() => onSelect(row.id)} />
              <Text dimColor={isOver}>{` ${row.type.slice(0, 14).padEnd(14)} `}</Text>
              <Text color={STATE_COLOR[row.state]} dimColor={isOver}>{row.state.padEnd(8)}</Text>
              <Text dimColor={isOver}>{fmtDuration((row.endedAt ?? p.now) - row.startedAt).padStart(5)}</Text>
              <Text dimColor={isOver}>{fmtTokens(row.tokens).padStart(9)}</Text>
              <Text dimColor={isOver}>{String(row.tools).padStart(7)}  </Text>
              <Text dimColor={isOver} wrap="truncate-end">{row.now.slice(0, nowWidth)}</Text>
            </Box>
            {p.ui.expanded === row.id && row.history.slice().reverse().map(entry => (
              <Text dimColor wrap="truncate-end">{`        ${entry.tool.padEnd(8)} ${entry.target}`.slice(0, p.columns - 1)}</Text>
            ))}
          </Box>
        )
      })}
    </Box>
  )
}
hooks/register.tsx lines 329–335 · Band
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const meters = await read($, metersA)
    const isQuiet = !cfg.band || e.props.hasSurvey || meters.ctxWindow === undefined || meters.ctxWindow === 0 || (await read($, bandHiddenA))
    if (isQuiet) return next(e)
    const agents = await read($, agentsA)
    return Band($.ui.resolve(e), { meters, agents, columns: e.props.bodyColumns, cfg })
  })
Licence text (MIT)
MIT License

Copyright (c) 2026 ilkayGkbdk

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

tool callsremembers

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 d16f8326d1c3 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.13 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.its repository's .claude-plugin/marketplace.json does not list it: no install line to give
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'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 "ilkaygkbdk-cctop" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs