AI Agent Hub
Back to plugins
⚙️

dsh-loop-brake

Workflow Updated 2026.09.01

Run the following command in DeepSeek Harness:

dsh plugin install jwilson411/dsh-loop-brake

Paste the following prompt into your AI chat to install this plugin:

Install in DeepSeek Harness by running dsh plugin install jwilson411/dsh-loop-brake; source code is available at https://github.com/jwilson411/dsh-loop-brake

About this plugin

An unattended agent will fall into the laziest possible loop: call search with the exact same arguments, read the result, call it again, read again, and keep spinning until the budget is gone or a human notices. dsh-loop-brake is the circuit breaker for that scenario. It tracks one thing per session: whether the same tool call—parameters canonically sorted at every nesting level, then hashed—appears in a consecutive streak. When the streak hits the configured threshold (default 3), the next call is refused with a thrown LoopBrakeError that carries the error code, the streak count, the limit, and twelve hex characters of the call hash. The original arguments are deliberately excluded from the error message so logs stay safe to share and ship.

By design the plugin performs no semantic judgment, no embedding similarity check, and no model invocation of any kind. It does exact hash matching with microsecond overhead, cannot hallucinate a false positive, and produces a denial that a developer can read at 3 a.m. and immediately understand. It will not catch loops where a timestamp, nonce, page cursor, or retry counter mutates the arguments on each call, nor A-B-A-B alternation. That is its honest boundary and the reason it is fundamentally different from every "these look similar" approach that needs a model in front of every tool call, with its false-positive rate and its bill.

This plugin is for teams orchestrating multi-tool agents on DeepSeek Harness who want to guard against token-burning spin-loops without changing the model-visible tool surface. It registers no new tools, injects no extra calls, and wraps the existing registry with a per-session streak counter and a hard refusal. Disposing or reloading the plugin restores the registry exactly as it was found and forgets every streak. One knob (maxRepeats), zero runtime dependencies beyond node:crypto, and Node 22 or later is all it needs.

Use Cases

  • Agent repeats the exact same tool call in a tight loop and burns tokens
  • Multi-tool orchestration needs a zero-model-overhead hard stop before budget overruns
  • Production demands explainable, hallucination-free denials that never leak call arguments into logs

Best For

  • Engineering teams orchestrating multi-tool agents on DeepSeek Harness
  • Developers who prefer deterministic, zero-hallucination loop prevention over semantic similarity
  • Ops and SRE engineers who read denial logs at 3 a.m. and need instant clarity