Shape-aware tool-output budget for DeepSeek Harness: git status/log/diff, listings, search matches and package-manager noise are digested before they reach the model, the full text stays one read away through the spill store, and failures are never truncated.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-output-budget
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:YOMXXX/dsh-output-budget
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
Shape-aware tool-output budgeting for DeepSeek Harness.
Every tool result is inspected once — after the tool ran, before it reaches the model. Noisy shapes are rewritten into a denser preview, the full text is stored through the harness spill store, and the model gets an explicit recoverability notice. Errors keep every byte.
$ git log --oneline -80
517963bc6 fix(resume): keep newlines and lists in a table sample
…
36e925902 Merge branch 'feature/setting-tag-20261013' into 'master'
[... +50 more commits ...]
(Omitted 3301 bytes. Full formatted result stored at: /…/session-…/06aca161290b-bash.txt. Use read with offset/limit, or grep this path to search within it.)
What it does
| Shape | Trigger | Rewrite |
|---|---|---|
git-status |
git status (long or porcelain) |
drops advice rows, caps each file group, keeps conflicts |
git-log |
git log, git log --oneline -n |
30 commits + remainder marker |
git-diff |
git diff, git show |
per-file +a/-b stats, hunk headers, 6 lines per hunk |
listing |
ls, find, tree, fd, du |
100 entries + remainder marker |
search |
grep, rg, or the grep tool |
matches grouped by file with counts |
package |
`pnpm/npm/yarn/bun install | add |
bash |
any other shell call | ANSI/progress-frame cleanup, repeated-line folding, head 40 + tail 40, error windows |
A rewrite only happens when the result is at least minChars long, the preview is strictly smaller, and
the result is not already a preview.
In the app
A compact chip sits in the composer tool row and shows how much this session has saved; clicking it opens the budget panel: a KPI band (saved, rewrites, compression), a per-shape stacked bar with a runs/saved/share table and a sparkline, and the last digests with their command and reduction. The chip and panel read one session projection, so they update on every committed tool result without polling.
What it never does
- Never rewrites a failure.
isError, a non-zero exit code, a signal, a timeout, or a sandbox denial keeps the result byte for byte. - Never rewrites
read. Lines the model asked for are the lines it gets. - Never edits your command. There is no pre-execute rewrite; only the model-facing text changes, and
valuestays intact. - Never hides output. Every rewrite carries the omitted byte count and a locator; the harness UI still recognises the notice as a spill preview.
Install
In DSH: Plugins → Add plugin → search dsh-output-budget → Install, then enable it.
From the CLI:
dsh plugin --profile <profile> add dsh-output-budget
To pin one exact build instead of tracking latest, install the tarball attached to a release:
dsh plugin --profile <profile> add \
https://github.com/YOMXXX/dsh-output-budget/releases/download/v0.2.2/dsh-output-budget-0.2.2.tgz
Nothing is compiled and nothing is downloaded at runtime: the package is plain ESM, with no build step, no external binary and no network access.
Configuration
Patch the row in your profile's cordis.patch.yml:
- id: dsh-output-budget
name: dsh-output-budget
config:
mode: dry-run
maxContentChars: 6000
| Key | Default | Meaning |
|---|---|---|
enabled |
true |
Master switch; false restores results byte for byte |
mode |
apply |
apply rewrites, dry-run only measures, off does nothing |
maxContentChars |
6000 |
Target preview size (≈4 characters per token) |
minChars |
1200 |
Results shorter than this are never inspected |
spill |
true |
Store the full text through the harness spill store |
digestBashGeneric |
true |
Generic shell cleanup |
digestListing |
true |
ls/find/tree capping |
digestGit |
true |
git status/log/diff |
digestSearch |
true |
Group many matches by file |
digestPackage |
true |
Package-manager warnings and errors |
digestTest |
false |
Test-runner output, off by default |
Start with mode: dry-run if you want to see the numbers before anything is rewritten.
The /budget command
Type /budget in a session to print what this process has inspected and saved:
output-budget (this process)
inspected 41 result(s), rewrote 33
saved 812,441 chars (~203,110 tokens)
session-… 33/41 rewritten, saved 812,441 chars [git-log 212,004, search 402,110, bash 198,327]
mode: apply · maxContentChars: 6000 · minChars: 1200 · spill: true
/budget dry-run, /budget on, /budget off switch the mode for the running process, so you can A/B
without editing a patch file; an edit to the patch layer is what survives a restart.
Offline report
scripts/ab.mjs replays recorded outputs and fails when a failure line would be lost:
node scripts/ab.mjs records.jsonl # {"command":"git status","output":"…"}
Known limitations
- The digest is a heuristic, not a parser: unusual command dialects may fall back to the generic shape, which is safe but less aggressive.
digestTestis off by default because test runners differ widely; enable it per project.- Previews are plain text: a rewritten result no longer renders as a rich terminal card in the Web UI. The UI still shows the spill affordance for the full text.
- Only text results are inspected; image-bearing results pass through untouched.
- Saved text lives in the session spill directory managed by the harness, so retention follows the harness's own spill policy.
Development
node --test # 36 unit tests
node scripts/ab.mjs records.jsonl
Compatibility
- DSH
^0.2.3-alpha.2. - Verified on DSH Desktop
0.2.3-alpha.2(macOS) in a live session: thegit statusandgit logdigests fired, a failing command kept its full output, and the spilled locator was written and read back. The chip and panel registrations were verified live through the client slot tree; their visual result was not screenshotted, so the layout itself is unverified by the author.
License
MIT
Links
More in this category
Tencent/WeKnora#dsh-weknora★ 38385
Four read-only tools over a WeKnora knowledge base: list knowledge bases, hybrid passage search, reassemble one document's chunks in order, and WeKnora's own cited RAG or ReAct-agent answer with a resumable session id.
DayuanJiang/next-ai-draw-io#dsh-plugin★ 37218
Draws draw.io diagrams in DeepSeek Harness through the next-ai-drawio MCP server: the link in the reply opens a live preview in the right sidebar, you can edit the diagram by hand, and each AI change is a version you can restore. Node.js 18+; npx downloads the MCP server on first use.
yikart/AiToEarn#dsh-plugin-aitoearn★ 28812
Generate copy, images and short videos, and publish with one click to Douyin, Kuaishou, Xiaohongshu, WeChat Official, Bilibili, Facebook, TikTok and more, covering the full content lifecycle from creation to publishing and monetization.
superdesigndev/treg★ 9804
Tool catalog for agents: search ~2,600 external endpoints (SEO and SERP, backlinks, social, people and company enrichment, ad libraries, scraping) by the task you want done, read each one's parameters and per-call price, then call it with the credential injected server-side. Ships the skill plus an MCP row that stays disabled until TREG_TOKEN is set.
T-Auto/dsh-ops★ 6039
Provides bash, PowerShell 7, and high-performance Rust tools for DSH on Windows to reduce token usage.
Hithink-Tech-Org/Financial-API#hithink-finance★ 4659
Query Hithink Finance data in DeepSeek Harness, view charts in chat, and save refreshable dashboards.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.