clawd-bar
Clawd, Claude Code's crab, lives in a band above your prompt: he acts out the session, shows what's running, your context and usage limits, and races your CI builds. Unofficial fan mod.
何をするか
- プロンプトの上の帯・トーストを描く
- /clawd・/ci を足す
- Bash・PowerShell・TodoWrite・TaskCreate の呼び出しを見張る(止めることがある)
- classic.Elicitation・classic.Notification・classic.PostCompact・classic.PostToolUse ほか 12 個にフックする
- ターンをまたいで自分の状態を持つ
良いところ
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like clawd-bar by KaiC5504 (band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/kaic5504-clawd-bar/
// 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, Svg, Text } = $.ui.resolve(e)
const source = '…'
const label = '…'
const name = '…'
const percent = '…'
const name2 = '…'
const percent2 = '…'
const name3 = '…'
const percent3 = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row" alignItems="center">
<Svg source={`${source}`} alt={`${label}`} height={48} isInteractive />
<Box flexDirection="row" marginLeft={2} flexShrink={0}>
<Box flexDirection="column" marginRight={2} flexShrink={0}>
<Text dimColor>
{name}
</Text>
<Text>
<Text>
▊▊▊▊▊▊▊▊
</Text>
<Text>
▊▊▊▊▊▊▊▊
</Text>
<Text>
▊▊▊▊▊▊▊▊
</Text>
{" "}
<Text bold>
{percent}
%
</Text>
</Text>
<Text dimColor>
{" "}
</Text>
</Box>
<Box flexDirection="column" marginRight={2} flexShrink={0}>
<Text dimColor>
{name2}
</Text>
<Text>
<Text>
▊▊▊▊▊▊▊▊
</Text>
<Text>
▊▊▊▊▊▊▊▊
</Text>
<Text>
▊▊▊▊▊▊▊▊
</Text>
{" "}
<Text bold>
{percent2}
%
</Text>
</Text>
<Text dimColor>
{" "}
</Text>
</Box>
<Box flexDirection="column" marginRight={2} flexShrink={0}>
<Text dimColor>
{name3}
</Text>
<Text>
<Text>
▊▊▊▊▊▊▊▊
</Text>
<Text>
▊▊▊▊▊▊▊▊
</Text>
<Text>
▊▊▊▊▊▊▊▊
</Text>
{" "}
<Text bold>
{percent3}
%
</Text>
</Text>
<Text dimColor>
{" "}
</Text>
</Box>
</Box>
<Text dimColor>
│
│
│
</Text>
<Box flexDirection="column" marginLeft={1} flexGrow={1} flexShrink={1} minWidth={0} />
</Box>
{await next(e)}
</Box>
)
})
on('session.start', async ($, e, next) => {
await $.ui.toast(`Clawd on Desk put its per-event hooks back. In Clawd on Desk, open Settings → Agents, turn off "Manage Claude hooks aut…`)
await $.ui.toast(`clawd-bar can't watch Codemagic without a token: set CODEMAGIC_API_TOKEN or write it to ~/.codemagic-token.`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/register.tsx 771〜771 行 · バンド
on('ui.render', { component: 'AbovePrompt' }, ($, e, next) => drawBand($, e as never, next as never) as never)hooks/register.tsx 650〜758 行 · バンド
async function drawBand($: EngineInterface, e: BandEvent, next: (e: BandEvent) => unknown) {
if (e.props.hasSurvey || !settings.isPetOn || (await read($, isHidden))) {
stopAnimation()
return next(e)
}
isEngineWorking = e.props.isWorking
const now = await $.clock.now()
const isTerminal = e.surface === 'terminal'
if (isTerminal) await read($, second)
else await read($, demoStep)
if (isTerminal) await read($, barFrame)
const scene = demoStartedAt === null ? null : demoScene(now - demoStartedAt, now)
const view = scene ? (scene.ci ?? null) : settings.isCiOn ? ((await read($, ciView)) ?? (await loadView(hostFrom($)))) : null
const ci = scene || settings.isCiOn ? ciShown(view, now) : null
const shownVisual = await read($, visual)
const shownPet = await read($, pet)
const session: SessionShown = scene?.session ?? {
...shownVisual,
activity: await read($, activity),
subagents: shownPet.subagents.length,
place: await read($, place),
}
const act = ci?.act ?? session.act
if (act === 'working' && lastAct !== 'working') cabinetSpell++
lastAct = act
const work: Work | null = (scene ? scene.work : shownPet.work) ?? null
const extras: Extras = ci
? {}
: {
sweat: (scene ? scene.sweat : shownVisual.isSweating) === true,
planes: session.subagents,
...(work ? { work } : {}),
...(act === 'working' ? { game: Math.max(0, cabinetSpell) % CABINET_GAMES } : {}),
}
const playKey = CALL_ACTS.has(act) && work ? `${act}:${work.id}` : act
const usage = scene ? null : await $.session.usage().then(u => u, () => null)
const meterList: Meter[] = scene ? scene.meters : usage ? meters(usage, now) : []
hasClock = scene !== null || ci !== null || session.activity.turnStartedAt !== null
// A live race's lanes move every second; on the desktop that's the one redraw a second worth its rebuild.
if (!isTerminal && ci?.run) await read($, second)
const columns = e.props.bodyColumns
const clawdCols = isTerminal ? CLAWD_COLS : DESKTOP_CLAWD_COLS
const boxCols = isTerminal ? 1 : DESKTOP_BOX_COLS
const fit = fitBand(columns, clawdCols, meterList, 10, boxCols, !isTerminal)
const textWidth = Math.max(10, columns - clawdCols - GAP - (fit.gauges ? fit.width + 2 : 0))
const els = $.ui.resolve(e) as never as { Box: any; Text: any; Client?: any }
const { Box, Client } = els
const turnStartedAt = session.activity.turnStartedAt
const turnClock =
!isTerminal && Client && turnStartedAt !== null ? (
<Client key="turn-clock" module="./ticker.tsx" props={{ elapsedMs: now - turnStartedAt }} />
) : undefined
const lines = ci ? ciLines(els, ci, view, now, textWidth) : sessionLines(els, session, now, turnClock)
// The terminal's bars move when their values change; the desktop's stand still, since a redraw there costs Clawd his frame.
if (isTerminal) {
bars.see(meterList, now)
barsShown = { meters: meterList, boxes: fit.boxes, look: barLook(meterList, fit.boxes, now) }
if (!barTimer && bars.isMoving(meterList, fit.boxes, now)) barTimer = $.clock.every(BAR_MS, () => void barTick($))
}
const paint = isTerminal ? (m: Meter, boxes: number) => bars.paint(m, boxes, now) : undefined
const right = [
<Box key="gauges" flexDirection="row" marginLeft={GAP} flexShrink={0}>
{gaugeColumns(els, meterList, fit, paint)}
</Box>,
fit.gauges ? divider(els) : null,
<Box key="lines" flexDirection="column" marginLeft={1} flexGrow={1} flexShrink={1} minWidth={0}>
{lines}
</Box>,
]
if (e.surface === 'terminal') {
const { Raster } = $.ui.resolve(e as never) as never as { Raster: any }
// A new label over the same act keeps its place in the loop; a new call starts its scene over.
if (!animation || animation.key !== playKey || animation.requestId !== e.requestId) {
stopAnimation()
animation = { key: playKey, act, startedAt: now, requestId: e.requestId, extras, painted: '' }
frameTimer = $.clock.every(FRAME_MS, () => void paintFrame($))
}
animation.extras = work ? { ...extras, lead: animation.startedAt - work.startedAt } : extras
animation.painted = cellsAt(animation, now)
return (
<Box flexDirection="row">
<Raster key={RASTER_KEY} columns={CLAWD_COLS} rows={CLAWD_ROWS} cells={animation.painted} />
{right}
</Box>
)
}
const { Svg } = $.ui.resolve(e as never) as never as { Svg: any }
const drawn = CALL_ACTS.has(act) && work ? JSON.stringify({ ...work, id: undefined, startedAt: undefined }) : `${extras.game ?? ''}`
const svgKey = `${act}:${extras.sweat ? 1 : 0}:${extras.planes ?? 0}:${drawn}`
const svg = svgs.get(svgKey) ?? svgFor(act, extras)
// Most recently used last, so the oldest goes first.
svgs.delete(svgKey)
svgs.set(svgKey, svg)
if (svgs.size > SVG_CACHE) svgs.delete(svgs.keys().next().value!)
if (desktopPlay?.key !== `${svgKey}:${playKey}`) desktopPlay = { key: `${svgKey}:${playKey}`, startedAt: now }
// Start the rebuilt frame where the loop already is, so a redraw doesn't send him back to the start.
const loop = svgLoopMs(act, extras)
const into = isOnce(act) ? Math.min(now - desktopPlay.startedAt, loop) : (now - desktopPlay.startedAt) % loop
const source = svg.replace('<style>', `<style>*{animation-delay:-${into}ms!important}`)
return (
<Box flexDirection="row" alignItems="center">
<Svg source={source} alt={session.label} width={SVG_HEIGHT * SVG_ASPECT} height={SVG_HEIGHT} isInteractive />
{right}
</Box>
)
}hooks/band.tsx 248〜276 行 · バンド
export function gaugeColumns(els: Els, meters: Meter[], fit: Fit, paint: (m: Meter, boxes: number) => BarPaint = stillBar) {
const { Box, Text } = els
if (!fit.gauges) return []
const paints = meters.map(m => paint(m, fit.boxes))
if (fit.isStacked) {
const column = (key: string, cell: (m: Meter, i: number) => unknown, marginRight = 1) => (
<Box key={key} flexDirection="column" marginRight={marginRight} flexShrink={0}>
{meters.map(cell)}
</Box>
)
return [
column('names', (m, i) => <Text key={i} dimColor>{m.name}</Text>),
fit.boxes > 0 ? column('bars', (_, i) => <Text key={i}>{bar(els, paints[i]!)}</Text>) : null,
column('percents', (m, i) => <Box key={i} justifyContent="flex-end">{percent(els, m, paints[i]!.isFlashing)}</Box>, meters.some(m => m.resetIn) ? 2 : GAP),
meters.some(m => m.resetIn) ? column('resets', (m, i) => <Text key={i} dimColor>{reset(m) || ' '}</Text>, GAP) : null,
]
}
return meters.map((m, i) => (
<Box key={`g${i}`} flexDirection="column" marginRight={GAP} flexShrink={0}>
<Text dimColor>{m.name}</Text>
<Text>
{fit.boxes > 0 ? bar(els, paints[i]!) : ''}
{fit.boxes > 0 ? ' ' : ''}
{percent(els, m, paints[i]!.isFlashing)}
</Text>
<Text dimColor>{reset(m) || ' '}</Text>
</Box>
))
}hooks/band.tsx 226〜238 行 · バンド
function bar({ Text }: Els, paint: BarPaint) {
const runs: { box: Paint; n: number }[] = []
for (const box of paint.boxes) {
const last = runs.at(-1)
if (last && last.box.color === box.color && last.box.isDim === box.isDim) last.n++
else runs.push({ box, n: 1 })
}
return runs.map(({ box, n }, i) => (
<Text key={i} color={box.color} dimColor={box.isDim}>
{BOX.repeat(n)}
</Text>
))
}hooks/band.tsx 240〜244 行 · バンド
const percent = ({ Text }: Els, m: Meter, isFlashing = false) => (
<Text bold inverse={isFlashing} color={m.percent >= 80 ? m.color : undefined}>
{m.percent}%
</Text>
)hooks/band.tsx 278〜282 行 · バンド
export const divider = ({ Text }: Els) => (
<Text key="divider" dimColor>
{'│\n│\n│'}
</Text>
)ライセンスの全文(MIT)
MIT License Copyright (c) 2026 KaiC5504 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 に読んだコミット 136c09b8e54a のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。25 ファイルを解析 |
| コードが 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:268 fetch(url); hooks/register.tsx:395 fetch(`http://127.0.0.1:${s.port}/health`) |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。hooks/register.tsx:150 実行時に決まるプログラム; hooks/register.tsx:209 実行時に決まるプログラム; hooks/register.tsx:269 実行時に決まるプログラム |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。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 KaiC5504/clawd-bar/plugin install clawd-bar@clawd-bar入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(136c09b8e54a)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「kaic5504-clawd-bar」をコードごと読んで、同じようなペインを作って似たデザイン
-
▴Token OptimizerCheckpointCheckpointCheckpointbuildStart freshbuildStart freshbuildStart freshbuildCheckpointCheckpointCheckpointCheckpointCheckpointCheckpointCheckpointCheckpointCheckpointbuildbuildbuildTokens savedSaved Clean up tokens in 30 days (chat 2 this session)Claude に頼む…
-
plan-progress is on. A bar appears when Claude starts a task with several steps.Claude に頼む…
-
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 個にフックする
-
pixel-pet: your theme no longer reads (3). Showing the slime.Claude に頼む…pixel-pet:
-
Contextchat 2Context42%Agentbuild42%Agentbuild42%Agentbuild42%Agent· Weekly· Weekly· Weekly⏳ AgentContext⏳ AgentContext⏳ Agent+3 more agents runningContextClaude に頼む…