ethanwong-hk/dsh-thinking-guard ↗★ 0
@ethanwong-hk/dsh-thinking-guard
Circuit breaker for pure-thinking idle loops in DSH agent turns: triple fusing on timeout, reasoning volume, and degenerate repetition. 适合使用推理模型时,需要防止因重复或超时导致 Token 额度异常消耗的用户。
설치
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:ethanwong-hk/dsh-thinking-guard配置
在 ~/.dsh/cordis.patch.yml 的 thinking-guard 条目 config 下调整,重启 DSH 生效:
- insert:
- id: thinking-guard
name: "dsh-thinking-guard"
config:
enabled: true
# 只思考、零 text/tool-call 的持续时长上限(毫秒)
thinkingOnlyMs: 45000
# 单次尝试 reasoning 字符总量上限
maxThinkingChars: 80000
# 退化循环:重复次数阈值
repeatThreshold: 3
# 熔断后自动注入「继续当前任务」指令
autoContinue: true
notify: true
verbose: false
环境变量可临时覆盖(无需改配置):
| 变量 | 作用 |
|---|---|
DSH_THINKING_GUARD_DISABLED=1 | 停用 |
DSH_THINKING_ONLY_MS | 纯思考停滞阈值 |
DSH_MAX_THINKING_CHARS | 思考容量阈值 |
DSH_THINKING_REPEAT_THRESHOLD | 重复次数阈值 |
DSH_THINKING_GUARD_VERBOSE=1 | 打日志 |