modscode EN

modscode / 図鑑 / agent-atc

agent-atc

Air-traffic control for subagents: a live pane listing every agent, what each one is doing now, and controls to message or stop one. Open it with /atc.

確かめやすいコードターミナル+デスクトップペインバンドステータスライントーストBoxButtonInputText

何をするか

  • 欄・トーストを描く
  • /atc を足す
  • ツールの呼び出しを見張る(止めることがある)
  • agent.spawn・session.end・session.start・turn.complete ほか 1 個にフックする

良いところ

  • ネットワークに出ない
  • プロセスを起こさない
  • TypeScript で書かれている
  • デスクトップ専用の分岐がある

作り始めるためのコード

2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。

雛形(register.tsx)

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

// Drawn like agent-atc by Matteo Hertel (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/tinyorbit-ai-agent-atc/
// 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, Input } = $.ui.resolve(e)
    const STEP_MARK = '…'
    const stepLine = '…'
    const ago = '…'
    const glyph = '…'
    const i = '…'
    const label = '…'
    const word = '…'
    const glyph2 = '…'
    const word2 = '…'
    const glyph3 = '…'
    const word3 = '…'
    const filter = '…'
    const label2 = '…'
    const clockTime = '…'
    const STEP_MARK2 = '…'
    const stepLine2 = '…'
    const clockTime2 = '…'
    const STEP_MARK3 = '…'
    const stepLine3 = '…'
    const clockTime3 = '…'
    const STEP_MARK4 = '…'
    const stepLine4 = '…'
    const answer = '…'
    return (
      <Box flexDirection="column">
        <Text bold wrap="truncate-end">
          No subagents yet
        </Text>
        <Text dimColor wrap="truncate-end">
          {"main: "}
          {STEP_MARK}
          {" "}
          {stepLine}
          {" · "}
          {ago}
          {" ago"}
        </Text>
        <Text dimColor>
          ────────
        </Text>
        <Text dimColor wrap="wrap">
          Each subagent shows here the moment it starts, with what it is doing now.
        </Text>
        <Box flexDirection="row">
          <Text>
            {"                "}
            ›
            {glyph}
            {" "}
          </Text>
          <Button plain hotkey={`${i}`} label={`${label}`} />
          <Text dimColor wrap="truncate-end">
            {"  "}
            {word}
            {`  ${stepLine}`}
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text>
            {"                "}
            ›
            {glyph2}
            {" "}
          </Text>
          <Button plain hotkey={`${i}`} label={`${label}`} />
          <Text dimColor wrap="truncate-end">
            {"  "}
            {word2}
            {`  ${stepLine}`}
          </Text>
        </Box>
        <Box flexDirection="row">
          <Text>
            {"                "}
            ›
            {glyph3}
            {" "}
          </Text>
          <Button plain hotkey={`${i}`} label={`${label}`} />
          <Text dimColor wrap="truncate-end">
            {"  "}
            {word3}
            {`  ${stepLine}`}
          </Text>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Text bold wrap="truncate-end">
            {label}
          </Text>
          <Text dimColor wrap="truncate-end">
            {filter}
          </Text>
          <Text dimColor wrap="truncate-end">
            {label2}
          </Text>
          <Box flexDirection="row">
            <Text dimColor>
              {clockTime}
              {" "}
            </Text>
            <Text color="red">
              {STEP_MARK2}
              {" "}
            </Text>
            <Text wrap="truncate-end">
              {stepLine2}
            </Text>
          </Box>
          <Box flexDirection="row">
            <Text dimColor>
              {clockTime2}
              {" "}
            </Text>
            <Text color="red">
              {STEP_MARK3}
              {" "}
            </Text>
            <Text wrap="truncate-end">
              {stepLine3}
            </Text>
          </Box>
          <Box flexDirection="row">
            <Text dimColor>
              {clockTime3}
              {" "}
            </Text>
            <Text color="red">
              {STEP_MARK4}
              {" "}
            </Text>
            <Text wrap="truncate-end">
              {stepLine4}
            </Text>
          </Box>
          <Text dimColor>
            No tool calls yet.
          </Text>
          <Text wrap="wrap">
            {"Answer: "}
            {answer}
          </Text>
          <Input placeholder="Message this agent…" submitLabel="Send" />
          <Box flexDirection="row" gap={1}>
            <Button label="Stop" />
            <Button label="Back" hotkey="b" />
          </Box>
        </Box>
        <Text dimColor wrap="truncate-end">
          {"\n"}
          1-9 picks an agent · Tab walks the controls · Esc gives the keyboard back
        </Text>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const label = '…'
    const deny = '…'
    await $.ui.toast(`Sent to ${label}`)
    await $.ui.toast(`Not stopped: ${deny}`)
    return next(e)
  })
}

