One of the core design principles of DeepSeek Harness (DSH) is plugin-based architecture. During usage, session compaction is a key operation for keeping context length manageable. By default, when DSH executes /compact or performs automatic compaction, it uses the model that answered the question in the previous turn. If you switch models in the Web UI but subsequently run /compact, the system will still use the old model to generate the summary. The dsh-compact-selected-model plugin solves this issue by enabling the compaction operation to use the currently selected model.
Plugin Introduction¶
This is a client-side plugin for DeepSeek Harness designed to use the currently selected model when compacting session summaries, rather than the model used in the previous turn. This plugin is maintained by DenAbr and is released under the MIT license.
Installation and Compatibility¶
Before installing, please ensure your DeepSeek Harness version is between 0.1.7-rc.2 and 0.2.x.
- Run the installation command:
npx @deepseek-ai/dsh plugin --profile web add dsh-compact-selected-model
- After installation is complete, restart the
dsh webservice.
Core Functionality and Principles¶
The plugin supports the /compact command as well as automatic compaction features. Its working logic is as follows:
- Model Selection Mechanism: When a model is selected in the Web UI, DSH adds a
model/selectionevent to the session. This selection remains pending until the next request utilizes it. - Request Interception: The plugin listens for
llm/streamevents. When it detects a request with apurposeof'compaction'and there is a pending model selection in the session, the plugin directs that request to the selected model. - Override Strategy: If
summarizationModelis explicitly set incompaction-basic, the plugin will not intervene, preserving the original behavior.
Notes¶
Please keep the following points in mind during usage:
- Log Display Discrepancy: The
compaction/summaryevent in the session log will still display the old model name, as this event is recorded by thecompaction-basiccomponent. The actual destination of the request can be viewed in the main log. - Auto-compaction Threshold: The threshold for automatic compaction is still calculated based on the context window of the previous model.
- Runtime Mode Limitations: This plugin relies on the session controller’s
modelSelectionprojection, so it does not function in headless mode. - Failure Handling: If the selected model fails (e.g., due to rate limits or insufficient context window), the compaction operation will also fail. In this case, you need to switch back to an available model and re-run
/compact.
Typical Usage¶
After switching models in the Web UI, simply run /compact. The plugin will use the currently selected model to generate the session summary.
Summary¶
This plugin provides DSH users with more flexible control over session compaction, allowing for the selection of the most appropriate model based on current intent to handle summary generation.
- GitHub Repository: https://github.com/DenAbr/dsh-compact-selected-model
- Plugin Directory: https://www.skillhub.cn/plugins/DenAbr/dsh-compact-selected-model