Saltar al contenido principal
Y

dsh-output-budget

yomxxx/dsh-output-budget

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.

Instalar

dsh plugin --profile web add github:yomxxx/dsh-output-budget

README

dsh-output-budget

English | 中文

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

ShapeTriggerRewrite
git-statusgit status (long or porcelain)drops advice rows, caps each file group, keeps conflicts
git-loggit log, git log --oneline -n30 commits + remainder marker
git-diffgit diff, git showper-file +a/-b stats, hunk headers, 6 lines per hunk
listingls, find, tree, fd, du100 entries + remainder marker
searchgrep, rg, or the grep toolmatches grouped by file with counts
package`pnpm/npm/yarn/bun installadd
bashany other shell callANSI/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 value stays 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
KeyDefaultMeaning
enabledtrueMaster switch; false restores results byte for byte
modeapplyapply rewrites, dry-run only measures, off does nothing
maxContentChars6000Target preview size (≈4 characters per token)
minChars1200Results shorter than this are never inspected
spilltrueStore the full text through the harness spill store
digestBashGenerictrueGeneric shell cleanup
digestListingtruels/find/tree capping
digestGittruegit status/log/diff
digestSearchtrueGroup many matches by file
digestPackagetruePackage-manager warnings and errors
digestTestfalseTest-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.
  • digestTest is 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: the git status and git log digests 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

Plugins relacionados