modscode JA

modscode / Gallery / agentpane

agentpane

A side pane for Claude Code that lists the subagents a session runs, what each is doing and what it costs in tokens, with each one's conversation a click away.

Code you can checkTerminal + desktopPaneBandStatus lineToastBoxButtonClientText

What it does

  • Draws a pane, toasts
  • Adds /agentpane
  • Watches tool calls and can refuse them
  • Hooks agent.spawn, session.start, turn.step, ui.close

Good points

  • No network calls
  • Starts no processes
  • Written in TypeScript
  • Has a desktop-specific branch

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 agentpane by Anji Xu (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/xuanji86-agentpane/
// 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: "Agents" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const glyph = '…'
    const counts = '…'
    const loopsLine = '…'
    const axisTitle = '…'
    const mark = '…'
    const name = '…'
    const fmtDuration = '…'
    const name2 = '…'
    const name3 = '…'
    const text = '…'
    return (
      <Box flexDirection="row">
        <Box flexDirection="column" width={2} flexShrink={0}>
          <Text>
            {" "}
          </Text>
          <Button label={`${glyph}`} plain dimColor />
          <Button label={`${glyph}`} plain dimColor />
          <Button label={`${glyph}`} plain dimColor />
        </Box>
        <Box flexDirection="column">
          <Box flexDirection="column" justifyContent="space-between">
            <Box flexDirection="column" flexShrink={1} overflow="hidden">
              <Box justifyContent="space-between">
                <Text>
                  <Text color="claude">
                    {"✻ "}
                  </Text>
                  <Text bold>
                    Agents
                  </Text>
                </Text>
                <Text dimColor>
                  {counts}
                </Text>
              </Box>
              <Text dimColor>
                No agents yet. They show here while they run.
              </Text>
              <Box marginTop={1}>
                <Text dimColor wrap="truncate-end">
                  {loopsLine}
                </Text>
              </Box>
            </Box>
            <Box flexDirection="column" flexShrink={0}>
              <Box flexDirection="column" flexShrink={0} marginTop={1}>
                <Text dimColor wrap="truncate-end">
                  {`──${axisTitle}────────`}
                </Text>
                <Text wrap="truncate-end">
                  <Text>
                    {`${mark} `}
                  </Text>
                  <Text>
                    {name}
                  </Text>
                  <Text dimColor>
                    {" ········"}
                  </Text>
                  <Text>
                    ━━━━━━━━
                  </Text>
                  <Text dimColor>
                    {`········${fmtDuration}`}
                  </Text>
                </Text>
                <Text wrap="truncate-end">
                  <Text>
                    {`${mark} `}
                  </Text>
                  <Text>
                    {name2}
                  </Text>
                  <Text dimColor>
                    {" ········"}
                  </Text>
                  <Text>
                    ━━━━━━━━
                  </Text>
                  <Text dimColor>
                    {`········${fmtDuration}`}
                  </Text>
                </Text>
                <Text wrap="truncate-end">
                  <Text>
                    {`${mark} `}
                  </Text>
                  <Text>
                    {name3}
                  </Text>
                  <Text dimColor>
                    {" ········"}
                  </Text>
                  <Text>
                    ━━━━━━━━
                  </Text>
                  <Text dimColor>
                    {`········${fmtDuration}`}
                  </Text>
                </Text>
                <Text wrap="truncate-end">
                  <Text color="error">
                    {"✗ "}
                  </Text>
                  <Text dimColor>
                    {text}
                  </Text>
                </Text>
              </Box>
              <Text dimColor wrap="truncate-end">
                click an agent to open it · click "done" to hide finished ones
              </Text>
            </Box>
          </Box>
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const name = '…'
    const why = '…'
    await $.ui.toast(`Could not stop ${name}: ${why}`)
    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 678–837 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const els = $.ui.resolve(e)
    const { Box, Button, Markdown, Text } = els
    // Live lines run on the surface's own frame clock where it has one (terminal, desktop); elsewhere they are
    // static. Every surface's table names Client, but on the others it draws nothing: ask by surface.
    const Client = (e.surface === 'terminal' || e.surface === 'desktop') && 'Client' in els ? els.Client : null
    lastPlacement = e.props.placement
    lastColumns = e.viewport?.columns ?? lastColumns
    isFullscreen = e.viewport?.isFullscreen ?? isFullscreen
    const inline = e.props.placement === 'inline' // above the prompt: a summary, no handle
    const W = Math.max(22, e.props.bodyColumns - (inline ? 0 : HANDLE_COLS) - RIGHT_MARGIN) // the content, right of the handle
    const viewed = e.props.view?.agentId ?? null // the agent the person has open in the main view
    const rows = Math.max(MIN_ROWS + 6, e.props.scroll.bodyRows)
    const now = await $.clock.now()
    const all = await read($, agents)
    const act = await read($, activity)
    const tok = await read($, tokens)
    const id = await read($, viewing)
    const agent = id ? all.find(a => a.id === id) : undefined
    viewingId = agent ? agent.id : null
    const runningCount = all.filter(a => a.status === 'running').length
    const doneCount = all.length - runningCount
    const hint = (text: string) => <Text dimColor wrap="truncate-end">{text}</Text>
    const alertOf = (a: Agent) => (tok[a.id]?.truncated ? `max_tokens ×${tok[a.id]!.truncated}` : '')
    // A running agent's spinner, shimmering "Running…" and clock, redrawn by the surface, not by this hook.
    const liveLine = (a: Agent, pad: string, detail: string) =>
      Client && a.seenRunning ? (
        <Client key={`live-${a.id}`} module="./live.tsx" props={{ since: a.firstSeen, now, pad, detail, alert: alertOf(a), motion: cfg.motion, clockOnly: false }} />
      ) : (
        <Text wrap="truncate-end">
          <Text color="claude">{`${pad}  ✻ Running…`}</Text>
          <Text dimColor>{` (${[elapsed(a, now), detail].filter(Boolean).join(' · ')}`}</Text>
          {alertOf(a) ? <Text color="error">{` · ${alertOf(a)}`}</Text> : null}
          <Text dimColor>)</Text>
        </Text>
      )
    const clock = (a: Agent) =>
      Client && a.status === 'running' && a.seenRunning ? (
        <Client key={`clock-${a.id}`} module="./live.tsx" props={{ since: a.firstSeen, now, pad: '', detail: '', alert: '', motion: false, clockOnly: true }} />
      ) : (
        <Text dimColor>{elapsed(a, now)}</Text>
      )
    // The first row, clear of the engine's close mark at its end.
    const header = (left: RenderChildren, right: RenderChildren) => (
      <Box width={W - CLOSE_MARK_COLS} justifyContent="space-between">
        {left}
        {typeof right === 'string' ? <Text dimColor>{right}</Text> : right}
      </Box>
    )
    // A handle on the pane's left edge, halfway down: ▸ hides the pane. Above the prompt there is no edge to hold.
    const withHandle = (body: RenderChildren) =>
      inline ? (
        <Box flexDirection="column" width={W}>
          {body}
        </Box>
      ) : (
      <Box flexDirection="row">
        <Box key="handle" flexDirection="column" width={HANDLE_COLS} flexShrink={0}>
          {Array.from({ length: Math.max(0, Math.floor((rows - HANDLE.length) / 2)) }, () => <Text> </Text>)}
          {HANDLE.map((glyph, i) => (
            <Button
              key={glyph.startsWith('▸') ? 'collapse' : `collapse-${i}`}
              label={glyph}
              plain
              dimColor
              hover={{ color: 'claude', bold: true }}
              onPress={() => foldAway($)}
            />
          ))}
        </Box>
        <Box flexDirection="column" width={W} height={rows}>
          {body}
        </Box>
      </Box>
      )

    // One agent's conversation, as Claude Code draws its own: > the brief, ⏺ replies and tool calls, ⎿ results.
    if (agent) {
      const key = `${agent.id}:${await read($, rev)}:${agent.status}`
      if (transcript.key !== key) {
        const msgs = await $.session.messages({ agentId: agent.id })
        transcript = { key, blocks: Array.isArray(msgs) ? transcriptBlocks(msgs, agent.status !== 'running') : [] }
      }
      const blocks = transcript.blocks
      const open = new Set(await read($, expanded))
      const armed = await read($, confirmStop)
      const savedTop = await read($, scrollTop)
      const top = savedTop === null ? null : Math.min(savedTop, Math.max(0, blocks.length - 1))
      const shown = pickBlocks(blocks, top)
      const newer = top === null ? 0 : blocks.length - top - 1 // blocks after the one at the top
      const used = tok[agent.id]
      const l = look(agent.status)
      const leave = async () => {
        await showList($)
        await openPane($, 'list') // back to the usual size
      }
      const toggle = (k: string) => update($, expanded, list => (list.includes(k) ? list.filter(x => x !== k) : [...list, k]))
      const result = (c: Call) =>
        c.state === 'running' ? [<Text color="claude">{'  ⎿  Running…'}</Text>]
        : c.state === 'stopped' ? [<Text dimColor>{'  ⎿  Interrupted'}</Text>]
        : [
            ...(c.result.length ? c.result : ['(No output)']).map((r, i) => (
              <Text color={c.state === 'error' ? 'error' : undefined} dimColor={c.state !== 'error'} wrap="truncate-end">
                {`${i ? '     ' : '  ⎿  '}${r}`}
              </Text>
            )),
            ...(c.more ? [<Text dimColor>{`     … +${c.more} line${c.more === 1 ? '' : 's'}`}</Text>] : []),
          ]
      const call = (c: Call) => (
        <Box flexDirection="column" flexShrink={0}>
          <Text wrap="truncate-end">
            <Text color={STATE_COLOR[c.state]}>⏺ </Text>
            <Text bold>{c.name}</Text>
            <Text>{c.arg ? `(${c.arg})` : ''}</Text>
          </Text>
          {result(c)}
        </Box>
      )
      const block = (b: Block): RenderElement => {
        if (b.kind === 'prompt') {
          const lines = wrap(b.text.slice(0, PROMPT_LINES * W * 2), W - 2)
          return (
            <Box flexDirection="column" flexShrink={0} marginTop={1}>
              {lines.slice(0, PROMPT_LINES).map((line, i) => (
                <Text dimColor wrap="truncate-end">{`${i ? '  ' : '> '}${line}`}</Text>
              ))}
              {lines.length > PROMPT_LINES ? <Text dimColor>{'  …'}</Text> : null}
            </Box>
          )
        }
        if (b.kind === 'reply') {
          const text = b.text.length > MAX_REPLY ? `${b.text.slice(0, MAX_REPLY)}\n\n… (${b.text.length - MAX_REPLY} more characters)` : b.text
          return (
            <Box flexDirection="row" flexShrink={0} marginTop={1}>
              <Text>⏺ </Text>
              <Box flexDirection="column" width={W - 2}>
                <Markdown text={text} />
              </Box>
            </Box>
          )
        }
        if (b.calls.length === 1) return <Box flexShrink={0} marginTop={1}>{call(b.calls[0]!)}</Box>
        const isOpen = open.has(b.key)
        const opened = lastCalls(b.calls)
        const live = b.calls.find(c => c.state === 'running')
        const failed = b.calls.find(c => c.state === 'error')
        return (
          <Box key={`grp-${b.key}`} flexDirection="column" flexShrink={0} marginTop={1}>
            <Box>
              <Text color={STATE_COLOR[groupState(b.calls)]}>⏺ </Text>
              <Button key={`group-${b.key}`} label={groupSummary(b.calls)} plain hover={{ color: 'claude' }} onPress={() => toggle(b.key)} />
              <Text dimColor>{isOpen ? ' (click to collapse)' : ' (click to expand)'}</Text>
            </Box>
            {isOpen ? (
              <Box flexDirection="column" paddingLeft={2}>
                {opened.hidden ? <Text dimColor>{`… +${opened.hidden} earlier call${opened.hidden === 1 ? '' : 's'}`}</Text> : null}
                {opened.shown.map(call)}
              </Box>
            ) : live ? (
              <Text color="claude" wrap="truncate-end">{`  ⎿  ${live.name}${live.arg ? `(${live.arg})` : ''} · Running…`}</Text>
Licence text (MIT)
MIT License

Copyright (c) 2026 Anji Xu

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

drives Claudetool calls

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 17be88979e57 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.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, 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.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 xuanji86/claude-agentpane
/plugin install agentpane@claude-agentpane

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

Search them from Claude: the MCP connector

Similar designs