Mod 自身のコード

Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。

mods/agent-atc/hooks/register.tsx 379〜527 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const ui = $.ui.resolve(e)
    const { Box, Text, Button } = ui
    const Input = 'Input' in ui ? ui.Input : undefined

    const [all, picked, , top, at] = await Promise.all([
      read($, agents),
      read($, selected),
      read($, now),
      read($, main),
      $.clock.now(),
    ])
    const width = Math.max(30, e.props.bodyColumns)
    const rows = treeOrder(Object.values(all))
    const live = rows.filter(row => isBusy(row.agent.status)).length
    const done = rows.filter(row => row.agent.status === 'completed').length
    const other = rows.filter(row => !isLive(row.agent.status) && row.agent.status !== 'completed').length
    const focusId = picked ?? e.props.view.agentId ?? null
    const focus = focusId === null ? undefined : all[focusId]

    const pick = (id: string) => () => {
      void update($, selected, current => (current === id ? null : id))
    }

    const send = (agent: AtcAgent) => async (text: string) => {
      const message = text.trim()
      if (message === '') return
      const sent = await $.session.send({ to: { agentId: agent.id }, text: message })
      $.ui.toast(sent.isDelivered ? `Sent to ${agent.label}` : `Not sent: ${sent.reason}`)
    }

    const stop = (agent: AtcAgent) => async () => {
      const ran = await $.tool.call({
        tool: 'TaskStop',
        task_id: agent.teammateId ?? agent.id,
        consent: `The user pressed "Stop" on agent ${agent.label} in the agent control pane.`,
      })
      if (ran.deny !== undefined) $.ui.toast(`Not stopped: ${ran.deny}`)
      else if (ran.isError === true) $.ui.toast(`Not stopped: ${ran.text}`)
      else $.ui.toast(`Stopped ${agent.label}`)
    }

    return (
      <Box flexDirection="column" width={width}>
        <Text bold wrap="truncate-end">
          {rows.length === 0
            ? 'No subagents yet'
            : `${live} running · ${done} done${other > 0 ? ` · ${other} stopped or failed` : ''}`}
        </Text>
        {top.step !== undefined && (
          <Text dimColor wrap="truncate-end">
            main: {STEP_MARK[top.step.state]} {stepLine(top.step)} · {ago(at - top.lastAt)} ago
          </Text>
        )}
        <Text dimColor>{'─'.repeat(width)}</Text>

        {rows.length === 0 && (
          <Text dimColor wrap="wrap">
            Each subagent shows here the moment it starts, with what it is doing now.
          </Text>
        )}
        {rows.map(({ agent, depth }, i) => {
          const { glyph, color, word } = look(agent, at)
          const last = agent.steps[agent.steps.length - 1]
          return (
            <Box key={`row-${agent.id}`} flexDirection="row">
              <Text color={color}>
                {'  '.repeat(depth)}
                {agent.id === focusId ? '›' : ' '}
                {glyph}{' '}
              </Text>
              <Button
                key={`pick-${agent.id}`}
                plain
                hotkey={i < 9 ? String(i + 1) : undefined}
                label={agent.name ?? agent.label}
                onPress={pick(agent.id)}
              />
              <Text dimColor wrap="truncate-end">
                {'  '}
                {word}
                {isLive(agent.status) && last !== undefined ? `  ${stepLine(last)}` : ''}
              </Text>
            </Box>
          )
        })}

        {focus !== undefined && (
          <Box flexDirection="column" marginTop={1}>
            <Text bold wrap="truncate-end">
              {focus.name ?? focus.label}
            </Text>
            <Text dimColor wrap="truncate-end">
              {[
                focus.type,
                shortModel(focus.model),
                `started ${clockTime(focus.startedAt)}`,
                `${focus.calls} calls`,
                focus.errors > 0 ? `${focus.errors} errors` : undefined,
                focus.tokens !== undefined ? kTokens(focus.tokens) : undefined,
              ]
                .filter(part => part !== undefined)
                .join(' · ')}
            </Text>
            {focus.name !== undefined && (
              <Text dimColor wrap="truncate-end">
                {focus.label}
              </Text>
            )}
            {focus.steps.map(step => (
              <Box key={`step-${step.id}`} flexDirection="row">
                <Text dimColor>{clockTime(step.at)} </Text>
                <Text color={step.state === 'err' || step.state === 'deny' ? 'red' : undefined}>
                  {STEP_MARK[step.state]}{' '}
                </Text>
                <Text wrap="truncate-end">{stepLine(step)}</Text>
              </Box>
            ))}
            {focus.steps.length === 0 && <Text dimColor>No tool calls yet.</Text>}
            {focus.answer !== undefined && !isLive(focus.status) && (
              <Text wrap="wrap">Answer: {focus.answer}</Text>
            )}
            {Input !== undefined && (
              <Input
                key={`msg-${focus.id}`}
                placeholder={isLive(focus.status) ? 'Message this agent…' : 'Ask it a follow-up…'}
                submitLabel="Send"
                onSubmit={send(focus)}
              />
            )}
            <Box flexDirection="row" gap={1}>
              {isLive(focus.status) && (
                <Button key="stop" label="Stop" onPress={stop(focus)} />
              )}
              {picked !== null && (
                <Button key="back" label="Back" hotkey="b" onPress={() => void update($, selected, () => null)} />
              )}
            </Box>
          </Box>
        )}

        {rows.length > 0 && (
          <Text dimColor wrap="truncate-end">
            {'\n'}1-9 picks an agent · Tab walks the controls · Esc gives the keyboard back
          </Text>
        )}
      </Box>
    )
  })
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Matteo Hertel / tinyorbit

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.

