gob-pet
Gob as a Tamagotchi-style companion who lives off your work: finished turns, green tests and commits grow him, and /pet lets you feed, play with, pet, nap and dress him. Free, and he never punishes you.
何をするか
- プロンプトの上の帯・欄を描く
- /pet を足す
- ツールの呼び出しを見張る(止めることがある)
- prompt.submit・session.start・state.set・turn.complete ほか 3 個にフックする
- ターンをまたいで自分の状態を持つ
良いところ
- ネットワークに出ない
- プロセスを起こさない
- TypeScript で書かれている
- デスクトップ専用の分岐がある
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like gob-pet by mako-code (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/mako-code-gob-pet/
// 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 } = $.ui.resolve(e)
const text = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row">
<Text wrap="wrap">
<Text>
{` ${text} `}
</Text>
</Text>
</Box>
{await next(e)}
</Box>
)
})
// the pane: open it with $.ui.open({ id: 'my-pane', title: "‹name›" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box } = $.ui.resolve(e)
return (
<Box flexDirection="column" />
)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
mods/fun/gob-pet/hooks/readout.ts 649〜655 行 · バンド
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const text = r.text
if ((await isHostedNow($, r)) || r.look.place !== 'top' || text === null || e.props.hasSurvey) return next(e)
const below = await next(e)
const { Box, Text } = $.ui.resolve(e)
return withReadout({ Box: Box as Make['Box'], Text: Text as Make['Text'] }, below, r.name, text, r.look, e.props.isWorking, e.surface === 'terminal' ? r.glyphs : 'full')
})mods/fun/gob-pet/hooks/readout.ts 461〜485 行 · バンド
export function withReadout(make: Make, below: RenderElement | null | undefined, name: string, text: string, look: Look, isWorking = false, glyphs: IconGlyphs = 'full'): RenderElement {
if (isWorking && look.whileWorking === 'hide') return below ?? make.Box({ children: [] })
const piece = pieceElement(make, { name, text, color: look.color }, look, isWorking && look.whileWorking === 'dim', glyphs)
const justify = justifyOf(look.align)
const ownRow = (key: string) => make.Box({ key, flexDirection: 'row', justifyContent: justify, children: [make.Text({ wrap: 'wrap', children: [piece] })] })
const isOurs = below !== null && below !== undefined && below.type === 'Box' && keyOf(below) === BAND_KEY
const rest: RenderNode[] = isOurs ? [...(below.children ?? [])] : isEmpty(below) ? [] : [below as RenderElement]
if (look.layout === 'merged') {
const at = rest.findIndex(n => keyOf(n) === ROW_KEY)
const row = at >= 0 ? rest[at] : undefined
if (row !== undefined && typeof row !== 'string' && row.type === 'Box') {
const line = row.children?.[0]
if (line !== undefined && typeof line !== 'string' && line.type === 'Text') {
const sep = make.Text({ dimColor: true, children: [separatorOf(look)] })
const joined = make.Text({ ...line.props, children: [piece, sep, ...(line.children ?? [])] })
rest[at] = make.Box({ ...row.props, children: [joined] })
return make.Box({ key: BAND_KEY, flexDirection: 'column', children: rest })
}
}
return make.Box({ key: BAND_KEY, flexDirection: 'column', children: [ownRow(ROW_KEY), ...rest] })
}
return make.Box({ key: BAND_KEY, flexDirection: 'column', children: [ownRow(`${ROW_KEY}:${name}`), ...rest] })
}mods/fun/gob-pet/hooks/readout.ts 412〜415 行 · バンド
function pieceElement(make: Make, p: Piece, look: Look, isDimmed: boolean, glyphs: IconGlyphs = 'full'): RenderElement {
const text = pieceText(p.name, p.text, look, glyphs)
return make.Text({ ...pieceProps(p.color, look, isDimmed), children: [look.style === 'pills' ? ` ${text} ` : text] })
}mods/fun/gob-pet/hooks/register.tsx 526〜649 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const now = await $.clock.now()
const stored = await read($, petState)
const pet = stored ? advance(stored, now) : newPet(now, optName())
const stage = await read($, stageState)
const pane = await read($, paneState)
const width = Math.max(30, e.props.bodyColumns - 1)
const mood = moodOf(pet, now, stage.worriedUntil)
const says = stage.says !== null && now < stage.saysUntil ? stage.says : lineFor(mood, pet.name)
// he thinks along while Claude works, unless he is napping (then he may doze off on the stage)
const stageMood: GobMood = mood === 'napping' ? 'sleep' : now < stage.cheerUntil ? 'cheer' : stage.isWorking ? 'think' : 'idle'
// asleep he wears his nightcap, whatever is in the wardrobe
const hat: GobHat | null = mood === 'napping' ? 'nightcap' : pet.hat
const parts: JSX.Element[] = []
// ------------------------------------------------------------ the stage
if (e.surface === 'terminal') {
const { Client } = $.ui.resolve(e)
const props: StageProps = { says, mood: stageMood, event: stage.event, seq: stage.seq, columns: width, rows: STAGE_ROWS, isReducedMotion, hat, cursorSeq: 0, chip: stage.chip }
parts.push(<Client key="stage" module="./stage.tsx" props={props} width={width} height={STAGE_ROWS} />)
} else {
const { Svg } = $.ui.resolve(e)
// the sky by the quarter hour, so the markup (and what it plays) changes only every 15 minutes
const local = new Date(now)
const hour = Math.floor((local.getHours() + local.getMinutes() / 60) * 4) / 4
const scene = sceneSvg({ says, mood: stageMood, event: stage.event, isFresh: now - stage.eventAt < 3200, seq: stage.seq, isAnimated: !isReducedMotion, hat, chip: stage.chip, ...(isReducedMotion ? {} : { hour }) })
const sceneWidth = Math.min(640, Math.max(280, e.props.bodyColumns * 7))
parts.push(<Svg source={scene} alt={`${pet.name}, your goblin, says: ${says}`} width={sceneWidth} height={Math.round((sceneWidth * SCENE_H) / SCENE_W)} isInteractive />)
}
// ------------------------------------------------------- name and level
const { level, into, need } = levelOf(pet.xp)
const barWidth = Math.max(8, Math.min(24, width - 30))
const xpBar = bar(into / need, barWidth)
parts.push(
<Box flexDirection="row" columnGap={1}>
<Text bold color={C.gob}>
{pet.name}
</Text>
<Text bold>{`Lv ${level}`}</Text>
<Text>
<Text color={C.gold}>{xpBar.filled}</Text>
<Text dimColor>{xpBar.empty}</Text>
</Text>
<Text dimColor>{`${into}/${need} xp`}</Text>
</Box>,
)
// ----------------------------------------------------------- the stats
const stat = (label: string, value: number, color: string, flag: string | null) => {
const b = bar(value / 100, barWidth)
return (
<Box flexDirection="row" columnGap={1}>
<Text>{label.padEnd(9)}</Text>
<Text>
<Text color={color}>{b.filled}</Text>
<Text dimColor>{b.empty}</Text>
</Text>
<Text dimColor>{String(Math.round(value)).padStart(3)}</Text>
{flag !== null && <Text color={C.amber}>{flag}</Text>}
</Box>
)
}
const isNapping = mood === 'napping'
parts.push(
stat('Happiness', pet.happiness, C.pink, null),
stat('Energy', pet.energy, C.blue, isNapping ? 'napping' : pet.energy < SLEEPY_BELOW ? 'sleepy' : null),
stat('Fullness', pet.fullness, C.green, pet.fullness < HUNGRY_BELOW ? 'hungry' : null),
)
// ------------------------------------------------ streak, age, tally
const streak = currentStreak(pet, now)
const streakText = streak > 0 ? `Streak ${streak} day${streak === 1 ? '' : 's'}${pet.bestStreak > streak ? ` (best ${pet.bestStreak})` : ''}` : 'Streak starts today'
parts.push(<Text dimColor wrap="wrap">{[streakText, ageText(pet, now), pet.hat ? `wearing the ${hatLabel(pet.hat)}` : 'no hat'].join(' · ')}</Text>)
const t = pet.tally
parts.push(
<Text dimColor wrap="wrap">
{`Turns ${t.turns} · Green tests ${t.tests} · Commits ${t.commits} · Errors ${t.errors} · Fed ${t.feeds} · Pets ${t.pets} · Plays ${t.plays} · Naps ${t.naps}`}
</Text>,
)
// ------------------------------------------------------------ buttons
parts.push(
<Box flexDirection="row" columnGap={2} flexWrap="wrap">
<Button key="feed" plain hotkey="f" label="Feed" onPress={() => void tend($, 'feed')} />
<Button key="play" plain hotkey="p" label="Play" onPress={() => void tend($, 'play')} />
<Button key="pet" plain hotkey="e" label="Pet" onPress={() => void tend($, 'pet')} />
<Button key="nap" plain hotkey="n" label={isNapping ? 'Wake' : 'Nap'} onPress={() => void tend($, 'nap')} />
<Button key="wardrobe" plain hotkey="w" label="Wardrobe" onPress={() => void togglePanel($, 'wardrobe')} />
<Button key="rename" plain hotkey="r" label="Rename" onPress={() => void togglePanel($, 'rename')} />
<Button key="close" hotkey="x" role="dismiss" label="Close" onPress={() => void $.ui.close({ id: PANE })} />
</Box>,
)
// ------------------------------------------------------------ drawers
if (pane.panel === 'wardrobe') {
const next = nextUnlock(level)
parts.push(
<Box flexDirection="column">
<Text dimColor>{pet.hats.length > 0 ? 'Wardrobe: pick a hat (digit keys), w closes' : 'Wardrobe: no hats yet; the first one comes at level 2.'}</Text>
<Box flexDirection="row" columnGap={2} flexWrap="wrap">
{wardrobeOf(pet).map((choice, i) => {
const hotkey = i < 10 ? { hotkey: String((i + 1) % 10) } : {}
const label = `${choice === pet.hat ? '● ' : ''}${choice ? hatLabel(choice) : 'no hat'}`
return <Button key={`hat:${choice ?? 'none'}`} plain {...hotkey} label={label} onPress={() => void wear($, choice ?? 'none')} />
})}
</Box>
{next && <Text dimColor>{`Next: the ${next.label} at level ${next.level}`}</Text>}
</Box>,
)
}
if (pane.panel === 'rename') {
if (e.surface === 'mobile') parts.push(<Text dimColor>{'Rename him with /pet name <name>'}</Text>)
else {
const { Input } = $.ui.resolve(e)
parts.push(<Input key="name" label="New name: " placeholder={pet.name} autoFocus onSubmit={value => void rename($, value)} />)
}
}
if (pane.notice) parts.push(<Text color={C.amber} wrap="wrap">{pane.notice}</Text>)
parts.push(<Text dimColor wrap="wrap">{`He lives off your work: a finished turn +${XP.turn} xp, green tests +${XP.test}, a commit +${XP.commit}.`}</Text>)
return <Box flexDirection="column">{parts}</Box>
})ライセンスの全文(MIT)
MIT License Copyright (c) 2026 mako-code 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 に読んだコミット ec6ea2383749 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。mods/fun/gob-pet/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/… などは無い)。Windows にないプログラムを使わない |
| 通信 | fetch の送り先(https のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。プログラムを起動しない |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。通信しない |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add mako-code/gobworks/plugin install gob-pet@gobworks入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(ec6ea2383749)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「mako-code-gob-pet」をコードごと読んで、同じようなペインを作って似たデザイン
-
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