ClaudeMods
☰
ZH-CN
● 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

其他同名作品

更多类似作品