DeepSeek Harness Plugin Hub

发布与管理完整 Harness Profiles,发现适合你的插件。

探索

插件目录环境预设文档中心动态

社区

发布插件联系我们报告问题

相关链接

Plugin Hub GitHubDeepSeek Harness 官方项目系统状态隐私说明
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

独立、非官方社区项目,与 DeepSeek 官方无隶属、授权或背书关系。

Agent Loop Guard — DeepSeek Harness 插件(DSH Plugin)
DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录
← Plugins
A

@goodandready/dsh-agent-loop-guard

Agent Loop Guard

DeepSeek Harness 的故障关闭式运行时工具调用循环防护。

插件会安装到这里;不确定时保持 web。

npx -y @deepseek-ai/dsh plugin --profile web add github:GooDAnDReaDY/dsh-agent-loop-guard#825bee49b321aa8a4c950b96cc5d798bc101759f
README兼容性版本

兼容性与来源证明

Agent Loop Guard 以 @goodandready/dsh-agent-loop-guard 发布,当前版本为 0.2.12。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

DSH 兼容范围
*
运行环境
web
发布来源
github
Registry 更新时间
2026/9/19

版本

0.2.12stable
2026/9/19
0.2.11stable
2026/9/19
0.2.10stable
2026/9/18
查看其余 6 个版本收起版本
0.2.9stable
2026/9/18
0.2.8stable
2026/9/18
0.2.7stable
2026/9/14
0.2.6stable
2026/9/14
0.2.4stable
2026/9/12
0.2.3stable
2026/9/2

相关插件

正在加载相关插件…

最新版
0.2.12
DSH
*
HMR
重启进程
Tree shaking
未声明可安全裁剪
解包体积
未提供
文件数
未提供
Surface
web
许可证
MIT
发布源
github
GitHub
★ 0
周下载
0
最近提交
2026/9/19
查看源码 ↗
README Badge

点击下方 Badge 复制 Markdown,粘贴到 README 即可。

这是你的 Plugin?认领权益 · 优先安全扫描

验证 package.json 声明的 GitHub 仓库,即可管理这个公开页面。认领后,Hub 会优先安排当前版本的安全扫描,并在通过后公开展示结果。

认领这个 Plugin →
报告问题

相关插件

继续浏览 security-access 分类下经过校验的插件。

Doctor@linxin666/dsh-doctorDSH 配置档案的事务性救援模式,配备受监督的启动器、隔离的恢复容器、确定性修复、健康监控以及本地 Web 恢复控制台Pocketdsh-pocket把 DeepSeek Harness 装进你的口袋:一个包、一个设置页,手机扫码即同步访问电脑上的 DSH(局域网 + 公网,实时同屏)。DSCODE@toddzheng024/dscode-bundle完整的 DeepSeek 编码代理,支持持久化 shell、Ultra 协作和自动权限审查。Auto Reviewdsh-auto-review针对 DeepSeek Harness 审批请求的第二模型 AI 自动审查:只读审查子代理在审批应答链上决定允许或拒绝,并采用故障关闭回退机制和完整的会话日志审计。

README

📦 @goodandready/dsh-agent-loop-guard

Fail-Closed Runtime Tool-Call & Assistant Output Loop Breaker for DeepSeek Harness

🇬🇧 English • 🇷🇺 Русский • 🇨🇳 中文说明

⭐ If you like this plugin, please star it on GitHub — it shows me that the plugin is useful to you and motivates me to keep developing it.

🐛 If you find a bug or would like to request a feature, open a GitHub issue in any language — I will review your proposal and implement useful suggestions in a future plugin version.

⚡ Overview & Problem Solved

When autonomous AI coding agents encounter unexpected tool failures, ambiguous instructions, or hallucination loops, they often enter infinite retry cycles — repeatedly reading the same directory, editing identical lines without progress, or echoing identical output lines across streaming turns. These loops rapidly exhaust token budgets, lock execution threads, and waste API credits without ever completing user goals.

