Skip to content

v1.0.0

Choose a tag to compare

@AllShadowAnan AllShadowAnan released this 06 Oct 19:08
· 5 commits to main since this release

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 contextWindow is 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-compressor

Then refresh the browser page. The host half hot-applies on a live profile; the browser half cannot.

If pnpm reports fetch failed on 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 and Invoke-WebRequest still 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). Any pnpm add of a github.com URL 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:

  1. prune over-budget tool results — if that alone clears the ceiling, no summary is written;
  2. 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;
  3. 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 / isVolatilePath against this plugin's Config.
  • CI green on Linux.
  • The tarball attached below was installed into a clean project and loaded through its exports before 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.