dsh-cache-hit-monitor: Real-time Prompt Cache hit rate monitoring in the DSH sidebar

Introduction

When running long conversations or repeatedly tweaking prompts in DSH (DeepSeek Harness), whether the model-side prompt cache hits directly affects latency and input token costs. The Host already provides session projections (tokenUsage, contextPressure), but the default UI may not surface “hit rate” and “per-request history” in an immediately scannable location.

Below is an introduction to the community plugin dsh-cache-hit-monitor (maintainer Billwu18, category: client). It adds a dashboard tab to the right sidebar of DSH Web, rendering the current session’s prompt-cache telemetry as a register bank, a dot-matrix hit rate, and a “reactor core” history board. Data comes from existing Host projections; the plugin itself makes no network requests.

What Is This

dsh-cache-hit-monitor is a client plugin for the DSH Web platform (dsh.client.platform: web). The Host-side index.js only exports an empty apply, used to register and enable/disable it in the Loader; all actual display is done by the browser-side client.js (React, DSH browser-module format).

The plugin reads the already-computed tokenUsage and contextPressure from the Host via useProjection. The collapsing logic depends on the Host-side @deepseek-ai/dsh-token-meter. No extra dependencies, no build step.

Core Features

The sidebar gains a new Tab; on every page load this Tab opens automatically once, so you can see the panel directly, and it can be closed the same way as other Tabs. The Tab is registered with keepMounted: true, so switching Tabs should avoid losing locally recorded history due to remount.

The panel consists of four “dials”:

Dial Content
Hit rate Session cache hit rate shown as a 5×7 dot-matrix percentage; plus the number of settled requests, the hit rate of the last request, the elapsed time since that request, and a 28-LED bar relative to the current total prompt size.
Register bank Four non-overlapping cache buckets: cache read, cache write, uncached input, output; shows the session cumulative total and proportionally lit LED rows.
Reactor core One cell per settled request, newest at top-left; color indicates that request’s hit rate, diameter relates to the request’s tokens relative to the heaviest request on the board, older ones fade out. Hover title to see the precise read / write / uncached / output breakdown.
Context pressure Pressure tokens relative to the context window.

How Hit Rate Is Calculated

Output tokens are not included in the hit rate (generated tokens cannot be cached; including them would inflate it):

hit rate = cache read / (cache read + cache write + uncached input)

Meaning of the Reactor Core Cells

  • Ink: That request’s hit rate, as a monochrome intensity gradient.
  • Diameter: sqrt(request tokens / heaviest request on the board), avoiding a large cold start from squeezing out small requests.
  • Fade: Lower cells are darker, indicating they are older.

Board height is controlled by ROWS 4 / 6 / 9 for the maximum number of rows; the number of columns adapts to the sidebar width, so on a narrow sidebar the same history takes more rows. CLR only clears the current session’s records stored in this plugin’s memory; it does not modify Host data.

Next to the title: a solid red dot indicates at least one settled request in this session; an empty ring indicates no records yet. The register bank is the session total, and LED rows scale proportionally relative to the largest bucket currently on screen.

Installation and Enablement

Requirements (consistent with the README):

  • DSH: >=0.1.7-rc.1 <0.2.0-0
  • Platform: web (dsh plugin --profile web)
  • React 18+ (provided by DSH Web UI)
  • Node >=20 is only needed for in-repo test scripts; running the plugin does not require Node

Install from GitHub:

dsh plugin --profile web add github:Billwu18/dsh-cache-hit-monitor

You can also install it via the Plugin Manager in the Web UI. After installation, refresh the page; when developing with a local-path install, the Host re-reads the build output based on file modification time, so after editing client.js just refresh—no need to restart dsh web.

The plugin runs with the permissions of the current DSH process and Web session; before installing, please review the source code and the MIT license yourself. SkillHub is a community site and has no official affiliation with DeepSeek / High-Flyer.

Typical Usage

  1. In a DSH Web environment meeting the version requirements, run the above dsh plugin --profile web add command (or add via the Plugin Manager).
  2. Reload the page; a Cache Hit Monitor Tab should appear automatically in the sidebar.
  3. Chat normally and send requests; every time a request settles, the hit-rate dot matrix, the register bank, and the session cumulative total update, and a new cell is added to the reactor core.
  4. To compare history density between narrow/wide sidebar widths, drag the sidebar width and observe the changes in column count and row filling.
  5. When doing A/B prompt or long-context experiments, use the reactor core’s colors and title breakdown to verify individual requests, rather than only looking at the session average dot matrix.
  6. If you only want to look at a new segment of experiments, click CLR to clear local history (it does not affect Host logs).

The UI supports English and Chinese locales, falling back to English for other languages; under both light and dark themes the dials are intentionally dim, and the surrounding chrome follows the --dsw-* tokens.

Use Cases and Notes

Who It’s For

  • Debugging agents, long system prompts, or repeated prefixes in DSH Web, where you need an intuitive view of whether the prompt cache is working.
  • Reviewing the hit-rate trend per request, rather than digging through token details only in logs.

Privacy and Data

  • Reads only local session projections; no network requests, no outbound telemetry; history is not persisted anywhere except in memory. CLR only clears the Tab’s internal state.

Compatibility and Host

  • Requires the Host to provide the sidebarRightTabs service and the above projections.
  • The Host-side plugin contains no business logic; disable/uninstall follows the regular DSH plugin workflow.

Conclusion

dsh-cache-hit-monitor aggregates the Host’s existing tokenUsage / contextPressure into a sidebar dashboard: use the register bank to see bucket proportions, the dot matrix to see session hit rate, and the reactor core to see per-request history. If you are doing prompt-cache-related optimization on the Web side, install it first and read values against the panel instead of guessing hot/cold from feel.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye