pricklywiggles/dsh-circuit-breaker0

dsh-circuit-breaker

在 DeepSeek Harness 中阻止失控的 Agent 循环:拒绝重复的相同工具调用,并强制执行每个 Agent 的调用上限。

AI 分析

核心用途是在模型指令之外,从外部拦截并终止 Agent 的死循环和重复工具调用。适合需要控制 API 消耗、防止 Agent 失控运行的用户。支持自定义重复限制和调用上限。

包名
dsh-circuit-breaker
版本
0.1.0
许可证
MIT
最近更新
2026年9月2日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:pricklywiggles/dsh-circuit-breaker

Configuration

Every setting has a default that works. To change one, target the plugin's row id in a cordis patch layer, either your profile's cordis.patch.yml or $DSH_HOME/cordis.patch.yml:

- id: circuit-breaker
  config:
    duplicateLimit: 6
    maxCallsPerAgent: 300
    incidentLog: /workspace/.circuit-breaker-incidents.jsonl

A circuit-breaker: section in settings.yaml does not work, and I tested it. That namespace reaches plugins that read settings for themselves, not a bundle plugin's config. The patch-layer override is the path that does.

KeyDefaultWhat it does
enabledtrueMaster switch
duplicateLimit6Deny after this many identical calls in the window
window200How many recent calls to remember per agent
maxCallsPerAgent300Lifetime call cap per agent object; once hit, that agent is stopped for good. Sized for unattended subagents, which get a fresh cap per run. 0 disables it
exempttodo_write, ask_user_question, exit_plan_modeTools the guard ignores
only[]If set, guard only these tools. Overrides exempt
ignoreArgsdescription, explanation, reason, thought, purposeArgument names excluded when comparing two calls
denyMessagesee sourceDenial text. Supports {tool}, {count}, {limit}
incidentLog"" (off)Append-only JSONL recording the first denial of each kind per agent, so a supervisor can notice a tripped agent. See below

Picking a duplicateLimit

The default sits far above normal behavior on purpose. Re-reading a file or re-listing a directory a few times is ordinary work and should not be punished. Running the same search 555 times is not ordinary. At 6, a real loop dies in seconds and healthy agents never notice the plugin is installed.

Lower it if you want tighter control and can live with the occasional false positive. Raise it if your agents legitimately poll something.