Preface¶
In DeepSeek Harness (DSH) development, logs, JSON, or HTML returned by tools often contain large amounts of duplicated or low-information content, which can quickly consume the model’s context window. Directly truncating the output may cause loss of critical error information or root-cause stack details.
DSH already has a size-based hard fallback mechanism (Spill Store), but it lacks awareness of “evidence.” The dsh-tool-squeeze plugin runs on the tools/post-execute lifecycle and compresses the result using local deterministic algorithms before it is sent to the model, preferentially preserving errors, warnings, and structured samples.
Overview¶
dsh-tool-squeeze is an evidence-preserving tool output compression plugin for DeepSeek Harness. It does not rely on an LLM for compression and does not modify the Harness Core itself; instead, it integrates safely through public plugin interfaces.
Maintainer: w2829562572-dev
License: MIT
Core value: Compresses context while ensuring that critical evidence (such as errors and failure information) is not lost, and preserves the original format through the official Spill Store.
Core Features¶
This plugin focuses on local, deterministic processing. Its main capabilities include:
- Deterministic local processing: Compression is performed before model invocation, with no additional model-call overhead.
- Evidence-preserving compression: During compression, it prioritizes preserving the head, tail, errors, warnings, and structured samples.
- Multi-format support: It supports processing logs, JSON, HTML, and plain text.
- Original retention mechanism: It preserves the original formatted content through the official DSH Spill Store, ensuring traceability.
- Safety isolation: It integrates through the
tools/post-executelifecycle, so parser or compressor exceptions do not cause the tool call to fail.
Installation and Configuration¶
Installation¶
Install the plugin through the DSH plugin manager:
dsh plugin --profile web add github:w2829562572-dev/dsh-tool-squeeze
Configuration¶
The plugin is enabled by default. Its configuration is defined in cordis.patch.yml. The default parameters are:
enabled: true
minTokens: 4000
targetTokens: 6000
maxTokens: 12000
processors:
log: true
json: true
html: true
text: true
preserve:
headLines: 80
tailLines: 120
errors: true
warnings: true
report:
enabled: true
excludeTools: []
retainOriginal: true
Usage Example¶
You can override the default configuration in cordis.patch.yml to adjust compression thresholds or exclude specific tools:
- id: dsh-tool-squeeze
config:
minTokens: 6000
targetTokens: 5000
excludeTools: [database_export]
If you need to disable original retention (not recommended), set retainOriginal: false.
Notes¶
- Environment requirements: The runtime environment must support
Node >= 22.19. - Dependencies: The plugin depends on the following Peer Dependencies:
@deepseek-ai/cordis ^4.0.1@deepseek-ai/dsh-tools 0.1.0-rc.8
- Safety priority: The plugin follows the priority order
Safety > information preservation > compression ratio. Outputs belowminTokensremain unchanged; error and warning information is always preserved first. - Exception handling: Internal parser or compressor exceptions are caught, and plugin failure does not turn a tool call into a system error.
Summary¶
dsh-tool-squeeze provides a solution for managing large tool outputs within the DSH ecosystem. By using local deterministic compression, it helps developers save context tokens while ensuring that critical evidence (such as failure logs and structured data) can be correctly perceived and utilized by the model.