xiaoliang2/dsh-compact-after-task ↗★ 0
dsh-compact-after-task
在当前任务完成后,根据用户设置的上下文阈值自动压缩 DSH 对话。
AI 分析
核心用途是在任务结束且上下文达到设定比例时自动触发压缩,避免重发过多 Token。适合需要控制 API 费用、优化长对话性能的用户。
安装
此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗
说明文档
阅读完整 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.