Stepwise Distillation¶
When developing agents in DSH (DeepSeek Harness), history records can expand rapidly in long conversation scenarios. Models often repeatedly read already processed tool results, patch contents, or script bodies, diluting the attention of the current request. dsh-stepwise-distill aims to solve this problem by solidifying session history step-by-step and rewriting tool results into the facts actually retained by the model, thereby preventing long conversations from resending noise in every turn.
Plugin Information¶
- Plugin Name:
dsh-stepwise-distill - Category: Memory
- Maintainer: yunxiyang
- License: MIT
- Core Value: Solidifies DSH session history step-by-step and rewrites tool results to reflect facts actually retained by the model, preventing the repeated sending of noise in long conversations.
Core Features¶
- Stepwise Distillation: Performs step-by-step distillation processing on DSH session history.
- Fact Rewriting: Rewrites tool results into the facts actually retained by the model.
- Noise Filtering: Prevents the repeated sending of completed work content in long conversations.
- Log Retention: Maintains an append-only event log without deleting any raw data.
Installation and Enablement¶
Installing the plugin requires specifying a profile name.
dsh plugin --profile <name> add dsh-stepwise-distill
The plugin is enabled by default after installation. The configuration file is usually located in the DSH profile definition, where the following parameters need to be set:
- id: stepwise-distill
config:
stepSummary: true # Summary for each completed step (default: true)
turnSummary: true # Notes at the end of each turn (default: true)
debug: false
If these overheads are not needed, they can be turned off by setting the parameters:
stepSummary: false
turnSummary: false
Typical Usage and Checks¶
After installation and enablement, you can check the plugin status via the /distill endpoint to view how many steps are currently retained, how many steps have been summarized, and how much raw material is no longer being carried by subsequent turns.
/distill
Notes¶
- Runtime Environment: Requires Node.js >= 20.
- Performance Cost: This plugin consumes approximately twice the input tokens and time, requiring additional model round-trips for each step.
- Cost Clarification: It increases token and time costs, rather than reducing the billing amount.
- Dependency Scope: Peer dependency scope is
^0.1.1-rc.2 || ^0.2.0-rc.1.
Conclusion¶
The core of dsh-stepwise-distill is to improve context density by compressing history records, allowing the token budget to carry information currently needed by the model rather than repeatedly sending completed content.