Introduction¶
Agent conversations usually follow an assistant -> tool -> assistant -> tool loop. Within a turn, the first model call is often the point at which the provider’s prompt cache has expired and a full re-prefill (cache rebuild) is needed; later calls in the same turn can usually hit the freshly rebuilt cache.
DSH’s built-in token/cache statistics appear below the input box, and the artifact-file row appears at the end of the turn. Neither location can show a hint in place where the miss actually occurs. When cache rebuilds happen frequently or when the context is long, this delayed information increases troubleshooting costs.
The following section introduces the dsh-cache-miss plugin. It renders a single-line yellow hint directly beneath the first assistant reply in a turn, but only when that request is truly a cache miss.
What Is This¶
dsh-cache-miss is a DSH web plugin in the “Memory” category, maintained by developer wefio.
This plugin is designed to solve the problem of hard-to-locate low cache-hit rates during Agent development. It helps developers quickly assess the effectiveness of context management and cache configuration by displaying detailed cache-miss data directly in the web interface.
Core Features¶
The plugin mainly provides the following capabilities:
- Immediate Miss Hint: Directly below the first assistant reply in a turn, it renders a single-line yellow hint only when the request is confirmed to be a cache miss.
- Detailed Data Display: The hint includes the following fields:
idle: idle time since the previous turn ended.re-billed: input tokens re-billed because the first request in the turn missed the cache (abbreviated as k).cached: cache hits within the same prefill.ttft: time to first token.
- Provider Compatibility Handling: If a provider does not return cache fields, it shows a gray “Unconfirmed” hint.
- Pure Front-End Implementation: It does not write to the session log, does not modify DSH source code, and does not occupy the turn-tail chain, so it will not conflict with artifact-file rows (for example,
DSH-better-sidebar).
Installation and Enablement¶
The installation command is as follows:
dsh plugin --profile web add dsh-cache-miss
After running the command above, restart dsh web (or perform a hard refresh on the running GUI) to load the client bundle.
Typical Usage¶
When a cache miss occurs, the interface displays a hint similar to:
Cache miss after 3m idle: 182k tokens re-billed · 0.8k cached · ttft 2.1s ↑
↑: The upward arrow indicates that rebuilding the prefill is usually slower.- The data is taken from the
usagechunk in the stream. The hint appears as soon as usage arrives (while the reply is still being generated), so there is no need to wait until the assistant message ends.
Applicable Scenarios and Notes¶
This plugin is suitable for debugging long Agent contexts and optimizing prompt caching strategies.
Note the following details:
- TTFT Display Scope: TTFT is derived from session event times, specifically the wall-clock interval from a step’s
step/startevent to the first non-empty token delta event. If either boundary falls outside the loaded window, it is treated as missing, and the· ttft ...segment is not shown. - Miss Determination Logic: The plugin determines a miss using
hitRatio, requiringinputTokens > 0,hitRatio < 80%, andinputTokens >= 1000. - Provider Compatibility: For a provider that has never returned cache fields, the first occurrence shows an “Unconfirmed” hint, without heuristic guessing. If the same provider appears later and still has no cache fields, it remains silent.
- Log Output: At most one console log is emitted per step; turns with cache hits do not produce a visible line.
Short Conclusion¶
After the steps above, dsh-cache-miss can provide real-time cache-hit-rate feedback in the DSH web client. It does not modify core system logic; it only uses front-end display to help developers optimize their context strategies.
Plugin directory: https://www.skillhub.cn/plugins/wefio/dsh-cache-miss
GitHub repository: https://github.com/wefio/dsh-cache-miss