@goodandready/dsh-agent-loop-guard is a native host runtime plugin for DeepSeek Harness that intercepts and breaks loops before they spiral out of control:

  1. Progress-Aware Tool-Call Guard: Employs epoch-based state tracking so that repeated calls are blocked only when no meaningful state changes or new evidence appear. Legitimate productive iterations (e.g. read ➔ edit ➔ read ➔ edit) remain fully unrestricted.
  2. Assistant Output Loop Breaker: Detects text-only repetition (identical streaming lines or multi-line markdown blocks) across turns and steps, cleanly canceling runaway generation without damaging session history.
  3. Answer-Only Graceful Fallback: Instead of terminating abruptly, the plugin triggers structured DSH denials that guide the LLM into answering with text explaining the bottleneck.
  4. Zero Core Modifications: Implemented purely through Cordis lifecycle hooks (ctx.tools.guard, agent/pre-step, tools/execute, session/event).

🏗️ Architecture

graph TD
    subgraph DSH ["DeepSeek Harness Core Runtime"]
        Turn["Agent Turn Execution<br/>(LLM Reasoning & Tool Calls)"]
        Stream["Assistant Output Stream<br/>(text-delta & block-end)"]
        UserStop["User Message Analysis<br/>(Stop words: stop, halt, прекрати)"]
    end

    subgraph LoopGuard ["@goodandready/dsh-agent-loop-guard"]
        ToolInterceptor["ctx.tools.guard Interceptor<br/>(denyReason evaluation)"]
        ProgressEpoch["Progress Epoch Tracker<br/>(Result & Argument Fingerprints)"]
        OutputState["AssistantOutputGuardState<br/>(Line & Block Deduplication)"]
        SafeLogger["Sanitized Event Logger<br/>(Token/Secret Redaction)"]
    end

    subgraph Actions ["Enforcement Actions"]
        Allow["Allow Tool Execution<br/>(Fresh state or valid progress)"]
        Deny["Answer-Only Denial<br/>(Mandates text summary from agent)"]
        Cancel["Session Cancel<br/>(keepInbox: false on runaway text)"]
    end

    Turn -->|Pre-step & Tool call| ToolInterceptor
    ToolInterceptor --> ProgressEpoch
    ProgressEpoch -->|Productive Result Diff| Allow
    ProgressEpoch -->|Duplicate / Budget Exceeded| Deny
    Stream --> OutputState
    OutputState -->|Exceeds Line/Block Repeat Limit| Cancel
    UserStop -->|Immediate Latch| Deny
    Deny -.-> SafeLogger
    Cancel -.-> SafeLogger

✨ Full Feature Breakdown

1. Progress-Aware Tool Execution Tracking

Unlike naive counters that blindly limit tool invocations, dsh-agent-loop-guard distinguishes between productive iteration and stagnant loops:

  • Canonical Fingerprinting: Creates deterministic JSON signatures of tool arguments (callFingerprint) and results (resultFingerprint).
  • Progress Epochs: When an edit or command yields a different result, the session transitions to a new progress epoch, resetting the failure budget.
  • Granular HTTP/VCS Safety: Distinct endpoints and HTTP methods (e.g., Gitea API operations or curl scripts) are never collapsed under a shared base URL.
  • Progress Tool Whitelist: Designated progress tools (todo_write, etc.) maintain independent no-progress budgets so task checklists do not trigger false positives.

2. Guard Violation Codes & Enforcement Modes

When a loop is detected, the guard rejects the call with structured diagnostics and enforces Answer-Only Mode for the rest of the turn:

Guard CodeTrigger ConditionDefault LimitGuard Action
LOOP_GUARD_STOPUser sent stop command (stop, halt, cancel, стоп, остановись, прекрати, ответь, петля)ImmediateRejects tool call; requires immediate text reply
LOOP_GUARD_DUPLICATEIdentical call arguments with identical result to previous attempt1 retryBlocks exact repeat; demands alternative approach
LOOP_GUARD_REPEATRepeated calls within current group without state changemaxCallsPerRepeatGroup (5)Prevents spinning on single tool
LOOP_GUARD_LIMITTotal non-productive tool attempts since last successful progressmaxToolAttemptsPerTurn (64)Caps turn exploratory budget
LOOP_GUARD_PROGRESS_LIMITSuccessive invocations of progress tools without content changesmaxProgressToolCallsPerTurn (16)Prevents infinite todo-writing loops
LOOP_GUARD_OUTPUTAssistant generated identical lines or multi-line blocksmaxRepeatedAssistantLines (5)Cancels session cleanly via agent.cancel()

3. Assistant Output Stream Guard

