viego-qiin/dsh-loop-detector

viego-qiin★ 1TypeScriptLast synced: 2026-08-15

Open on GitHub

Dead-loop / repetition detector for DeepSeek Harness agents — hard-interrupts text loops and same-topic search retries that soft reminders miss.

README excerpt

dsh-loop-detector Dead-loop / repetition detector plugin for DeepSeek Harness (dsh). Local LLMs (especially quantized / RL-tuned reasoning models) sometimes get stuck: repeating the same sentence forever, or re-running web search with reworded queries for the same topic without gaining any new information. This plugin watches the agent's stream in real time, detects both kinds of loops, and interrupts them hard — not a soft reminder the model can ignore. 中文文档见 README.zh.md. Features - Text-level repetition detection — watches assistant/chunk ( text-delta + optional reasoning-delta ) with three layered detectors: 1. Period scan : tail repeats with a fixed period (8–256 chars) 2. n-gram : a 64-char block seen ≥3 times in the recent window 3. Large-scale anchor : a 512-char tail block reappearing earlier (catches whole-paragraph repetition, e.g. a model re-planning the same answer twice) - Tool-call intent-level repetition detection — watches tools/execute for web search : extracts query keywords, keeps a "topic set" (union of the last 3 queries), and if a new query brings <25% novel tokens twice in a row , it judges the model is re-searching the same topic with different wording (int…

View full README on GitHub →
Agentsdeepseek-harnessdeepseek-harness-plugindshdsh-pluginloop-detectorsagentsearch

Category