modscode / 図鑑 / clawd-sidekick
clawd-sidekick
Clawd's pixel world above your prompt, in four scenes that follow your local time, season and holidays: Clawd walks to the zone of whatever Claude is doing while his crew plays, and acts out what happens: tests, commits, pushes, permission…
何をするか
- プロンプトの上の帯・欄を描く
- /clawd・/deadline を足す
- ツールの呼び出しを見張る
- classic.Notification・command.describe・session.compact・session.end ほか 4 個にフックする
- ターンをまたいで自分の状態を持つ
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like clawd-sidekick by Tunai (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/tunai-0511-clawd-sidekick/
// 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 label = '…'
const gitLine = '…'
const map = '…'
const model = '…'
const bar = '…'
const contextPercent = '…'
const fiveHour = '…'
const sevenDay = '…'
const usd = '…'
const turn = '…'
const clockText = '…'
const tools = '…'
const edited = '…'
const files = '…'
const ran = '…'
const commands = '…'
const noDeadline = '…'
const list = '…'
const pet = '…'
const scene = '…'
const otherLanguage = '…'
const hide = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row" flexWrap="wrap" columnGap={2}>
<Text color="#D97757" bold wrap="truncate-end">
{`「${label}」`}
</Text>
<Text>
{gitLine}
</Text>
<Text>
<Text dimColor>
{`${label} `}
</Text>
<Text>
{map}
</Text>
</Text>
<Text dimColor>
{model}
</Text>
<Text>
<Text dimColor>
{`${label} `}
</Text>
<Text>
{`${bar} ${contextPercent}%`}
</Text>
</Text>
<Text>
<Text dimColor>
{`${label} `}
</Text>
<Text>
{`${fiveHour}%`}
</Text>
</Text>
<Text>
<Text dimColor>
{`${label} `}
</Text>
<Text>
{`${sevenDay}%`}
</Text>
</Text>
<Text>
<Text dimColor>
{`${label} `}
</Text>
<Text>
{usd}
</Text>
</Text>
<Text>
<Text dimColor>
{`${turn} `}
</Text>
{clockText}
<Text dimColor>
{` · ${tools} `}
</Text>
{tools}
<Text dimColor>
{` · ${edited} `}
</Text>
{files}
<Text dimColor>
{` · ${ran} `}
</Text>
{commands}
</Text>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={1}>
<Text dimColor>
{noDeadline}
</Text>
<Box flexGrow={1} />
<Button label={`${list}`} hotkey="l" />
<Button label={`${pet}`} />
<Button label={`${scene}`} hotkey="s" />
<Button label={`${otherLanguage}`} />
<Button label={`${hide}`} plain dimColor />
</Box>
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "‹paneTitle›" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text } = $.ui.resolve(e)
const changesTitle = '…'
const changesNone = '…'
const notARepo = '…'
const changesFiles = '…'
const changesThisTurn = '…'
const relativePath = '…'
const added = '…'
const removed = '…'
const edits = '…'
const relativePath2 = '…'
const relativePath3 = '…'
const changesCommands = '…'
const text = '…'
const text2 = '…'
const text3 = '…'
return (
<Box flexDirection="column" gap={1}>
<Text color="#D97757" bold>
{`── ${changesTitle} ──`}
</Text>
<Text>
{changesNone}
</Text>
<Text dimColor>
{notARepo}
</Text>
<Box flexDirection="column">
<Text bold>
{`${changesFiles} `}
<Text color="#D97757">
{changesThisTurn}
</Text>
</Text>
<Box flexDirection="row" gap={1}>
<Text color="#D97757">
●
</Text>
<Text wrap="truncate-start">
{relativePath}
</Text>
<Text color="#4CB363">
new
</Text>
<Text color="#4CB363">
{`+${added}`}
</Text>
<Text color="#E5484D">
{`−${removed}`}
</Text>
<Text dimColor>
{`×${edits}`}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text color="#D97757">
●
</Text>
<Text wrap="truncate-start">
{relativePath2}
</Text>
<Text color="#4CB363">
new
</Text>
<Text color="#4CB363">
{`+${added}`}
</Text>
<Text color="#E5484D">
{`−${removed}`}
</Text>
<Text dimColor>
{`×${edits}`}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text color="#D97757">
●
</Text>
<Text wrap="truncate-start">
{relativePath3}
</Text>
<Text color="#4CB363">
new
</Text>
<Text color="#4CB363">
{`+${added}`}
</Text>
<Text color="#E5484D">
{`−${removed}`}
</Text>
<Text dimColor>
{`×${edits}`}
</Text>
</Box>
</Box>
<Box flexDirection="column">
<Text bold>
{changesCommands}
</Text>
<Box flexDirection="row" gap={1}>
<Text color="#D97757">
●
</Text>
<Text color="#4CB363">
✓
</Text>
<Text wrap="truncate-end">
{text}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text color="#D97757">
●
</Text>
<Text color="#4CB363">
✓
</Text>
<Text wrap="truncate-end">
{text2}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
<Text color="#D97757">
●
</Text>
<Text color="#4CB363">
✓
</Text>
<Text wrap="truncate-end">
{text3}
</Text>
</Box>
</Box>
</Box>
)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/register.tsx 895〜1054 行 · バンド
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
if (e.props.hasSurvey) return next(e)
const [doing, deadlines, isCollapsed, actors, usage, game, offset, talk, theme, zone, seasonPick, holidayPick, trophies, neighbors, egg, birthday, names, git] = await Promise.all([
read($, activity),
read($, deadlinesAtom),
read($, collapsedAtom),
read($, actorsAtom),
read($, usageAtom),
read($, gameAtom),
read($, offsetAtom),
read($, langAtom),
read($, themeAtom),
read($, zoneAtom),
read($, seasonPickAtom),
read($, holidayPickAtom),
read($, trophiesAtom),
read($, neighborsAtom),
read($, eggAtom),
read($, birthdayAtom),
read($, namesAtom),
read($, gitAtom),
read($, nowAtom),
])
const w = say(talk)
const now = await $.clock.now()
const ahead = deadlines.filter(d => d.due > now - 86_400_000)
const nearest = ahead[0]
const { Box, Text, Button } = $.ui.resolve(e)
const width = e.props.bodyColumns
// The terminal folds the band when the house cannot fit; the desktop scales it instead.
const isCramped = e.surface === 'terminal' && (width < 70 || e.props.maxRows < SH / 2 + 3)
const main = actors.find(a => a.cap === null)
const langButton = <Button key="lang" label={w.otherLanguage} onPress={() => setLang($, talk === 'zh' ? 'en' : 'zh')} />
if (isCollapsed || isCramped) {
const now_ = doing.label && doing.label !== w.sleepy ? doing.label : w.doings[main?.doing ?? 'idle']
const summary = [`${names.main ?? 'Clawd'} · ${now_}`]
if (nearest !== undefined) summary.push(w.due(nearest.title, countdown(nearest.due, now, talk)))
let face: RenderElement
if (e.surface === 'terminal') {
face = <Text color={ORANGE}>▐▛███▜▌</Text>
} else {
const { Svg } = $.ui.resolve(e)
face = <Svg source={miniClawdSvg(main?.doing ?? 'idle')} alt="Clawd" width={36} height={24} />
}
return (
<Box flexDirection="row" gap={1} alignItems="center">
{face}
<Text wrap="truncate-end">{summary.join(' · ')}</Text>
<Box flexGrow={1} />
{isCollapsed ? <Button key="expand" label={w.expand} variant="primary" onPress={() => setCollapsed($, false)} /> : null}
{e.surface === 'terminal' ? null : langButton}
</Box>
)
}
const holiday = holidayPick !== 'auto' ? holidayPick : holidayOf(now, offset)
const scene: SceneProps = {
actors,
// The board pins every deadline ahead, nearest first; the hour is fine enough.
notes: ahead.slice(0, 8).map(d => ({ text: `${d.title} · ${countdown(d.due, now, talk, true)}`, urgency: urgency(d.due, now) })),
days: nearest === undefined ? null : Math.max(0, Math.floor((nearest.due - now) / 86_400_000)),
urgency: nearest === undefined ? 'none' : urgency(nearest.due, now),
game,
time: timeOfDay(now, offset),
// To the hour only: a minute's change would redraw the desktop house and start its loops over.
deadline: nearest === undefined ? '' : `${nearest.title} · ${formatDue(nearest.due, offset)} · ${countdown(nearest.due, now, talk, true)}`,
lang: talk,
theme,
memory: usage.contextPercent === null ? null : Math.min(10, Math.floor(usage.contextPercent / 10)),
isTired: (usage.fiveHour ?? 0) >= 80,
season: seasonPick !== 'auto' ? seasonPick : seasonOf(now, offset, zone),
holiday,
medals: medalsOf(trophies.unlocked),
trophyCount: [Object.keys(trophies.unlocked).length, TROPHY_TOTAL],
// A holiday's hat stands in for the trophy hat, unless one was picked by hand.
hat: trophies.hat === 'auto' && (holiday === 'christmas' || holiday === 'halloween') ? null : hatFor(trophies),
pal: palFor(trophies),
golden: goldenOf(trophies.unlocked),
egg,
isBirthday: birthday !== '' && monthDay(now, offset) === birthday,
names,
}
let house: RenderElement
if (e.surface === 'terminal') {
const { Client } = $.ui.resolve(e)
house = <Client key="house" module="./scene-client.tsx" props={scene} width="100%" height={SH / 2 + 1} />
} else {
const { Svg } = $.ui.resolve(e)
const frame = Math.round(width * CELL_PX)
house = (
<Svg
source={sceneSvg(scene, now)}
alt={w.houseAlt(doing.label || w.readingInLibrary)}
isInteractive
width={frame}
height={Math.round((frame * SH) / SW)}
/>
)
}
const level = (percent: number | null): string | undefined =>
percent === null ? undefined : percent >= 80 ? '#E5484D' : percent >= 50 ? '#F5C542' : '#4CB363'
const bar = (percent: number): string => {
const filled = Math.round(percent / 20)
return '▰'.repeat(filled) + '▱'.repeat(5 - filled)
}
const elapsed = isWorking ? now - usage.turnStartedAt : lastTurnMs
const clockText = `${Math.floor(elapsed / 60_000)}:${String(Math.floor((elapsed % 60_000) / 1000)).padStart(2, '0')}`
const stat = (label: string, value: string, color?: string): RenderElement => (
<Text>
<Text dimColor>{`${label} `}</Text>
<Text color={color}>{value}</Text>
</Text>
)
return (
<Box flexDirection="column">
{house}
<Box flexDirection="row" flexWrap="wrap" columnGap={2}>
<Text color={ORANGE} bold wrap="truncate-end">
{`「${doing.label || (isWorking ? w.thinking : w.hello)}」`}
</Text>
{git === null ? null : (
<Text color={gitColor(git, dirtySince, now)} dimColor={gitColor(git, dirtySince, now) === undefined}>
{w.gitLine(git.branch, git.ahead, git.behind, git.changed + git.untracked)}
</Text>
)}
{neighbors.length === 0 ? null : stat(w.neighborsLabel, neighbors.map(n => n.project).join(talk === 'zh' ? '、' : ', '))}
{usage.model ? <Text dimColor>{usage.model}</Text> : null}
{usage.contextPercent === null ? null : stat('ctx', `${bar(usage.contextPercent)} ${Math.round(usage.contextPercent)}%`, level(usage.contextPercent))}
{usage.fiveHour === null ? null : stat('5h', `${Math.round(usage.fiveHour)}%`, level(usage.fiveHour))}
{usage.sevenDay === null ? null : stat('7d', `${Math.round(usage.sevenDay)}%`, level(usage.sevenDay))}
{usage.usd === null ? null : stat('$', usage.usd.toFixed(2))}
{/* One group, so it reads as one thing: how long Claude has been on your latest message (or took on the last), and what it did there. */}
<Text>
<Text dimColor>{`${isWorking ? w.turn : w.lastTurn} `}</Text>
{clockText}
<Text dimColor>{` · ${w.tools} `}</Text>
{String(usage.tools)}
<Text dimColor>{` · ${w.edited} `}</Text>
{w.files(usage.edits)}
<Text dimColor>{` · ${w.ran} `}</Text>
{w.commands(usage.runs)}
</Text>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={1}>
{nearest === undefined ? <Text dimColor>{w.noDeadline}</Text> : (
<Text color={URGENCY_COLOR[urgency(nearest.due, now)]} wrap="truncate-end">
{` ${w.due(clip(nearest.title, 10), countdown(nearest.due, now, talk))}`}
</Text>
)}
<Box flexGrow={1} />
<Button key="panel" label={w.list} hotkey="l" onPress={() => $.ui.open({ id: PANE, title: w.paneTitle })} />
{e.surface === 'terminal' ? null : <Button key="pet" label={w.pet} onPress={() => onPet($, 'main')} />}
<Button key="scene" label={w.scene(w.themes[theme])} hotkey="s" onPress={() => setTheme($, 'next')} />
{langButton}
<Button key="hide" label={w.hide} plain dimColor onPress={() => setCollapsed($, true)} />
</Box>
</Box>hooks/register.tsx 1258〜1298 行 · ペイン
on('ui.render', { component: 'Pane', requestId: CHANGES_PANE }, async ($, e) => {
const [talk, changes, git] = await Promise.all([read($, langAtom), read($, changesAtom), read($, gitAtom)])
const root = await $.session.root()
const w = say(talk)
const { Box, Text } = $.ui.resolve(e)
const sum = totals(changes)
return (
<Box flexDirection="column" gap={1}>
<Text color={ORANGE} bold>{`── ${w.changesTitle} ──`}</Text>
<Text>{sum.files + sum.commands === 0 ? w.changesNone : w.changesSummary(sum.files, sum.added, sum.removed, sum.commands, sum.failed)}</Text>
<Text dimColor>{git === null ? w.notARepo : w.gitLine(git.branch, git.ahead, git.behind, git.changed + git.untracked)}</Text>
{changes.files.length === 0 ? null : (
<Box flexDirection="column">
<Text bold>{`${w.changesFiles} `}<Text color={ORANGE}>{w.changesThisTurn}</Text></Text>
{changes.files.map(f => (
<Box key={f.path} flexDirection="row" gap={1}>
<Text color={ORANGE}>{f.turn === changes.turn ? '●' : ' '}</Text>
<Text wrap="truncate-start">{relativePath(f.path, root)}</Text>
{f.isNew ? <Text color="#4CB363">new</Text> : null}
<Text color="#4CB363">{`+${f.added}`}</Text>
<Text color="#E5484D">{`−${f.removed}`}</Text>
<Text dimColor>{`×${f.edits}`}</Text>
</Box>
))}
</Box>
)}
{changes.commands.length === 0 ? null : (
<Box flexDirection="column">
<Text bold>{w.changesCommands}</Text>
{changes.commands.slice(0, 15).map((c, i) => (
<Box key={`cmd-${i}`} flexDirection="row" gap={1}>
<Text color={ORANGE}>{c.turn === changes.turn ? '●' : ' '}</Text>
<Text color={c.isOk ? '#4CB363' : '#E5484D'}>{c.isOk ? '✓' : '✗'}</Text>
<Text wrap="truncate-end">{c.text}</Text>
</Box>
))}
</Box>
)}
</Box>
)
})ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Tunai 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.
コードが呼ぶもの
プログラム起動ファイル読み取り環境変数ツール呼び出し保存
コードから読めること
2026-10-06 に読んだコミット 95f98a651fe1 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。19 ファイルを解析 |
| コードが 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/… などは無い)。hooks/register.tsx:851 /usr/bin/defaults(Windows にない); hooks/register.tsx:1462 /bin/date(Windows にない) |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。readlink, git(通信する), /usr/bin/defaults, /bin/date |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。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 Tunai-0511/clawd-sidekick/plugin install clawd-sidekick@clawd-sidekick入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(95f98a651fe1)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「tunai-0511-clawd-sidekick」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…Fix loginRemoveCopy markdownacme/app · mainCopy linkCopy markdownbuild2h 10mbuild2h 10mbuild2h 10mHosted on uploads.sh, not committed to the repo.They will appear in a comment on the pull request once opened.
-
何をするか
- プロンプトの上の帯・欄を描く
- /progress を足す
- ツールの呼び出しを見張る(止めることがある)
- classic.SessionStart・prompt.compose・prompt.submit・session.start ほか 2 個にフックする
-
Claude に頼む…Skins0 Your promptadd rate limiting to the hub api0 Tool rows: finished, running, failedYour prompt Spinner0 Folded group of reads and searches●main · note 3 · note 3 · note 30 Edit diff cardDesktop only; the terminal keeps Claude Code's diff.0 Shell output cardDesktop only.0 Code block cardDesktop only; the terminal keeps Claude Code's markdown.0 TableAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopy0 SpinnerAccent SpinnerSpinnerSpinner… 2h 10m0 Band above the prompt: normal, then nudging to compact█████░░░ 42% build█████░░░ 42% build█████░░░ 42% buildContext is 42% full0 Compact now0 Band above a questionTable BashBashBash0 Turn footer (terminal)3 build in 2h 10m · Grep · +3 −3
-
spending-effort-with-jev: no TypeSafe API key, so effort tips are off. Set it in /plugin.⚠ effort: long run, fuzzy spec → have Claude interview you, then go maxClaude に頼む…
-
✦ explain as pick how Claude answers×3 ● build3 ● build3 ● build▸ VideoClaude に頼む…
-
Claude に頼む…Clawd's shopLevel 3 · Fix loginTinkerer1 coin per 12.4 tokens Claude writes, 100 per level, 25 per badgeTake everything offContextbuildLevel 3buildLevel 3buildLevel 3ContextbuildLevel 3buildLevel 3buildLevel 3ContextbuildLevel 3buildLevel 3buildLevel 3