
falling-ts/dsh-force-compact
dsh-force-compact
dsh-force-compact is a community DeepSeek Harness plugin. Read the repository README before installing.
Install
npx @deepseek-ai/dsh plugin --profile web add github:falling-ts/dsh-force-compactRestart `dsh web` after install. Bundle APIs can change during the developer preview.
README badge
[](https://dshhub.dev/plugins/dsh-force-compact)Paste this into your README. The star count updates with every catalog sync.
From the README
Excerpt from falling-ts/dsh-force-compact, cleaned of badges and images.
dsh-force-compact
Aggressive, local-first context compaction for DeepSeek Harness agents.
A DSH Cordis function plugin that keeps the agent's working context lean by design: serve
Qwen3.8‑27B on a self-hosted llama.cpp with a modest context, and the plugin shrinks the
conversation itself — a large-window feel with no API cost and no data egress.
Why
- Self-hosted inference — the agent talks to a local OpenAI-compatible llama.cpp server through the standard DeepSeek adapter; no separate adapter needed.
- Low context, high signal — instead of fighting a small cap, the plugin shrinks the conversation, so the agent reasons over a tight prompt while keeping deep memory in the compressed head.
- Think off for compactions, passthrough everywhere else —
disableThinking: true(default) turns thinking off on this plugin's own compaction summarization call only; every other model request rides the machine's configuration unchanged. - Private & free — no per-token billing, no egress.
What it does
Two compaction engines coexist behind one facade (resolveCompaction), transparent to callers:
| Engine | Used when | Notes |
|---|---|---|
| Official | the compaction service resolves in the agent realm | Preferred; delegates to compaction/basic. |
| Builtin | automatic fallback (typical standard preset isolates the service) | Self-contained persistent transaction on ctx.sessions / ctx.llm.stream / ctx.tokenMeter; reuses the official compaction/* event vocabulary, so it replays safely across builds. |
No toggling — official wins when reachable, builtin takes over otherwise.
Trigger points
- Per-request guard (
agent/pre-step) — reads the session's projected context tokens (the exact number the harness renders bottom-right). AtautoThresholdTokensit rejects the outgoing request and compacts the head instead, retaining the latestretainLatestTokensverbatim. Below the threshold the request proceeds. - Turn end / idle (
agent/status→idle) — when the agent quiesces, optionally compacts viacompactNow(gate:turnEndForceCompactionEnabled). - Manual
/force-compact— immediatecompactNowwhen idle; when busy it queues a process-local flag consumed at the next model step. Loaded lazily — see "Command availability" under Install. session/flush— the awaited durability checkpoint.
Every path funnels into the single "compaction result landed in the session" boundary — the same point where the LiveUI signal fires.
Decision key is projectedTokens (provider-anchored, same figure as the UI corner), so the
plugin never drifts from what you see; the threshold-aware shrink gate skips summarizer calls
that provably cannot pull the session below the threshold (kills the low-threshold dead loop).
The builtin transaction bills shadowedTokenCount from the same tokenMeter.measure
per-node prices the official engine uses, so the meter's collapse protocol settles the drop
correctly — the bottom-right counter goes down after compaction.
Thinking control: scoped to compactions
Since the 2026-08 semantics revision, disableThinking controls one thing: whether this
plugin's own summarization call (engine/builtin.js → engine/summarizer.js →
ctx.llm.stream) carries reasoningEffort:'off'. Everything else is untouched:
…

