Reasonix风格缓存感知压缩后端,用于DeepSeek Harness(DSH)。模块化压缩插件,自动同步自esengine/DeepSeek-Reasonix。
Reasonix-style cache-aware compaction backend for DeepSeek Harness (DSH). Modular compact plugin with auto-sync from esengine/DeepSeek-Reasonix.
安装
dsh plugin --profile web add github:Zhuchen00123/dsh-compaction-cacheawareGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
目录
Reasonix-style cache-aware compaction backend for DeepSeek Harness (DSH).
This is a standalone, modular DSH plugin. It implements the official
@deepseek-ai/dsh-compaction seam (ctx.compaction) and is designed to be
mounted instead of @deepseek-ai/dsh-compaction-basic inside a preset's
compaction realm. It does not modify other plugins, presets, or host files.
🐋 收录于 DSH 创意工坊
本仓库打上
dsh-plugintopic 后,会被 DSH 创意工坊 自动扫描收录。 在线地址:https://JxaMe.github.io/dsh-workshop/
Docs
- PROJECT.md — 项目说明与维护入口
- MAINTENANCE.md — 维护手册
- MIGRATION_BRIEF.md — 迁移交接说明
- reasonix_compact_design.md — Reasonix 原始设计
What it ports from Reasonix
- One automatic trigger:
compact_ratio(default0.85), not multiple soft/snip/force thresholds. - One structured checkpoint: stable prefix + one summary + recent tail.
- Recent tail budget:
clamp(window×10%, 32K, 96K). - Checkpoint acceptance: normal candidates ≤ 50% of window and below the trigger; exceptional fixed-prefix path requires ≥25% savings.
- Canonical transcript preserved: DSH's surface
replaceshadows the old range in the model-visible projection only; the raw session log remains the source of truth. - One summarizer call per transaction: no application-layer retry loops.
- Reasonix summary headings:
Standing facts & constraints,Goal,Decisions & rationale,Files & code,Commands & outcomes,Errors & fixes,Pending & next step.
Install / build
安装到 DSH profile(推荐)
已发布到 npm registry,直接安装:
cd "$env:USERPROFILE\.dsh\profiles\web"
pnpm add dsh-compaction-cacheaware
也可以从 GitHub 安装:
pnpm add dsh-compaction-cacheaware@github:Zhuchen00123/dsh-compaction-cacheaware
本地开发 / 构建
pnpm install
pnpm build
然后在 preset 的 compaction realm 里替换:
# - id: compaction-basic
# name: '@deepseek-ai/dsh-compaction-basic'
- id: compaction-cacheaware
name: 'dsh-compaction-cacheaware'
config:
compactRatio: 0.85
checkpointCeilingRatio: 0.5
recentTailRatio: 0.1
recentTailMinTokens: 32768
recentTailMaxTokens: 98304
summaryMaxTokens: 16384
如果从源码本地调试,也可以直接用编译产物路径:
- id: compaction-cacheaware
name: 'file:///absolute/path/to/dsh-compaction-cacheaware/lib/index.js'
config:
compactRatio: 0.85
checkpointCeilingRatio: 0.5
recentTailRatio: 0.1
recentTailMinTokens: 32768
recentTailMaxTokens: 98304
summaryMaxTokens: 16384
Keep @deepseek-ai/dsh-command-compact in the same realm so /compact uses
this backend. The optional @deepseek-ai/dsh-compaction-tool-result-pruner can
still be mounted as a sibling; this plugin reads it through ctx.get().
Configuration
| Key | Default | Meaning |
|---|---|---|
compactRatio |
0.85 |
Sole automatic trigger fraction. |
checkpointCeilingRatio |
0.5 |
Normal auto-checkpoint acceptance ceiling. |
recentTailRatio |
0.1 |
Recent verbatim tail fraction. |
recentTailMinTokens |
32768 |
Lower bound for production tail. |
recentTailMaxTokens |
98304 |
Upper bound for production tail. |
summaryMaxTokens |
16384 |
Summarizer output cap. |
exceptionalMinSavingsRatio |
0.25 |
Required savings when fixed prefix exceeds ceiling. |
minRecentKeep |
2 |
Minimum recent messages kept. |
minCompactMessages |
2 |
Minimum compactable messages. |
maxPinnedFirstUserTokens |
1500 |
Pin first user turn if ≤ this. |
pinnedFirstUserWindowFrac |
0.15 |
First-user pin window fraction cap. |
protocolReserveTokens |
256 |
Framing reserve. |
summarizationProvider / summarizationModel |
'' |
Optional summary route; defaults to conversation route. |
auto |
true |
Register automatic pressure/overflow listeners. |
Modularity
- The plugin only registers
ctx.compactionand its own automatic listeners. - It does not edit
dsh-wsl-bash,dsh-team-dashboard,router-opencode-wsl, or any other plugin. - To use it, mount it in your own preset or profile patch; see
cordis.patch.example.ymlin this package.
Keeping in sync with Reasonix
scripts/sync-reasonix-compact.mjs and the GitHub Action in
.github/workflows/sync-reasonix-compact.yml watch
esengine/DeepSeek-Reasonix and open/update a PR when the upstream compact
implementation changes. The sync job:
- Fetches the latest
main-v2Reasonix source. - Updates
vendor/reasonix/compact/with the upstream compact files and design docs. - Regenerates
src/generated/reasonix-constants.tsfrom the Go constants and summary prompt (when they change). - Commits and opens a PR with a summary of what changed.
The generated constants are imported by this package so tuning values stay traceable to upstream.
Publish to GitHub / DSH Workshop
This repository is designed to be published as a standalone public GitHub repo.
The DSH creative workshop discovers public repos with the dsh-plugin topic.
# 1. Authenticate GitHub CLI once
gh auth login
# 2. From this repository root, publish and add workshop topics
./scripts/publish.sh dsh-compaction-cacheaware
scripts/publish.sh will:
- Create a public GitHub repo and push this repository.
- Add
dsh-plugin,deepseek-harness, andreasonixtopics.
After that, the workshop index at https://JxaMe.github.io/dsh-workshop/
will pick it up automatically (it scans dsh-plugin topic repositories).
License
MIT
原始 README: https://github.com/Zhuchen00123/dsh-compaction-cacheaware/blob/main/README.md ↗
同类插件
查看全部 →
mnemon
LLM监督持久内存插件 — 基于图的召回,跨会话知识,单二进制。与DeepSeek Harness、Claude Code、OpenClaw及任何代理运行时兼容。

memtrace-public
面向 AI 编码 agent 的结构化记忆:双时态图谱、MCP 原生、零 LLM 调用;支持 Cursor · Claude Code · Codex · DeepSeek Harness · Hermes · VS Code · Windsurf

dsh-flowix-memory
将本地 flowix-cli 注册为 MCP 服务,让 agent 可以搜索、读取、创建和编辑 Flowix 备忘与思维导图产物。

flowix
笔记助你,记忆助你的代理。

engramory
AI代理的便携式内存协议 — 以静态规则加载;整理学科 + 参考规范 + 可选的钩子API

dsh-memory-evolve
为 DeepSeek Harness 提供纯插件实现的跨会话长期记忆与后台自我进化能力:五轨记忆、Git 分支感知、回合内自我审查、技能自我进化与技能管理器、四轨待办、COI 调度、会话广播、会话搜索、提示词管理器和临时信息便签;零核心修改、零运行时依赖,安装即用,卸载即净。