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

  1. Early truncation: Truncate oversized tool results via the tools/post-execute stream before they enter the session surface.
  2. Rewrite prevention: Provides the toolResultPruner service to prevent rewriting delivered results.
  3. 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

  1. Truncation: Hook into tools/post-execute to intercept and truncate a result before it is appended to the session.
  2. Service: Implement the toolResultPruner service 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.

GitHub
Plugin Directory