Introduction¶
When running Agents in DeepSeek Harness (DSH), models sometimes output extremely short repeated lines repeatedly in the reasoning area, causing tasks to stall. The common workaround is to manually stop generation, clear or rewrite the context, and retry, which interrupts the session and often loses completed tool results and file modifications.
Rice Patrol (leelizuoliu/rice-patrol) targets this type of “bounded reasoning repetition”: after confirming a loop, it stops the current generation and allows the original Agent to resume the unfinished task within the same session. The following sections introduce its detection rules, recovery workflow, and how to enable and configure it in DSH.
What is this¶
Rice Patrol is a DSH community plugin maintained by LeeLizuoLiu and categorized as admin-security in the SkillHub directory. Its one-sentence positioning is: it performs repetition pattern detection on the reasoning stream exposed by DSH; once confirmed, it truncates the generation and executes a “clean recovery” instead of merely alerting or relying on manual session switching.
The current package version is 0.2.11-desktopcompat.1. The source code is maintained synchronously on GitHub; the README states that this update does not release an npm package. The project is licensed under the MIT license.
Core Features¶
Automatic Recovery, No Mode Selection¶
After enabling the plugin, there is no need to select response modes such as Stop, Observe, or Recover. Each time a loop is confirmed, the workflow is fixed: stop current generation → clean the stream → resume the task in the original session.
The legacy configuration keys mode: stop, mode: observe, and mode: recover no longer determine behavior; retaining these fields will not prevent automatic recovery. To completely disable the capability, use DSH’s built-in plugin toggle rather than relying on the legacy mode fields.
During the recovery process, the “Stop Recovery” button on the interface remains available; sending new user input will also interrupt the current recovery. If the plugin cannot verify the session or host background task status, it will pause recovery and provide an explanation.
Loop Detection Rules¶
The detection logic is independent of specific model providers; each model request uses an independent detector, and the standard output token limit is not within the scope of detection.
- The plugin reads the reasoning text exposed by DSH, splits it by lines, trims leading and trailing whitespace, and ignores empty lines.
- It scores the most recent 50 non-empty lines: if the median line length is ≤ 20 characters, and at least 70% of the lines have exactly identical duplicates within the window → recorded as a warning.
- A warning will not stop generation. After accumulating at least another 50 non-empty lines that again satisfy the above window conditions → confirm loop and stop generation.
The README explicitly states that the detection thresholds mentioned above have not been modified in this version.
Continuation (Recovery) Behavior¶
After confirming the loop and stopping, the plugin will:
- Wait for the current generation and stream cleanup to finish, and verify host background tasks;
- Exclude the interrupted reasoning from the model-visible history;
- Continue via the original Agent and the same session; completed file edits and tool results remain available;
- Require the model to first check the workspace status in the continuation prompt before repeating side effects.
Only one handoff is submitted per truncation; every newly confirmed loop can trigger a recovery again. Failed or blocked old recovery tasks are not automatically retried. The recovered Agent still follows DSH’s original policies; the plugin does not initiate additional summary-type model requests nor does it impose plugin-level limits on the number of model/tool calls after continuation.
resumeTimeoutMs defaults to 5 minutes and applies to handoff waiting and the first continuation response, not as a total time limit for the entire subsequent task. The plugin retains minimal recovery state and duplicate-handoff records but does not provide block-by-block observation logs.
Installation and Activation¶
Neither the fetched materials nor the SkillHub directory page provide a fixed CLI installation command such as dsh plugin add …; installation is based on your current DSH distribution installing from a community/GitHub source via the Plugins page (Directory Page: https://www.skillhub.cn/plugins/LeeLizuoLiu/rice-patrol).
Environment Requirements (from README):
- DSH
0.2.0-rc.2or higher (including0.2.1-rc.1), with no upper limit for 0.2.x; subsequent patch versions can generally be loaded directly. - Plugin declared peer dependencies:
@deepseek-ai/dsh-llm,@deepseek-ai/dsh-compactionmust both be>=0.2.0-rc.2; DSH validates declarations during loading, and plugins pinned to a single specific version will be skipped.
Activation Steps:
- Install and enable Rice Patrol and its components on the DSH Plugins page.
- Read the automatic recovery instructions on the plugin page; recovery status will be displayed near the conversation input area.
- If plugin files are updated, you must restart DSH to load the new host code.
For configuration field examples, see config/recover.example.yml in the repository (GitHub path: LeeLizuoLiu/rice-patrol).
Typical Usage and Configuration Highlights¶
Typical usage centers on “enable and it works”: there is no need to switch response modes or start separate observation logs. Users simply keep it enabled in Plugins; when persistent short-line repetition occurs in the reasoning area, the plugin automatically warns and confirms based on two-stage window rules.
Items that remain configurable (listed in README) include:
- Provider / model filters;
- State directory;
- Recovery-related timeouts (including
resumeTimeoutMs).
“Response modes” can no longer be configured; when used alongside plugins that cancel and resume the same reasoning stream, you should keep only one recovery controller to avoid competing for stream control.
For more complete recovery design and historical implementation notes, refer to the repository documentation docs/SINGLE_AGENT_RECOVERY.md.
Use Cases and Notes¶
Who is it for: Developers or operators who run Agents in DSH long-term and have encountered “short phrase repetition, task stalling” in the reasoning area; scenarios where you want to preserve tool and editing results within the same session and reduce manual stopping and session reopening.
Please be aware before use:
- The plugin runs under the permissions of the current DSH process; it reads reasoning text and participates in truncation and recovery. Review the GitHub Source Code and the MIT license before installation.
- SkillHub (https://www.skillhub.cn) is a community plugin directory site and has no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem emphasizes “everything is a plugin,” decoupling the directory from host capabilities.
- Detection targets line-level repetitive features in the reasoning stream and cannot replace output token limits, business-layer timeouts, or manual review; during the warning stage, the model will continue generating until the second window confirmation is met.
Conclusion¶
Rice Patrol transforms “reasoning repetition” from pure manual intervention into predictable two-stage detection and same-session automatic recovery, striving to preserve completed workspace side effects. If you need to reduce the cost of Agents getting stuck in short-line loops within DSH, you can install it from the directory page and enable it in Plugins, provided you meet the version requirements.
- Directory Page: https://www.skillhub.cn/plugins/LeeLizuoLiu/rice-patrol
- Source Code & README: https://github.com/LeeLizuoLiu/rice-patrol