ClaudeMods
☰
JA
● 0 人がオンライン ・閲覧 0 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 Oualid0

usage-ring

プロンプトの上に制限、コンテキスト、Todo、トークン、コスト、プロンプトキャッシュを示すリングを表示します

Oualid0@Oualid0

Oualid0/claude-mods/tree/main/plugins/usage-ring

翻訳済み

この mod について

claude-mods

Claude Code ターミナル向けの mod です。プロンプトの上にリングを並べ、制限、このチャットの使用量、プロンプトキャッシュを表示します。実行中の Claude セッションを一覧するボードもあります。

クイックインストール

このプロンプトを Claude Code にコピーします。

Install the Claude Code plugins from https://github.com/Oualid0/claude-mods:
add the repo as a plugin marketplace, then install every plugin listed in its
.claude-plugin/marketplace.json, and tell me to run /reload-plugins when done.

手動インストール

claude plugin marketplace add Oualid0/claude-mods
claude plugin install usage-ring@claude-mods
claude plugin install session-board@claude-mods

続いて Claude Code で /reload-plugins を実行するか、新しいセッションを開始します。ローカルの clone からは ./install.sh でも同じことができます(python3 が必要)。安全に何度でも実行できます。

Mod

自動更新はデフォルトで無効です。セッション中に /plugin marketplace update claude-mods を実行して手動更新するか、シェルで claude plugin update usage-ring@claude-mods と claude plugin update session-board@claude-mods を実行します。/plugin の Marketplaces で marketplace の Enable auto-update を有効にすることもできます。

| Plugin | 内容 | |---|---| | usage-ring | プロンプトのすぐ上に limits と chat の 2 つのチップを表示します。横のピクセル Claude はターン中に叩き、そうでないときは眠ります。さらに横にモデル名を灰色で表示します。例:Opus 5.5 (mid)(effort は low、mid、high、xhigh、max のいずれかで、最初のリクエストから判明します)。 | | session-board | このマシンで他の Claude セッションが実行中の間、上に sessions チップを表示します。各セッションは 1 行(● 実行中、終了後 60 s は ✓ 完了)、自分の行(○ 準備完了または ● 実行中)には ← を付けます。他に実行中のセッションがなければボードは非表示です。 |

ラベルの意味

| ラベル | チップ | 意味 | |---|---|---| | Wk | limits | 使用した週次制限(パーセント)。 | | Se | limits | 使用したセッション制限(5 時間のウィンドウ)とリセットまでの時間。4:50h、1 時間未満なら 33m と表示します。ウィンドウ終了後、次の読み取りまでは 0% 5:00h になります。 | | Cx | chat | 使用したコンテキストウィンドウ(パーセント)。 | | Td | chat | 完了した Todo / 全 Todo。例:3/5。チャットに Todo リストがある間だけ表示します。 | | Tk | chat | セッション開始後にこのチャットが使用したトークン(入力、出力、キャッシュの読み書き、サブエージェントを含む)。モデルリクエストごとに増えます。 | | Co | chat | 現在までのセッションのコスト(米ドル)。 | | Ca | chat | プロンプトキャッシュの残り時間(33m)。期限切れになると expired です。 |

ターミナルの幅が狭いときは、重要度の低い順にモデルラベル、limits と chat、Ca、Co、Tk、Td、Wk、ピクセル Claude、Cx を削ります。Se はできるだけ残し、それも収まらなければ帯全体を隠します。詰めたり折り返したりはしません。

制限

  • mod(function-hook プラグイン)に対応した Claude Code が必要です。Claude Code 2.1.288 でテストしています。mod API はまだ early access で、バージョン間で変わる可能性があります。
  • リングは kitty と Ghostty ではピクセル画像、それ以外のターミナルではグリフを表示します。
  • 週、セッション、コンテキストのリングは 95% から赤くなり、キャッシュ時間 Ca は最後の 3 分で赤くなります。
  • Ca は推定値です。Claude Code はキャッシュの有効時間(5 分または 1 時間)をプラグインに知らせないため、ボードは 1 時間と仮定し、各リクエストがキャッシュから読んだ内容を見て学習します。5 分を超える中断後のヒットは 1 時間、ミスは 5 分を意味します。システムプロンプトが変わった場合もミスになりますが、ボードからは判別できません。
  • セッション開始時または再開時、Tk は 0 から始まります。再開したセッションの以前のトークンは利用できません。Co はセッションのコストから始まります。
  • Td は TaskCreate/TaskUpdate/TaskList と TodoWrite を数えます。新しいモデルでこれらのツールを使うには CLAUDE_CODE_ENABLE_TODO_TOOLS=1 が必要です(docs)。
  • ボードが把握する他のセッションの状態は busy か idle だけで、「入力が必要」かどうかは分かりません。名前のないセッションは隠れます。
  • ボードは 5 s ごとに ListAgents ツールからセッション一覧を読みます。出力はモデル向けのテキストで固定形式ではないため、Claude Code の更新で形式が変わるとエラーを表示せず空のままになります。

オプション

usage-ring にはデフォルトで無効なオプションが 1 つあります。

| オプション | 意味 | |---|---| | limitsFile | セッションと週次制限を $CLAUDE_CONFIG_DIR/usage-limits.json(デフォルト ~/.claude)に書き込み、他のツールから読めるようにします。 |

Claude Code で /plugin configure usage-ring@claude-mods を実行するか、次を実行します。

echo '{"limitsFile":"true"}' | claude plugin configure usage-ring@claude-mods --values-stdin

