modscode EN

modscode / 図鑑 / spawn-pane

spawn-pane

Lets a planner session open a new terminal tab in any folder and hand a briefed Claude agent the work there.

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

何をするか

  • 欄・トーストを描く
  • /workers・/standup を足す
  • ツールの呼び出しを見張る(止めることがある)
  • prompt.submit・session.startにフックする
  • ターンをまたいで自分の状態を持つ

良いところ

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

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like spawn-pane by Eddy Ogutu (pane, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/eddyficial-spawn-pane/
// 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: "Workers" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const length = '…'
    const working = '…'
    const needsYou = '…'
    const sum = '…'
    const costUsd = '…'
    const name = '…'
    const model = '…'
    const STATUS_TEXT = '…'
    const age = '…'
    const money = '…'
    const note = '…'
    const c = '…'
    const name2 = '…'
    const model2 = '…'
    const STATUS_TEXT2 = '…'
    const age2 = '…'
    const money2 = '…'
    const note2 = '…'
    const name3 = '…'
    const model3 = '…'
    const STATUS_TEXT3 = '…'
    const age3 = '…'
    const money3 = '…'
    const note3 = '…'
    return (
      <Box flexDirection="column" paddingX={1}>
        <Box justifyContent="space-between">
          <Text>
            <Text bold>
              {length}
              {" open"}
            </Text>
            <Text color="#F59E0B">
              {" · "}
              {working}
              {" working"}
            </Text>
            <Text bold>
              {" · "}
              {needsYou}
              {" need you"}
            </Text>
          </Text>
          <Text bold color="green">
            {`${sum}${costUsd}`}
          </Text>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Box justifyContent="space-between" gap={1}>
            <Text wrap="truncate-end">
              <Text bold>
                ▌
              </Text>
              <Text bold>
                {" "}
                {name}
              </Text>
              <Text>
                {" "}
                {model}
              </Text>
              <Text dimColor>
                {" read-only"}
              </Text>
              <Text>
                {"  "}
                {"● "}
                {STATUS_TEXT}
              </Text>
            </Text>
            <Box gap={1} flexShrink={0}>
              <Text dimColor>
                {age}
                {" · "}
                {money}
              </Text>
              <Button label="■ stop" variant="primary" />
              <Button label="close" dimColor />
            </Box>
          </Box>
          <Box paddingLeft={2}>
            <Text wrap="wrap">
              {note}
            </Text>
          </Box>
          <Box paddingLeft={2} gap={1}>
            <Button label="✓ approve" variant="primary" />
            <Button label="✕ deny" />
            <Button label={`${c}…`} variant="primary" />
            <Button label={`${c}…`} variant="primary" />
            <Button label={`${c}…`} variant="primary" />
            <Button label="▶ continue" variant="primary" />
            <Button label="close" dimColor />
          </Box>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Box justifyContent="space-between" gap={1}>
            <Text wrap="truncate-end">
              <Text bold>
                ▌
              </Text>
              <Text bold>
                {" "}
                {name2}
              </Text>
              <Text>
                {" "}
                {model2}
              </Text>
              <Text dimColor>
                {" read-only"}
              </Text>
              <Text>
                {"  "}
                {"● "}
                {STATUS_TEXT2}
              </Text>
            </Text>
            <Box gap={1} flexShrink={0}>
              <Text dimColor>
                {age2}
                {" · "}
                {money2}
              </Text>
              <Button label="■ stop" variant="primary" />
              <Button label="close" dimColor />
            </Box>
          </Box>
          <Box paddingLeft={2}>
            <Text wrap="wrap">
              {note2}
            </Text>
          </Box>
          <Box paddingLeft={2} gap={1}>
            <Button label="✓ approve" variant="primary" />
            <Button label="✕ deny" />
            <Button label={`${c}…`} variant="primary" />
            <Button label={`${c}…`} variant="primary" />
            <Button label={`${c}…`} variant="primary" />
            <Button label="▶ continue" variant="primary" />
            <Button label="close" dimColor />
          </Box>
        </Box>
        <Box flexDirection="column" marginTop={1}>
          <Box justifyContent="space-between" gap={1}>
            <Text wrap="truncate-end">
              <Text bold>
                ▌
              </Text>
              <Text bold>
                {" "}
                {name3}
              </Text>
              <Text>
                {" "}
                {model3}
              </Text>
              <Text dimColor>
                {" read-only"}
              </Text>
              <Text>
                {"  "}
                {"● "}
                {STATUS_TEXT3}
              </Text>
            </Text>
            <Box gap={1} flexShrink={0}>
              <Text dimColor>
                {age3}
                {" · "}
                {money3}
              </Text>
              <Button label="■ stop" variant="primary" />
              <Button label="close" dimColor />
            </Box>
          </Box>
          <Box paddingLeft={2}>
            <Text wrap="wrap">
              {note3}
            </Text>
          </Box>
          <Box paddingLeft={2} gap={1}>
            <Button label="✓ approve" variant="primary" />
            <Button label="✕ deny" />
            <Button label={`${c}…`} variant="primary" />
            <Button label={`${c}…`} variant="primary" />
            <Button label={`${c}…`} variant="primary" />
            <Button label="▶ continue" variant="primary" />
            <Button label="close" dimColor />
          </Box>
        </Box>
        <Box marginTop={1}>
          <Text dimColor italic>
            costs are API-equivalent estimates
          </Text>
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const model = '…'
    const name = '…'
    await $.ui.toast(`Opened ${model} worker in ${name}`)
    return next(e)
  })
}

Mod 自身のコード

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

