agentzero
AgentZero for Claude Code: all of AgentZero, plus hot set loading and a check of the operator's words.
何をするか
- ターミナルにプロンプトの上の帯・欄・ステータス行・トーストを描く
- /agentzero を足す
- Bash の呼び出しを見張る(止めることがある)
- command.register・env.get・fs.read・fs.stat ほか 13 個にフックする
- プロセスを起こす
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like agentzero by jesselei1102-hue (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/jesselei1102-hue-agentzero/
// 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 => {
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
plugins/agentzero/hooks/feature-hud.tsx 30〜76 行 · バンド
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
if (e.props.hasSurvey) return next(e)
const data = sessionData(await $.session.id())
const workspace = await locateWorkspace(data, () => $.session.root(), p => $.fs.stat(p).then(() => true, () => false))
if (workspace === null) return next(e)
let percent: number | undefined
try {
percent = (await $.session.usage()).context.percent
} catch {
percent = undefined
}
const m = bandModel(await read($, hudAtom), await read($, hotSetErrorAtom), percent, await $.clock.now())
const openReview = async () => {
await $.ui.open({ id: REVIEW_PANE, title: REVIEW_TITLE })
const io: HudIo = {
run: (argv, init) => $.process.run(argv, init),
read: p => $.fs.read(p) as Promise<string>,
write: fn => update($, hudAtom, fn),
status: t => $.ui.status(t),
pluginRoot: $.plugin.root,
}
await data.gate.run(refreshJob(io, workspace))
}
const { Box, Text, Button, Svg } = $.ui.resolve(e) as Record<string, (props: Record<string, unknown>) => never>
const review = m.showReview ? <Button key="az-review" label="Review" variant="primary" onPress={openReview} /> : null
if (e.surface === 'terminal') {
return (
<Box flexDirection="row" gap={1}>
{m.pills.map(p => (
<Text color={PALETTE[p.tone].fg} backgroundColor={PALETTE[p.tone].bg}>{` ${p.text} `}</Text>
))}
{m.ring !== null && (
<Text color={MUTED}>{`context ${m.ring.percent}%${m.ring.note !== null ? ` · ${m.ring.note}` : ''}`}</Text>
)}
{review}
</Box>
)
}
return (
<Box flexDirection="row" alignItems="center" gap={1}>
<Svg source={bandSvg(m)} alt={m.alt} />
{review}
</Box>
)
})plugins/agentzero/hooks/feature-hud.tsx 78〜145 行 · ペイン
on('ui.render', { component: 'Pane', requestId: REVIEW_PANE }, async ($, e) => {
const { Box, Text, Button, Svg } = $.ui.resolve(e) as Record<string, (props: Record<string, unknown>) => never>
const data = sessionData(await $.session.id())
const workspace = await locateWorkspace(data, () => $.session.root(), p => $.fs.stat(p).then(() => true, () => false))
if (workspace === null) return <Text color={MUTED}>This is not an AgentZero workspace.</Text>
const hud = await read($, hudAtom)
if (hud.snapshot === null) {
// never "nothing waits" when the state could not be read
return <Text color={MUTED}>{hud.error !== null ? `memory unreadable (${hud.error})` : 'reading memory…'}</Text>
}
const { rows, open, done } = paneRows(hud.snapshot?.pending ?? [], await read($, paneResultsAtom))
const decide = async (item: PendingItem, verb: 'keep' | 'reject') => {
let ran
try {
ran = await $.process.run(reviewArgv(workspace, verb, item.id), { cwd: workspace, timeoutMs: KEEP_TIMEOUT_MS })
} catch (err) {
ran = err instanceof Error ? err : new Error(String(err))
}
const result = paneResult(item, verb, ran)
await update($, paneResultsAtom, m => mergeResult(m, result))
const io: HudIo = {
run: (argv, init) => $.process.run(argv, init),
read: p => $.fs.read(p) as Promise<string>,
write: fn => update($, hudAtom, fn),
status: t => $.ui.status(t),
pluginRoot: $.plugin.root,
}
await data.gate.run(refreshJob(io, workspace))
}
const buttons = (item: PendingItem) => (
<Box flexDirection="row" gap={2}>
<Button key={`az-keep-${item.id}`} label="✓ Keep" plain={true} onPress={() => decide(item, 'keep')} />
<Button key={`az-reject-${item.id}`} label="✗ Reject" plain={true} dimColor={true} onPress={() => decide(item, 'reject')} />
</Box>
)
const empty = rows.length === 0 ? <Text color={PALETTE.green.fg}>Nothing is waiting for you ✓</Text> : null
if (e.surface === 'terminal') {
return (
<Box flexDirection="column" gap={1}>
<Text bold={true}>{`Waiting for you · ${open} waiting · ${done} done`}</Text>
{rows.map(row => (
<Box flexDirection="column">
<Text>{`[${KIND_LABEL[row.item.kind] ?? row.item.kind}] ${row.item.sentence}`}</Text>
{row.state === 'kept' && <Text color={PALETTE.green.fg}>✓ Kept</Text>}
{row.state === 'rejected' && <Text color={MUTED}>✗ Rejected</Text>}
{row.state === 'failed' && <Text color={PALETTE.red.fg}>{row.message ?? ''}</Text>}
{row.actionable && buttons(row.item)}
</Box>
))}
{empty}
</Box>
)
}
return (
<Box flexDirection="column" gap={1} paddingX={1}>
<Svg source={paneHeaderSvg(open, done)} alt={`${open} waiting, ${done} done`} />
{rows.map(row => (
<Box flexDirection="column" gap={0}>
<Svg source={pendingItemSvg(row)} alt={row.item.sentence} />
{row.actionable && buttons(row.item)}
</Box>
))}
{empty}
</Box>
)
})ライセンスの全文(MIT)
MIT License Copyright (c) 2026 AgentZero Contributors 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 に読んだコミット 784a606495f3 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。plugins/agentzero/hooks/register.ts |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。16 ファイルを解析 |
| コードが 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 のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。plugins/agentzero/hooks/command.ts:67 実行時に決まるプログラム; plugins/agentzero/hooks/command.ts:97 実行時に決まるプログラム; plugins/agentzero/hooks/command.ts:107 実行時に決まるプログラム; plugins/agentzero/hooks/command.ts:113 実行時に決まるプログラム; plugins/agentzero/hooks/feature-hotset.ts:73 実行時に決まるプログラム |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。通信しない |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add jesselei1102-hue/agentzero-claude-mod/plugin install agentzero@agentzero入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(784a606495f3)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「jesselei1102-hue-agentzero」をコードごと読んで、同じようなペインを作って似たデザイン
-
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 に頼む…superpowersϟ Arc tokens showing buildNot now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)Not now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)Not now██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓██ FinalFinal42%:1 ✓███ brand gradient (OKLCH)d darkl lightz daltonizeda ansiu auto
-
Claude に頼む…Timer● MonAprNo timer runningStopResume last CollapseFri week./meter.tsxUnbilled Wed h$1.24 · expenses MarMayToday, Oct 6This week
-
Claude に頼む…Notes⚠ A team of Never uses your Claude usage much faster.Showing:buildbuildbuildHide completed:buildbuildbuildSet team size:DefaultDefaultDefaultSet model:NotesNotesNotesWorkflowYour next prompt can hand work to Never Notes helpers.● Fix login · Tool agents42% AllCopy failed2h 10m● Fix login · Tool agents42% AllCopy failed2h 10m● Fix login · Tool agents42% AllCopy failed2h 10m
-
Claude に頼む…Prompt cacheexpired · LowTTL Cache breaks · last hit 0 · ctx 42%extending…This conversationavg hit – · req English · breaks Compact · extended Compact · peak ctx 12.4kPer request · token cost■ read ×0.1■ write□ miss▬▬▬ hit rate▬ break┊ idle near expiry▲ extendedCache breaksnone● Low Extend● Low Extend● Low ExtendBreak sensitivityEnglishHigher counts smaller drops as breaks; applies from the next requestExtensionsnone2h 10m · English · 32h 10m · English · 32h 10m · English · 3SettingsWhen about to expireLowAuto-extend per idle stretch2h 10mToast notificationsDetailsCache TTLautoPrompt cacheBand above the promptOffBreak sensitivityEnglishHigher counts smaller drops as breaks; applies from the next requestLanguageen