claudagotchi
A tiny Claude to raise while you work: feed it your edits, play, clean, dress it up, watch it evolve.
何をするか
- 欄・プロンプトの上の帯・ステータス行・トーストを描く
- /pet を足す
- ツールの呼び出しを見張る(止めることがある)
- prompt.submit・session.end・session.start・turn.complete ほか 1 個にフックする
- ターンをまたいで自分の状態を持つ
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like claudagotchi by Syrul (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/syrul-claudagotchi/
// 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: "‹name›" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const name = '…'
const stage = '…'
const coins = '…'
const text = '…'
const label = '…'
const value = '…'
const label2 = '…'
const value2 = '…'
const label3 = '…'
const value3 = '…'
const label4 = '…'
const value4 = '…'
const label5 = '…'
const value5 = '…'
const tip = '…'
const poops = '…'
const icon = '…'
const text2 = '…'
const ago = '…'
const icon2 = '…'
const text3 = '…'
const ago2 = '…'
const icon3 = '…'
const text4 = '…'
const ago3 = '…'
return (
<Box flexDirection="column" gap={0}>
<Text>
<Text bold color="#D97757">
{name}
</Text>
{" "}
<Text dimColor>
{stage}
</Text>
{" "}
<Text color="#A78BFA">
▰▰▰▰▰▰▰▰
</Text>
<Text dimColor>
▱▱▱▱▱▱▱▱
</Text>
{" "}
<Text color="#E8B341" bold>
{"🪙 "}
{coins}
</Text>
</Text>
<Box borderStyle="round" borderColor="#E5484D" paddingX={1}>
<Text>
{text}
</Text>
</Box>
<Box flexDirection="row" gap={2} flexWrap="wrap">
<Box flexDirection="column">
<Text>
🍙
{" "}
{label}
{" "}
<Text color="#E5484D">
████████
</Text>
<Text dimColor>
░░░░░░░░
</Text>
{" "}
{value}
</Text>
<Text>
🎈
{" "}
{label2}
{" "}
<Text color="#E5484D">
████████
</Text>
<Text dimColor>
░░░░░░░░
</Text>
{" "}
{value2}
</Text>
<Text>
⚡
{" "}
{label3}
{" "}
<Text color="#E5484D">
████████
</Text>
<Text dimColor>
░░░░░░░░
</Text>
{" "}
{value3}
</Text>
</Box>
<Box flexDirection="column">
<Text>
🫧
{" "}
{label4}
{" "}
<Text color="#E5484D">
████████
</Text>
<Text dimColor>
░░░░░░░░
</Text>
{" "}
{value4}
</Text>
<Text>
💗
{" "}
{label5}
{" "}
<Text color="#E5484D">
████████
</Text>
<Text dimColor>
░░░░░░░░
</Text>
{" "}
{value5}
</Text>
<Text>
<Text color="#F0445C">
♥♥♥♥♥♥♥♥♡♡♡♡♡♡♡♡
</Text>
{" "}
<Text dimColor>
🤒 sick
</Text>
</Text>
</Box>
</Box>
<Text dimColor>
{tip}
</Text>
<Box flexDirection="row" flexWrap="wrap" gap={1}>
<Button label="🍙 Feed" hotkey="f" />
<Button label="🎮 Play" hotkey="p" />
<Button label={`🧹 Clean (${poops})`} hotkey="c" />
<Button label="🤲 Pet" hotkey="h" />
<Button label="💤 Sleep" hotkey="s" />
<Button label="💊 Heal" hotkey="m" variant="primary" />
<Button label="🛍️ Shop" hotkey="b" />
<Button label="👒 Closet" hotkey="k" />
<Button label="📊" hotkey="i" />
</Box>
<Box flexDirection="column">
<Text dimColor bold>
Fresh from your work
</Text>
<Text dimColor wrap="truncate-end">
{icon}
{" "}
{text2}
{" · "}
{ago}
</Text>
<Text dimColor wrap="truncate-end">
{icon2}
{" "}
{text3}
{" · "}
{ago2}
</Text>
<Text dimColor wrap="truncate-end">
{icon3}
{" "}
{text4}
{" · "}
{ago3}
</Text>
</Box>
</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 kaomoji = '…'
const name = '…'
const map = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row" gap={1} flexWrap="wrap">
<Text color="#D97757">
{kaomoji}
{" "}
{name}
{" "}
{map}
</Text>
<Button label="🍙 Feed" hotkey="f" />
<Button label="🧹 Clean" hotkey="c" />
<Button label="💊 Heal" hotkey="m" />
<Button label="💤 Nap" hotkey="s" />
<Button label="🤲 Pet" hotkey="h" />
<Button label="Open" hotkey="o" dimColor />
<Button label="Later" hotkey="l" dimColor />
</Box>
{await next(e)}
</Box>
)
})
on('session.start', async ($, e, next) => {
const name = '…'
const warmth = '…'
const text = '…'
await $.ui.status(`🥚 ${name} · warmth ${warmth}/12`)
await $.ui.toast(`${name}: ${text}`)
await $.ui.toast(`🥚 You found an egg! Type /pet to meet it.`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/register.tsx 797〜831 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const game = await read($, gameAtom)
const settings = await read($, settingsAtom)
const now = Date.now()
const pet = game.pet ?? newPet(now)
const { anim, speech } = live(game.ui, now)
const isFresh = anim.kind !== 'none'
const face = faceOf(pet, anim.kind)
const ui: Ui = { ...game.ui, speech }
const press = (key: string) => () => dispatch($, key)
const renameTo = (name: string) => rename($, name)
const columns = e.props.bodyColumns
if (e.surface === 'terminal') {
hasTerminal = true
const { Box, Text, Button, Input, Raster } = $.ui.resolve(e) as Elements['terminal']
const cols = Math.max(20, Math.min(columns, 64))
snapshot = { pet, ui: game.ui, columns: cols }
startAnimation($)
const art = <Raster key="stage" columns={cols} rows={ROWS} cells={frameCells({ pet, face, anim, now, hour: hour(), columns: cols })} />
return drawPane({ els: { Box, Text, Button, Input }, isTerminal: true, pet, ui, settings, face, press, rename: renameTo, art, stats: null, now, columns })
}
// The scene's markup changes only when something in it does, so a redraw
// for anything else (a coin, a stat) keeps its frame; its height is fixed
// so a frame that does reload never moves the buttons under the pointer.
const els = $.ui.resolve(e) as Elements['mobile'] & Partial<Pick<Elements['desktop'], 'Input'>>
const { Box, Text, Button, Svg } = els
const from = game.ui.from && now - game.ui.fromAt < 2500 ? game.ui.from : null
const scene = sceneSvg({ pet, face, baseFace: faceOf(pet, 'none'), anim, isFresh, speech, ...(speech ? { speechLife: speechLife(speech) } : {}), hour: hour() })
const art = <Svg source={scene} alt={`${pet.name}${speech ? `, saying: ${speech.text}` : ''}`} height={260} isInteractive />
const stats = <Svg source={statsSvg(pet, from)} alt={`${pet.name}'s stats`} height={118} />
const kit = els.Input ? { Box, Text, Button, Input: els.Input } : { Box, Text, Button }
return drawPane({ els: kit, isTerminal: false, pet, ui, settings, face, press, rename: renameTo, art, stats, now, columns })
})hooks/view.tsx 365〜406 行 · ペイン
export const drawPane = (a: PaneArgs): RenderElement => {
const { Box, Text } = a.els
const { pet, ui, isTerminal } = a
const speech = ui.speech
const body =
ui.view === 'feed'
? feedView(a)
: ui.view === 'play'
? gameView(a)
: ui.view === 'shop'
? shopView(a)
: ui.view === 'closet'
? closetView(a)
: ui.view === 'stats'
? statsView(a)
: ui.view === 'name'
? nameView(a)
: null
const tip =
pet.stage === 'egg'
? 'Keep it warm. Every tool call Claude makes warms it too.'
: needs(pet)
.map(n => `${pet.name} ${n.text}`)
.join(' · ')
return (
<Box flexDirection="column" gap={isTerminal ? 0 : 1}>
{isTerminal ? header(a) : null}
{isTerminal && speech ? (
<Box borderStyle="round" borderColor={speech.isAlert ? '#E5484D' : ACCENT} paddingX={1}>
<Text>{speech.text}</Text>
</Box>
) : null}
{a.stats}
{a.art}
{isTerminal ? statBars(a) : null}
{tip ? pet.stage === 'egg' ? <Text dimColor>{tip}</Text> : <Text color="#E5484D">{tip}</Text> : null}
{actionRow(a)}
{body}
{ui.view === 'home' ? snackFeed(a) : null}
</Box>
)
}hooks/view.tsx 73〜95 行 · ペイン
const header = ({ els, pet }: PaneArgs) => {
const { Text } = els
const stage = pet.stage === 'adult' && pet.form ? FORM_LABEL[pet.form] : STAGE_LABEL[pet.stage]
const need = pet.stage === 'egg' ? HATCH_AT : xpFor(pet.level)
const have = pet.stage === 'egg' ? pet.warmth : pet.xp
const n = Math.round((Math.min(have, need) / need) * 10)
return (
<Text>
<Text bold color={ACCENT}>
{pet.name}
</Text>{' '}
<Text dimColor>
{stage}
{pet.stage === 'egg' ? '' : ` · Lv ${pet.level}`}
</Text>{' '}
<Text color="#A78BFA">{'▰'.repeat(n)}</Text>
<Text dimColor>{'▱'.repeat(10 - n)}</Text>{' '}
<Text color="#E8B341" bold>
🪙 {pet.coins}
</Text>
</Text>
)
}hooks/view.tsx 42〜71 行 · ペイン
const statBars = ({ els, pet, columns }: PaneArgs) => {
const { Box, Text } = els
const width = Math.max(6, Math.min(16, Math.floor((columns - 26) / 2)))
const row = (icon: string, label: string, value: number, color: string) => {
const n = Math.round((value / 100) * width)
return (
<Text>
{icon} {label.padEnd(6)} <Text color={value < 25 ? '#E5484D' : color}>{'█'.repeat(n)}</Text>
<Text dimColor>{'░'.repeat(width - n)}</Text> {String(Math.round(value)).padStart(3)}
</Text>
)
}
return (
<Box flexDirection="row" gap={2} flexWrap="wrap">
<Box flexDirection="column">
{row('🍙', 'Food', pet.hunger, '#FFA94D')}
{row('🎈', 'Fun', pet.fun, '#FF6FA8')}
{row('⚡', 'Energy', pet.energy, '#5AA9FF')}
</Box>
<Box flexDirection="column">
{row('🫧', 'Clean', pet.hygiene, '#38D9C5')}
{row('💗', 'Bond', pet.bond, '#F0445C')}
<Text>
<Text color="#F0445C">{hearts(pet.bond)}</Text>{' '}
<Text dimColor>{pet.isSick ? '🤒 sick' : pet.isAsleep ? '💤 asleep' : pet.poops > 0 ? `💩 ×${pet.poops}` : '✨ fine'}</Text>
</Text>
</Box>
</Box>
)
}hooks/view.tsx 97〜130 行 · ペイン
const actionRow = (a: PaneArgs) => {
const { Box, Button } = a.els
const { pet, press } = a
if (pet.stage === 'egg')
return (
<Box flexDirection="row" flexWrap="wrap" gap={1}>
<Button key="warm" label="🔥 Warm the egg" hotkey="w" variant="primary" onPress={press('warm')} />
<Button key="name" label="✏️ Name it" hotkey="n" onPress={press('name')} />
<Button key="shop" label="🛍️ Shop" hotkey="b" onPress={press('shop')} />
</Box>
)
if (pet.isAsleep)
return (
<Box flexDirection="row" flexWrap="wrap" gap={1}>
<Button key="wake" label="☀️ Wake up" hotkey="s" variant="primary" onPress={press('wake')} />
<Button key="pat" label="🤲 Tuck in" hotkey="h" onPress={press('pat')} />
<Button key="shop" label="🛍️ Shop" hotkey="b" onPress={press('shop')} />
<Button key="closet" label="👒 Closet" hotkey="k" onPress={press('closet')} />
</Box>
)
return (
<Box flexDirection="row" flexWrap="wrap" gap={1}>
<Button key="feed" label="🍙 Feed" hotkey="f" {...(pet.hunger < 40 ? { variant: 'primary' as const } : {})} onPress={press('feed')} />
<Button key="play" label="🎮 Play" hotkey="p" {...(pet.fun < 40 ? { variant: 'primary' as const } : {})} onPress={press('play')} />
<Button key="clean" label={pet.poops > 0 ? `🧹 Clean (${pet.poops})` : '🫧 Bath'} hotkey="c" {...(pet.poops > 1 || pet.hygiene < 40 ? { variant: 'primary' as const } : {})} onPress={press('clean')} />
<Button key="pat" label="🤲 Pet" hotkey="h" onPress={press('pat')} />
<Button key="sleep" label="💤 Sleep" hotkey="s" {...(pet.energy < 25 ? { variant: 'primary' as const } : {})} onPress={press('sleep')} />
{pet.isSick ? <Button key="heal" label="💊 Heal" hotkey="m" variant="primary" onPress={press('heal')} /> : null}
<Button key="shop" label="🛍️ Shop" hotkey="b" onPress={press('shop')} />
<Button key="closet" label="👒 Closet" hotkey="k" onPress={press('closet')} />
<Button key="stats" label="📊" hotkey="i" onPress={press('stats')} />
</Box>
)
}hooks/view.tsx 348〜363 行 · ペイン
const snackFeed = ({ els, ui, now }: PaneArgs) => {
const { Box, Text } = els
if (ui.snacks.length === 0) return null
return (
<Box flexDirection="column">
<Text dimColor bold>
Fresh from your work
</Text>
{ui.snacks.slice(0, 4).map(snack => (
<Text dimColor wrap="truncate-end">
{snack.icon} {snack.text} · {ago(now - snack.at)}
</Text>
))}
</Box>
)
}ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Syrul 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 に読んだコミット 7d4bf31a95b6 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。8 ファイルを解析 |
| コードが 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:630 date(Windows にない) |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。git(通信する), date |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。通信するが、ファイルも環境変数も読まない |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add Syrul/claudagotchi/plugin install claudagotchi@claudagotchi入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(7d4bf31a95b6)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「syrul-claudagotchi」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…2h 10m · █████░░░✓ build ✓ build ✓ buildJavaKotlin3 Python■ ok 3 ■ ok 3 ■ ok 3 Razor proven 3 Razor proven 3 Razor proven 3Phases ──────── 3/3build Pythonbuild Pythonbuild Python… 3 more phasesLua ──────── 3/Kotlin■ the whole upgrade Ruby■ build build Ruby■ build build Ruby■ build build Ruby … 3 moreNext ──────── PythonRuby (by hand)Podsclick a button, or ctrl+x tab then Tab, EnterAttention ──────── 3! Scala ! Scala ! Scala … 3 moreSession ──────── okJava
-
Open a file first: /crit-tui file <path>Reopen this one in the crit browser view.Claude に頼む…
-
Claude に頼む…TodayOct 63 left · Mar overdueRemCTL: Sep✓ All done for today.● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓Updated 14:32UndoRefresh
-
Claude に頼む…TO graph› Fix login › Fix login › Fix loginScopeThis featureWhole projectHide done stepsReconnect
-
Claude に頼む…InboxUntitled captureFinishing Open in localvoxtralUntitled captureFinishing Open in localvoxtralUntitled captureFinishing Open in localvoxtral
-
Claude に頼む…InboxUntitled captureFinishing Open in localvoxtralUntitled captureFinishing Open in localvoxtralUntitled captureFinishing Open in localvoxtral