glyph-hud
Dot-matrix HUD for Claude Code: chat tokens by model, 5-hour limit estimates, cache timer and code stats. Local only, no model calls.
何をするか
- 欄を描く
- /glyph を足す
- Bash・Edit・Write の呼び出しを見張る(止めることがある)
- classic.Stop・prompt.edit・prompt.submit・session.measure ほか 4 個にフックする
- ターンをまたいで自分の状態を持つ
良いところ
- ネットワークに出ない
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like glyph-hud by Mridul Negi (pane, status), as modscode read it from the mod's code:
// https://modscode.com/gallery/mridulnegi2005-glyph-hud/
// 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: "Glyph" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Svg, Button } = $.ui.resolve(e)
const svgHud = '…'
const compact = '…'
const length = '…'
const toolCalls = '…'
const edits = '…'
return (
<Box flexDirection="column" gap={1}>
<Svg source={`${svgHud}`} alt={`This chat used ${compact} tokens across ${length} models; ${toolCalls} tool calls, ${edits} edits`} />
<Box flexDirection="row" gap={1}>
<Button label="Rescan" />
<Button label="Reset code stats" />
<Button label="Close" role="dismiss" />
</Box>
</Box>
)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
hooks/register.tsx 652〜774 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const [s, life, u, c, live] = await Promise.all([
read($, stats),
read($, lifetime),
read($, usage),
read($, cold),
read($, isLive),
])
if (e.surface !== 'terminal') {
const { Box, Svg, Button } = $.ui.resolve(e)
const sum = sumUsage(u)
return (
<Box flexDirection="column" gap={1}>
<Svg
source={svgHud(s, life, u, c, live)}
alt={`This chat used ${compact(sum.input + sum.cacheWrite + sum.cacheRead + sum.output)} tokens across ${u.models.length} models; ${s.toolCalls} tool calls, ${s.edits} edits`}
/>
<Box flexDirection="row" gap={1}>
<Button key="rescan" label="Rescan" onPress={() => scanUsage($, true)} />
<Button key="reset" label="Reset code stats" onPress={() => bump($, () => EMPTY)} />
<Button key="close" label="Close" role="dismiss" onPress={() => $.ui.close({ id: PANE })} />
</Box>
</Box>
)
}
const { Box, Text, Button } = $.ui.resolve(e)
const width = Math.max(24, (e.props.bodyColumns ?? 40) - 2)
const barRoom = Math.max(6, Math.min(30, width - 22))
const sum = sumUsage(u)
const total = sum.input + sum.cacheWrite + sum.cacheRead + sum.output
const top = topTools(s, 4)
const max = top[0]?.[1] ?? 1
return (
<Box flexDirection="column">
<Box flexDirection="row" justifyContent="space-between">
<Text dimColor>G L Y P H / H U D</Text>
<Text color={live ? RED : MUTED}>{live ? '● LIVE' : '○ IDLE'}</Text>
</Box>
<Text dimColor>THIS CHAT · TOKENS</Text>
{textDots(compact(total)).map(row => (
<Text>{row}</Text>
))}
<Text>
<Text color={RED}>{u.costUsd === undefined ? '—' : `$${u.costUsd.toFixed(2)}`}</Text>
<Text dimColor> ctx </Text>
{u.contextPct === undefined ? '—' : `${u.contextPct}%`}
<Text dimColor> req </Text>
{sum.requests}
</Text>
<Text>
<Text dimColor>cold cache call </Text>
<Text color={c.coldPct === undefined ? MUTED : RED}>
{c.coldPct === undefined ? 'calibrating' : `≈ ${c.coldPct.toFixed(1)}% of 5h`}
</Text>
<Text dimColor> 5h used </Text>
{c.fiveHourPct === undefined ? '—' : `${c.fiveHourPct}%`}
</Text>
{c.lastCold && (
<Text dimColor>
last cold {c.lastCold.before}% → {c.lastCold.after}% (+{(c.lastCold.after - c.lastCold.before).toFixed(1)}),
before-reading {c.lastCold.staleMinutes}m old
</Text>
)}
<Text dimColor>
in {compact(sum.input)} · cw {compact(sum.cacheWrite)} · cr {compact(sum.cacheRead)} · out {compact(sum.output)}
</Text>
<Text> </Text>
<Text dimColor>SPREAD BY MODEL</Text>
{u.models.length === 0 && <Text dimColor>{u.error ?? 'no responses counted yet'}</Text>}
{u.models.map((t, i) => {
const share = total > 0 ? totalOf(t) / total : 0
const lit = Math.max(1, Math.round(share * barRoom))
return (
<Box flexDirection="column">
<Box flexDirection="row">
<Text bold color={i === 0 ? RED : undefined}>
{shortModel(t.model).slice(0, 16).padEnd(17)}
</Text>
<Text color={i === 0 ? RED : undefined}>{'●'.repeat(lit)}</Text>
<Text dimColor>
{'·'.repeat(barRoom - lit)} {compact(totalOf(t))} {Math.round(share * 100)}%
</Text>
</Box>
<Text dimColor>
{' '}in {compact(t.input)} cw {compact(t.cacheWrite)} cr {compact(t.cacheRead)} out {compact(t.output)} · {t.requests} req
</Text>
</Box>
)
})}
<Text> </Text>
<Text dimColor>CODE · THIS SESSION</Text>
{top.map(([name, count], i) => {
const lit = Math.max(1, Math.round((count / max) * barRoom))
return (
<Box flexDirection="row">
<Text>{shortTool(name).slice(0, 16).padEnd(17)}</Text>
<Text color={i === 0 ? RED : undefined}>{'●'.repeat(lit)}</Text>
<Text dimColor>
{'·'.repeat(barRoom - lit)} {count}
</Text>
</Box>
)
})}
{codeTiles(s, life).map(([name, v, isAlert]) => (
<Box flexDirection="row">
<Text dimColor>{name.padEnd(12)}</Text>
<Text bold color={isAlert ? RED : undefined}>
{v}
</Text>
</Box>
))}
{s.blocked > 0 && <Text color={RED}>● {s.blocked} AI-attribution commit(s) blocked</Text>}
<Box flexDirection="row" gap={1}>
<Button key="rescan" label="rescan" onPress={() => scanUsage($, true)} />
<Button key="reset" label="reset" onPress={() => bump($, () => EMPTY)} />
<Button key="close" label="close" role="dismiss" onPress={() => $.ui.close({ id: PANE })} />
</Box>
</Box>
)
})ライセンスの全文(MIT)
MIT License Copyright (c) 2026 Mridul Negi 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.
コードが呼ぶもの
プログラム起動ファイル読み取り環境変数ツール呼び出し保存
コードから読み取ったデザイン
読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。
コードから読めること
2026-10-06 に読んだコミット 0dc775eeecb6 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。1 ファイルを解析 |
| コードが 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:211 python(シェル・インタプリタ) |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。通信しない |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add MridulNegi2005/glyph-hud/plugin install glyph-hud@glyph-hud入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(0dc775eeecb6)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「mridulnegi2005-glyph-hud」をコードごと読んで、同じようなペインを作って似たデザイン
-
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 に頼む…Usage▲usage-meterokPlan limitsNo rate-limit windows reported (API key, or a plan without limits).note▲ 42%2h 10m · +14:32%/h this session · full in ~4mnote▲ 42%2h 10m · +14:32%/h this session · full in ~4mnote▲ 42%2h 10m · +14:32%/h this session · full in ~4m⋯This sessionCostUsageTimeUsageTurnsUsageOutputUsageCache readUsageCache writeUsageLow cache hit: long pauses or edits to early context break the cache.Cache hitUsage
-
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 に頼む…Swarmrefresh rclear finished c
-
何をするか
- ターミナルにプロンプトの上の帯・欄・ステータス行・トーストを描く
- /agentzero を足す
- Bash の呼び出しを見張る(止めることがある)
- command.register・env.get・fs.read・fs.stat ほか 13 個にフックする