pricklywiggles/dsh-circuit-breaker0

dsh-circuit-breaker

Stop runaway agent loops in DeepSeek Harness: denies repeated identical tool calls and enforces a per-agent call cap, outside the model where instructions cannot reach.

AI 分析

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

パッケージ
dsh-circuit-breaker
バージョン
0.1.0
ライセンス
MIT
最終更新
2026/09/02

インストール

$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.

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.