dsh-asc
Agentic Surface Compaction (ASC) for DeepSeek Harness: the model decides when and what to compact, committed as durable session-log replacements with full replay, search, and degradation
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:lmst2/dsh-asc说明文档
阅读完整 README ↗dsh-asc
dsh-asc(全名 DeepSeek Harness Agentic Surface Compaction)是
DeepSeek Harness 的上下文压缩插件:由模型自己决定何时压缩、压缩什么,每个压缩决策都以持久化会话日志替换事件(surfaceOp: replace)提交,可回放、可检索、可撤销。
灵感来自 opencode-acp 的"模型自主压缩"哲学,但建在 DSH 事件溯源日志之上——压缩不产生任何侧面状态文件,解压靠日志回放,搜索覆盖包括压缩原文在内的全量日志。
安装
前置要求:已安装 DeepSeek Harness(dsh 命令可用);Node.js ^22.19 或 >=24。
dsh plugin --profile add dsh-asc
dsh plugin 会把插件加入 profile,并根据包内的 dsh.bundle 声明自动启用它;工具和系统提示随该 profile 一起加载。
重启生效:安装完成后,重启正在运行的 DeepSeek Harness 服务。
其他安装方式
从 GitHub 安装——想用尚未发布到 npm 的最新提交:
dsh plugin --profile add github:lmst2/dsh-asc
从源码安装——要改插件本身,或参与开发:
git clone https://github.com/lmst2/dsh-asc.git
cd dsh-asc
pnpm install
pnpm build
dsh plugin --profile add "link:$(pwd)"
禁用 basic 后端
ctx.compaction 同一时刻只能有一个提供者。在 profile 自己的 cordis.patch.yml 里禁用默认的 basic 后端:
- id: compaction-basic
disabled: true
可选:挂载不变式伴生和全文检索后端:
- insert:
- id: dsh-asc-invariant # 运行时不变式检查(可选,推荐)
name: "dsh-asc/invariant"
- id: session-query-sqlite # context_search 全文检索后端(可选)
name: "@deepseek-ai/dsh-session-query-sqlite"
使用
安装并重启后,无需任何配置——插件会:
- 在系统提示中注入上下文管理规范(判断测试、工具用法、分层压缩节奏),模型从第一轮起就主动管理上下文;
- 在上下文偏高时按需注入 (以真实增长与节奏门控,不会每轮打扰);