コードが呼ぶもの

Claude を動かすツール呼び出し

コードから読み取ったデザイン

読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。

コードから読めること

2026-10-06 に読んだコミット d03405eee4c2 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。mods/agent-atc/hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。1 ファイルを解析
コードが Mod の中で完結import は Mod 自身のファイルかエンジンのモジュールだけ。パッケージも require もない。コードはすべて Mod の中
読める圧縮した行・eval・new Function・計算した道の import()・符号化した塊がない。圧縮・eval・符号化した塊なし
呼び出しが見える通信とプログラム起動はその場で $.http.fetch・$.process.run と書き、他へ渡さない。外への呼び出しはすべてその場の $ で
入れる前に自分で判断する材料
描く場所コードから読んだ、描く先。ターミナル・デスクトップアプリ・両方・何も描かない(フックだけ: 見張りやプロンプトの書き換え)のどれか。出すだけで、外す理由にはしない。ターミナルとデスクトップアプリに同じように描く
入れる手順リポジトリ自身の .claude-plugin/marketplace.json にこの Mod が載っていて、ページに書いた手順でそのマーケットプレイスから入れられるか。リポジトリの .claude-plugin/marketplace.json に載っており、そこから入れられる
Windows のプログラム$.process で起動するプログラムが Windows にあるか(tail・date・open・osascript・/usr/… などは無い)。Windows にないプログラムを使わない
通信fetch の送り先(https のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。プログラムを起動しない
読んで送るファイルや環境変数を読み、かつ通信するか。通信しない
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件

入れる

入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。

リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。

/plugin marketplace add tinyorbit-ai/skills
/plugin install agent-atc@tinyorbit

入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(d03405eee4c2)と違うことがあります。入れる前に見比べてください。

Claude に聞く

modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:

modscode のデザイン「tinyorbit-ai-agent-atc」をコードごと読んで、同じようなペインを作って

Claude から探す: MCP コネクタ

似たデザイン