Skip to content

dsh-plugin-auto-slim

Verified

dsh-plugin-auto-slim · v1.0.5 · MIT

Cuts token spend on repeated tool calls: identical read-only calls reuse their earlier result, superseded results collapse to a placeholder. No session rewrite, no effect on side-effecting commands.

Install

dsh plugin add dsh-plugin-auto-slim

Confirm the layer applied with dsh --profile default --dump-config — see the install guide.

Source

Published to npm without a public repository. Inspect the package contents before installing.

Tags

Creators

Readme

dsh-plugin-auto-slim

一个 DeepSeek Harness 宿主插件:同一份工具输出,不让模型付两次钱。

它不改变工具行为,也不改会话记录,只在“发给模型的请求”上做两件保守的事:

1. 相同调用直接复用

read / read_image / glob / grep / web_fetch / web_search 用完全相同的参数再调一次时,插件把上一次的结果原样返回,加一行说明,不再执行工具。

对 2 万字符以上的 write,内容完全相同也算重复。

2. 过期结果坍缩成一行

当更晚的调用能证明覆盖了旧结果时,旧结果在下一次请求里被替换成一行占位:

  • 同一工具、同样参数再次执行(搜索类允许只变 limit);
  • read 的新窗口覆盖旧窗口的全部行(整读覆盖分页读;分页读不覆盖整读)。

什么情况下不会有变化

  • 每次调用参数都不同:基本不命中。
  • pwsh / bash / 编辑等有副作用的调用:永远不替换,输出原样保留。
  • 失败结果、空结果、参数解析不了的调用:跳过。
  • 已经发出去的历史:不追溯,只影响之后的请求。

省的是什么

每次请求都会重发整个上下文,所以一份工具输出进入历史后,会在后面每一步里反复计费。

  • 复用:省掉一次重复执行和它的输出;
  • 占位:之后每一步都少发送那一段旧文本。

没有承诺具体百分比。 收益取决于重复率;重复越多的会话收益越大。插件不压缩必要的一次性输出。

安装

dsh plugin add dsh-plugin-auto-slim

或从本仓库目录安装:dsh plugin add ./dsh-plugin-auto-slim。

装完需要重启 DSH:宿主插件在启动时装配。

配置

没有配置项。关闭方式:在「插件」页面停用该组合包,或从 profile 的 dsh.profile.bundles 移除。

兼容性

  • 在 DSH Desktop 0.2.1-rc.2(Windows)上实测:重复读取会命中复用。
  • 只依赖 agent/pre-step、tools/post-execute、agent/request 三个事件名与消息结构;没有对内部模块的 import。
  • 没有在其它 DSH 版本上做过兼容性测试,engines 未声明。

诊断

设置环境变量 DSH_AUTO_SLIM_TRACE=1 后启动 DSH,会在 <cwd>/.cache/auto-slim/state.json 写入加载时间与三个钩子的触发次数,用于确认插件是否被加载。默认关闭,不写任何文件。

测试

node test/run.js          # 19 个单元测试
node test/load.test.js    # 加载形状:apply 注册三个钩子,异常输入放行
node test/integration.mjs # 6 项,跑在真实 cordis 事件链上

限制

  • 缓存是每个会话的内存状态,重启清空;不做持久化。
  • 只覆盖上面列出的只读工具与大型 write。
  • 判定是保守的:不确定就不动,宁可少省一点也不改错。

License

MIT

声明

与 DeepSeek 及 DeepSeek Harness 项目无隶属关系,包名只描述用途。按原样提供、不附带担保;安装前请自行审阅源码。