modscode / 図鑑 / subagents-monitor
subagents-monitor
Live side pane listing the session's subagents: status, elapsed and working time, model, effort and estimated cost.
何をするか
- 欄を描く
- /subagents を足す
- ツールの呼び出しを見張る
- agent.spawn・session.start・turn.complete・turn.stepにフックする
良いところ
- ネットワークに出ない
- プロセスを起こさない
- TypeScript で書かれている
- ファイルを書かない
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like subagents-monitor by Fazzani (pane, status), as modscode read it from the mod's code:
// https://modscode.com/gallery/fazzani-subagents-monitor/
// 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 } = $.ui.resolve(e)
const heading = '…'
const spin = '…'
const working = '…'
const done = '…'
const failed = '…'
const emptyTitle = '…'
const emptyHint = '…'
const spin2 = '…'
const description = '…'
const status = '…'
const type = '…'
const shortModel = '…'
const effort = '…'
const background = '…'
const full = '…'
const empty = '…'
const clock = '…'
const clock2 = '…'
const tokens = '…'
const tokens2 = '…'
const usd = '…'
const spin3 = '…'
const description2 = '…'
const status2 = '…'
const type2 = '…'
const shortModel2 = '…'
const effort2 = '…'
const background2 = '…'
const full2 = '…'
const empty2 = '…'
const clock3 = '…'
const clock4 = '…'
const tokens3 = '…'
const tokens4 = '…'
const usd2 = '…'
const spin4 = '…'
const description3 = '…'
const status3 = '…'
const type3 = '…'
const shortModel3 = '…'
const effort3 = '…'
const background3 = '…'
const full3 = '…'
const empty3 = '…'
const clock5 = '…'
const clock6 = '…'
const tokens5 = '…'
const tokens6 = '…'
const usd3 = '…'
const footerSubagents = '…'
const sum = '…'
const costUsd = '…'
const footerSession = '…'
const usd4 = '…'
const legend = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row" justifyContent="space-between">
<Text bold color="#D97757">
{heading}
</Text>
<Box flexDirection="row" gap={1}>
<Text color="#58A6FF">
{spin}
{" "}
{working}
</Text>
<Text color="#3FB950">
{"✓ "}
{done}
</Text>
<Text color="#F85149">
{"✗ "}
{failed}
</Text>
</Box>
</Box>
<Text dimColor>
────────
</Text>
<Box flexDirection="column" paddingY={1}>
<Text dimColor>
{emptyTitle}
</Text>
<Text dimColor>
{emptyHint}
</Text>
</Box>
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Box flexDirection="row" justifyContent="space-between">
<Box flexShrink={1}>
<Text bold>
{spin2}
{" "}
</Text>
<Text wrap="truncate-end">
{description}
</Text>
</Box>
<Text bold>
{" "}
{status}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text color="#D97757">
{type}
</Text>
<Text dimColor>
·
</Text>
<Text>
{shortModel}
</Text>
<Text dimColor>
·
</Text>
<Text italic>
{effort}
</Text>
<Text dimColor>
{"· "}
{background}
</Text>
</Box>
<Box flexDirection="row" justifyContent="space-between">
<Box flexDirection="row">
<Text>
{full}
</Text>
<Text dimColor>
{empty}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text dimColor>
⏱
</Text>
<Text>
{clock}
</Text>
<Text dimColor>
⚡
</Text>
<Text>
{clock2}
</Text>
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between">
<Text dimColor>
{tokens}
{" "}
{tokens2}
</Text>
<Text color="#3FB950">
≈
{usd}
</Text>
</Box>
</Box>
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Box flexDirection="row" justifyContent="space-between">
<Box flexShrink={1}>
<Text bold>
{spin3}
{" "}
</Text>
<Text wrap="truncate-end">
{description2}
</Text>
</Box>
<Text bold>
{" "}
{status2}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text color="#D97757">
{type2}
</Text>
<Text dimColor>
·
</Text>
<Text>
{shortModel2}
</Text>
<Text dimColor>
·
</Text>
<Text italic>
{effort2}
</Text>
<Text dimColor>
{"· "}
{background2}
</Text>
</Box>
<Box flexDirection="row" justifyContent="space-between">
<Box flexDirection="row">
<Text>
{full2}
</Text>
<Text dimColor>
{empty2}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text dimColor>
⏱
</Text>
<Text>
{clock3}
</Text>
<Text dimColor>
⚡
</Text>
<Text>
{clock4}
</Text>
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between">
<Text dimColor>
{tokens3}
{" "}
{tokens4}
</Text>
<Text color="#3FB950">
≈
{usd2}
</Text>
</Box>
</Box>
<Box flexDirection="column" borderStyle="round" paddingX={1}>
<Box flexDirection="row" justifyContent="space-between">
<Box flexShrink={1}>
<Text bold>
{spin4}
{" "}
</Text>
<Text wrap="truncate-end">
{description3}
</Text>
</Box>
<Text bold>
{" "}
{status3}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text color="#D97757">
{type3}
</Text>
<Text dimColor>
·
</Text>
<Text>
{shortModel3}
</Text>
<Text dimColor>
·
</Text>
<Text italic>
{effort3}
</Text>
<Text dimColor>
{"· "}
{background3}
</Text>
</Box>
<Box flexDirection="row" justifyContent="space-between">
<Box flexDirection="row">
<Text>
{full3}
</Text>
<Text dimColor>
{empty3}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text dimColor>
⏱
</Text>
<Text>
{clock5}
</Text>
<Text dimColor>
⚡
</Text>
<Text>
{clock6}
</Text>
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between">
<Text dimColor>
{tokens5}
{" "}
{tokens6}
</Text>
<Text color="#3FB950">
≈
{usd3}
</Text>
</Box>
</Box>
<Text dimColor>
────────
</Text>
<Box flexDirection="row" justifyContent="space-between">
<Text dimColor>
{footerSubagents}
{" ≈"}
{`${sum}${costUsd}`}
</Text>
<Text dimColor>
{footerSession}
{" "}
{usd4}
</Text>
</Box>
<Text dimColor>
{legend}
</Text>
</Box>
)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
plugins/subagents-monitor/hooks/register.tsx 324〜448 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const { Box, Text } = $.ui.resolve(e)
const m = t()
const list = (await read($, agents)) ?? []
const at = Math.max(await read($, now), ...list.map(row => row.endedAt ?? row.startedAt))
const total = await read($, sessionUsd)
const width = Math.max(28, e.props.bodyColumns)
const isNarrow = width < 44
const working = list.filter(row => row.status === 'working').length
const done = list.filter(row => row.status === 'done').length
const failed = list.length - working - done
const estimated = list.reduce((sum, row) => sum + row.costUsd, 0)
const byId = new Map(list.map(row => [row.id, row]))
const ordered = [...list].sort((a, b) => {
const live = Number(b.status === 'working') - Number(a.status === 'working')
return live !== 0 ? live : b.startedAt - a.startedAt
})
const spin = SPINNER[Math.floor(at / 1000) % SPINNER.length]
return (
<Box flexDirection="column" width={width}>
<Box flexDirection="row" justifyContent="space-between">
<Text bold color={ACCENT}>
{m.heading}
</Text>
<Box flexDirection="row" gap={1}>
<Text color={COLORS.working}>
{working > 0 ? spin : '●'} {working}
</Text>
<Text color={COLORS.done}>✓ {done}</Text>
{failed > 0 && <Text color={COLORS.failed}>✗ {failed}</Text>}
</Box>
</Box>
<Text dimColor>{'─'.repeat(width)}</Text>
{list.length === 0 && (
<Box flexDirection="column" paddingY={1}>
<Text dimColor>{m.emptyTitle}</Text>
<Text dimColor>{m.emptyHint}</Text>
</Box>
)}
{ordered.map(row => {
const color = COLORS[row.status]
const isLive = row.status === 'working'
const elapsed = elapsedOf(row, at)
const work = workingOf(row, at)
const [full, empty] = bar(elapsed === 0 ? 0 : work / elapsed, isNarrow ? 6 : 10)
const indent = depthOf(row, byId) * 2
return (
<Box
key={`agent-${row.id}`}
flexDirection="column"
borderStyle="round"
borderColor={color}
borderDimColor={!isLive}
paddingX={1}
marginLeft={indent}
>
<Box flexDirection="row" justifyContent="space-between">
<Box flexShrink={1}>
<Text color={color} bold>
{isLive ? spin : GLYPHS[row.status]}{' '}
</Text>
<Text bold={isLive} wrap="truncate-end">
{row.description}
</Text>
</Box>
<Text color={color} bold>
{' '}
{m.status[row.status]}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text color={ACCENT}>{row.type}</Text>
<Text dimColor>·</Text>
<Text>{shortModel(row.model)}</Text>
{row.effort && (
<>
<Text dimColor>·</Text>
<Text italic>{row.effort}</Text>
</>
)}
{row.isBackground && <Text dimColor>· {m.background}</Text>}
</Box>
<Box flexDirection="row" justifyContent="space-between">
<Box flexDirection="row">
<Text color={color}>{full}</Text>
<Text dimColor>{empty}</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text dimColor>⏱</Text>
<Text>{clock(elapsed)}</Text>
<Text dimColor>⚡</Text>
<Text>{clock(work)}</Text>
</Box>
</Box>
<Box flexDirection="row" justifyContent="space-between">
<Text dimColor>{tokens(row.tokens)} {m.tokens}</Text>
<Text color={COLORS.done}>≈{usd(row.costUsd)}</Text>
</Box>
</Box>
)
})}
{list.length > 0 && (
<>
<Text dimColor>{'─'.repeat(width)}</Text>
<Box flexDirection="row" justifyContent="space-between">
<Text dimColor>{m.footerSubagents} ≈{usd(estimated)}</Text>
{total !== null && <Text dimColor>{m.footerSession} {usd(total)}</Text>}
</Box>
<Text dimColor>{m.legend}</Text>
</>
)}
</Box>
)
})ライセンスの全文(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.
コードが呼ぶもの
環境変数Claude を動かすツール呼び出し
コードから読めること
2026-10-06 に読んだコミット 6a268fb607b9 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。plugins/subagents-monitor/hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。5 ファイルを解析 |
| コードが 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 Fazzani/claude-mods/plugin install subagents-monitor@claude-mods入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(6a268fb607b9)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「fazzani-subagents-monitor」をコードごと読んで、同じようなペインを作って似たデザイン
-
何をするか
- 欄を描く
- session.end・session.start・ui.closeにフックする
- プロセスを起こす
-
Claude に頼む…2h 10m · █████░░░✓ build ✓ build ✓ buildJavaKotlin3 Python■ ok 3 ■ ok 3 ■ ok 3 Razor proven 3 Razor proven 3 Razor proven 3Phases ──────── 3/3build Pythonbuild Pythonbuild Python… 3 more phasesLua ──────── 3/Kotlin■ the whole upgrade Ruby■ build build Ruby■ build build Ruby■ build build Ruby … 3 moreNext ──────── PythonRuby (by hand)Podsclick a button, or ctrl+x tab then Tab, EnterAttention ──────── 3! Scala ! Scala ! Scala … 3 moreSession ──────── okJava
-
何をするか
- プロンプトの上の帯を描く
- /seo-spend・/seo-doctor・/seo-cockpit を足す
- Agent の呼び出しを見張る(止めることがある)
- agent.spawn・classic.SessionStart・prompt.submit・session.compact ほか 3 個にフックする
-
Open a file first: /crit-tui file <path>Reopen this one in the crit browser view.Claude に頼む…
-
Claude に頼む…TodayOct 63 left · Mar overdueRemCTL: Sep✓ All done for today.● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓Updated 14:32UndoRefresh
-
Claude に頼む…TO graph› Fix login › Fix login › Fix loginScopeThis featureWhole projectHide done stepsReconnect