jimmyeao/claude-code-bars/tree/main/plugins/usage-bar
GitHub リポジトリ · 投稿者 jimmyeao
usage-bar
プランの使用量制限をプロンプト上部に時間枠ごとの色付きバーで表示し、時計の進みより速く使っている時間枠を示します。`/usage-bar` で切り替えます。
jimmyeao@jimmyeao
この mod について
usage-bar
プランの使用量制限をプロンプト上部にバーで表示し、時計の進みより速く使っている時間枠を示します(表示例であり、実際の数値ではありません)。
Usage · amber = using a window faster than its clock · session $12.19
Session █████████████████████░░░░░ 79% used · 47% of time · 32 pts ahead of the clock · resets in 2h 40m
Week ███░░░░░░░░░░░░░░░░░░░░░░░ 10% used · 61% of time · resets in 2d 18h
- 制限時間枠ごとに 1 本のバー:エンジンが報告するのは
Session(5 時間)、Week(7 日)、ゲートウェイの支出制限を表すSpendです。色は時間枠を示します。塗りつぶし部分が使用済み、網掛け部分が残りです。 % of timeは、リセット時刻から計算した時間枠の経過割合です。- フラグは表示された 2 つの数値を比較します。5 ポイントを超えて先行すると
% usedがアンバーになり、N pts ahead of the clockが追加されます。25 ポイントを超えて先行するか、使用量が 95% 以上になると赤になります。長さが不明な時間枠(支出制限)には時計がないため、ほぼ満杯のときだけフラグが付きます。 - セッションコストはヘッダー行に表示されます。
使い方
/usage-bar で切り替えます。各セッションでは最初から有効です。
仕組み
$.session.usage()から、直近の API 応答に含まれるレート制限時間枠とセッションコストを読み取ります。- 各プロンプトとターン完了後に更新し、カウントダウンが進み続けるよう 1 分ごとにも更新します。
AbovePromptバンドに描画し、そこに描画する他のバンドの上に重ねます。アンケート表示中は場所を空けます。
制限
- エンジンが報告する時間枠だけを表示します。モデル別の行(たとえば Sonnet のみ)はないため、
/usageのすべての行とは一致しません。 - サブスクリプションプランを利用していない場合は描画する制限がなく、"No plan limits reported for this account." と表示します。
- 時間枠の長さは 5 時間と 7 日と仮定します。実際の長さが異なる場合、
% of timeは概算です。
インストール
まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。
claude plugin marketplace add jimmyeao/claude-code-bars claude plugin install usage-bar
原文 / README
usage-bar
Draws your plan usage limits as bars above the prompt, and flags a window you are using faster than its clock (illustrative output, not real figures):
Usage · amber = using a window faster than its clock · session $12.19
Session █████████████████████░░░░░ 79% used · 47% of time · 32 pts ahead of the clock · resets in 2h 40m
Week ███░░░░░░░░░░░░░░░░░░░░░░░ 10% used · 61% of time · resets in 2d 18h
- One bar per limit window the engine reports:
Session(5 hours),Week(7 days), andSpendfor a gateway spend limit. The colour says which window it is. The solid part is what you have used, the shaded part is what is left. % of timeis how much of the window has already passed, worked out from its reset time.- The flag compares the two printed numbers. More than 5 points ahead turns
% usedamber and addsN pts ahead of the clock. More than 25 points ahead, or 95% used or more, turns it red. A window with no known length (the spend limit) has no clock, so it is flagged only when nearly full. - Session cost appears in the header line.
Use
/usage-bar toggles it. It starts on in every session.
How it works
- Reads
$.session.usage(): the rate-limit windows from the last API response, and the session cost. - Refreshes after each prompt and finished turn, and once a minute so the countdowns keep moving.
- Draws in the
AbovePromptband, on top of whatever other band mods draw there. It steps aside while a survey is showing.
Limits
- It shows only the windows the engine reports. There are no per-model rows (for example Sonnet-only), so it will not match every line of
/usage. - Off a subscription plan there are no limits to draw, and it says "No plan limits reported for this account."
- The 5-hour and 7-day window lengths are assumed. If a window is not exactly that long,
% of timeis approximate.
