modscode EN

modscode / 図鑑 / mission-control

mission-control

Live coding-orchestrator cockpit: relay context zone, subagents in flight, report-card grades and the Jev decision feed.

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

何をするか

  • プロンプトの上の帯・欄・ステータス行・トーストを描く
  • /orch・/sessions を足す
  • Bash の呼び出しを見張る(止めることがある)
  • agent.spawn・session.measure・session.start・turn.completeにフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • ネットワークに出ない
  • TypeScript で書かれている
  • エラーを扱う
  • ファイルを書かない

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like mission-control by davesheffer (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/davesheffer-mission-control/
// 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 band above the prompt; what else goes there is drawn under it
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const zone = '…'
    const kTokens = '…'
    const kTokens2 = '…'
    const jevText = '…'
    const length = '…'
    const crew = '…'
    const roleOf = '…'
    const confidence = '…'
    const unverified = '…'
    const sessionCount = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
          <Text bold>
            ●
            {" "}
            {zone}
            {" "}
            {kTokens}
            /
            {kTokens2}
          </Text>
          <Text>
            ████████░░░░░░░░
          </Text>
          <Text>
            {jevText}
          </Text>
          <Text>
            🧠
            {" hunch "}
            {length}
            …
            {` ⚠${length}`}
          </Text>
          <Text wrap="truncate">
            ⚙
            {" "}
            {crew}
          </Text>
          <Text>
            {"last "}
            {roleOf}
            {" "}
            {confidence}
            {` ⚠${unverified}`}
          </Text>
          <Button label="orch" />
          <Button label={`🗂 ${sessionCount}`} />
          <Button label="hide" />
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Mission Control" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const zone = '…'
    const kTokens = '…'
    const kTokens2 = '…'
    const kTokens3 = '…'
    const kTokens4 = '…'
    const usd = '…'
    const ZONE_HINT = '…'
    const length = '…'
    const roleOf = '…'
    const model = '…'
    const seconds = '…'
    const description = '…'
    const roleOf2 = '…'
    const model2 = '…'
    const seconds2 = '…'
    const description2 = '…'
    const roleOf3 = '…'
    const model3 = '…'
    const seconds3 = '…'
    const description3 = '…'
    const confidence = '…'
    const roleOf4 = '…'
    const seconds4 = '…'
    const exitCodes = '…'
    const unverified = '…'
    const missing = '…'
    const result = '…'
    const confidence2 = '…'
    const roleOf5 = '…'
    const seconds5 = '…'
    const result2 = '…'
    const confidence3 = '…'
    const roleOf6 = '…'
    const seconds6 = '…'
    const result3 = '…'
    const length2 = '…'
    const map = '…'
    const clockTime = '…'
    const HUNCH_MARK = '…'
    const role = '…'
    const name = '…'
    const target = '…'
    const clockTime2 = '…'
    const HUNCH_MARK2 = '…'
    const role2 = '…'
    const name2 = '…'
    const target2 = '…'
    const clockTime3 = '…'
    const HUNCH_MARK3 = '…'
    const role3 = '…'
    const name3 = '…'
    const target3 = '…'
    const spendToday = '…'
    const deniesToday = '…'
    const weakToday = '…'
    const note = '…'
    const ts = '…'
    const feature = '…'
    const summary = '…'
    const ts2 = '…'
    const feature2 = '…'
    const summary2 = '…'
    const ts3 = '…'
    const feature3 = '…'
    const summary3 = '…'
    return (
      <Box flexDirection="column">
        <Text bold>
          Relay
        </Text>
        <Text>
          {zone}
          {" "}
          ████████░░░░░░░░
          {" "}
          {kTokens}
          /
          {kTokens2}
        </Text>
        <Text dimColor wrap="truncate">
          {"amber "}
          {kTokens3}
          {" · red "}
          {kTokens4}
          {` · session $${usd}`}
          {` · ${ZONE_HINT}`}
        </Text>
        <Text bold>
          In flight (
          {length}
          )
        </Text>
        <Text dimColor>
          No subagents running.
        </Text>
        <Text wrap="truncate">
          {roleOf}
          {" "}
          {model}
          {" "}
          {seconds}
          {" "}
          {"bg "}
          {description}
        </Text>
        <Text wrap="truncate">
          {roleOf2}
          {" "}
          {model2}
          {" "}
          {seconds2}
          {" "}
          {"bg "}
          {description2}
        </Text>
        <Text wrap="truncate">
          {roleOf3}
          {" "}
          {model3}
          {" "}
          {seconds3}
          {" "}
          {"bg "}
          {description3}
        </Text>
        <Text bold>
          Report cards
        </Text>
        <Text dimColor>
          No role reports yet.
        </Text>
        <Box flexDirection="column">
          <Text wrap="truncate">
            <Text>
              {confidence}
            </Text>
            {" "}
            {roleOf4}
            {" "}
            {seconds4}
            {` exit ${exitCodes}`}
            {` ⚠ ${unverified} unverified`}
            {` missing ${missing}`}
          </Text>
          <Text dimColor wrap="truncate">
            {"  "}
            {result}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text wrap="truncate">
            <Text>
              {confidence2}
            </Text>
            {" "}
            {roleOf5}
            {" "}
            {seconds5}
            {` exit ${exitCodes}`}
            {` ⚠ ${unverified} unverified`}
            {` missing ${missing}`}
          </Text>
          <Text dimColor wrap="truncate">
            {"  "}
            {result2}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text wrap="truncate">
            <Text>
              {confidence3}
            </Text>
            {" "}
            {roleOf6}
            {" "}
            {seconds6}
            {` exit ${exitCodes}`}
            {` ⚠ ${unverified} unverified`}
            {` missing ${missing}`}
          </Text>
          <Text dimColor wrap="truncate">
            {"  "}
            {result3}
          </Text>
        </Box>
        <Text bold>
          Hunch
          {" "}
          <Text>
            no task id yet
            {" · "}
            {length2}
            {" call"}
          </Text>
        </Text>
        <Text dimColor>
          No Hunch calls yet this task.
        </Text>
        <Text dimColor wrap="truncate">
          {map}
        </Text>
        <Box flexDirection="column">
          <Text wrap="truncate">
            {clockTime}
            {" "}
            {HUNCH_MARK}
            {" "}
            {role}
            {" "}
            {name}
            {" "}
            {target}
          </Text>
          <Text dimColor wrap="truncate">
            {"      "}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text wrap="truncate">
            {clockTime2}
            {" "}
            {HUNCH_MARK2}
            {" "}
            {role2}
            {" "}
            {name2}
            {" "}
            {target2}
          </Text>
          <Text dimColor wrap="truncate">
            {"      "}
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text wrap="truncate">
            {clockTime3}
            {" "}
            {HUNCH_MARK3}
            {" "}
            {role3}
            {" "}
            {name3}
            {" "}
            {target3}
          </Text>
          <Text dimColor wrap="truncate">
            {"      "}
          </Text>
        </Box>
        <Text bold>
          Jev
          {" "}
          <Text color="green">
            online
          </Text>
        </Text>
        <Text dimColor>
          today $
          {spendToday}
          {" · "}
          {deniesToday}
          {" gate denies · "}
          {weakToday}
          {" weak reports"}
        </Text>
        <Text color="yellow">
          {note}
        </Text>
        <Text wrap="truncate" color="red">
          {ts}
          {" "}
          {feature}
          {" "}
          {summary}
        </Text>
        <Text wrap="truncate" color="red">
          {ts2}
          {" "}
          {feature2}
          {" "}
          {summary2}
        </Text>
        <Text wrap="truncate" color="red">
          {ts3}
          {" "}
          {feature3}
          {" "}
          {summary3}
        </Text>
        <Box flexDirection="row" columnGap={1}>
          <Button label="toggle band" />
          <Button label="clear done" />
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const zone = '…'
    const kTokens = '…'
    const running = '…'
    const jevMark = '…'
    const hunchCount = '…'
    const ZONE_HINT = '…'
    const op = '…'
    const why = '…'
    await $.ui.status(`${zone} ${kTokens} · ${running} agents · ${jevMark} · hunch ${hunchCount}`)
    await $.ui.toast(`Relay ${zone} at ${kTokens}: ${ZONE_HINT}`)
    await $.ui.toast(`⛔ Jev risk gate denied ${op} (${why})`)
    return next(e)
  })
}

