Introduction¶
DeepSeek Harness (DSH)’s dsh-compaction-basic plugin, when performing compaction summarization, extracts only provider and model from the session’s finalized routing header by default, causing key parameters such as reasoningEffort and maxTokens to be lost in the compaction request. This makes the compaction request envelope completely different from the previous turn, causing the provider’s prefix cache to miss and forcing the compaction operation to recompute the entire history at full price instead of only the instruction itself. The dsh-compaction-cache plugin injects the missing parameters so that the compaction request envelope matches the previous turn and can reuse the provider’s prefix cache.
Core Features¶
The plugin mounts on the llm/stream waterfall and applies only to requests marked with purpose: 'compaction'. It populates the summarization envelope parameters using the following rules:
1. Parameter Mirror: Inject reasoningEffort and temperature from the routing header into the summarization call (effective only when not explicitly set and not an adapter default).
2. MaxTokens Alignment: Unconditionally override maxTokens with the routing value, because the summarizer always forces this value.
3. Boundary Handling: Do not modify the message list, do not touch ordinary requests; any exception is swallowed and next() is called as usual, ensuring a plugin failure does not block the invocation.
This plugin is a zero-dependency, zero-tool, zero-UI, build-free temporary patch, distributed only from GitHub.
Installation¶
This package is not published to npm; it is distributed only via GitHub.
Method 1: Add dependency via pnpm
// <DSH_HOME>/profiles/<profile>/package.json
"dependencies": { "dsh-compaction-cache": "github:deepseekv41flash/dsh-compaction-cache" },
"dsh": { "profile": { "bundles": ["…", "dsh-compaction-cache"] } }
Run command: pnpm add github:deepseekv41flash/dsh-compaction-cache
Method 2: Local Clone + Link
git clone https://github.com/deepseekv41flash/dsh-compaction-cache
Reference it with a link: spec in the profile and include it in bundles.
Configuration¶
All configuration options are optional and enabled by default.
| Key | Default Value | Description |
|---|---|---|
enabled |
true |
Master switch |
log |
true |
Log alignment information |
mirror |
['reasoningEffort','temperature'] |
Routing parameter names to mirror |
alignMaxTokens |
true |
Whether to force maxTokens alignment |
Verification¶
After activation, the host log outputs alignment information:
compaction-cache: aligned summarization envelope (reasoningEffort=max maxTokens=256000 (was 65536)) session=...
Criterion: Compared with before the fix, inputTokens in compaction/summary.usage should drop sharply (from around 130k to a few hundred), while cacheReadTokens becomes a six-digit number.
Notes¶
- Temporary Patch: This is a temporary workaround for an upstream defect (discussion #1944); uninstall it after the official fix.
- GitHub Only: The package is not published to npm and cannot be installed through regular package managers.
- Exceptions Swallowed: Internal plugin exceptions are caught and ignored, with no impact on the main flow.
- Event Value Discrepancy: The
maxTokensrecorded in thecompaction/summaryevent is the spec value rather than the actual envelope value; checkinputTokens/cacheReadTokensinusageto determine whether it is effective.