xiaoliang2/dsh-compact-after-task ↗★ 0
dsh-compact-after-task
Auto-compact a DSH conversation after the current task finishes, at a user-set context threshold.
AI Analysis
核心用途是在任务结束且上下文达到设定比例时自动触发压缩,避免重发过多 Token。适合需要控制 API 费用、优化长对话性能的用户。
Install
This plugin has no verified bundle, or compatibility checks failed. Read the repository notes first. Read the full README ↗
README
Read the full README ↗Configuration
| Key | Type | Default | Meaning |
|---|---|---|---|
enabled | boolean | true | Master switch. |
thresholdRatio | number (0.05–1) | 0.5 | Compress when pressure reaches this fraction of the routed model's context window (0.5 = 50%). |
onlyRoots | boolean | false | Only compress top-level conversation agents (skip background subagents). |
Picking a threshold
Set it from "the max per-turn re-send you can tolerate ÷ the model's context window":
- DeepSeek's default 1M window: 0.3–0.6 is the sweet spot; 0.5 is a conservative default.
- Want each turn to re-send ≤ 400K tokens → 0.4; ≤ 250K → 0.25.
- Don't go ≥ 0.8: the built-in compaction already fires at 0.8 at a step boundary, so a higher threshold here is meaningless.
- Small-window models (128K/64K): raise to 0.6–0.8, or you'll squeeze out useful working context.
- Too low (below ~0.1) means compressing after every small task, and the summary swallows details that were still useful.
Tune by feel after a couple of long tasks: compressing after every little task / summaries getting coarse → raise it; still re-sending hundreds of thousands of tokens per turn → lower it. Edit thresholdRatio in cordis.patch.yml and restart.