pricklywiggles/dsh-circuit-breaker ↗★ 0
dsh-circuit-breaker
在 DeepSeek Harness 中阻止失控的 Agent 循环:拒绝重复的相同工具调用,并强制执行每个 Agent 的调用上限。
AI 分析
核心用途是在模型指令之外,从外部拦截并终止 Agent 的死循环和重复工具调用。适合需要控制 API 消耗、防止 Agent 失控运行的用户。支持自定义重复限制和调用上限。
安裝
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:pricklywiggles/dsh-circuit-breaker說明文件
閱讀完整 README ↗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.
| Key | Default | What it does |
|---|---|---|
enabled | true | Master switch |
duplicateLimit | 6 | Deny after this many identical calls in the window |
window | 200 | How many recent calls to remember per agent |
maxCallsPerAgent | 300 | Lifetime 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 |
exempt | todo_write, ask_user_question, exit_plan_mode | Tools the guard ignores |
only | [] | If set, guard only these tools. Overrides exempt |
ignoreArgs | description, explanation, reason, thought, purpose | Argument names excluded when comparing two calls |
denyMessage | see source | Denial 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.