myUdav4iik/claude-mods/tree/main/context-bar

Claude Code のプラグインです。プロンプトの上にある帯にコンテキストウィンドウの内訳をリアルタイム表示し、カテゴリ別使用量、コンパクション閾値、レート制限ウィンドウを示します。/context-bar で切り替えます。
myUdav4iik/claude-mods/tree/main/context-bar

context-bar は、プロンプトの上の帯にコンテキストウィンドウの内訳をリアルタイムで描画する Claude Code mod です。ヘッダーには、使用中のウィンドウの割合を色分けしたバッジ(50% 未満は緑、80% 未満は黄、それ以上は赤)、使用中の token、ウィンドウサイズ、自動コンパクションが実行される位置が表示されます。バーには各カテゴリの割合に応じたセグメントが 1 つずつ並び、その後に空き領域のトラックが続きます。凡例には各カテゴリと token 数が、/context で使われる色で表示されます。オプションの使用量行には、プランのレート制限ウィンドウ(5h、7d、またはゲートウェイの利用上限)、使用割合、リセットまでのカウントダウンが表示されます。これはサブスクリプションでのみ表示されます。/context-bar、/context-bar on、/context-bar off で切り替え、選択はセッションをまたいで保持されます。使用するフックは session.start(登録、状態の復元、初回読み取り、カウントダウンタイマー)、turn.complete(各メイン会話ターン後の読み取り、サブエージェントはスキップ)、session.compact(コンパクション後の読み取り)、session.measure(ターン間の使用量更新)、AbovePrompt 上の ui.render(帯の描画、アンケート時は退避)です。読み取り元は $.session.usage({ breakdown: 'summary' }) で、ローカル推定のためリクエストは送りません。バーは flex box を使うため正確な割合で分割され、折り返しません。空き領域はターミナルでは暗い線、デスクトップアプリでは暗い塗りつぶしで表示します。既知の制限は、カテゴリの数値が推定値であること、1 ターンに 1 回だけ更新すること、次の API 応答まで使用率が古いままになること、初回読み取り前はプレースホルダーになること、他の mod と帯を共有することです。テストは tests/bar.test.tsx にあり、claude plugin test . で実行できます。
まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。
claude plugin marketplace add myUdav4iik/claude-mods claude plugin install context-bar
A live breakdown of the context window, drawn in the band above Claude Code's prompt.
In the terminal:

In the desktop app:

/context uses.5h, 7d, or a gateway's spend limit), each with the share used, coloured like the context badge, and a countdown to when it resets. The row only appears on a subscription, where Claude Code receives these figures.| Command | Does |
| --- | --- |
| /context-bar | Shows or hides the bar |
| /context-bar on | Shows the bar |
| /context-bar off | Hides the bar |
The command runs at once, even while Claude is working. The choice is remembered across sessions. Claude Code's own [-] control on the band collapses it as well.
| Hook | What it does |
| --- | --- |
| session.start | Registers /context-bar, restores the saved on/off choice, takes a first reading, and starts a once-a-minute timer for the reset countdowns. |
| turn.complete | Takes a reading after each turn of the main conversation. Subagent turns are skipped. |
| session.compact | Takes a reading after the conversation is compacted. |
| session.measure | Updates the usage row when a rate-limit window moves, between turns too. |
| ui.render on AbovePrompt | Draws the band. It steps aside while Claude Code shows a survey there. |
Readings come from $.session.usage({ breakdown: 'summary' }), the same per-category breakdown /context shows. The summary mode estimates locally, so a reading sends no requests and costs nothing. The same call returns the rate-limit windows from the last API response; the usage row shows those, so it sends no requests either.
The bar is built from flex boxes, each growing by its share of the window, so it splits in exact proportion at any width and never wraps. Small categories still get at least one cell. Free space is drawn differently per surface:
The compaction reserve is drawn as part of the free track; the header shows where compaction runs.
/context, so the total can differ slightly from the status line.tests/bar.test.tsx feeds the mod a sample breakdown, draws the band on the terminal and desktop surfaces, and fails if either surface refuses the drawing. Claude Code drops a drawing it can't validate without an error you'd see, so run the tests after changing how the bar is drawn:
claude plugin test .