← 返回 Skills 市场
81
总下载
0
收藏
2
当前安装
2
版本数
在 OpenClaw 中安装
/install loop-prevention
功能描述
操作循环防止规范。防止 Agent 对同一操作反复执行造成资源浪费。适用于 exec 命令、工具调用、文件读写等所有可重复操作。核心规则:同一操作最多 5 次、结果不理想换策略、检测到循环立即停止。
使用说明 (SKILL.md)
Loop Prevention
防止对同一操作反复执行。适用于 exec 命令、工具调用、文件读写、API 请求等所有可重复操作。
核心规则
- 同一操作最多 5 次 — 超限必须停止
- 结果不理想时换策略 — 换参数、换工具、换思路,不要重复相同操作
- 检测到循环倾向立即停止 — thinking 中出现"再试一次"、连续 2 次相同操作 → 停止并向用户说明
触发信号
| 信号 | 说明 |
|---|---|
| 连续 2 次相同或极相似的操作 | 循环开始 |
| 输出被截断后再次执行相同命令 | 截断≠失败,用重定向 |
| thinking 中出现"再试一次"意图 | 自我循环预警 |
| 结果越来越差但还在继续 | 必须停止 |
正确做法
输出被截断
# ❌ 反复执行
git diff
# ✅ 重定向或限制
git diff > /tmp/out.txt && head -200 /tmp/out.txt
git diff --stat
工具调用失败
# ❌ 相同参数反复调用
tool_call(same_params)
# ✅ 换参数或换工具
tool_call(different_params)
other_tool(same_params)
需要完整内容
command > /tmp/out.txt
head -50 /tmp/out.txt # 前段
tail -50 /tmp/out.txt # 后段
wc -l /tmp/out.txt # 总量
检查清单
| 问题 | 行动 |
|---|---|
| 这个操作执行过吗? | 是 → 计数,超限则停止 |
| 上次结果不理想? | 是 → 换策略 |
| 在想"再试一次"? | 是 → 停止,换方法 |
| 连续 2 次操作相同? | 是 → 循环信号,立即停止 |
安全使用建议
This is a coherent, low-risk guideline for preventing repeated operations. It's just policy text — it doesn't enforce behavior by itself. Before relying on it, ensure your agent's runtime actually implements counting and stopping logic (the SKILL.md describes the policy but enforcement is up to the agent). Note the examples write to /tmp; that is normal but means temporary files may be created. Also be aware these heuristics can produce false positives (legitimate repeated retries might be stopped); test with your agent in safe environments.
功能分析
Type: OpenClaw Skill
Name: loop-prevention
Version: 1.0.1
The skill bundle 'loop-prevention' consists solely of instructional markdown (SKILL.md) designed to improve agent efficiency by preventing infinite loops and repetitive command execution. It contains no executable code, network requests, or malicious prompt injection; rather, it provides safety guidelines for the agent to limit retries and change strategies when operations fail.
能力评估
Purpose & Capability
Name/description match the SKILL.md: guidance to detect and stop repeated execs, tool calls, file reads/writes and API requests. No unrelated credentials, binaries, or installs are requested.
Instruction Scope
Instructions are procedural guidelines and examples (redirecting output to /tmp/out.txt, using head/tail/wc, changing params/tools). They do not ask the agent to read unrelated system files, call external endpoints, or exfiltrate data.
Install Mechanism
No install spec and no code files — instruction-only skill; nothing is written to disk by the skill itself beyond example usage of /tmp in the docs.
Credentials
No environment variables, credentials, or config paths are required. The examples reference common temporary files but do not require secrets or service tokens.
Persistence & Privilege
always is false and the skill is user-invocable; it does not request permanent presence or modify other skills or system-wide settings.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install loop-prevention - 安装完成后,直接呼叫该 Skill 的名称或使用
/loop-prevention触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
精简优化:去除冗余描述,保留核心规则+触发信号+正确做法+检查清单
v1.0.0
初始版本:操作循环防止规范,适用于所有可重复操作
元数据
常见问题
Loop Prevention 是什么?
操作循环防止规范。防止 Agent 对同一操作反复执行造成资源浪费。适用于 exec 命令、工具调用、文件读写等所有可重复操作。核心规则:同一操作最多 5 次、结果不理想换策略、检测到循环立即停止。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 81 次。
如何安装 Loop Prevention?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install loop-prevention」即可一键安装,无需额外配置。
Loop Prevention 是免费的吗?
是的,Loop Prevention 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Loop Prevention 支持哪些平台?
Loop Prevention 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Loop Prevention?
由 wei dong(@weidongkl)开发并维护,当前版本 v1.0.1。
推荐 Skills