開発

  • 各プラグインは plugins/<name>/ にあり、.claude-plugin/plugin.json、hooks/hooks.json、hook を持つ hooks/register.tsx、隣接する純粋ロジックのファイル、状態契約である types/index.d.ts、tests/ で構成されます。
  • 確認:claude plugin validate .、続いて claude plugin validate plugins/<name> と claude plugin test plugins/<name> を実行します。
  • ローカル clone からインストールすると、Claude Code はその場のファイルを読みます。変更は /reload-plugins または次のセッションで反映されます。
  • 2 つの mod はプロンプト上の同じ帯に描画されます。各 render hook は next(e) を呼び、下にある内容を残します(session-board が上、usage-ring がプロンプトの隣)。

ライセンス

MIT。 LICENSE を参照してください。

インストール

まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。

claude plugin marketplace add Oualid0/claude-mods
claude plugin install usage-ring
原文 / README

claude-mods

Mods for the Claude Code terminal: a band of rings above the prompt that shows your limits, this chat's usage and the prompt cache, plus a board of your running Claude sessions.

Quick install

Copy this prompt into Claude Code:

Install the Claude Code plugins from https://github.com/Oualid0/claude-mods:
add the repo as a plugin marketplace, then install every plugin listed in its
.claude-plugin/marketplace.json, and tell me to run /reload-plugins when done.

Manual install

claude plugin marketplace add Oualid0/claude-mods
claude plugin install usage-ring@claude-mods
claude plugin install session-board@claude-mods

Then run /reload-plugins in Claude Code, or start a new session. From a local clone, ./install.sh does the same (it needs python3) and is safe to run again.

Update

Auto-update is off by default. Update by hand with /plugin marketplace update claude-mods in a session, or claude plugin update usage-ring@claude-mods and claude plugin update session-board@claude-mods in the shell. You can also turn on Enable auto-update for the marketplace under Marketplaces in /plugin.

Mods

| Plugin | What it does | |---|---| | usage-ring | Two chips right above the prompt: limits and chat, with a pixel Claude beside them that hammers while a turn runs and sleeps otherwise, and the model in grey next to it, e.g. Opus 5.5 (mid) (effort low, mid, high, xhigh or max, known from the first request on). | | session-board | A sessions chip above that while other Claude sessions on this machine are running: one row each (● running, ✓ done for 60 s after it finished), plus your own row (○ ready or ● running) marked ←. With no other session running, the board is hidden. |

What the labels mean

| Label | Chip | Meaning | |---|---|---| | Wk | limits | Weekly limit used, in percent. | | Se | limits | Session limit (the 5-hour window) used, and the time until it resets: 4:50h, or 33m under an hour. Once the window is over it shows 0% 5:00h until the next reading. | | Cx | chat | Context window used, in percent. | | Td | chat | Todos done out of all, e.g. 3/5. Only while the chat has a todo list. | | Tk | chat | Tokens this chat used since the session started (input, output, cache reads and writes, subagents included). Grows after every model request. | | Co | chat | What the session cost so far, in US dollars. | | Ca | chat | Time left on the prompt cache (33m), expired once it lapsed. |

When the terminal is narrow, the least important goes first: the model label, the words limits and chat, Ca, Co, Tk, Td, Wk, the pixel Claude, then Cx. Se stays longest; if not even it fits, the band is hidden. Nothing is squeezed or wrapped.

Limits

  • Needs a Claude Code version with mods (function-hook plugins); tested with Claude Code 2.1.288. The mod API is early access and may change between versions.
  • Rings are pixel images in kitty and Ghostty; other terminals show a glyph instead.
  • Rings for the week, session and context turn red from 95%, and the cache time Ca turns red in its last 3 minutes.
  • Ca is an estimate. Claude Code does not tell plugins how long the cache lives (5 minutes or 1 hour), so the band assumes 1 hour and learns from what each request read from the cache: a hit after a pause of more than 5 minutes means 1 hour, a miss means 5 minutes. A miss can also come from a changed system prompt, which the band cannot see.
  • Tk starts at 0 when a session starts or resumes; earlier tokens of a resumed session are not available. Co starts with the session's cost.
  • Td counts TaskCreate/TaskUpdate/TaskList and TodoWrite. Newer models only have these tools with CLAUDE_CODE_ENABLE_TODO_TOOLS=1 (docs).
  • The board knows other sessions only as busy or idle; "needs input" is not available. Sessions without a name are hidden.
  • The board reads the session list from the ListAgents tool every 5 s. Its output is text for the model, not a fixed format: if a Claude Code update changes it, the board stays empty instead of showing an error.

Options

usage-ring has one option, off by default:

| Option | Meaning | |---|---| | limitsFile | Write the session and weekly limits to $CLAUDE_CONFIG_DIR/usage-limits.json (default ~/.claude) for other tools to read. |

Set it with /plugin configure usage-ring@claude-mods in Claude Code, or:

echo '{"limitsFile":"true"}' | claude plugin configure usage-ring@claude-mods --values-stdin

Development

  • Each plugin lives in plugins/<name>/: .claude-plugin/plugin.json, hooks/hooks.json, hooks/register.tsx with the hooks, pure logic in files beside it, types/index.d.ts (the state contract) and tests/.
  • Check: claude plugin validate ., then claude plugin validate plugins/<name> and claude plugin test plugins/<name>.
  • Installed from a local clone, Claude Code reads the files in place: changes apply with /reload-plugins or the next session.
  • Both mods draw into the same band above the prompt; each render hook calls next(e) and keeps what is beneath (session-board on top, usage-ring next to the prompt).

License

MIT, see LICENSE.

関連作品