Introduction

In the DSH (DeepSeek Harness) development workflow, tool execution results enter the model context directly. When tool output is extremely large (for example, a complete HTML page, long logs, or a codebase index), it can quickly fill the context window, making it impossible for the model to process subsequent tasks.

dsh-clear-tool-results is a DSH host plugin positioned in the tools/post-execute waterfall stage, where it performs admission filtering before results enter the context. For plain-text results that exceed the threshold, the plugin writes the full content to the session directory, and the model receives only a “receipt.” The receipt contains a bounded preview and the absolute path; the original content can be retrieved when needed through the built-in read tool or the plugin-provided read_tool_result_log.

Installation and Enabling

The plugin is installed via its official package name; no manual configuration editing is required.

dsh plugin --profile web add dsh-clear-tool-results

After installation or upgrade, the DSH GUI process must be restarted, because modules already imported inside the process are not hot-reloaded.

Core Features

Admission Filtering and Persistence

The plugin intervenes in the tools/post-execute stage (prepend: true). It only evaluates plain-text results:
* Threshold: UTF-8 size exceeds 1024 bytes.
* Persistence: The full content is written to the tool-result-logs/results/ subdirectory of the session directory.
* Receipt: What the model receives is the receipt (summary + preview + absolute path); the receipt length is always shorter than the original content, ensuring the context does not bloat.
* Idempotence: Only one copy is written for the same callId; retries will not archive it repeatedly.
* Failure-safe: If writing to disk fails, the original result passes through unchanged, and the successful call is not marked as an error.

Receipt Format

Example of the receipt seen by the model:

[bash · npm test · 84,231 字节 / 2,104 行 → 全文已落盘,此处是尾部 30 行]
路径:/Users/…/sessions/…/tool-result-logs/results/t0001-s0003-01-bash-call_00_ab12.txt
取全文:read 该路径(可用 offset/limit 分页),或 grep 该路径检索。

Retrieval Tool

The plugin registers the read_tool_result_log tool, which supports reading archived results by turn, step, or time, and also supports a manifest mode to view historical records.

Usage

Command Control

  • /clear-tool-results on: Enable filtering.
  • /clear-tool-results off: Disable filtering; tool results enter the context unchanged.
  • /clear-tool-results status: Display the enabled state, admission threshold, exempt tools, and plugin version.

The state file is stored at $DSH_HOME/clear-tool-results.json.

Tool Invocation

  • read_tool_result_log: Registered unconditionally; historical archives can still be read after disabling.
  • read: Read the absolute path provided in the receipt directly.

Applicable Scenarios and Cautions

Applicable Scenarios

  • Handling large file outputs (such as web scraping or long logs).
  • Preserving full tool result content for later retrieval under a limited context window.

Cautions

  • ⚠️ Deprecated: Check the maintenance status of the plugin repository.
  • Admission Policy: Only plain text is subject to filtering; structured output (with value), non-text content, error messages (isError), and short text (≤1024 bytes) all pass through unchanged.
  • Dependency: Depends on DSH’s built-in tools/post-execute waterfall mechanism.
  • Coexistence: Can coexist with built-in mechanisms such as spill-policy and compaction.

Summary

dsh-clear-tool-results intercepts and archives results before they enter the context, solving the problem of large text output crowding out context space. It provides a clear receipt mechanism and multiple retrieval methods, making it suitable for scenarios requiring handling of large volumes of tool output. This plugin is currently marked as deprecated; please evaluate before use.