dsh-cache-helper: DSH Cache Hit Display, Pre-send Risk Confirmation, and Session Dashboard

Preface

When running long sessions in DeepSeek Harness (DSH), context prefix caching can significantly reduce billing for repeated inputs; however, once the tool list, history projection, or system prompt changes, the entire prefix may be invalidated all at once, and the usage figure in the interface often only reflects “the last call of this turn,” making it difficult to judge “whether this send will blow away the cache accumulated last time” before sending. The community plugin dsh-cache-helper (maintainer ghang, current version 0.1.2) targets the web profile, displays the last actual cache reading and hit rate at the end of answers, intercepts large-scale prefix-loss risks by threshold after context assembly, and retains WARN and session-level cache dashboard to facilitate troubleshooting against the real usage receipts in the Session.

What Is This

dsh-cache-helper is a cache helper plugin for DSH: it displays cacheReadTokens and the hit rate, lets you confirm expected large-scale cache invalidation before sending, records anomalous turns, and provides session statistics and step details in “Settings → Cache Dashboard.” The plugin does not register model tools, does not inject prompts, and does not modify model requests; the Session remains the source of truth for context and usage. The documented verified host is the DSH 0.2.1-rc.2 web profile; other versions must be verified yourself. Prebuilt packages are available at GitHub Releases; directory page: skillhub.cn/plugins/ghang/dsh-cache-helper.

Core Features

The four capabilities below are summarized according to the behavior table in the README.

Last Cache Per Turn

At the bottom of the answer, after “Usage” and before the time, display the cache read tokens and hit rate of the last actual model call in that turn; hover to view the step and exact values. By convention, only the last call of the belonging turn is taken, without accumulating multiple steps, and without mixing in other turns; when the last receipt lacks cache fields, “Unknown” is shown, without falling back to earlier known values.

Pre-Send Confirmation

After context assembly completes, the plugin compares the valid prefix of the last actual request; when the expected loss reaches the threshold, it pauses sending, and you need to click “Confirm and Send” to continue. The default thresholds are: expected loss at least 50,000 tok, and reaching 20% of the last input. The first cold start passes normally; only appending user input is not counted as old prefix loss. For models that support history tool updates, comparison is done by actual tool projection; when new deferred tools activate at the end of history, false positives due to the declaration list changing alone will not occur.

WARN

Above the input box, retain anomalous turns, steps, actual metrics, and difference clues (local comparison clues such as tool, system, or history changes, not a definite proof of server-side invalidation). Even if hits recover later, records are retained, and can be expanded or collapsed.

Cache Dashboard

In “Settings → Cache Dashboard,” view session cumulative metrics and step details, with support for search, anomaly filtering, and paging; there is also a quick entry at the end of answers. The dashboard indicates the scan range, failure count, and unknown usage; reaching the scan limit does not mean all historical sessions have been analyzed.

Metric Conventions (Recommended Reading Before Interpreting Readings)

Cache quantity is the cacheReadTokens of that response. The cache rate is:

cacheReadTokens / (inputTokens + cacheReadTokens + cacheWriteTokens)

DSH’s inputTokens is uncached input; output is not counted in the denominator. The dashboard’s cumulative rate is weighted by each input quantity. Expected prefix loss is calibrated using character positions and the last actual usage; it is an estimate. Actual miss alerts subtract the explainable impact of newly added input.

Installation and Enablement

Node.js 22 or newer and an installed DSH CLI are required. Download the corresponding version of dsh-cache-helper.tgz and SHA256SUMS from Releases, and verify integrity in the directory containing both:

shasum -a 256 -c SHA256SUMS

For a first trial, it is recommended to only install to web: first end the current task and stop the web service, then replace the path in the following example with the actual package path:

dsh plugin --profile web add /absolute/path/dsh-cache-helper.tgz --offline
dsh --profile web --port 3099

--offline requires DSH dependencies to already be cached locally; installation fails when dependencies are incomplete. Open the local authentication address in the startup output to log in; the token in the link must not be written into screenshots or public feedback. After installation or upgrade, restart web and refresh the page, checking the plugin entry and readings. The current documentation does not provide installation steps for the desktop profile.

