Skills Plugins MCP Prompt Model 导航 博客 资讯 我的中心
会话与消息 #agent-preset#auto-compact#cli#context-compaction#deepseek-harness#developer-tools

dsh-auto-compact

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

songoao25 @songoao25 ⬇ 1 ★ 3 main

安装

dsh plugin --profile web add github:songoao25/dsh-auto-compact
下载安装清单

需要可复现安装时,可在仓库后追加 #commit 固定提交。

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

该插件未提供要点说明,请参考仓库 README。

agent-presetauto-compactclicontext-compactiondeepseek-harnessdeveloper-tools
  1. 安装并启动 DeepSeek Harness:npx @deepseek-ai/dsh web
  2. 在终端执行上面的安装命令(CLI 会解析插件并核验来源)
  3. 用 dsh plugins list 确认已安装,必要时重启 Harness 生效

插件以当前 dsh 进程的权限运行,安装时可能执行代码。请先通读仓库源码与许可证,确认无破坏性命令与越权访问;本站只做索引,不对第三方插件安全性作担保。

代码仓库github.com/songoao25/dsh-auto-compact
许可证MIT
主要语言main
下载量1
GitHub 星标3
最近推送2026-09-04
收录日期2026-09-19
分类会话与消息

事实信息来自公开插件目录快照(2026-10-01),介绍文案由本站再加工。

以下为插件仓库 README 全文(原始内容,由公开目录抓取整理)。

# dsh-auto-compact

**English** | [**中文**](README.zh-CN.md)

[![License](https://img.shields.io/github/license/songoao25/dsh-auto-compact)](LICENSE)
[![Release](https://img.shields.io/github/v/release/songoao25/dsh-auto-compact)](https://github.com/songoao25/dsh-auto-compact/releases)
[![CI](https://img.shields.io/github/actions/workflow/status/songoao25/dsh-auto-compact/ci.yml)](https://github.com/songoao25/dsh-auto-compact/actions)
[![Last Commit](https://img.shields.io/github/last-commit/songoao25/dsh-auto-compact)](https://github.com/songoao25/dsh-auto-compact/commits/main)
[![Stars](https://img.shields.io/github/stars/songoao25/dsh-auto-compact)](https://github.com/songoao25/dsh-auto-compact)
[![Dependabot](https://img.shields.io/badge/dependabot-enabled-025e8c?logo=dependabot)](https://github.com/songoao25/dsh-auto-compact/security/dependabot)

Enhanced auto-compaction defaults for [DeepSeek Harness](https://github.com/deepseek-ai/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

```bash
dsh plugin --profile  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:

```bash
./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:
   ```bash
   cp -r "$(npm root -g)/@deepseek-ai/dsh/node_modules/@deepseek-ai/dsh-agent-presets/presets/" "$DSH_HOME/.agent-presets/"
   ```
2. Run `./install.sh` again to inject the enhanced configuration.
3. 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:

```bash
node scripts/inject.mjs --dry-run
```

| Key | Default | Meaning |
|---|---|---|
| `thresholdRatio` | 0.75 | Trigger compaction when estimated usage reaches this fraction of the model context window |
| `retainRatio` | 0.20 | Keep 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

数据来源:公开的 DeepSeek Harness 插件目录与各插件 GitHub 仓库。本站为独立第三方目录,与 DeepSeek、幻方(High-Flyer)及插件作者均无隶属或背书关系。

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

提交后我们会发送一封确认邮件,点击邮件里的链接才会开始收信。

完全免费,取消任意时间。我们不会发送垃圾邮件。