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 和評分是快照中的導航訊號。

安裝與排錯 · 專案問題反饋

同類專案