mrzzmrzz/claude-code-mods/tree/main/plugins/omni-token
omni-token
プロンプト上の帯にコンテキストウィンドウの予測、tok/s、プロンプトキャッシュのヒット率、TTL をリアルタイム表示し、任意でキャッシュの自動ウォームと /omni-token 操作を提供する Claude Code プラグインです。
この mod について
omni-token は claude-code-mods マーケットプレイスの Claude Code プラグインで、各ターンの後に更新されるコンテキストウィンドウのリアルタイム予測をプロンプト上の帯に描画します。表示には天気のような塗りつぶしインジケーター(Clear から Compact soon まで)、絶対値と割合のコンテキスト使用量、12 ターンの sparkline、直前のターンの出力 token/秒、プロンプトキャッシュのヒット率、キャッシュの有効期限までのカウントダウンが含まれます。5 分未満になると黄色になり、期限切れ後は expired と表示します。/plugin marketplace add mrzzmrzz/claude-code-mods と /plugin install omni-token@claude-code-mods でインストールします。オプションは cacheTtl(5m または 1h)、autoWarm、warmHours です。auto-warm を有効にすると、アイドル状態のセッションはキャッシュ期限の少し前に小さな fork リクエストを 1 回送り、TTL を再開します。そのリクエストはトランスクリプトに入らず、warmHours に達するかキャッシュがすでに冷えていれば停止します。/omni-token コマンドで状態を表示し、セッションごとにウォームをオフ、オン、リセットできます。
インストール
まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。
claude plugin marketplace add mrzzmrzz/claude-code-mods claude plugin install omni-token
原文 / README
claude-code-mods
Mods for Claude Code, packaged as a plugin marketplace.
Install
In Claude Code:
/plugin marketplace add mrzzmrzz/claude-code-mods
/plugin install omni-token@claude-code-mods
Mods
omni-token
A live forecast of your context window, shown in the band above the prompt and updated after every turn:
Cloudy 67% 134.4k / 200k ▂▃▄▅▆█ ▲ +98.3k last turn 95 tok/s cache 96% 58:12
| Fill | Forecast (color) | | --- | --- | | < 25% | Clear (yellow) | | 25–49% | Cloudy (cyan) | | 50–74% | Showers (blue) | | 75–89% | Storm (magenta) | | ≥ 90% | Compact soon (red) |
- The sparkline covers the last 12 turns, scaled to the highest of them.
tok/sis the last turn's output tokens (thinking included) over the time from each request's start to its response's end.cache 96%is the last turn's prompt-cache hit rate: cache reads over all input tokens.58:12counts down to when the prompt cache expires: the last main-loop request's start plus the cache TTL. It turns yellow under 5 minutes and readsexpiredafter.
Options
| Option | Values | Default |
| --- | --- | --- |
| cacheTtl | 5m, 1h | 1h |
| autoWarm | true, false | false |
| warmHours | hours | 24 |
Auto-warm
With autoWarm on, while the session is idle the mod sends one tiny forked request over the main thread's own prefix shortly before the cache expires (3 minutes before on 1h, 1 minute on 5m). The cache read restarts the TTL, so the next real message reads the cache instead of rewriting the whole context. The fork never enters the transcript.
- Each warm bills a cache read of the whole context (on Claude Opus 5.5, context × $0.20/MTok) plus a few hundred output tokens.
- It stops
warmHoursafter the last turn started, and never warms an expired cache (that would pay the full write it exists to avoid) or a context under 50k tokens. warmed 3xshows how many warms ran since the last turn;warm missedmeans a warm found the cache already cold, and warming stops until the next turn.
/omni-token
| Command | Effect |
| --- | --- |
| /omni-token | Status: auto-warm on or off and why, cache TTL and time left, warms since the last turn, option names |
| /omni-token warm off | Stop auto-warming in this session, at once; other sessions and the autoWarm option are unchanged |
| /omni-token warm on | Auto-warm this session even with autoWarm off |
| /omni-token warm reset | Follow the autoWarm option again |
On a 1-hour TTL, keeping a cache warm costs 0.2/7.8 of a cold restart per hour, so it pays off for gaps under about 39 hours, if you come back.
The API's usage figures don't say which TTL a session runs on, so set it to match yours: 1h on most Claude subscriptions, 5m on the API default or in usage overage.
Developing
Load a mod straight from this checkout, with hot reload on save:
claude --plugin-dir ./plugins/omni-token
Check one before committing:
claude plugin validate ./plugins/omni-token
claude plugin test ./plugins/omni-token