Mod 自身のコード

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

mods/mission-control/hooks/register.tsx 522〜570 行 · バンド
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey || (await read($, isBandHidden))) return next(e)

    const { Box, Text, Button } = $.ui.resolve(e)
    const g = await read($, gauge)
    const j = await read($, jev)
    const running = (await read($, agents)).filter(agent => agent.status === 'running')
    const last = (await read($, reports)).at(-1)
    const hunchNow = taskCalls(await read($, hunch))
    const hunchLevel = loudest(hunchNow)
    const sessionCount = (await read($, sessions)).length
    const isWide = e.props.bodyColumns >= 100

    const zone: Zone = g?.zone ?? 'unknown'
    const fill = g?.tokens === undefined ? 0 : g.tokens / g.hard
    const jevColor = j?.isOnline === true ? 'green' : j?.isOnline === false ? 'red' : 'gray'
    const jevText = j?.isOnline === true ? 'Jev ✔' : j?.isOnline === false ? `Jev ✖ ${j.lastError ?? ''}`.trim() : 'Jev ?'
    const crew =
      running.length === 0
        ? 'idle'
        : running.map(agent => `${roleOf(agent.type)}·${agent.model}`).join(', ')

    return (
      <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
        <Text color={ZONE_COLOR[zone]} bold>
          {'●'} {zone.toUpperCase()} {kTokens(g?.tokens)}/{kTokens(g?.hard)}
        </Text>
        {isWide && <Text color={ZONE_COLOR[zone]}>{bar(fill, 10)}</Text>}
        <Text color={jevColor}>{jevText}</Text>
        <Text color={HUNCH_COLOR[hunchLevel] ?? (hunchNow.length === 0 ? 'gray' : 'cyan')}>
          {'🧠'} hunch {hunchNow.length}
          {hunchNow.some(call => call.status === 'running') ? '…' : ''}
          {hunchLevel !== 'info' ? ` ⚠${hunchNow.filter(call => call.level !== 'info').length}` : ''}
        </Text>
        <Text wrap="truncate">
          {'⚙'} {crew}
        </Text>
        {last !== undefined && (
          <Text color={CONFIDENCE_COLOR[last.confidence]}>
            last {roleOf(last.type)} {last.confidence.toUpperCase()}
            {last.unverified > 0 ? ` ⚠${last.unverified}` : ''}
          </Text>
        )}
        <Button key="open" label="orch" onPress={() => openPane($)} />
        <Button key="sessions" label={`🗂 ${sessionCount}`} onPress={() => openSessions($)} />
        <Button key="hide" label="hide" onPress={() => setBandHidden($, true)} />
      </Box>
    )
  })
