Plugin directory / Knowledge / dsh-auto-compact
dsh-auto-compact
Verified · install-tested on dsh wangxiang0605qvq
What it does
DeepSeek Harness auto-compaction plugin: model tool compact_now, auto-compacts context after the turn | Auto compaction plugin for DSH: compact_now tool, compacts context after the turn.
Works — verified, early-stage project
DeepSeek Harness auto-compaction plugin: model tool compact_now, auto-compacts context after the turn | Auto compaction plugin for DSH: compact_now tool, compacts context after the turn. It installs cleanly and boots without issues in our testing. It's early-stage but functional.
“Verified” means our automated CI actually ran dsh plugin add in a clean profile and it booted — nothing more. Feature descriptions and version compatibility are the author’s claims. This is not a security audit and not an endorsement of third-party code.
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
Install
Install the catalog once, then DeepSeek Harness can find and install any plugin from this site automatically:
dsh plugin add dshbase-catalog Then say "install dsh-auto-compact for me" — your agent finds it in the directory and installs it. Docs: dshbase-catalog · verified packs.
This plugin is GitHub source (not published to npm) — install it straight from the repo:
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 Test report
Verified: L1 install + L2 load + L3 runtime from GitHub source on dsh 0.1.0-rc.6.
When to use it
Give the agent a memory, a knowledge base, or a retrieval layer so it stops forgetting context between sessions.
Who it's for
Users running long projects who want the agent to remember decisions, docs, and preferences without re-explaining.
For developers — extending it
The memory/retrieval backend is the seam — plug a new store, tune what gets distilled, or add citation and audit trails.