Preface¶
DeepSeek Harness (DSH) relies on automatic compaction to maintain performance when processing long contexts. The official dsh-compaction-basic plugin provides baseline capabilities, but its thresholdRatio (default 0.8) is a static configuration and lacks an entry point for dynamic adjustment during a conversation. When developers debug long-context strategies or adjust compaction intensity for different models, they often need to modify configuration files or restart the service.
What Is This¶
@kuanfu0430/dsh-compaction-tune is a DeepSeek Harness client plugin maintained by user kuanfu0430. It adds Composer-level control to DSH’s automatic compaction. Its core role is to allow the compaction threshold to be set in real time through the UI without replacing the original compaction engine, persist the configuration locally, and make it take effect at the next agent step.
Core Features¶
The plugin offers two threshold configuration modes:
1. Percentage mode: allows setting the context occupancy rate from 30% to 80%, defaulting to 60%.
2. Token mode: allows setting an absolute Token threshold from 64k to 832k, in steps of 64k, defaulting to 128k.
The configured value is written to the kuanfu-compaction-tune section of $DSH_HOME/settings.yaml. At the host level, the plugin exposes the service kuanfuCompactionPolicy.resolve(session) to read the current session’s compaction policy. It also provides a set of API routes /compaction-tune/api/* for querying settings and status.
Installation and Enablement¶
Installing this plugin requires the Web profile of Deep Harness.
dsh plugin --profile web add github:kuanfu0430/dsh-compaction-tune
After installation, restart dsh web. In the UI, the control chip appears in conversation.input.right (the bottom-right corner of the Composer input box).
Typical Usage¶
- After restarting
dsh web, locate the new compaction control chip in the bottom-right corner of the conversation input box. - In the chip, select Percentage or Token mode and enter the corresponding value.
- Continue the conversation or execute an Agent step; the new threshold takes effect at the next step.
Use Cases and Notes¶
This plugin is suitable for developers who need to dynamically adjust compaction policies for specific sessions or models. However, before using it, please note the following:
- Backend engine dependency: Installing this plugin alone does not add a compaction engine. If no
ctx.compactionbackend (such asdsh-compaction-basicordsh-compaction-anchored) is loaded in the Web profile, the chip can save settings but will show that no backend is available. - Compatibility: Tested on DeepSeek Harness 0.1.1-rc.2. Compatibility with 0.1.2-alpha is not claimed because that version changed session slots and the Web token gate.
- Sub-session isolation: Sub-sessions (for example, sidebar branches) do not inherit the main chat’s threshold settings; they retain the backend’s default 80% trigger mechanism.
- Percentage mode limitation: Percentage mode does not take effect until the model context window can be resolved.
- Security limitation:
/compaction-tune/api/*routes only allow requests from loopback or within the Profile trust fence, and responses do not include message contents or credentials. - UI dependency: The Composer’s
conversation.input.rightslot is a contract of 0.1.1-rc.2. If a later version removes this slot, the chip cannot be mounted.
Short Conclusion¶
This plugin fills the gap for runtime adjustment of DSH compaction policies through the UI and persisted configuration, and is suitable for developers who need flexible control over context compaction intensity during debugging. More details can be found in its catalog page or source code.