Lyoko-Jeremie/dsh-compaction-threshold ↗★ 0

dsh-compaction-threshold

Override the automatic context-compaction pressure threshold of dsh-compaction-basic at runtime, without restating agent preset declarations. 适合需要精细控制上下文压缩时机、优化Token消耗的高级用户。

패키지
dsh-compaction-threshold
호환성
미검증
버전
0.1.0
라이선스
MIT
최근 업데이트
2026. 10. 22.

같은 패키지 이름의 다른 저장소

설치

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Lyoko-Jeremie/dsh-compaction-threshold

配置

bundle 默认 thresholdRatio: 0.5。在 profile 的 cordis.patch.yml 覆盖(按行 id 替换整个 config):

- id: compaction-threshold
  config:
    thresholdRatio: 0.6

合法范围是 (0, 1],且必须大于引擎的 retainRatio(默认 0.16),否则自动压缩会在运行时拒绝该配置。

实际触发阈值并不等于 contextWindow × thresholdRatio,而是:

thresholdTokens = min(contextWindow × thresholdRatio,
                      contextWindow − maxTokens − headroomTokens)

例如:contextWindow = 1,048,576、maxTokens = 256,000、headroomTokens = 65,536 时,0.8 与 0.5 的实际阈值分别为 727,040 与 524,288。