AI Agent Hub
Back to plugins
🤖

dsh-dupguard

Model Inference Updated 2026.09.09

Run the following command in DeepSeek Harness:

dsh plugin install zqh260619/dsh-dupguard

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

Run dsh plugin install zqh260619/dsh-dupguard in the DeepSeek Harness terminal to install this plugin; the source code is available at https://github.com/zqh260619/dsh-dupguard

About this plugin

Large models occasionally fall into repetition loops mid-stream — repeating the same word, a line of separators, or even a single character over and over, burning tokens and breaking the reader's rhythm. Reasoning chains are equally susceptible. Bluntly aborting the stream usually loses already-generated text or pollutes the session log, leaving the user to watch the model spin idle. dupguard exists for exactly this: it inspects every text delta in real time and, the moment the same string repeats past a configurable threshold, halts generation at the server while committing all prior output as a clean assistant message — no errors, no lost text, no log corruption.

Detection covers a range of loop patterns: single-character cycles, word-level repetition, and space- or newline-delimited repeats are all caught (whitespace is stripped before comparison by default). Markdown table separators made of hyphens and pipes are immune to false positives. Reasoning text is guarded by default; tool-call arguments are excluded to avoid tripping on legitimate base64 or JSON repetition. Every parameter — threshold, unit-length bounds, detection window, whitespace handling, reasoning and tool-argument toggles — is editable from a dedicated settings section in DSH and persists instantly. Sensible defaults mean it works out of the box with zero configuration.

If you drive long-form inference, report writing, or Agent orchestration through DeepSeek Harness and keep hitting models that lock into loops and exhaust the context window, dupguard cuts the cycle at the source with no prompt changes and no post-hoc log scrubbing, letting every turn end cleanly.

Use Cases

  • Auto-halting model output when it falls into a repetition loop
  • Stopping reasoning chains before they waste tokens on repeated cycles
  • Preventing context-window exhaustion when a model gets stuck in a loop during multi-turn Agent flows

Best For

  • Developers running long-form inference or report generation through DSH
  • Engineers orchestrating Agent workflows with token efficiency in mind
  • End users who want loop-free output without modifying their prompts