In long sessions, installation, removal, start/stop, and updates should be concentrated in task gaps. Changing the model-visible tool list, definitions, or order may break prefix caching; this plugin cannot prevent other plugins from changing the request prefix.

Configuration

Override the plugin ID cache-helper through the DSH web profile, then restart web after saving:

- id: cache-helper
  config:
    minLostTokens: 50000
    minLossRatio: 0.2
    dashboardLimit: 50
    maxEvents: 200000
    maxCachedSessions: 64
Config Default Meaning
minLostTokens 50000 Token lower bound for old prefix loss estimation
minLostRatio 0.2 Lower bound for the proportion of loss relative to the last input
dashboardLimit 50 Maximum number of main sessions scanned from newest to oldest by creation time (max 200)
maxEvents 200000 Maximum number of analysis events per session
maxCachedSessions 64 Number of sessions retaining derived metrics in memory (max 200)

Typical Usage and Interaction

  1. After normal conversation, check the “last cache” reading and hit rate at the end of each answer to judge whether the last step of that turn is still eating full prefix cache.
  2. When context changes greatly and you are about to send, if the gate is triggered, read the expected loss description in the confirmation box and choose “Confirm and Send” or cancel; canceling, closing the box, Escape, stopping the task, or uninstalling will cancel the wait; disconnection will not auto-release.
  3. When a WARN appears above the input box, expand it to view the turn, step, and reason clues; when you need cross-session aggregation, open “Settings → Cache Dashboard” and use the anomaly filter to locate problem turns.

Confirmations bind the current session and request fingerprint, and are consumed only once; during waiting, if history or projection changes, the old confirmation becomes invalid and must be sent again. If a confirmed risk actually results in a miss, a WARN is still generated; recovery of hits only marks recovery and does not delete that anomaly.

Data Storage and Privacy Boundaries

The server side only stores the state version and user-collapsed warning IDs in $DSH_HOME/storages/cache-helper/web-state.json; WARN and metrics are rebuilt from the Session, and one-time confirmations are not persisted. The browser stores the anomaly filter switch in localStorage under dsh-cache-helper.only-warnings.v1. The plugin does not additionally store full requests, responses, or prompts, does not read model credentials, and does not add external services.

Disabling, Uninstalling, and Rollback

First stop the task or cancel pending confirmation requests, then disable in web → Settings → Plugin Management; restart web to confirm the entry disappears. For complete uninstallation, first close web, then execute:

dsh plugin --profile web remove dsh-cache-helper --config.offline=true

Keep the previous verified .tgz before upgrading. To roll back, stop web, uninstall the current package, then install the old package:

dsh plugin --profile web add /absolute/path/dsh-cache-helper-PREVIOUS.tgz --offline
dsh --profile web --port 3099

PREVIOUS is a version placeholder for the retained old package; after rollback, verify the configuration, last cache readings, and confirmation flow.

Applicable Scenarios and Cautions

Suitable for long-term Agent sessions with many tools under DSH web, where you need to perceive large-scale prefix loss before sending, and retain searchable WARN and dashboard clues after misses. The README states that the current gate covers each step of the native AgentLoop main session and normal user forks, excluding some auxiliary purposes, sub-agent sessions, etc.; images, files, and other adapter paths are handled as unknown checks. Server-side TTL and cache domain implementation cannot be precisely observed by the client; misses may occur even when the context does not change—the plugin provides confirmation and clues, and does not automatically repair server-side caching.

The plugin runs with the current dsh process privileges; before installing, you should read the source code and the MIT license, and verify package integrity from Releases before installing with --offline. The community directory skillhub.cn has no official affiliation with DeepSeek / High-Flyer (幻方); the DSH ecosystem philosophy is “everything is a plugin,” and this introduction does not represent official endorsement.

Conclusion

dsh-cache-helper turns cache hits from “occasionally glancing at usage” into a three-stage workflow of “visible at each turn’s last call, gated before sending, and reviewable for anomalies,” suitable for DSH users who care about long-session cache costs and prefix stability. For more information, visit the directory page ghang/dsh-cache-helper and the repository github.com/ghang/dsh-cache-helper.

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

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

Xiaoye