DeepSHPlugins
dsh-auto-compact 项目预览
GITHUB / COMMUNITY PROJECT

dsh-auto-compact

记忆与知识JavaScriptMIT

为 DSH 智能体预设注入增强的自动压缩默认值:一键应用调优的触发阈值/保留比例与分模型策略,幂等执行、自动备份、可回滚。

3 Starssongoao25 更新时间 2026-09-04
访问 GitHub 仓库
dsh-auto-compact 项目预览

项目介绍

中文

为 DSH 智能体预设注入增强的自动压缩默认值:一键应用调优的触发阈值/保留比例与分模型策略,幂等执行、自动备份、可回滚。

English

Enhanced auto-compaction defaults for DeepSeek Harness agent presets: apply tuned threshold/retention budgets and per-model policies with one command, idempotent with backups and rollback.

项目信息与收录信号

快照 2026-09-11
作者 / 组织
songoao25
仓库
songoao25/dsh-auto-compact
GitHub Stars
3
Forks
0
开发语言
JavaScript
许可证
MIT
最近推送
2026-09-04
Manifest
数据中检测到声明

公开仓库不自动等于可商用;许可证与当前兼容性以原项目文档为准。Manifest 和数据评分不构成安装安全认证。

数据评分

58/ 100
维护活跃
96
文档与实用信息
85
生态关注度
17
安装便捷信号
75
项目声明信号
100

近 7 天仍在更新;README 含完整安装与使用说明;关注度尚低(3)。

评分来自已有数据快照的五维模型,仅作浏览参考,不是实际使用评测或安全检测结论。

安装与使用

所有项目资料与许可均以对应 GitHub 仓库为准。

dsh plugin --profile web add github:songoao25/dsh-auto-compact

复制命令不会自动执行。请先阅读仓库文档,确认环境要求与许可证。

项目截图

仓库 README

GitHub 原文

已保存的仓库文档快照;文档抓取时间未记录,可能与上方目录介绍处于不同版本。安装前请核对当前仓库说明。

dsh-auto-compact

English | 中文

License Release CI Last Commit Stars Dependabot

Enhanced auto-compaction defaults for DeepSeek Harness.

DeepSeek Harness ships automatic context compaction (dsh-compaction-basic), but the default trigger threshold is 80% of the model's context window — too late for large-context models. This tool lowers the threshold to 75% and adds per-route policies, so history is tidied up earlier and long sessions stay responsive.

How it works

DeepSeek Harness runs one compaction-basic instance per agent preset (per session). Profile-level patches cannot reach that subtree, so this tool directly injects configuration into the compaction-basic entry of every user-installed preset under $DSH_HOME/.agent-presets/ (default: ~/.dsh/.agent-presets/).

  • Default: trigger at 75% of the context window, keep the most recent 20% verbatim.
  • Per-route policies:
  • ChatGPT / Codex GPT-5.6 (272K context): trigger at 70%.
  • OpenCode Go DeepSeek V4 (1M declared context): trigger at 65%.
  • Keeps the existing summarization, retry, and safe-fallback behavior of dsh-compaction-basic (a failed summary preserves the original history and never silently drops context).
  • Manual /compact and tool-result pruning remain available.

Installation

dsh plugin --profile <profile-name> add songoao25/dsh-auto-compact

Restart DeepSeek Harness once afterward. On bundle load, the plugin runs the same safe injector described below: it changes only user-installed presets, creates a timestamped backup before every change, skips a preset that already has its own compaction-basic configuration, and is idempotent on later starts. Roll back with:

./uninstall.sh

The uninstaller restores the latest backup for each affected preset. Run it from a checkout of this repository; removing the DSH bundle alone does not discard the preserved preset configuration.

Important: Factory Presets

This tool only injects into user-installed presets under $DSH_HOME/.agent-presets/. The alpha.4 factory presets (standard, cordis, minimal, ptc) ship with their own default compaction settings and are read-only — this tool will not modify them.

If you want enhanced compaction for a factory preset:

  1. Copy it to your user presets directory:
   cp -r "$(npm root -g)/@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-agent-presets/presets/<preset-name>" "$DSH_HOME/.agent-presets/"
  1. Run ./install.sh again to inject the enhanced configuration.
  2. Select the copied preset in DSH's session setup.

What the installer does

  • Finds every agent.cordis.yml under $DSH_HOME/.agent-presets/.
  • Injects the policy block into the compaction-basic entry of each preset.
  • Backs up each modified file as agent.cordis.yml.bak-auto-compact.
  • Idempotent: a marker comment prevents double injection.
  • Skips presets that already configure compaction-basic themselves (merge manually in that case).
  • Never touches the read-only factory presets in the DSH install directory.

Configuration

All values live in config.json. The generated block uses the alpha.4 compaction-basic fields; edit the JSON before running ./install.sh if you want different thresholds. Preview with:

node scripts/inject.mjs --dry-run
KeyDefaultMeaning
thresholdRatio0.75Trigger compaction when estimated usage reaches this fraction of the model context window
retainRatio0.20Keep the most recent fraction of the window verbatim
modelPolicies–Per provider/model overrides

Safety

  • A failed summarization preserves the original history and logs a warning.
  • Automatic recovery never loops indefinitely (bounded retries).
  • The tool contains no secrets and no personal paths.
  • Installation is fully reversible via ./uninstall.sh.

License

MIT © songoao25

使用前核对

安装步骤、兼容版本与授权范围以原项目当前文档为准。Stars 和评分是快照中的导航信号。

安装与排错 · 项目问题反馈

同类项目