mods/mission-control/hooks/register.tsx 572〜700 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const g = await read($, gauge)
    const j = await read($, jev)
    const list = await read($, agents)
    const cards = await read($, reports)
    const hunchLog = await read($, hunch)
    const hunchNow = taskCalls(hunchLog)
    const counts = new Map<string, number>()
    for (const call of hunchNow) counts.set(call.name, (counts.get(call.name) ?? 0) + 1)
    const now = Math.max(await read($, tick), ...list.map(agent => agent.startedAt))
    const width = Math.max(20, e.props.bodyColumns)
    const zone: Zone = g?.zone ?? 'unknown'
    const running = list.filter(agent => agent.status === 'running')

    return (
      <Box flexDirection="column" width={width}>
        <Text bold>Relay</Text>
        <Text color={ZONE_COLOR[zone]}>
          {zone.toUpperCase()} {bar(g?.tokens === undefined ? 0 : g.tokens / g.hard, Math.min(24, width - 22))}{' '}
          {kTokens(g?.tokens)}/{kTokens(g?.hard)}
        </Text>
        <Text dimColor wrap="truncate">
          amber {kTokens(g?.soft)} · red {kTokens(g?.hard)}
          {g?.usd !== undefined ? ` · session $${g.usd.toFixed(2)}` : ''}
          {ZONE_HINT[zone] !== '' ? ` · ${ZONE_HINT[zone]}` : ''}
        </Text>

        <Text bold>In flight ({running.length})</Text>
        {running.length === 0 && <Text dimColor>No subagents running.</Text>}
        {running.map(agent => (
          <Text wrap="truncate">
            {roleOf(agent.type).padEnd(8)} {agent.model.padEnd(7)} {seconds(now - agent.startedAt).padStart(4)}{' '}
            {agent.isBackground ? 'bg ' : ''}
            {agent.description}
          </Text>
        ))}

        <Text bold>Report cards</Text>
        {cards.length === 0 && <Text dimColor>No role reports yet.</Text>}
        {cards
          .slice(-6)
          .reverse()
          .map(card => (
            <Box flexDirection="column">
              <Text wrap="truncate">
                <Text color={CONFIDENCE_COLOR[card.confidence]}>{card.confidence.toUpperCase().padEnd(7)}</Text>{' '}
                {roleOf(card.type).padEnd(8)} {seconds(card.durationMs).padStart(4)}
                {card.exitCodes.length > 0 ? ` exit ${card.exitCodes.join(',')}` : ''}
                {card.unverified > 0 ? ` ⚠ ${card.unverified} unverified` : ''}
                {card.missing.length > 0 ? ` missing ${card.missing.join('/')}` : ''}
              </Text>
              {card.result !== '' && (
                <Text dimColor wrap="truncate">
                  {'  '}
                  {card.result}
                </Text>
              )}
            </Box>
          ))}

        <Text bold>
          Hunch{' '}
          <Text color={HUNCH_COLOR[loudest(hunchNow)]}>
            {hunchLog.taskId ?? 'no task id yet'} · {hunchNow.length} call{hunchNow.length === 1 ? '' : 's'}
          </Text>
        </Text>
        {hunchNow.length === 0 && <Text dimColor>No Hunch calls yet this task.</Text>}
        {counts.size > 0 && (
          <Text dimColor wrap="truncate">
            {[...counts].map(([name, count]) => `${name} ${count}`).join(' · ')}
          </Text>
        )}
        {hunchNow
          .slice(-8)
          .reverse()
          .map(call => (
            <Box flexDirection="column">
              <Text wrap="truncate" color={HUNCH_COLOR[call.level]}>
                {clockTime(call.startedAt)} {HUNCH_MARK[call.status]} {call.role.padEnd(7)} {call.name.padEnd(17)}{' '}
                {call.durationMs === undefined ? '' : `${seconds(call.durationMs).padStart(4)} `}
                {call.target}
              </Text>
              {call.summary !== '' && (
                <Text dimColor wrap="truncate">
                  {'      '}
                  {call.summary}
                </Text>
              )}
            </Box>
          ))}

        <Text bold>
          Jev{' '}
          <Text color={j?.isOnline === true ? 'green' : j?.isOnline === false ? 'red' : 'gray'}>
            {j?.isOnline === true ? 'online' : j?.isOnline === false ? `offline (${j.lastError ?? 'unavailable'})` : 'unknown'}
          </Text>
        </Text>
        {j !== null && (
          <Text dimColor>
            today ${j.spendToday.toFixed(4)} · {j.deniesToday} gate denies · {j.weakToday} weak reports
          </Text>
        )}
        {j?.note !== undefined && <Text color="yellow">{j.note}</Text>}
        {(j?.recent ?? []).map(entry => (
          <Text wrap="truncate" color={entry.isAlert ? 'red' : undefined}>
            {entry.ts.slice(11, 16)} {entry.feature.padEnd(13)} {entry.summary}
          </Text>
        ))}

        <Box flexDirection="row" columnGap={1}>
          <Button
            key="band"
            label="toggle band"
            onPress={async () => setBandHidden($, !(await read($, isBandHidden)))}
          />
          <Button
            key="clear"
            label="clear done"
            onPress={async () => {
              await update($, agents, all => all.filter(agent => agent.status === 'running'))
              const now = await $.clock.now()
              await update($, hunch, log => ({ ...log, calls: reapStale(log.calls, now).filter(call => call.status === 'running') }))
            }}
          />
        </Box>
      </Box>
    )
  })
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 David Sheffer

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.

コードが呼ぶもの

プログラム起動ファイル読み取り環境変数ツール呼び出し保存

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

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

コードから読めること

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。mods/mission-control/hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。2 ファイルを解析
コードが 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 のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。mods/mission-control/hooks/register.tsx:329 python(シェル・インタプリタ)
読んで送るファイルや環境変数を読み、かつ通信するか。通信しない
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

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

入れる

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

リポジトリの .claude-plugin/marketplace.json にこの Mod が載っていないため、入れる手順は出せません。コードとして読むか、作者の README に従ってください。

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン