xiaoliang2/dsh-compact-after-task0

dsh-compact-after-task

在当前任务完成后,根据用户设置的上下文阈值自动压缩 DSH 对话。

AI 分析

核心用途是在任务结束且上下文达到设定比例时自动触发压缩,避免重发过多 Token。适合需要控制 API 费用、优化长对话性能的用户。

包名
dsh-compact-after-task
版本
0.1.0
许可证
MIT
最近更新
2026年8月18日

安装

此插件尚未提供可验证的 bundle,或兼容性检查未通过。请先阅读仓库说明。 阅读完整 README ↗

Configuration

KeyTypeDefaultMeaning
enabledbooleantrueMaster switch.
thresholdRationumber (0.05–1)0.5Compress when pressure reaches this fraction of the routed model's context window (0.5 = 50%).
onlyRootsbooleanfalseOnly 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.