Projects oversized tool receipts (read, grep, glob, bash, ssh) to a head/tail view with a spill locator for the full text, and can run read-only calls whose arguments are literally derivable from the previous receipt without a model round trip. Shadow-first by default — it records before it changes anything — with measured savings and stable degradation codes in `boost status`, a settings page for workspace scope and the shadow/projection switches, and optional receipt distillation that is off by default. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-boost
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:SAXEM1997/dsh-boost
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
English | 简体中文
dsh-boost
Cut DeepSeek Harness token usage — a DSH plugin
Tool-receipt projection and deterministic read-only substitution shorten the history every model request replays: large receipts are truncated to head and tail plus a locator, with the original spilled and re-readable; repeated read-only results across tools are skipped with a deterministic substitution that saves one model round-trip. A same-origin settings page shows the degradation codes, the savings ledger and the effective configuration.
flowchart LR
R["Tool receipts<br/>read · grep · glob · bash · ssh"] --> P["Projection<br/>truncate + locator + spill"]
R --> S["Substitution<br/>deterministic read-only · shadow-only accounting"]
P --> M["Model request<br/>shorter context"]
S --> M
U["Settings page<br/>status · scope · shadow switch"] --> S
Status: v1 is implemented. Projection, substitution and the control surface are all in place, and the full test suite passes. The benefit range is an ex-ante design estimate (3.5% lower bound / 10.0% ideal upper bound; ~0.4% aggregate net on the 300 longest sessions), an offline estimate at both ends — not a per-session floor — and not reproducible from the deliverables. See
docs/RELEASE.md§3.
What it does
DSH replays the whole history on every model request. Across the 300 longest sessions measured locally, 97.01% of the input was cache reads, and tool receipts dominate the volume (bash 61.75%, read 22.13%, ssh 10.01%), yet the part of a receipt the next step actually uses is far smaller than the receipt itself.
The plugin does two things:
- Projection — before a tool receipt enters the context, keep its head and tail per tool family and replace the middle with a retrievable on-disk handle. The original stays readable; the footer names the path. Projection is deterministic and makes no per-call decision.
- Substitution — when a repeated read-only call (
read/grep/glob) in a plan already has deterministic evidence satisfying its guard, commit it without asking the model for another decision; with several candidates, one auxiliary request picks one.
The ex-ante estimate for v1 is 3.5% (lower bound) to 10.0% (ideal upper bound) of raw
totalTokens; projection's aggregate net across the 300 longest sessions is about 0.4%.
Both ends are offline estimates: 3.5% is not a floor, and neither figure is a per-session
floor — short sessions can be net negative, and nothing in the deliverable can recompute it. The
corpus, snapshot and derivation live in how it works (Chinese).
The settings page (the host's "Token efficiency" section) shows degradation codes, the savings
ledger and the effective configuration, and edits the scope and the two switches; it writes
scope.json through the same CAS as the boost tool.
Install
Node.js >=24.9.0 and DSH >=0.2.2-rc.4 <0.2.3-0 (a range, not an exact pin). Substitution is
POSIX-only; v1 targets the web profile.
dsh plugin --profile <name> add dsh-boost@^0.4.6 --registry=https://registry.npmjs.org/
dsh plugin requires a profile and forwards the remaining arguments to pnpm in that profile
directory (so pnpm must be on PATH); for a local checkout, run npm run build first and pass the
absolute path to add. npmjs has latest at 0.4.6; a mirror may lag, so pass --registry
explicitly when the registry matters. Version history, mirrors and the 0.0.0-stage trap are in
the operations guide (Chinese). You must restart DSH after
installing (plugins load at host startup); for the web profile, restart dsh web.
Enable it
After installation the plugin is inert (with no scope.json it is selected + an empty list +
shadow). Enable it from the settings page (Settings → Token efficiency) — until a workspace
is selected, the model does not see the boost tool: it shares the protocol section's visibility
gate, and not seeing it means not paying its 399 tokens. That is the 0.4 trade-off, and the price
is losing the in-chat way to enable a workspace.
- Open the settings page and select the workspaces to expose under "scope" (or switch to
global), then save. - Back in a session,
boostis now visible; call it with{"cmd":"status"}and confirmok: truewith an emptydegraded. - Shadow for a week: keep
shadow: trueandprojection: "shadow", and work normally. - Set
projectionto"on"and then confirmhasSpillistrueanddegradeddoes not carryERR_HOST_SPILL_UNUSABLE. The order is load-bearing: that code only entersdegradedwhileprojectionis"on", so checking first is a check that always passes. - Once the shadow report is acceptable, set
shadowtofalse; after the first real substitution, watch for thecontent[].thinking400 as described indocs/RELEASE.md§4.
The full walkthrough, every field and rollback are in the operations guide
(Chinese). workspaceIds are the host's workspace UUIDs, not paths; on a single-user machine
without the UUID, "mode": "global" is the fallback.
Settings page
Once installed and enabled in a profile, the host's settings panel gains a "Token efficiency"
section (「Token 效率」 in Chinese). It shows state, edits scope, and warns about the two dangerous
switches: turning projection on shows the spill precondition, and turning shadow off shows the
content[].thinking 400 to watch for. Both give a rollback and both are advisory, never gates.
When the page cannot reach its data it shows a stable code instead of an empty table;
curl with the page cookie returns the same JSON; a bare curl gets ERR_HTTP_UNAUTHORIZED on a host that requires auth, which is the expected result.
| It does | Content |
|---|---|
| Shows | degradation codes and what to do, substitution saving as a lower/upper bound, projection gross/net, retrieval count, receipt counts, fixed overhead, effective configuration (read-only) |
| Shows (distillation) | enabled, families, trigger, max output, timeout, route; plus calls/tokens/adopted/rejected/fallback/saved_tokens (what distillation itself saved)/spilled_bytes (originals spilled and then refused), and the total characters sent for distillation |
| Writes | four fields of <dshHome>/boost/scope.json: mode, workspaceIds, shadow, projection |
Distillation's configuration is not editable here: distillation.* lives in the profile's
cordis.patch.yml, not in scope.json, so the page only displays the effective values. When
enabled is true the page adds a note (role="note", three sentences: one extra call, products are
pinned, turning it off affects only later receipts) — advisory, never a gate. It is lighter than
substitution (it changes what the model reads, not what the model decides), but every call really
spends money and an adopted product is pinned for good.
Receipts for distillation (receipt distillation, ADR 0001): an adopted distillation writes
code: 'projected' (kind: 'projection') plus mode: 'adopted' and the distill_* fields — to a
ledger reader it is this receipt's projection; distill names the decision, not a receipt code.
Not adopted writes distill-failed, distill-rejected:empty, distill-rejected:timeout,
distill-rejected:unverifiable, distill-rejected:not-smaller or
distill-rejected:not-worth-it; a call whose answer lands after its timeout writes a separate
distill-late line. Three refusals (empty/unverifiable/not-smaller) pin a bodyless tombstone
that a replay reads instead of paying for the call again; timeout and not-worth-it are never
pinned — the first to leave room for a late answer, the second because the remaining-step count it
rests on grows with the session, so a tombstone would freeze a judgement the evidence has since
overturned. Meaning and remedy per code: the receipt-code table in
the release notes.
It writes through the same CAS as the boost tool's scope-set, so neither overwrites the
other; if someone else got there first the page reports ERR_SCOPE_REVISION_CONFLICT and keeps
your draft. Per-field and per-code detail is in the
operations guide (Chinese).
Go deeper
These documents live in the repository, not in the npm tarball (files ships only dist,
locale, static, cordis.patch.yml, both READMEs, LICENSE, and NOTICE; src/ is not shipped
either, and the dist source maps inline the sources). If you are reading on the npm page, open
them from the repository. The how-it-works and operations guides are Chinese-only, as
are docs/RELEASE.md and the design documents; this English README is the English entry point.
| Document | What it answers |
|---|---|
| How it works | How projection, substitution and admission work; where the numbers come from; protocol section and cache-prefix stability |
| Operations | Install, enable, roll back, uninstall; config keys, degradation codes, state fields and known limits |
| Release acceptance | How to run npm run verify:package; the two release-gate invariants, zero peerDependencies and the install spec, the degradation-code matrix; the manual 20-task regression and shadow-week recompute |
| Quality instrument | Paired two-arm comparison over existing trajectories; what the apparatus does and does not deliver; three known biases and the phase-two gate |
| A/B runbook | Step-by-step checklist for one paired quality run: preconditions, both arms, result format, five ways to ruin it, the pre-committed gate |
| Design | Goals, evidence, architecture, contracts, measurement, risks, release shape |
| Host contracts appendix | Interface reference copied line by line from the host sources |
| Three-tier delegation research | 25 primary sources on caching, routing thresholds, compression, and verification |
The source and docs live in the repository at
github.com/SAXEM1997/dsh-boost; package.json points
repository, homepage, and bugs at it. The document links above are repository-relative.
License
Apache-2.0. The mechanisms are ported from HarnessMM
(Apache-2.0): the flat candidate bank, GDR guard, CCS single-candidate commit, and the closed-set
selector. EDG's graph/chain (predecessor_id) and the RSI loop were not ported. A NOTICE
ships with the package.
Links
More in this category
bowenliang123/dsh-context★ 5511
DSH context insight panel: Context dashboard + /context command + Context browser — one-stop context lifecycle management with categorized composition, content details, evolution trends, compaction/injection events, and stats.
Han-1413141/dsh-cost-meter★ 756
Per-session and daily API cost, budget with usage %, official balance, history dashboard, and one-click official price sync with peak/off-peak pricing.
wssfk12138/dsh-damage-pulse★ 291
Tracks DeepSeek token usage, per-call and session costs, and account balance with cache-aware charge animations in the DSH Web UI.
zh667/TokenLedger★ 206
Sidebar usage panel that attributes tokens to the relay site that served each request, read from your existing provider config: today/month/all-time totals, per-site and per-model breakdowns, a year activity heatmap, and New API / Sub2API / DeepSeek balances.
Ychris12138/dsh-usage-stats★ 192
Multi-provider usage dashboard with provider/model token breakdowns, calendar drill-downs, account balances, and OpenCode Go / Z.ai subscription quota tracking.
PolinniZhong/dsh-personal-center★ 115
Personal center for DeepSeek Harness: cross-session usage statistics with per-provider and per-model breakdown (auto-discovers configured models), per-model cost estimation, global custom instructions, a data-driven desktop pet with bitmap & vector skins, and a conversation status overview, all local and offline.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.