rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:zyd232/dsh-compaction-policy
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
English | 中文
Stop DeepSeek Harness from condensing your conversation too early — and put the trigger where you want it.
DSH automatically condenses older history when a conversation grows. On a lot of models it starts much earlier than "80% full", and then it does it again a few steps later. This plugin gives you that decision back: it does not edit any config file, it adjusts the running compaction engine.
Probably yes if any of these sound familiar:
If you only ever use very large windows (e.g. 1M), the built-in behaviour is already near 80% and you most likely don't need this.
Before each step DSH checks how large the next request would be and compares it to this trigger:
trigger = min(window × 0.8, window − output reserve − 65536)
The second half of that formula is the catch: it subtracts a fixed 65,536 tokens regardless of how large the window is. Once the window is below about 330,000, that fixed subtraction is the tighter of the two limits, so it becomes the real trigger:
| Context window | Where DSH actually triggers | Where 80% would be |
|---|---|---|
| 128k | ~62k (49%) | 102k |
| 150k | ~84k (56%) | 120k |
| 256k | ~190k (74%) | 205k |
| 1M | ~678k (68%) | 800k |
On very small windows (roughly up to 65k) the fixed margin swallows the whole window: DSH then refuses to configure proactive compaction at all and only reacts after a request is rejected for being too long — which throws away far more history than a planned condensation would.
In DSH 0.2 the compaction policy lives inside each agent preset, and a preset is addressed as one whole definition: neither a profile config file nor a plugin's own config layer can change a single field of it. The only way to write it to disk is to replace the preset body — which pins your preset and stops it from picking up DSH updates.
So this plugin doesn't touch any file. It changes the behaviour of the compaction engine while DSH runs.
/compact command
are never touched.| DSH version | Status |
|---|---|
0.2.2-rc.3 |
Verified — the build this release was developed and tested against |
0.2.0-rc.2 … 0.2.2-rc.1 |
Previously verified — same seam, same behaviour |
later 0.2.x / 0.3.x |
Expected to work: the peers are open-ended, and if an internal seam changes the plugin steps aside instead of breaking your session |
earlier than 0.2.0-rc.2 |
Not supported — it wraps the per-agent-preset compaction engine, which only exists in the 0.2 line |
The machine-readable form of this is in package.json: open-ended @deepseek-ai/* peer ranges, with the tested build recorded in dsh.verifiedWith. If it does nothing on your build, nothing breaks — check that Settings lists Compaction policy, then open an issue with dsh --version.
Last verified: DSH 0.2.2-rc.3, 2026-11-16 (previously 0.2.2-rc.1 and 0.2.1-rc.3).
dsh plugin --profile <your profile> add github:zyd232/dsh-compaction-policy
Use the profile you actually run — desktop for the desktop app, web for
dsh web, or your own profile name. Then restart DSH: plugin rows are only
read at startup, so without a restart nothing changes.
You do not need to start a new conversation. Existing conversations are picked up on their next step.
To remove it again:
dsh plugin --profile <your profile> remove dsh-compaction-policy
Open Settings and look at the left sidebar: you will find a Compaction policy entry alongside the built-in sections. The panel follows DSH's language (Settings → General → Language) and defaults to English; Chinese is included.
Everything there is saved to DSH's normal settings document and applies immediately — no restart needed. Each field also has a restore default button that removes your override.
| Field | Default | What it means |
|---|---|---|
| Enable | on | Turn the plugin off to get DSH's stock behaviour back. |
| Routes | * |
Which routes it governs: provider or provider/model, comma or space separated. * = every route. |
| Trigger ratio | 0.8 |
Condense once the context reaches this share of the window. 0.8 = 80%, DSH's own default. |
| Output reserve (tokens) | 24576 |
The margin kept free for the model's answer. DSH's own value is 65536; this is the knob that fixes the early trigger. |
General rule first, examples second.
0.8 unless you want extra safety. On a very
small window some people prefer 0.7.16384–32768 covers most chat and coding work; a model that
writes very long files may want more. Too small a reserve risks a request being
rejected because the answer had nowhere to go.llama-cpp (only local models served by llama.cpp), ollama, openai, or
ollama/* to spell out every model of that provider.With the default reserve of 24,576 the trigger becomes a clean 80% of the window for every window above roughly 123k, and stays proportional below that.
Compaction is recorded in the session log. If you want numbers instead of a feeling, take the request size immediately before a compaction and divide it by the model's window: it should now land near your trigger ratio instead of the old ~50% mark.
Visually, the context ring should keep growing past the point where it used to drop.
agentPresets.serviceFor(…, 'compaction')) and wraps its
compactIfNeeded method. If a future DSH renames that service or changes that
signature, the plugin needs an update — until then it simply does nothing rather
than misbehave.@deepseek-ai/* peer ranges are intentionally open-ended
(>=0.2.0-rc.2, one arm per verified line, no upper bound), so a future harness release can never prevent
the plugin from installing or loading.CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: llm、deepseek-harness。