DeepSeek Harness 插件

dsh-auto-compact-lileikej

Auto context compaction for DeepSeek Harness: token-pressure-driven summarization checkpoints with a configurable (LATE-by-default) trigger threshold and a settings card.(英文原文)

跳到安装方式

来源信息

GitHub 仓库
lileikeji/dsh-auto-compact
最近更新
2026年8月20日
分类
记忆
GitHub stars
0
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/lileikeji/dsh-auto-compact
插件名:dsh-auto-compact-lileikej
作者:lileikeji

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器3 个文件
README.md来源说明 · 只读预览

dsh-auto-compact

Automatic context compaction for DeepSeek Harness: at every agent step it prices the routed request against the model's context window, and once pressure crosses the configured threshold it condenses the older span of the conversation into a durable <compacted-summary> checkpoint (via the conversation's own model, reusing the warm prefix cache) — so long sessions keep working without losing essential context.

It wraps the harness's own token-meter-driven engine (@deepseek-ai/dsh-compaction-basic); this plugin adds a LATE-by-default trigger, a settings card, and install docs.

Why "compact later"?

The harness's pi-ai provider falls back to DEFAULT_CONTEXT_WINDOW = 262144 (256K) for models that do not declare a window. With the default thresholdRatio of 0.8 that means compression can fire at ~205K tokens — only ~20% of a real 1M-window model. This plugin defaults to thresholdRatio: 0.92 and documents the window fix, so big windows are actually used.

Install

# profile dir (C:\Users\<you>\.dsh\profiles\<name>)
pnpm add -w dsh-auto-compact
# or from GitHub:
pnpm add -w dsh-auto-compact@github:lileikeji/dsh-auto-compact

Add dsh-auto-compact to the profile package.json dsh.profile.bundles list, then disable the harness's own engine so only one engine owns compaction:

# profile cordis.patch.yml
- id: compaction-basic
  name: '@deepseek-ai/dsh-compaction-basic'
  disabled: true

Window configuration (important)

The engine reads the model's context window from the LLM adapter. If your model's window is not declared (pi-ai defaults to 256K), set it per provider in ~/.dsh/settings.yaml:

llm-pi-ai:
  providers:
    my-provider:
      apiKeyEnv: MY_API_KEY
      defaultContextWindow: 1000000   # the model's real window

Configuration (settings card)

Settings → 插件 → 自动压缩上下文(auto-compact):

  • thresholdRatio — trigger threshold as a fraction of the context window (default 0.92).
  • retainRatio — fraction of the recent conversation kept verbatim (default 0.12).
  • maxTokens — summary output cap (default 8192).
  • auto — enable/disable automatic compaction.

Changes apply after a profile restart.

How it works

1. agent/pre-step: price the latest durable routed request with the token meter. 2. If totalTokens ≥ thresholdRatio × contextWindow (output-budget aware when known), pick a head-anchored span that never splits a tool call/result pair, retaining the recent tail. 3. Summarize that span with the conversation's own model (system prompt + tools + leading messages replayed verbatim so the provider's KV cache is reused), appending the compaction instruction. 4. Land the checkpoint as a compaction/start → summary → compaction/end transaction on the session surface; subsequent steps continue from the checkpoint.

License

MIT