hooks/register.tsx 929〜1028 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button } = $.ui.resolve(e)
    const list = await read($, workers)
    const now = Date.now()
    const open = list.filter(w => w.status !== 'closed')
    const total = open.reduce((sum, w) => sum + w.costUsd, 0)
    const working = open.filter(w => w.status === 'working').length
    const needsYou = open.filter(w => w.status === 'needs-you').length
    // Blinking rows show their color on the "on" beats and go grey between.
    const shade = (w: Worker) => (BLINKS.has(w.status) && !blinkOn ? 'gray' : STATUS_COLORS[w.status])
    const act = (w: Worker, run: () => Promise<string>) => () => void run().then(msg => $.ui.toast(msg)).catch(() => undefined)

    if (open.length === 0)
      return (
        <Box flexDirection="column" paddingX={1} paddingY={1}>
          <Text dimColor>No workers open.</Text>
          <Text dimColor italic>Ask the planner, e.g. "check the api project".</Text>
        </Box>
      )

    // One row per worker, so many fit; a second, dim row for what it's waiting
    // on, or its summary (else the last line of its latest reply). A Button's
    // label must be plain text: a styled child makes the whole pane fail to draw.
    return (
      <Box flexDirection="column" paddingX={1}>
        <Box justifyContent="space-between">
          <Text>
            <Text bold>{open.length} open</Text>
            {working > 0 && <Text color={STATUS_COLORS.working}> · {working} working</Text>}
            {needsYou > 0 && <Text bold color={STATUS_COLORS['needs-you']}> · {needsYou} need you</Text>}
          </Text>
          <Text bold color="green">{money(total)}</Text>
        </Box>

        {open.map(w => {
          // What it needs from the user: a permission prompt, or a question it ended on.
          const asking = w.status === 'needs-you' && w.pending !== undefined
          const boxed = w.status === 'needs-you' && !asking && w.box === true
          const questioning = w.status === 'needs-you' && !asking && !boxed && w.question !== undefined
          const urgent = asking || questioning || boxed
          const running = w.background?.length ?? 0
          const latest = w.summary ?? w.lastLine
          const note = asking
            ? `waiting: ${w.pending}`
            : questioning || boxed
              ? `asks: ${w.question}${boxed && !w.choices ? ' (answer it in its tab)' : ''}`
              : running > 0 && w.last === 'turn-end'
                ? `${running} background task${running === 1 ? '' : 's'} still running${latest ? ` · ${latest}` : ''}`
                : latest
          return (
            <Box key={`card-${w.id}`} flexDirection="column" marginTop={1}>
              <Box justifyContent="space-between" gap={1}>
                <Text wrap="truncate-end">
                  <Text color={shade(w)} bold>▌</Text>
                  <Text bold> {w.name}</Text>
                  <Text color={MODEL_COLORS[w.model]}> {w.model}</Text>
                  {w.readOnly && <Text dimColor> read-only</Text>}
                  <Text color={shade(w)} bold={w.status === 'needs-you'} dimColor={w.status === 'starting'}>
                    {'  '}● {STATUS_TEXT[w.status]}
                  </Text>
                </Text>
                <Box gap={1} flexShrink={0}>
                  <Text dimColor>
                    {age(w.startedAt, now)} · {money(w.costUsd)}
                  </Text>
                  {BLINKS.has(w.status) && !urgent && <Button key={`stop-${w.id}`} label="■ stop" variant="primary" onPress={act(w, () => stopWorker($, w))} />}
                  {!BLINKS.has(w.status) && <Button key={`close-${w.id}`} label="close" dimColor onPress={act(w, () => closeAll($, [w]).then(l => l.join('; ')))} />}
                </Box>
              </Box>
              {/* Wrapped, not cut off: a question or a request must be readable here. */}
              {note && (
                <Box paddingLeft={2}>
                  <Text color={urgent ? STATUS_COLORS['needs-you'] : undefined} dimColor={!urgent} italic={!urgent} wrap="wrap">
                    {note}
                  </Text>
                </Box>
              )}
              {/* The answers sit under what they answer, keeping the top row readable. */}
              {urgent && (
                <Box paddingLeft={2} gap={1}>
                  {asking && <Button key={`approve-${w.id}`} label="✓ approve" variant="primary" onPress={act(w, () => answerWorker($, w, 'approve'))} />}
                  {asking && <Button key={`deny-${w.id}`} label="✕ deny" onPress={act(w, () => answerWorker($, w, 'deny'))} />}
                  {boxed &&
                    w.choices?.map((c, i) => (
                      <Button key={`choice-${w.id}-${i}`} label={c.length > 24 ? `${c.slice(0, 23)}…` : c} variant={i === 0 ? 'primary' : undefined} onPress={act(w, () => answerBox($, w, String(i + 1)))} />
                    ))}
                  {questioning && <Button key={`continue-${w.id}`} label="▶ continue" variant="primary" onPress={act(w, () => replyToWorker($, w, 'continue'))} />}
                  {questioning && <Button key={`close-${w.id}`} label="close" dimColor onPress={act(w, () => closeAll($, [w]).then(l => l.join('; ')))} />}
                </Box>
              )}
            </Box>
          )
        })}

        <Box marginTop={1}>
          <Text dimColor italic>costs are API-equivalent estimates</Text>
        </Box>
      </Box>
    )
  })
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Eddy Ogutu

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 に読んだコミット 97f3b3ac2e0f のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

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

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

入れる

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

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

/plugin marketplace add eddyficial/spawn-pane
/plugin install spawn-pane@spawn-pane

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン