ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 Vosssa

usage-band

一個 Claude Code 外掛,在提示列上方顯示四個環:上下文填充量、5 小時用量限制、每週限制和提示快取熱度,並在大型上下文時顯示建議 Clear/Compact 操作的提醒列。

Vosssa@Vosssa

Vosssa/claude-usage-band/tree/main/plugins/usage-band

原貼文圖片1
已翻譯

關於這個 mod

usage-band 會在 Claude Code 提示列上方一直顯示四個環:Context(例如 92k / 1M)、帶重設時間的 5h 用量限制、帶重設時間的 7d 每週限制,以及 Cache warmth(顯示剩餘 TTL 的 Warm,或 Cold)。隨著限制接近,環會從綠色變成琥珀色再變成紅色。上下文超過 400k token 後會出現提醒列,提供一鍵 Clear、Compact 和 Later 操作,並根據快取狀態選擇成本最低的動作(冷快取偏向 Clear,接近過期或熱快取偏向 Compact)。相同四項也會在終端機 Claude Code 中顯示為文字環(○ ◔ ◑ ◕ ●)。它回報約 0 個常駐 token:不會向提示加入任何內容,從不呼叫模型,只接收 Claude Code 在每次回應後推送的用量數字,並且只執行本機每分鐘一次的倒數計時器。快取計時器會用真實 API 命中/未命中次數驗證;TTL 從觀察到的命中或未命中中學習,狀態會跨重新啟動保存,限制在各專案之間共享。5h 和 7d 環需要訂閱;使用 API key 時只顯示 Context 和 Cache。透過 'claude plugin marketplace add Vosssa/claude-usage-band' 和 'claude plugin install usage-band@claude-usage-band --scope user' 安裝。採用 MIT 授權。

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add Vosssa/claude-usage-band
claude plugin install usage-band
原文 / README

usage-band

Your Claude Code limits, context fill and prompt-cache warmth, right above the prompt.

usage-band: context, 5h, weekly and cache rings above the Claude Code prompt

Four small rings, always in view:

| | What it shows | |---|---| | Context | How full the context window is: 92k / 1M | | 5h | Your 5-hour usage limit, and when it resets | | 7d | Your weekly limit, and when it resets | | Cache | Whether the prompt cache is Warm (and how long it has left) or Cold |

Rings go green → amber → red as you approach a limit.

The big-context reminder

Above 400k tokens of context, a reminder row appears with one-click actions. It knows the state of the cache and suggests the cheapest move:

usage-band reminder row with Clear, Compact and Later buttons

| Situation | Message | Suggested | |---|---|---| | Cache is cold | Cache cold: next message re-reads 452k. Clear is free. | Clear | | Cache expires within 10 min | Cache expires in 6m: compact now while it's cheap. | Compact | | Cache is warm | 452k in context: each turn re-sends all of it. | Compact |

Later hides the row until the context grows by another 100k.

Why this matters: a cached prompt is read at about a tenth of the normal input price. Once the cache has expired, your next message pays to read the whole conversation again, and so does /compact. /clear costs nothing.

Terminal too

In terminal Claude Code it shows the same four items with text rings (○ ◔ ◑ ◕ ●):

usage-band in terminal Claude Code

Install

claude plugin marketplace add Vosssa/claude-usage-band
claude plugin install usage-band@claude-usage-band --scope user

Restart Claude Code. The band appears in every session, in both the desktop app and the terminal.

Update later with:

claude plugin marketplace update claude-usage-band
claude plugin update usage-band@claude-usage-band

Cost: zero tokens

claude plugin details usage-band@claude-usage-band reports Always-on: ~0 tok.

  • It adds nothing to the prompt and never calls the model.
  • The usage numbers are pushed to it by Claude Code after each response. It never polls for them.
  • It runs one local timer, once a minute, to keep the countdowns current.

Notes

  • The cache timer is checked against the real numbers. The countdown runs from your last response. After every message, the API's own cache counts show whether it was actually read from cache (✓ hit 98%) or paid in full (✗ missed 452k). An unexpected miss also shows a toast.
  • The TTL is learned. It starts by assuming 1 hour on a subscription and 5 minutes on an API key. When a message sent after a longer pause still hits, or misses, the band switches to the TTL it actually saw and remembers it.
  • It remembers between restarts. The limits and the cache timer show up right away when you open a session, not only after your first message. Limits are shared across projects: a session you switch back to picks up newer numbers within a minute.
  • The 5h and 7d rings need a subscription. On an API key, only Context and Cache are shown.

License

MIT

其他同名作品

更多類似作品