dsh-cache-safe-tool-result: Keeping Tool Result Cache Prefixes Consistent for DeepSeek Harness
doctorxpriestess/dsh-cache-safe-tool-result
A DeepSeek Harness (DSH) plugin that keeps tool results cache-prefix safe: it truncates an oversized result before it first enters the session surface and never rewrites a result a provider request has already delivered.
dsh-cache-safe-tool-result is a cache-prefix safety plugin for DeepSeek Harness that addresses tool results being rewritten after the fact and invalidating the prompt cache. DSH's implicit prompt cache is a prefix cache, so the request's leading tokens must stay byte-identical to hit it, yet the built-in pruner appends a replacement node to a result already sent, re-billing everything after that node. This plugin moves truncation ahead of the result's first entry into the session surface, refuses to rewrite any result a provider request has already carried, and skips conservatively when delivery cannot be proven, preserving byte consistency across long sessions.
How to Install
dsh plugin --profile web add github:doctorxpriestess/dsh-cache-safe-tool-result- Category
- Tools & Capabilities
- Platform
- DSH Plugin
- Author
- doctorxpriestess
- Distribution
- Plugin
dsh-cache-safe-tool-result Key Features
dsh-cache-safe-tool-result Repo Summary
What Does It Do?
It is a DSH plugin for DeepSeek Harness that keeps tool results cache-prefix safe. DSH's implicit prompt cache is a prefix cache: the provider reuses a cached prefix only while the request's leading tokens stay byte-identical. The built-in tool-result pruner truncates oversized results in place by appending a replacement node for a result already sent, which invalidates everything after that node and re-bills the whole tail as uncached input. This plugin closes that hole by truncating a result before it first enters the session surface and by refusing to rewrite any result a provider request has already delivered.
Core Features
- First-pass truncation: compresses an over-budget tool result before the loop appends it to the session surface, using DSH's sanctioned post-execute waterfall.
- Delivered-result guard: exposes the toolResultPruner service and skips any result a provider request has already carried, keeping its bytes byte-identical with no replacement node.
- Fail-closed on unprovable nodes: when it cannot prove whether a node was already delivered, it skips rather than rewrites.
- Compaction integration: acts as the pruning provider consumed by dsh-compaction-basic, reusing the same truncation geometry as the built-in pruner.
- Public extension points only: relies solely on documented DSH/Cordis hooks and patch layers, touching no dependency files.
How to Use This Plugin?
After enabling it in DSH, both halves mount together, so no per-session manual step is needed. It takes over tool results about to be appended through the agent-scope post-execute waterfall and is resolved as the pruning service inside the compaction flow, so oversized tool output in long sessions is compressed before it enters the session surface. To confirm where the provider row actually lives, dump the configuration as the README suggests, then adjust the preset patch layer per the official instructions.
How to Troubleshoot This Plugin?
If cache hit rate drops or large uncached token jumps appear, an already-delivered tool result was likely rewritten after delivery, so verify the guard is resolved as the pruning provider. If truncation never fires, check that the first-pass listener is attached to the agent-scope post-execute waterfall and that the preset patch layer completed its row swap as documented.
This page is an independent rewrite of the plugin's official README — for authoritative documentation and the latest changes, refer to the source: doctorxpriestess/dsh-cache-safe-tool-result. The plugin is third-party code that runs on your machine once installed; inclusion does not imply endorsement — please review the source before installing.
