Introduction¶
When developing or debugging with DSH, small context models often face context overflow due to long conversation histories, leading to the loss of critical details. dsh-handoff-compaction is a context compaction plugin designed specifically to solve this problem. It converts old conversations into a structured # Context Handoff, retains recent messages in their original form, and retrieves complete records via history tools when the model requires them. This allows small context models to maintain task continuity in long sessions.
Feature Introduction¶
The plugin offers the following core capabilities:
- Visual Context Configuration: Adjust summary limits and recent context budgets directly via the Web interface. The default configuration is 8192 (summary) + 16000 (recent) tokens.
- Cache-Friendly Compaction: Employs a full-surface compaction strategy that preserves system prompts and tool definitions while replaying the conversation surface, facilitating cache hits for local providers.
- Lossless Long-Term Memory: Session events remain append-only. Facts hidden by compaction can still be searched and read using the official SQLite history tool.
- Task Continuity: Ensures continuity by structuring and recording the current task’s goals, progress, decisions, constraints, and next steps via
Context Handoff. - Version Compatibility: Supports DSH 0.1.x and 0.2.x versions. One plugin package adapts to all compatible DSH versions.
Installation and Activation¶
Install via the npm package name. The plugin is injected into specified DSH configuration files as a Bundle.
dsh plugin --profile web add dsh-handoff-compaction
dsh plugin --profile headless add dsh-handoff-compaction
Once installed, restart the configuration file to apply the changes.
Configuration and Usage¶
Web Interface Configuration: Access Plugins → dsh-handoff-compaction via the Web client sidebar. Here, you can adjust the Handoff summary limit (default 8192 tokens) and Recent context budget (default 16000 tokens). Click Save to persist the configuration; these budgets will apply to subsequent compaction runs.
Manual Trigger: Type /compact in the conversation to manually trigger context compaction.
Working Principles and Precautions¶
- Not Native Window Expansion: This plugin does not physically increase the model’s native context window size.
- Budget Control: The configured
maxTokensandretainTokenscontrol the summary output and recent message retention, not the exact total request size. The actual request size includes system prompts, tool definitions, and message pairs, so sufficient buffer space should be reserved during configuration. - Global Replacement: Installation is a configuration-file-scoped replacement. The plugin disables
compaction-basicandtool-result-prunervia Bundle patches and injects its own compaction logic and SQLite backend. - Data Retrievability: Compaction only hides old conversation content; it does not delete data. Session events remain append-only, and compacted facts remain searchable in the history log.
Compatibility¶
Based on verified information, this plugin supports the DSH 0.1.x and 0.2.x series. No specific version selection is needed during installation; the same package name works for all DSH versions within the declared compatibility range.