Runaway LLM generation can manifest as repetitive narration without tool calls. The output guard monitors streaming text in real time:

  • Line Normalization: Collapses carriage returns and whitespace to catch formatted repetition.
  • Multi-Line Block Detection: Hashes blocks up to maxAssistantBlockChars (16,384 bytes) to detect cyclical paragraph generation.
  • Active Tool Immunity: While tool calls are executing, output cancellation is temporarily suppressed to avoid false alarms during long tasks.
  • Lossless Deduplication: Cleanses streaming chunks and message buffers without losing valid context.

4. Enterprise Privacy & Token Redaction

All loop guard warning logs automatically redact sensitive credentials:

  • Bearer tokens, passwords, cookies, and query parameter secrets (token=, api-key=, secret=) are replaced with [redacted] before reaching logs.
  • Deeply nested argument trees are bounded to prevent memory leaks during massive JSON payloads.

5. Native WebUI Settings, Telemetry & One-Click Updater

  • Integrated Settings Card: Placed directly inside DSH Web UI under Settings ➔ Plugins ➔ Plugin Settings (settings.plugin.item, order 95).
  • Native DSH Design System: Styled exclusively using standard DSH design variables (--dsw-alias-*), accessible <label>/<input> associations (htmlFor/id), and smooth chevron rotation without external UI dependencies.
  • Live Protection Telemetry: Real-time counters of blocked loops (LOOP_GUARD_DUPLICATE, LOOP_GUARD_REPEAT, LOOP_GUARD_LIMIT, LOOP_GUARD_OUTPUT) with instant statistics reset via /api/@goodandready/dsh-agent-loop-guard/telemetry.
  • One-Click In-Place Updater: Seamless version verification against the npm registry and one-click upgrades via authenticated loopback API (/api/@goodandready/dsh-agent-loop-guard/update).

📦 Installation

Install via DeepSeek Harness CLI:

dsh plugin --profile web add @goodandready/dsh-agent-loop-guard

Restart DSH Web UI and reload your workspace.


⚙️ Configuration

Configure via config.yaml or through the Web UI settings:

# config.yaml
dsh-agent-loop-guard:
  maxToolAttemptsPerTurn: 64
  maxProgressToolCallsPerTurn: 16
  progressToolNames:
    - todo_write
  maxCallsPerRepeatGroup: 5
  blockExactDuplicates: true
  assistantOutputGuard: true
  maxRepeatedAssistantLines: 5
  maxRepeatedAssistantBlocks: 5
  maxAssistantBlockChars: 16384

Settings Reference Table

KeyTypeDefaultDescription
maxToolAttemptsPerTurnnumber64Maximum un-productive tool attempts allowed before forcing an answer. Set to 0 to disable aggregate budget.
maxProgressToolCallsPerTurnnumber16Maximum consecutive calls to progress tools (todo_write) without substantive progress.
progressToolNamesarray["todo_write"]Array of tool names considered progress markers.
maxCallsPerRepeatGroupnumber5Maximum tool calls allowed within the same repeat group without producing a new result.
maxCallsPerToolPerTurnnumber5(Deprecated) Legacy alias for maxCallsPerRepeatGroup. If both are specified, maxCallsPerRepeatGroup takes precedence. Omitted from UI card to avoid confusion.
strictToolsarray[]Array of tool names subjected to lower repeat tolerance (e.g. mutating tools).
strictToolLimitnumber3Maximum repeat count allowed for tools specified in strictTools.
blockExactDuplicatesbooleantrueImmediately block consecutive identical calls with zero state change.

🧪 Testing & Verification

Run the full automated test suite covering all loop denial paths, streaming output guards, and progress epochs:

npm test
npm run check

📄 License

  • License: MIT © GooDAnDReaDY
  • Changelog: Detailed release history and migration notes are maintained in CHANGELOG.md.
dryRunMode
boolean
false
Audit mode: logs violations and tracks telemetry without aborting tool calls.
assistantOutputGuardbooleantrueEnable real-time detection and cancellation of repetitive assistant output loops.
maxRepeatedAssistantLinesnumber5Threshold of consecutive identical output lines to trigger session cancellation.
maxRepeatedAssistantBlocksnumber5Threshold of repeated multi-line markdown blocks before aborting generation.
maxAssistantBlockCharsnumber16384Maximum byte length captured for block fingerprinting.