vibe-any/dsh-plugin-save-token
Slims oversized tool output at the entrance of every model request — reversibly, structure-aware, with the original spilled to disk.
Most of an agent session's cost is tool output that keeps re-entering the context: API JSON, CLI tables, logs. This plugin intercepts each tool result before the model sees it and applies the cheapest route that passes two gates — a TOON-style lossless re-encode for uniform JSON arrays and JSONL logs, stride sampling with annotated line numbers for wide tables, and head/tail elision with error-line protection for plain text. Every replacement happens only after the original is written to DSH's spill store, and the substitution carries a retrieval path: a save_token_expand tool plus a file locator, so any elided text is one call away. Byte-identical results inside the dedupe window collapse to a stub, and the panel meters real billed tokens against avoided tokens with a per-model calibration, showing a cache-hit percentage so a change that saves tokens but raises cost is visible rather than hidden.
Install
dsh plugin --profile web add github:vibe-any/dsh-plugin-save-tokenThe README's Install section gives two identical-outcome commands and recommends running one: the npm form dsh plugin --profile web add dsh-plugin-save-token, or this GitHub form. Requirements it lists are a running DSH with its Web GUI and pnpm on PATH; the web profile supplies the tools, webServer, React dashboard and spillStore the plugin needs. If spillStore is ever missing, compression stays off by design rather than degrading.
Compatibility
Needs the DSH Web GUI and pnpm on PATH. The README's own figures for the compression thresholds: byte gate keepRatioMax=0.72 with at least 500 B saved, and a token gate that must strictly decrease. Compaction assist ships OFF from v2.3.0 because the README measured ~90% of input tokens as provider cache reads billed at roughly 1/30 of the miss price — summarising cached context converts cheap replay into full-price input.
Details
- Repo: vibe-any/dsh-plugin-save-token
- Category: Usage & Billing
- Stars: 32
- Version: installed from the repository; the README documents v2.4.0 as the current line
Alternatives
white-sand-grand/dsh-plugin-doctor · wuyan19/dsh-plugin-zquota · kenz1117/dsh-ui-usage-billing