modscode EN

modscode / 図鑑 / agent-cockpit

agent-cockpit

The instruments around each Claude Code session: themed status line, TTSR and layered rules, AGENTS.md and APPEND_SYSTEM, an edit advisor

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

何をするか

  • 欄・プロンプトの上の帯・トーストを描く
  • /dgs を足す
  • Edit・Write の呼び出しを見張る(止めることがある)
  • prompt.compose・prompt.context・prompt.submit・session.start ほか 3 個にフックする
  • ターンをまたいで自分の状態を持つ

良いところ

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

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like agent-cockpit by Daniel Santana (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/dgsantana-agent-cockpit/
// 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: "dgs settings" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Button, Text, Select } = $.ui.resolve(e)
    const i = '…'
    const label = '…'
    const name = '…'
    const kind = '…'
    const source = '…'
    const title = '…'
    const value = '…'
    const origin = '…'
    const text = '…'
    const label2 = '…'
    const text2 = '…'
    const label3 = '…'
    const text3 = '…'
    const segOrigin = '…'
    const id = '…'
    const side = '…'
    const id2 = '…'
    const id3 = '…'
    const title2 = '…'
    const label4 = '…'
    const text4 = '…'
    const label5 = '…'
    const text5 = '…'
    const label6 = '…'
    const text6 = '…'
    const id4 = '…'
    const id5 = '…'
    const id6 = '…'
    const title3 = '…'
    const label7 = '…'
    const text7 = '…'
    const label8 = '…'
    const text8 = '…'
    const label9 = '…'
    const text9 = '…'
    const id7 = '…'
    const id8 = '…'
    const id9 = '…'
    const hint = '…'
    return (
      <Box flexDirection="column">
        <Box gap={1}>
          <Button hotkey={`${i}`} label={`${label}`} variant="primary" />
          <Button hotkey={`${i}`} label={`${label}`} variant="primary" />
          <Button hotkey={`${i}`} label={`${label}`} variant="primary" />
        </Box>
        <Box gap={1}>
          <Text dimColor>
            write to
          </Text>
          <Button label="Global" variant="primary" />
          <Button label="This project" variant="primary" />
          <Text dimColor />
        </Box>
        <Box flexDirection="column">
          <Box gap={1}>
            <Button label="[ ]" plain />
            <Text>
              {`${name}  ${kind} · ${source}`}
            </Text>
          </Box>
          <Box gap={1}>
            <Button label="[ ]" plain />
            <Text>
              {`${name}  ${kind} · ${source}`}
            </Text>
          </Box>
          <Box gap={1}>
            <Button label="[ ]" plain />
            <Text>
              {`${name}  ${kind} · ${source}`}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text bold color="suggestion">
            {title}
          </Text>
          <Box flexDirection="column">
            <Box gap={1}>
              <Box>
                <Text>
                  {label}
                </Text>
              </Box>
              <Box gap={1}>
                <Text dimColor>
                  family
                </Text>
                <Select value={`${label}`} />
                <Text dimColor>
                  theme
                </Text>
                <Select value={`${value}`} />
              </Box>
              <Text dimColor>
                {`· ${origin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Text color="red">
              {text}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box gap={1}>
              <Box>
                <Text>
                  {label2}
                </Text>
              </Box>
              <Box gap={1}>
                <Text dimColor>
                  family
                </Text>
                <Select value={`${label}`} />
                <Text dimColor>
                  theme
                </Text>
                <Select value={`${value}`} />
              </Box>
              <Text dimColor>
                {`· ${origin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Text color="red">
              {text2}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box gap={1}>
              <Box>
                <Text>
                  {label3}
                </Text>
              </Box>
              <Box gap={1}>
                <Text dimColor>
                  family
                </Text>
                <Select value={`${label}`} />
                <Text dimColor>
                  theme
                </Text>
                <Select value={`${value}`} />
              </Box>
              <Text dimColor>
                {`· ${origin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Text color="red">
              {text3}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box gap={1}>
              <Text bold color="suggestion">
                Segments
              </Text>
              <Text dimColor>
                {`· ${segOrigin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Box gap={1}>
              <Box>
                <Text>
                  {id}
                </Text>
              </Box>
              <Button label="[x]" plain />
              <Button label={`${side}`} plain />
              <Button label="↑" plain />
              <Button label="↓" plain />
            </Box>
            <Box gap={1}>
              <Box>
                <Text>
                  {id2}
                </Text>
              </Box>
              <Button label="[x]" plain />
              <Button label={`${side}`} plain />
              <Button label="↑" plain />
              <Button label="↓" plain />
            </Box>
            <Box gap={1}>
              <Box>
                <Text>
                  {id3}
                </Text>
              </Box>
              <Button label="[x]" plain />
              <Button label={`${side}`} plain />
              <Button label="↑" plain />
              <Button label="↓" plain />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text bold color="suggestion">
            {title2}
          </Text>
          <Box flexDirection="column">
            <Box gap={1}>
              <Box>
                <Text>
                  {label4}
                </Text>
              </Box>
              <Box gap={1}>
                <Text dimColor>
                  family
                </Text>
                <Select value={`${label}`} />
                <Text dimColor>
                  theme
                </Text>
                <Select value={`${value}`} />
              </Box>
              <Text dimColor>
                {`· ${origin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Text color="red">
              {text4}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box gap={1}>
              <Box>
                <Text>
                  {label5}
                </Text>
              </Box>
              <Box gap={1}>
                <Text dimColor>
                  family
                </Text>
                <Select value={`${label}`} />
                <Text dimColor>
                  theme
                </Text>
                <Select value={`${value}`} />
              </Box>
              <Text dimColor>
                {`· ${origin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Text color="red">
              {text5}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box gap={1}>
              <Box>
                <Text>
                  {label6}
                </Text>
              </Box>
              <Box gap={1}>
                <Text dimColor>
                  family
                </Text>
                <Select value={`${label}`} />
                <Text dimColor>
                  theme
                </Text>
                <Select value={`${value}`} />
              </Box>
              <Text dimColor>
                {`· ${origin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Text color="red">
              {text6}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box gap={1}>
              <Text bold color="suggestion">
                Segments
              </Text>
              <Text dimColor>
                {`· ${segOrigin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Box gap={1}>
              <Box>
                <Text>
                  {id4}
                </Text>
              </Box>
              <Button label="[x]" plain />
              <Button label={`${side}`} plain />
              <Button label="↑" plain />
              <Button label="↓" plain />
            </Box>
            <Box gap={1}>
              <Box>
                <Text>
                  {id5}
                </Text>
              </Box>
              <Button label="[x]" plain />
              <Button label={`${side}`} plain />
              <Button label="↑" plain />
              <Button label="↓" plain />
            </Box>
            <Box gap={1}>
              <Box>
                <Text>
                  {id6}
                </Text>
              </Box>
              <Button label="[x]" plain />
              <Button label={`${side}`} plain />
              <Button label="↑" plain />
              <Button label="↓" plain />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="column">
          <Text bold color="suggestion">
            {title3}
          </Text>
          <Box flexDirection="column">
            <Box gap={1}>
              <Box>
                <Text>
                  {label7}
                </Text>
              </Box>
              <Box gap={1}>
                <Text dimColor>
                  family
                </Text>
                <Select value={`${label}`} />
                <Text dimColor>
                  theme
                </Text>
                <Select value={`${value}`} />
              </Box>
              <Text dimColor>
                {`· ${origin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Text color="red">
              {text7}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box gap={1}>
              <Box>
                <Text>
                  {label8}
                </Text>
              </Box>
              <Box gap={1}>
                <Text dimColor>
                  family
                </Text>
                <Select value={`${label}`} />
                <Text dimColor>
                  theme
                </Text>
                <Select value={`${value}`} />
              </Box>
              <Text dimColor>
                {`· ${origin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Text color="red">
              {text8}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box gap={1}>
              <Box>
                <Text>
                  {label9}
                </Text>
              </Box>
              <Box gap={1}>
                <Text dimColor>
                  family
                </Text>
                <Select value={`${label}`} />
                <Text dimColor>
                  theme
                </Text>
                <Select value={`${value}`} />
              </Box>
              <Text dimColor>
                {`· ${origin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Text color="red">
              {text9}
            </Text>
          </Box>
          <Box flexDirection="column">
            <Box gap={1}>
              <Text bold color="suggestion">
                Segments
              </Text>
              <Text dimColor>
                {`· ${segOrigin}`}
              </Text>
              <Button label="reset" plain />
            </Box>
            <Box gap={1}>
              <Box>
                <Text>
                  {id7}
                </Text>
              </Box>
              <Button label="[x]" plain />
              <Button label={`${side}`} plain />
              <Button label="↑" plain />
              <Button label="↓" plain />
            </Box>
            <Box gap={1}>
              <Box>
                <Text>
                  {id8}
                </Text>
              </Box>
              <Button label="[x]" plain />
              <Button label={`${side}`} plain />
              <Button label="↑" plain />
              <Button label="↓" plain />
            </Box>
            <Box gap={1}>
              <Box>
                <Text>
                  {id9}
                </Text>
              </Box>
              <Button label="[x]" plain />
              <Button label={`${side}`} plain />
              <Button label="↑" plain />
              <Button label="↓" plain />
            </Box>
          </Box>
        </Box>
        <Text dimColor>
          {hint}
        </Text>
      </Box>
    )
  })

  // 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 note = '…'
    return (
      <Box flexDirection="column">
        <Text>
          <Text bold color="warning">
            {"Advisor: "}
          </Text>
          {note}
        </Text>
        <Box>
          <Button label="✓ Send with next prompt" />
          <Text>
            {" "}
          </Text>
          <Button label="✓ Ignore" />
        </Box>
        {await next(e)}
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const fired = '…'
    const model = '…'
    await $.ui.toast(`agent-cockpit TTSR: ${fired}`)
    await $.ui.toast(`Advisor: no price for ${model}; spend estimated at the highest known rate (set advisor.prices in config)`)
    return next(e)
  })
}

Mod 自身のコード

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

plugins/agent-cockpit/hooks/register.tsx 707〜857 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: PANE_ID }, async ($, e) => {
    if (e.surface === 'mobile') {
      const { Text } = $.ui.resolve(e)
      return <Text>dgs settings need a terminal or desktop session (pickers and inputs).</Text>
    }
    const { Box, Button, Input, Select, Text } = $.ui.resolve(e)
    const tab: Tab = (await $.state.get(PANE_TAB)).value ?? 'statusline'
    const scope = (await $.state.get(PANE_SCOPE)).value ?? 'global'
    const error = (await $.state.get(PANE_ERROR)).value
    const themeGroup = (await $.state.get(PANE_THEME_GROUP)).value
    const hint = hintFor((await $.state.get(PANE_FOCUS)).value ?? undefined)
    let snap: Snapshot
    try {
      snap = await snapshot($)
    } catch (err) {
      return <Text>agent-cockpit: settings unavailable ({errText(err)})</Text>
    }
    const targets = await paneTargets($, snap)
    const rows = paneRows(tab, snap, await storeValues($))
    const builtin = await builtinThemes($)
    const themes = listThemes(builtin, snap.themeSpecs)
    const statusline = sanitizeStatusline(snap.config.statusline).config
    // The preview stops a cell short of the pane's frame.
    const columns = e.props.bodyColumns === undefined ? undefined : e.props.bodyColumns - 1
    const extra = await paneExtras($, tab, snap, statusline, builtin, e, columns)
    const groups = paneGroups(settingsFor(tab))
    const lw = labelWidth(groups.flatMap(g => g.settings))
    const rowOf = new Map(rows.map(r => [r.setting.key, r]))

    const control = (s: Setting, value: unknown) => {
      const key = `set-${s.key}`
      switch (s.kind) {
        case 'bool':
          return <Button key={key} label={value ? '[x] on' : '[ ] off'} plain onPress={() => writeSetting($, s, !value)} />
        case 'enum':
          return (
            <Select key={key} options={s.options.map(o => ({ value: o }))} value={String(value)} onSelect={(v: string) => writeSetting($, s, v)} />
          )
        case 'theme': {
          // Two steps: a family, then a theme in it (a Select takes at most SELECT_MAX options).
          const groups = themeGroups(themes.includes(String(value)) ? themes : [String(value), ...themes])
          const group = groups.find(g => g.label === themeGroup) ?? groups.find(g => g.names.includes(String(value))) ?? groups[0]
          return (
            <Box key={key + '-box'} gap={1}>
              <Text dimColor>family</Text>
              <Select
                key={`${key}-group`}
                options={groups.slice(0, SELECT_MAX).map(g => ({ value: g.label }))}
                value={group?.label}
                onSelect={(v: string) => $.state.set(PANE_THEME_GROUP, v)}
              />
              <Text dimColor>theme</Text>
              <Select
                key={key}
                options={(group?.names ?? [String(value)]).map(o => ({ value: o }))}
                value={group?.names.includes(String(value)) ? String(value) : undefined}
                onSelect={(v: string) => writeSetting($, s, v)}
              />
            </Box>
          )
        }
        case 'stringList':
          return (
            <Input
              key={key}
              value={Array.isArray(value) ? value.join(', ') : ''}
              onSubmit={(v: string) => writeSetting($, s, parseListInput(v))}
            />
          )
        default:
          return <Input key={key} value={value === undefined ? '' : String(value)} onSubmit={(v: string) => writeSetting($, s, v)} />
      }
    }

    // The segment table: every segment, on or off, its side and its order.
    const lists: SegmentLists = { left: statusline.left, right: statusline.right }
    const segOrigin = rows.find(r => r.setting.kind === 'segments' && r.origin !== 'default')?.origin
    const segmentTable = (
      <Box key="group-segments" flexDirection="column">
        <Box gap={1}>
          <Text bold color="suggestion">Segments</Text>
          {segOrigin ? <Text dimColor>{`· ${segOrigin}`}</Text> : null}
          {segOrigin ? <Button key="reset-segments" label="reset" plain onPress={() => resetSegments($)} /> : null}
        </Box>
        {segmentRows(lists).map(r => (
          <Box key={`segrow-${r.id}`} gap={1}>
            <Box width={lw}>
              <Text dimColor={r.side === null}>{r.id}</Text>
            </Box>
            <Button key={`seg-on-${r.id}`} label={r.side ? '[x]' : '[ ]'} plain onPress={() => writeSegments($, segmentToggle(lists, r.id))} />
            {r.side ? <Button key={`seg-side-${r.id}`} label={r.side} plain onPress={() => writeSegments($, segmentSide(lists, r.id))} /> : null}
            {r.side ? <Button key={`seg-up-${r.id}`} label="↑" plain onPress={() => writeSegments($, segmentMove(lists, r.id, 'up'))} /> : null}
            {r.side ? <Button key={`seg-down-${r.id}`} label="↓" plain onPress={() => writeSegments($, segmentMove(lists, r.id, 'down'))} /> : null}
          </Box>
        ))}
      </Box>
    )

    return (
      <Box flexDirection="column">
        <Box gap={1}>
          {TABS.map((t, i) => (
            <Button
              key={`tab-${t.id}`}
              hotkey={String(i + 1)}
              label={t.label}
              variant={t.id === tab ? 'primary' : undefined}
              onPress={() => $.state.set(PANE_TAB, t.id)}
            />
          ))}
        </Box>
        <Box gap={1}>
          <Text dimColor>write to</Text>
          <Button key="scope-global" label="Global" variant={scope === 'global' ? 'primary' : undefined} onPress={() => setScope($, 'global')} />
          <Button
            key="scope-project"
            label="This project"
            dimColor={!targets.project}
            variant={scope === 'project' ? 'primary' : undefined}
            onPress={() => setScope($, 'project')}
          />
          <Text dimColor>{(scope === 'project' ? targets.project : targets.global) ?? ''}</Text>
        </Box>
        {extra}
        {groups.map((g, gi) => (
          <Box key={`group-${gi}`} flexDirection="column">
            {g.title ? <Text bold color="suggestion">{g.title}</Text> : null}
            {g.settings.map(setting => {
              const row = rowOf.get(setting.key)
              const isSet = row !== undefined && row.origin !== 'default'
              return (
                <Box key={`row-${setting.key}`} flexDirection="column">
                  <Box gap={1}>
                    <Box width={lw}>
                      <Text>{setting.label}</Text>
                    </Box>
                    {control(setting, row?.value)}
                    {isSet ? <Text dimColor>{`· ${row.origin}`}</Text> : null}
                    {isSet ? <Button key={`reset-${setting.key}`} label="reset" plain onPress={() => resetSetting($, setting)} /> : null}
                  </Box>
                  {error?.key === setting.key ? <Text color="red">{error.text}</Text> : null}
                </Box>
              )
            })}
            {tab === 'statusline' && g.title === 'Look' ? segmentTable : null}
          </Box>
        ))}
        {hint ? <Text dimColor>{hint}</Text> : null}
      </Box>
    )
  })
plugins/agent-cockpit/hooks/register.tsx 476〜542 行 · ペイン
async function paneExtras(
  $: EngineInterface,
  tab: Tab,
  snap: Snapshot,
  statusline: StatuslineConfig,
  builtin: Record<string, Record<string, string>>,
  e: Parameters<EngineInterface['ui']['resolve']>[0],
  columns: number | undefined,
) {
  const { Box, Button, Text } = $.ui.resolve(e)
  if (tab === 'statusline') {
    const resolved = resolveTheme(statusline.theme, builtin, snap.themeSpecs)
    const warnings = [...sanitizeStatusline(snap.config.statusline).warnings, ...resolved.warnings]
    for (const w of warnings) warnOnce($, w)
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" flexWrap="nowrap" overflow="hidden">
          {(() => {
            const { left, middle, right } = statusSpans(PREVIEW_DATA, statusline, resolved.theme, columns)
            return [...left, ...middle, ...right].map(s => (
              <Text color={s.color} backgroundColor={s.backgroundColor} wrap="truncate">
                {s.text}
              </Text>
            ))
          })()}
        </Box>
        {warnings.map(w => (
          <Text color="yellow">{`⚠ ${w}`}</Text>
        ))}
      </Box>
    )
  }
  if (tab === 'rules') {
    const disabledSetting = SETTINGS.find(s => s.key === 'rules.disabled') as Setting
    const disabled = snap.config.rules.disabled
    return (
      <Box flexDirection="column">
        {rulesRows(snap.allRules, snap.config.rules).map(r => (
          <Box key={`rulerow-${r.name}`} gap={1}>
            <Button
              key={`rule-${r.name}`}
              label={r.disabled ? '[ ]' : '[x]'}
              plain
              onPress={() =>
                writeSetting($, disabledSetting, disabled.includes(r.name) ? disabled.filter(n => n !== r.name) : [...disabled, r.name])
              }
            />
            <Text dimColor={r.disabled}>{`${r.name}  ${r.kind} · ${r.source}`}</Text>
          </Box>
        ))}
      </Box>
    )
  }
  if (tab === 'advisor') {
    const session = (await $.state.get(SESSION_USD)).value ?? 0
    const total = await $.store.get('advisor.totalUsd')
    const lastError = (await $.state.get(LAST_ERROR)).value
    return (
      <Box gap={1}>
        <Text>{`spent: session $${session.toFixed(3)}, total $${(typeof total === 'number' ? total : 0).toFixed(3)}`}</Text>
        <Button key="advisor-reset-spend" label="Reset spend" onPress={() => $.store.set('advisor.totalUsd', 0)} />
        {lastError ? <Text color="red">{`last review failed: ${lastError}`}</Text> : null}
      </Box>
    )
  }
  return null
}
plugins/agent-cockpit/hooks/register.tsx 879〜913 行 · バンド
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (e.props.hasSurvey) return next(e)
    let status = null
    try {
      status = await statusRow($, e, e.props.bodyColumns)
    } catch (err) {
      warnOnce($, `status line not drawn (${errText(err)})`)
    }
    const note = (await $.state.get(NOTE)).value
    if (!note) return status ?? next(e)
    const decision = (await $.state.get(DECISION)).value ?? 'accept'
    const { Box, Button, Text } = $.ui.resolve(e)
    return (
      <Box flexDirection="column">
        {status}
        <Text>
          <Text bold color="warning">Advisor: </Text>
          {note}
        </Text>
        <Box>
          <Button
            key="advisor-accept"
            label={decision === 'accept' ? '✓ Send with next prompt' : 'Send with next prompt'}
            onPress={() => $.state.set(DECISION, 'accept')}
          />
          <Text> </Text>
          <Button
            key="advisor-ignore"
            label={decision === 'ignore' ? '✓ Ignore' : 'Ignore'}
            onPress={() => $.state.set(DECISION, 'ignore')}
          />
        </Box>
      </Box>
    )
  })
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Daniel Santana

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

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。plugins/agent-cockpit/hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。17 ファイルを解析
コードが 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 のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。ast-grep, git(通信する)
読んで送るファイルや環境変数を読み、かつ通信するか。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 dgsantana/claude-mods
/plugin install agent-cockpit@dgsantana

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン