dsh-dupguard: A Real-Time Repetition Guard for DeepSeek Harness
zqh260619/dsh-dupguard
dupguard is a real-time repetition guard for DeepSeek Harness (DSH) that halts generation the moment the model starts looping, commits the text already produced, and exposes a graphical settings page for thresholds and whitelists.
dsh-dupguard is a real-time repetition guard built for DeepSeek Harness, aimed at the runaway loops where a model keeps repeating itself. It inspects the streamed output increment by increment and, once the same string repeats past the threshold, ends the turn right away while committing the text already produced as a normal assistant message, with no errors and no session-log pollution. Threshold, unit length, detection window and the ignore whitelist are all editable on a graphical settings page, and the defaults work out of the box for developers whose workflows keep getting derailed by repetition.
How to Install
dsh plugin --profile web add dsh-dupguard- Category
- Tools & Capabilities
- Platform
- DSH Plugin
- Author
- zqh260619
- Distribution
- Plugin
dsh-dupguard Key Features
dsh-dupguard Repo Summary
What Does It Do?
It is a DSH plugin for DeepSeek Harness that acts as a real-time repetition guard, stopping model generation as soon as the same string repeats too many times in the streamed output. It solves the runaway-repetition problem: once the threshold (10 consecutive repeats by default) is hit, the turn ends cleanly and the text already produced is committed as a normal assistant message, with no errors, no lost output and no session-log pollution. All detection parameters can be tuned live from a graphical settings page, and the defaults work out of the box.
Core Features
- Real-time per-delta detection: checks every text delta, so repetition is caught within a single increment.
- Handles many repetition shapes: single-character loops, word loops and repeats separated by spaces or newlines, with whitespace stripped by default.
- Reasoning guard: reasoning text is monitored too, so loops inside thinking are also stopped, and this can be turned off.
- True server-side stop: closes the stream iteration early and aborts the HTTP connection so the model stops generating on the server.
- Graphical settings page: registers a dedicated section in the DSH settings panel for editing the threshold, min/max unit length, detection window, whitespace and reasoning toggles, tool-argument switch and ignore-character whitelist, persisted and applied immediately.
- Markdown-table friendly: hyphens and pipes are ignored by default, so table separator rows and long rules are not misread as repetition.
How to Use This Plugin?
After enabling it in DSH, just chat normally; no configuration is required, and a detected loop ends the turn while keeping the generated text. To change behavior, open the repetition-guard section in the DSH settings panel and adjust the repeat threshold, min/max unit length, detection window, whitespace and reasoning toggles, tool-argument switch and ignore-character whitelist, then save for immediate effect; if the window is smaller than threshold times max unit length, the page warns you to raise it. Maintained by zqh260619 under the MIT license, it ships both a dynamic-plugin entry and a persistent composition mount with identical behavior.
How to Troubleshoot This Plugin?
A duplicate loader entry id: dupguard error means the same entry is loaded twice, usually because the manual patch layer and the bundle mount are both active, so pick one as described in the official instructions. If the settings page reports the window length is too small, raise the detection window as prompted. On older DSH versions affected by the preset standing-mount multi-generation conflict, rely on the built-in compatibility patch, which is enabled by default.
This page is an independent rewrite of the plugin's official README — for authoritative documentation and the latest changes, refer to the source: zqh260619/dsh-dupguard. The plugin is third-party code that runs on your machine once installed; inclusion does not imply endorsement — please review the source before installing.
