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 额度异常消耗的用户。

Package
@ethanwong-hk/dsh-thinking-guard
Compatibility
Unverified
Cordis peer range
^4.0.1
Version
1.0.2
License
MIT
Last updated
Sep 26, 2026

Install

$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打日志