Introduction¶
DeepSeek Harness (DSH) ships with a built-in compaction-basic module responsible for context compaction. However, under the default interface, critical parameters such as compaction trigger points, reserved headroom, and retention ratios are difficult to adjust intuitively, and real-time context usage is only represented by a simple progress bar. This leads to unclear compaction timing during long conversations, or messages being compacted too early or too late due to misconfiguration, which degrades the quality of context retention.
Below is an introduction to the Compact Tool plugin maintained by KouzakiUmi. It provides a settings page, per-model overrides, and a context usage ring in the input box footer for DSH’s built-in compaction-basic.
What It Is¶
Compact Tool is a plugin for DeepSeek Harness, categorized under “Model Inference.” It does not modify DSH Core; instead, it mounts within DSH’s web client, extends the behavior of compaction-basic through the configuration write channel, and provides a visual settings panel along with real-time context monitoring.
Core value: It transforms DSH’s built-in context compaction capability from a behind-the-scenes configuration item into a draggable, real-time previewable interface tool, making it easier for agent developers to control context management strategies during long conversations.
Core Features¶
Settings Page: Context Compaction¶
Open “Settings → Context Compaction” to configure global policies and per-model overrides.
- Global Policy: Supports adjusting trigger ratio (
thresholdRatio), reserved headroom (headroomTokens), post-compaction retention ratio / retained tokens (retainRatio/retainTokens), summary output limit (maxTokens), retry counts (compactionRetries,maxOverflowRetries), auto-compaction toggle (auto), and summary model routing. - Budget Bar: Based on the selected model’s context window, it visualizes reserved headroom, output reservation, trigger point, and retention point. Sliding the slider updates the preview in real time.
- Per-Model Override: Add override rows from the current provider / model catalog dropdown. Each row’s fields include an “Inherit Global” toggle; dragging an inherited field writes a concrete value and removes the inheritance.
- Summary Route Check: When an explicitly configured summary provider / model is not found in the current catalog, a warning is displayed at the corresponding position, with a one-click option to revert to the session model.
Input Box Footer: Context Usage Ring¶
The ring chart in the input box footer replaces the built-in context usage ring, displaying real-time context utilization. An amber tick marks the compaction trigger point. The trigger point is calculated using compaction-basic’s algorithm: min(window × trigger ratio, window − output reservation − reserved headroom). For example, with a 128k window, default headroom of 65536, and output reservation estimated at 8192, the trigger point falls at approximately 42% of the window, rather than at the trigger ratio itself.
Clicking the ring chart opens an anchored panel showing system, tool, and message usage segments, overlaid with the trigger point and retention point. The panel includes three quick sliders: Trigger, Headroom, and Retain, which can write directly to the current model’s override row. The panel also contains a “Use dedicated policy for this model” toggle, along with a “More Settings…” link to the full dialog.
Model Selector¶
At the bottom of the model menu, click the gear icon “⚙ Compaction Settings…” to open the same configuration panel described above.
Installation and Activation¶
Run the following command in the terminal to install the plugin. desktop is an example Profile—please replace it with your actual target.
dsh plugin --profile desktop add @mileskent/dsh-compact-tool
DSH NEXT Desktop uses the DSH Desktop CLI provided by the target desktop shell; do not use the standalone npm public CLI to manage the reserved desktop Profile.
After installation and activation, include:compact-tool will be visible on the plugin management page. Reload or restart according to your deployment method so that both Host and Client take effect together.
Typical Usage¶
- Install and Activate: Install using the command above, reload or restart DSH, and confirm that
include:compact-toolappears on the plugin management page. - Open “Settings → Context Compaction”: Adjust the global policy, or create per-model overrides.
- Return to the Conversation: The ring chart in the input box footer displays current context usage, with the amber tick marking the compaction trigger point; click the ring to view usage breakdown and adjust the current model’s policy.
Changes are written to the Profile’s configuration patch. New sessions use the new configuration, while already-attached sessions retain their original configuration.
Compatibility and Dependencies¶
- DSH Core version: target range
>=0.2.0-rc.2 <0.3.0-0, tested on0.2.2-rc.3. - Peer dependencies:
@deepseek-ai/cordis ^4.0.1,react ^18.2.0. - Host services:
llm,configEditor. - Client: uses
remote,slots, andlocaleservices at runtime; injectsdsh-api-session-controller,dsh-api-remotes,dsh-client-locale,dsh-client-ui-slots,dsh-client-ui-layout,dsh-client-ui-settings,dsh-client-ui-model-selection.
The plugin runs with the current dsh process permissions. Review the source code and license before installation.
Use Cases¶
Suitable for DSH developers and agent engineers who need fine-grained control over context compaction strategies, particularly in long-conversation and multi-turn interaction scenarios where they want to visually see compaction trigger points, reserved headroom, and retention ratios, and differentiate policies per model.
Conclusion¶
Compact Tool transforms DSH’s built-in compaction-basic from a behind-the-scenes configuration item into a visualized interface tool, making compaction trigger points and retention strategies easier to tune. The plugin is maintained by KouzakiUmi. GitHub repository: https://github.com/KouzakiUmi/dsh-compact-tool