Repository navigation
Releases
v1.1.0
The plugin no longer only enforces an absolute ceiling. It now offers two triggers, and you pick one: a fixed token count, or a share of the routed model's context window.
# take the current version from the Releases page
dsh plugin --profile desktop add https://github.com/AllShadowAnan/dsh-context-compressor/releases/download/v1.1.0/dsh-context-compressor-1.1.0.tgzThe two triggers
| Absolute ceiling | Share of window | |
|---|---|---|
| Setting | a token count | a percentage, 5–95 |
| Threshold | fixed | routed model's declared window × percentage |
| Good for | a cost and latency budget, mixed routing, endpoints whose declared window is a guess | compact earlier to save cost, or later to keep more context |
They are mutually exclusive. Only the selected one is computed, and the Settings page renders only the field that belongs to it. The other value stays in the config, so switching back restores it.
Ratio mode is what DSH's own compaction-basic already does with the percentage hard-coded at 80%. This exposes the number; it does not replace the built-in policy, which still fires on its own terms.
Worth knowing
Ratio mode is inert until the window is known. A session that has logged no request/context has no declared window, and the plugin does nothing rather than guess. The readout shows — for the resolved ceiling in that state.
mode is a closed set. It is declared union([const('absolute'), const('ratio')]) rather than a bare string, so a typo in a config file is rejected at load instead of silently turning the plugin into a no-op. contextRatioPercent is bounded to 5–95.
The readout warns about a tail that is too large. If retainTokens is not smaller than the ceiling, a compaction would have nothing left to summarize. The live readout says so rather than failing quietly.
The page uses SegmentedControl, the primitive DSH already ships, instead of a hand-rolled control.
Do not install from the releases/latest alias. pnpm caches a remote tarball's resolution by URL, and that URL never changes — so it keeps installing whichever version you first got from it, and --force does not make it re-resolve. Use the versioned URL above, which is reproducible anyway. Clicking the alias in a browser is fine: there it is always the newest release.
Upgrading
Nothing to do. mode defaults to absolute and contextRatioPercent to 80, so an existing config behaves exactly as before until you change it.
Verification
47 tests (was 31), including the harness's own volatileForm / projectForm / isVolatilePath run against the new union field. CI green on Linux.
Note for plugin authors
Editing a plugin's own source requires an application restart. The host half is Node code loaded at boot, and the browser bundle's bytes are read and cached at boot; reinstalling or touching the profile manifest does not re-evaluate an already-loaded module, and a page refresh is not enough. The README now documents this.
v1.0.1
Documentation only — no code changes. The plugin behaves exactly as v1.0.0.
# newest release, permanent URL
dsh plugin --profile desktop add https://github.com/AllShadowAnan/dsh-context-compressor/releases/latest/download/dsh-context-compressor.tgzWhat changed
-
The README now defaults to Chinese. GitHub renders
README.md, so the Chinese text moved there and the English moved toREADME.en.md. Both open with a language switcher. -
The install command was wrong. It told you to run
dsh plugin add dsh-context-compressoragainst a registry. This package has never been published to one, so that command would have 404'd. It now points at the release tarballs. -
releases/latesthas a stable alias. Every release carries the versioneddsh-context-compressor-<version>.tgzfor pinning, plusdsh-context-compressor.tgz, soreleases/latest/download/dsh-context-compressor.tgzis a URL that never goes stale. -
Troubleshooting for an install that fails. If
pnpmreportsfetch failed, Node's bundled CA list cannot verify GitHub's certificate chain on your machine — TLS inspection, or a corporate root that is in the Windows store but not in Node's bundle. A browser andInvoke-WebRequeststill work, so it reads as a network failure rather than a trust one. AddNODE_OPTIONS=--use-system-cato that one command. -
package.jsonlinks back.repository,homepageandbugsare filled in.
What the plugin does
See v1.0.0.
v1.0.0
First release. A DeepSeek Harness plugin that adds an absolute context ceiling: set a token limit, and once a session reaches it the harness compacts the conversation automatically — independent of which model is routed or how large that model's context window is.
Why
DeepSeek Harness already compacts, but relatively: compaction-basic triggers at a fraction of whatever window the routed model declares (80% by default). That is the right default, and this plugin does not touch it. What it adds is the knob that policy cannot express:
- a cost and latency ceiling that does not move when the route changes,
- one budget across models with very different windows,
- a real limit in front of a third-party endpoint whose declared
contextWindowis a guess.
Leave the ceiling at 0 and DSH behaves exactly as it did before.
Install
# from this release — no registry needed
dsh plugin --profile desktop add https://github.com/AllShadowAnan/dsh-context-compressor/releases/download/v1.0.0/dsh-context-compressor-1.0.0.tgz
# or from a checkout
pnpm install
dsh plugin --profile desktop add link:/absolute/path/to/dsh-context-compressorThen refresh the browser page. The host half hot-applies on a live profile; the browser half cannot.
If
pnpmreportsfetch failedon that URL, Node's bundled CA list cannot verify GitHub's certificate chain on your machine — TLS inspection, or a corporate root that is in the Windows store but not in Node's bundle. A browser andInvoke-WebRequeststill work, so it reads as a network failure. Point Node at the system trust store for that one command:NODE_OPTIONS=--use-system-ca dsh plugin --profile desktop add <url>(PowerShell:$env:NODE_OPTIONS = "--use-system-ca"first). Anypnpm addof agithub.comURL is affected the same way.
What is in it
A dedicated page — Settings → Context compression — with the ceiling in tokens, the verbatim retained tail, how many reductions one step may attempt, and a master switch. Every field is staged (only Save writes, leaving the page discards) and every field is volatile, so saving updates the running plugin in place instead of restarting it. A live readout below the form shows the ceiling in force, the recently measured sessions, and the last compaction's before/after counts.
Enforcement runs at every step boundary, and only when a session is over the ceiling:
- prune over-budget tool results — if that alone clears the ceiling, no summary is written;
- otherwise replace everything older than the retained tail with one summary, cutting only at a tool-pairing-balanced boundary so no tool call loses its result;
- repeat up to the configured bound, stopping as soon as the session is under the ceiling or a round makes no progress.
Every failure is contained and surfaced in the readout. A context ceiling is an optimization, never a reason to fail a turn.
Note for plugin authors
One finding is worth carrying forward: agent.ctx.get('compaction') does not work in the shipped web composition. The compaction stack is mounted inside each agent preset's isolated cordis group, and the web bundle disables the profile-root rows of the same names — so agent.ctx, which chains to the root agent-loop row, finds nothing under its isolate key. (agent.ctx.compaction as a property throws outright.)
The seam that does work is the registry which mounted the preset:
ctx.get('agentPresets')?.serviceFor(agent, 'compaction')@deepseek-ai/dsh-api-session-controller resolves skills the same way. The README's How it reaches the compaction engine section has the full explanation.
Verification
- 31 tests: the policy against fakes, the browser bundle evaluated against the module loader and rendered with real React, and a conformance suite that runs DeepSeek Harness's own
volatileForm/projectForm/isVolatilePathagainst this plugin'sConfig. - CI green on Linux.
- The tarball attached below was installed into a clean project and loaded through its
exportsbefore publishing.
Requirements
DeepSeek Harness 0.2.0-rc.2 (Desktop or web profile — any composition that mounts the compaction stack). Node ^22.19.0 || >=24. MIT.