dsh-token-saver
DeepSeek Harness plugin that aggressively saves tokens without affecting task quality: lossless head/tail truncation of tool results (default), grep-result folding, pressure-triggered dsh-compaction-basic delegation, and an LLM-summary CompactionEngine subclass for the aggressive mode. Saves 97.6% of input tokens on an 8-scenario synthetic suite, with all reductions routed through dsh event flow so model-visible = logged stays intact.
为 DeepSeek Harness 设计的 token 节省插件:不损失任务效果。默认 conservative 档对工具结果做无损头尾裁剪与 grep 折叠;balanced 档在压力阈值委托 dsh-compaction-basic;aggressive 档以 LLM-summary 引擎子类化替换官方压缩。8 个合成场景累计节省 97.6% 输入 tokens,所有削减走 dsh 事件流,model-visible = logged 不变式仍成立。
How to install
dsh plugin add github:Shaw529/dsh-token-saver About
dsh-token-saver 一个为 DeepSeek Harness (dsh) 设计的 Cordis 插件。**激进节省 token、绝不破坏任务效果**。 dsh-token-saver 通过挂载三个扩展点节约 token:tools/post-execute(无损头尾裁剪 / grep 折叠)、agent/pre-step(委托官方 ctx.compaction)、以及可选的 prompt-cache 段稳定排序。所有改写都走 dsh 的事件流,不会触发"model-visible 与 logged 不一致"不变式。 --- 目录 为什么需要它 四种模式 安装 配置参考 测试效果 如何保证不影响任务效果 开发 架构 License --- 为什么需要它 DeepSeek 这类 agent 在长任务里 80%+ 的 prompt tokens 来自两类内容: 1. **被读出来的大文件** —— 一次性 read 一个 1MB 的迁移 SQL 就要吃掉 250k tokens。 2. **被反复搜索出来的命中结果** —— grep 几十个文件,回填全部 grep 结果,模型根本没读完。 dsh-token-saver 默认 conservative 档只做一件事:**完整保留头/尾,中间的部分用一行 metadata 替换**。这是一种"lossless"折叠 —— 模型…
Recommendation signals
Meta
- License
- MIT
- Language
- TypeScript
- GitHub stars
- 2
- mo. downloads
- –
- Last push
- 2026-09-07
- Created
- 2026-09-02
Links
Basic safety check
- Findings
- curated 收录但无 npm 包/安装命令
- Sources
- curated:awesome-dsh-plugin.com, curated:awesome-dsh-plugin/awesome-dsh-plugin
- Topics
- ai-agents, compaction, deepseek-harness, dsh-plugin, token-saver
Related plugins
TokenLedger
zh667/TokenLedger
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.
dsh-context
bowenliang123/dsh-context
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.
dsh-usage-statistics-panel
HaoyueQin/dsh-usage-statistics-panel
Usage statistics settings panel: 26-week activity heatmap, daily token trend with a cache hit-rate curve, per-model donut and breakdown, time-range filters, summary cards, one-time historical backfill and lossless rebuild.
dsh-all-usage
ParticleLight/dsh-all-usage
Analyze usage across models, providers, workspaces, and time ranges — including custom start/end dates over the full retained history — with live cache-hit visibility and separate model and provider breakdowns. Includes hourly single-day trends, daily cross-day trends, a 53-week GitHub-style heatmap, usage streaks, model and workspace Token-share donut charts with Token, cost, and percentage details, independent combinable filters, cache-efficiency trends, DeepSeek account balance, workspace aliases, CSV export, and a durable ledger that preserves successfully flushed usage after session deletion — and after a workspace is deleted, where its recorded usage is summed into one Deleted row — and rebuilds incrementally — on restart, unchanged sessions are applied from the ledger without re-reading their logs (a per-session log revision is the change signal), and only changed/new events are folded. The workspace registry is kept fresh automatically through the DSH domain/changed probe: only added/removed workspaces are reprocessed incrementally, unchanged workspaces reuse their computed aggregates and ledger with zero rescan, and usage is strictly limited to DSH-registered workspaces (unregistered cwds are ignored). After a scan, lightweight revision status fetches full history only when the Host/data state changes and exposes non-sensitive sync health (revision reuse, rereads, ledger recovery, and failures). Token accounting is explicit: input is fresh (cache read/write and reasoning are separate buckets) and zero-usage replays never overwrite recorded usage. Chinese uses local time, English uses UTC; API access is loopback-only.