插件目录 / Knowledge / dsh-auto-compact
dsh-auto-compact
已验证 · 实测可装 wangxiang0605qvq
功能简介
dsh-auto-compact — DSH 插件(会话)
可用 — 实测通过,早期项目
dsh-auto-compact — DSH 插件(会话) 实测能干净安装、正常启动。早期项目,但功能可用。
「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。
README
dsh-auto-compact — DeepSeek Harness 自动压缩插件 | Auto Compaction Plugin
让模型可以主动调度 DeepSeek Harness 会话上下文的自动压缩。注册模型工具 compact_now:模型在回合中请求压缩当前会话历史,插件在**回合结束后(agent 空闲时)**自动执行压缩,并写入会话日志。
Allows the model to schedule automatic compaction of its session context. Registers the compact_now tool: when called, the plugin runs compaction after the current turn ends (once the agent is idle) and records the result in the session log.
为什么需要它 | Why
- DSH 内置了按压力触发的自动压缩(
compaction-basic)和人类手动的/compact命令。 - 但模型自己无法触发压缩:
compaction.compactNow要求 agent 空闲,而工具在回合内执行时 agent 必然处于运行中(会抛busy)。 - 本插件的
compact_now用agent.whenIdle()把压缩推迟到回合结束后的空闲时刻执行,绕开 busy 限制。
安装 | Install
将本仓库复制到 DSH profile 的 node_modules 下:
Copy-Item -Recurse . "$env:USERPROFILE\.dsh\profiles\node_modules\@deepseek-ai\dsh-auto-compact"
在 profile 补丁(如 ~/.dsh/profiles/web/cordis.patch.yml)中插入:
- insert:
- id: auto-compact
name: "@deepseek-ai/dsh-auto-compact"
inject: ["tools", "agents", "timer"]
config: {}
重启 DSH 生效。
使用 | Usage
模型直接调用 compact_now 工具即可:
- 返回
{ ok: true, status: "scheduled" }:压缩已排队,回合结束后自动执行; - 返回
{ ok: false, reason }:压缩服务不可用(如 minimal 预设未挂compaction-basic); - 压缩结果(
compaction/start标记、摘要等)记录在会话日志中,模型可从后续上下文中看到。
依赖 | Dependencies
@deepseek-ai/dsh-compaction:压缩服务契约(agent 预设需挂载compaction-basic实现)。@deepseek-ai/dsh-tools、@deepseek-ai/cordis:工具注册与运行时。
License
MIT
安装
装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:
dsh plugin add dshbase-catalog 然后对 agent 说「帮我装 dsh-auto-compact」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。
该插件是 GitHub 源码(未发 npm)——直接从仓库装:
Web profile:
dsh plugin --profile web add github:wangxiang0605qvq/dsh-auto-compact Headless(CLI)profile:
dsh plugin --profile headless add github:wangxiang0605qvq/dsh-auto-compact 实测报告
验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。
使用场景
给 agent 一套记忆、知识库或检索层,让它不再跨会话丢上下文。
适合谁
跑长项目、想让 agent 记住决策、文档和偏好而不用每次重讲的人。
二次开发建议
记忆/检索后端是缝——插新存储、调蒸馏策略,或加引用与审计轨迹。