Preface¶
DeepSeek Harness (DSH) uses implicit prompt caching. The provider only reuses the cache when the leading bytes match a previous request. DSH’s built-in tool result pruner truncates oversized results by appending a replacement node. This kind of “in-place” truncation invalidates everything after that node and recharges the tail as uncached input.
This plugin addresses this gap through two mechanisms: truncating results before they enter the session surface, and preventing the rewriting of delivered results.
Plugin Introduction¶
This is a DeepSeek Harness (DSH) plugin that keeps tool-result cache prefixes safe.
- Maintainer: DoctorxPriestess
- Category: Memory
- License: MIT
Core Features¶
- Early truncation: Truncate oversized tool results via the
tools/post-executestream before they enter the session surface. - Rewrite prevention: Provides the
toolResultPrunerservice to prevent rewriting delivered results. - High cache hit rate: Achieves a 99.7% cached-token hit rate in hot sessions.
Installation and Enablement¶
The plugin requires Node.js >= 18. It uses extension points only and does not modify node_modules.
Typical Usage¶
- Truncation: Hook into
tools/post-executeto intercept and truncate a result before it is appended to the session. - Service: Implement the
toolResultPrunerservice to prevent rewriting.
Use Cases and Notes¶
This plugin is suitable for scenarios where large tool results must not break the DSH cache prefix.
Notes:
- Requires Node.js >= 18.
- MIT license.
- Uses extension points only; does not modify node_modules.
Postscript¶
By handling truncation before a result first enters the session surface and ensuring delivered results are not rewritten, this plugin maintains the validity of the cache prefix.