ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 Lunik

context-cache

一个 Claude Code 外挂,在底部网格中加入一行,显示上下文窗口填充量和提示缓存状态(命中率及 TTL 倒计时);上下文接近填满或缓存过期时会显示通知。

Lunik@Lunik

Lunik/gmz-claude-marketplace/tree/master/context-cache

已翻译

关于这个 mod

context-cache 会显示上下文窗口有多满,以及提示缓存的状态。

Context ┃ Window 17% ┃ Cache hit 99% ┃ Cache TTL 4m33s

单元格:

  • Window:上下文填充量。低于 70% 为绿色,从 70% 起为橙色,从 85% 起为红色。
  • Cache hit:上一条提示中由缓存提供的比例。低于 20% 为红色。
  • Cache TTL:距离缓存过期的倒计时,来自 API 报告的 TTL(5 分钟或 1 小时)。耗尽后显示 expired。

只有当上下文至少包含 20k 个令牌时,才会显示 Cache hit 和 Cache TTL。

上下文越过 70%、85% 或 95%,发生缓存未命中、距离过期 60 秒,以及过期时,都会触发通知。

行为:右下角网格中的一行每秒刷新;只计算主对话,因为子代理拥有自己的缓存条目。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add Lunik/gmz-claude-marketplace
claude plugin install context-cache
原文 / README

context-cache

Shows how full the context window is and how the prompt cache is doing.

Context ┃ Window 17% ┃ Cache hit 99% ┃ Cache TTL 4m33s

Cells

| Cell | Meaning | |---|---| | Window | Context fill. Green below 70%, orange from 70%, red from 85%. | | Cache hit | Share of the last prompt served from cache. Red below 20%. | | Cache TTL | Countdown to cache expiry, from the TTL the API reports for the entry it just wrote (5 minutes or 1 hour). expired once it ran out. |

Cache hit and Cache TTL only show once the context holds at least 20k tokens, below that a cold cache costs little. Until then, and before the first response, they read -.

Toasts

  • Context crosses 70%, 85% or 95%: consider /compact.
  • Cache miss: a response re-wrote 20k+ tokens at full price with a hit rate under 20%.
  • Cache expires in 60 seconds: send a prompt to keep it.
  • Cache expired: the next prompt re-reads the context uncached.

Behavior

  • Row in the bottom-right grid, refreshed every second.
  • Only the main conversation counts; a subagent has its own cache entry.

更多类似作品