dsh-compaction-slider
A DeepSeek Harness (dsh) plugin that puts an auto-compaction threshold slider on the Plugins page.
By default the stock compaction-basic engine fires at 80 % of the model's context window minus a large fixed headroom. On big-window models this wastes most of the context: a 204 800-token model compacts at ~108 k tokens. This plugin lets you set the exact token level where automatic compaction happens — and change it live, no restart.
What you get
- A card "Auto-compaction threshold" on the Plugins page (next to Agent loop, Web search, …).
- A live slider right in the Plugins list: drag it, release, done — the value is saved instantly and applies to new sessions.
- The plugin page: the same slider with an exact token field, a Reset to default action, and clamping info.
- Range 16 384 – 262 144 tokens (default 163 840 = 160 k); the Host config field allows 8 192 – 4 194 304.
How it works
The plugin adds one top-level row (compaction-slider) and touches no preset rows. On every agent/created it wraps the compaction service's compactPressure check of that agent's preset:
- just before the engine measures pressure, the policy is swapped for one whose threshold equals the slider value (probed against the routed model's real context window, clamped to
window − output reserve); - right after the check the original policy is restored;
- overflow recovery, manual
/compact, and per-model policy overrides are untouched; - retention (
retainTokens) keeps the engine's native value, only capped below the new threshold.
Because the swap happens per pressure-check, engines shared by several presets and preset-local compaction groups all honor the slider.
Note: the wrapper is installed when an agent is created, so existing sessions keep their old threshold until they start a new session (or the app restarts). New sessions pick the current slider value immediately — no restart needed for changes, the setting is volatile and applied live.
Install
From the Plugins page: Add plugin and install github:zveryga5/dsh-compaction-slider (a local checkout folder works too). To get in-page updates, pin the spec to a full commit: github:zveryga5/dsh-compaction-slider#<full-sha>.
Manually: pnpm install --ignore-workspace inside this folder (installs @deepseek-ai/schemastery), then add to your profile's cordis.patch.yml:
- insert:
- id: compaction-slider
name: dsh-compaction-slider
config: {}
and add the package as a profile dependency (e.g. "dsh-compaction-slider": "link:<path-to-this-folder>" in the profile package.json). Restart dsh after manual edits.
Configure
Plugins page → Auto-compaction threshold:
- Slider in the card row — drag & release to save immediately.
- Plugin page — slider + exact token input; Save writes, Reset to default returns to 163 840 (or clears the override so the Host default applies).
- The effective trigger is
min(slider, contextWindow − outputReserve)per routed model, so a small-window model still compacts early enough.
Files
| File | Role |
|---|---|
index.js |
Host plugin: config schema (thresholdTokens, volatile) + the per-agent compactPressure wrapper |
client.js |
Web client: the slider card, registered in the plugins.item slot |
cordis.patch.yml |
Inserts the single compaction-slider row into every profile that installs the bundle |
locale/*.json |
Plugin card metadata (English in all interface languages) |
Compatibility
Built against dsh 0.2.2-rc.1 and running on 0.2.2-rc.5 (@deepseek-ai/dsh-compaction-basic pressure-check API: compactPressure(target, header, signal, requireBelowThreshold) reading this.config per check). A future engine refactor may need the wrapper updated.
License
MIT
No comments yet. Be the first to write one.