Preface¶
In the DeepSeek Harness (DSH) workflow, tool execution results are appended to the conversation history and re-sent in every subsequent model request. Long outputs (for example, npm test or reading a large codebase) persist throughout the session. They not only consume the context window, but also bury critical error messages under large volumes of redundant logs. The existing stages (capture, execution, and compression time) cannot directly address what the model “sees,” nor can they perform filtering before each conversational turn begins.
What It Is¶
dsh-funnel is a workflow plugin developed by YuanyuanMa03 under the MIT license. Its core purpose is to curate data before it enters the model context: it retains critical lines (such as errors, warnings, head, and tail), dumps the remainder to disk, and includes pointers to the full data. This significantly reduces the model view while keeping the original data intact at the disk level, allowing the model to read it on demand when needed.
Core Features¶
- Tool Output Curation: Covers all tools that return text, including bash, file reading, web fetching, and search.
- Retention of Critical Lines: Automatically retains error lines, warning lines, and the head and tail of the output content.
- Disk Dump: Writes the complete original output to the
.dsh-funnel/directory and references it through pointers in logs. - Performance Improvement: The model-visible content is substantially compressed. In tests, an output of 2001 lines was compressed to about 370 characters, reducing the model view by roughly 24 times.
- Zero Configuration: Default behavior covers common scenarios. Small results pass through byte-for-byte unchanged, and no tuning is required.
- Lossless and Consistent: The complete original data is preserved on disk, and the model-visible content is fully consistent with the log records.
Installation and Configuration¶
Installing the plugin requires the following command:
dsh plugin add github:YuanyuanMa03/dsh-funnel
After installing the plugin, behavior can be fine-tuned in the configuration file. All configuration items are optional and located in the plugin configuration block:
- id: dsh-funnel
name: 'dsh-funnel'
config:
maxChars: 4000 # 长度在此以下的原始结果会以字节相同的方式直接通过
keepHead: 15 # 保留输出开头的行数
keepTail: 25 # 保留输出末尾的行数(通常包含错误信息)
keepPatterns: # 通过正则匹配需要保留的关键行
- error
- warn
- fail
- fatal
- exception
- assert
- denied
- panic
maxLineChars: 1000 # 对单行过长的内容(如 minified JSON)进行截断
spill: true # 是否将完整原始内容写入磁盘
tools: # 针对特定工具的覆盖配置
web_fetch: { maxChars: 2000 }
How It Works¶
dsh-funnel is mounted on the tools/execute extension point. It intercepts the return value of tool execution, replaces long string fields (such as stdout, file content, and web fetch results), and projects only the curated content into the model-visible value field. At the same time, it writes the complete original data to disk. Error results are never curated, because they are usually short and essential to the context.
Notes¶
- Runtime Environment: The plugin requires Node.js version >= 20.
- Tool Scope: It only covers tools that return text.
- Error Handling: Error results are not curated or truncated and are always left unchanged.
- Security: The plugin runs with the permissions of the current DSH process. Check the source code and license before installation.
Summary¶
dsh-funnel addresses context bloat and attention distraction caused by long outputs by preprocessing the data before it enters the model context. With minimal configuration overhead, it achieves significant Token savings and performance improvements while preserving data completeness and auditability. For more details, see the SkillHub Catalog or the GitHub repository.