← 返回列表
D

dsh-funnel

v0.1.0 · 2 天前发布

Curate tool output before it enters the model's context: keep error/warning lines and head/tail, spill the full text to disk with a pointer. Faster turns, smaller context, sharper attention — for every tool, not just bash.

deepseek-harnessdshdsh-plugincontexttokensperformancetool-output

README

dsh-funnel

English | 中文

在工具输出进入模型上下文之前先过一道漏斗——留住要紧的行,其余落盘留指针。更快、更省、注意力更集中,且对所有工具生效。

问题

每次工具结果都会追加进对话,并在之后每一轮模型请求里重发。跑一次 npm test 打出 500 行,这 500 行就跟着会话走到底:每一轮都为它付费,上下文窗口被它填满,模型真正需要的那一行 AssertionError 反而被埋掉。

现有层都不覆盖这件事:

| 层 | 已有 | 没做的 |
| --- | --- | --- |
| 捕获(执行器) | 64 MB spill 防进程 OOM | 与模型看到什么无关 |
| 执行(仅 bash) | maxOutputBytes 字节顶、头部截断 | 只覆盖 shell 工具;盲切,不留 error 行 |
| 压缩时点 | 官方 tool-result-pruner 重写超预算结果的 surface | 只在压缩时触发;盲切头尾;模型读不回原文 |
| 摄入——每个结果、立即生效 | —— | ← dsh-funnel |

压缩时点的修剪是预算爆了之后补救;dsh-funnel 让预算别爆。两者互补。

你能得到什么

1. 装完即忘。 一条命令、零配置。覆盖所有返回文本的工具——bash、文件读取、网页抓取、搜索——低于门槛的结果字节级原样通过,省钱之前你完全感觉不到它的存在。
2. 实测约 24 倍的视图缩减。 真实 headless 会话中,2001 行(8,893 字节)的 bash 结果以 370 字符到达模型:头、尾、加上所有 error/warning 行:

```diff
- [2001 行原始输出]

查看完整 README →

版本兼容矩阵

DSH 版本状态说明
dsh@0.1.0-rc.6 ✅ 兼容 cordis patch ✅
dsh@0.1.0 ✅ 兼容 标准 patch ✅
dsh@0.2.0 ⚠️ 待验证 待实测(API 可能在变)
dsh@0.3.0+ ❓ 未知 尚未发布

💡 兼容矩阵每周末自动跑实测,欢迎 PR 修正

元数据

License
MIT
npm
dsh-funnel
Repo
git+https://github.com/YuanyuanMa03/dsh-funnel.git
Engines
{"node":">=20"}
Weekly DL
0
Monthly DL
0
dsh.bundle
{"bundle":{"patch":"./cordis.patch.yml"}}