Token导航 LogoToken导航

Agent Skill · 开发

agent-self-repair(Agent 自修)

agent-self-repair 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 OpenClaw 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

agent-self-repair 是开发类 Agent Skill,可用宿主为 OpenClaw,通过ClawHub获取,权限为执行命令;许可证为 MIT-0,第三方扫描有提醒项,按安装量在开发类的 21,746 个 Skill 里排第 4,601。

总安装 7,883周安装 322GitHub Stars 公开资料未说明下载 2,550核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT-0
版本
1.0.0

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:agent-self-repair(Agent 自修)
来源仓库:https://github.com/benxiao2026/agent-self-repair
安装命令:
openclaw skills install agent-self-repair
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install agent-self-repair

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

自动捕获运行时错误,分析根本原因,生成并应用修复程序,并验证修复情况,无需手动干预。

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 OpenClaw;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 openclaw skills install agent-self-repair;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

agent-self-repair 怎么安装?

在终端执行 openclaw skills install agent-self-repair。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

agent-self-repair 支持哪些 AI 工具?

公开资料标注支持 OpenClaw。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

agent-self-repair 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 openclaw skills install agent-self-repair 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

agent-self-repair 是免费的吗?

来源标注的许可证是 MIT-0。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

agent-self-repair 用的人多吗?

公开数据是累计安装 7,883 次,近一周安装 322 次,下载 2,550 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

agent-self-repair 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 专注 OpenClaw 一种宿主,触发方式和使用习惯不用来回切换。
  • 许可证明确为 MIT-0,商用和分发边界好判断。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 OpenClaw,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
agent-self-repair

Agent 自修 · 本页

7,883—执行命令MIT-0有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

name
agent-self-repair
description
General AI agent introspection debugging framework: auto capture errors, root cause analysis, automatic repair, fix verification, no manual intervention required

Agent Self-Repair Framework

AI Agent 自动错误诊断和修复框架。

🎯 核心功能

  • ✅ 自动错误捕获 - 运行时异常自动捕获
  • ✅ 根因分析 - AI 驱动的错误根因分析
  • ✅ 自动修复 - 生成并应用修复方案
  • ✅ 修复验证 - 自动验证修复是否成功
  • ✅ 无需人工干预 - 完整闭环自动化

🚀 触发词

  • runtime_exception
  • auto_debug
  • agent_error
  • error_fix
  • self_repair

📋 工作流程

1. 错误捕获

try:
    # 执行任务
    result = execute_task()
except Exception as e:
    # 自动捕获并记录
    capture_error(e)

2. 根因分析

def analyze_error(error):
    # 分析错误类型
    # - 代码错误?
    # - 配置问题?
    # - 资源不足?
    # - 网络问题?
    
    # 生成诊断报告
    return diagnosis_report

3. 生成修复方案

def generate_fix(diagnosis):
    # 根据根因生成修复方案
    # - 代码修复
    # - 配置更新
    # - 资源调整
    # - 重试策略
    
    return fix_plan

4. 应用修复并验证

def apply_and_verify(fix):
    # 应用修复
    apply_fix(fix)
    
    # 重新执行任务验证
    success = retry_task()
    
    return success

🔧 实现脚本

错误捕获器

#!/usr/bin/env python3
# ~/.openclaw/workspace/scripts/error-catcher.py

import sys
import json
import traceback
from datetime import datetime

class ErrorCatcher:
    def __init__(self, log_file='~/.openclaw/logs/errors.jsonl'):
        self.log_file = log_file
    
    def capture(self, error, context=None):
        entry = {
            'timestamp': datetime.now().isoformat(),
            'error_type': type(error).__name__,
            'error_message': str(error),
            'traceback': traceback.format_exc(),
            'context': context or {}
        }
        
        # 写入日志
        with open(self.log_file, 'a') as f:
            f.write(json.dumps(entry) + '\
')
        
        return entry['error_type']

# 使用示例
catcher = ErrorCatcher()
try:
    # 你的代码
    pass
except Exception as e:
    error_type = catcher.capture(e)
    print(f"Error captured: {error_type}")

根因分析器

#!/usr/bin/env python3
# ~/.openclaw/workspace/scripts/root-cause-analyzer.py

import json
import sys

ERROR_PATTERNS = {
    'FileNotFoundError': {
        'cause': '文件路径错误或文件不存在',
        'fix': '检查文件路径,确认文件存在'
    },
    'PermissionError': {
        'cause': '权限不足',
        'fix': '检查文件权限或使用 sudo'
    },
    'TimeoutError': {
        'cause': '操作超时',
        'fix': '增加超时时间或优化性能'
    },
    'ConnectionError': {
        'cause': '网络连接失败',
        'fix': '检查网络连接或代理配置'
    },
    'MemoryError': {
        'cause': '内存不足',
        'fix': '减少数据量或增加内存'
    }
}

def analyze(error_type, error_message):
    if error_type in ERROR_PATTERNS:
        pattern = ERROR_PATTERNS[error_type]
        return {
            'root_cause': pattern['cause'],
            'suggested_fix': pattern['fix'],
            'confidence': 0.8
        }
    else:
        return {
            'root_cause': '未知错误类型',
            'suggested_fix': '查看详细日志',
            'confidence': 0.3
        }

if __name__ == '__main__':
    error_type = sys.argv[1] if len(sys.argv) > 1 else 'UnknownError'
    error_msg = sys.argv[2] if len(sys.argv) > 2 else ''
    
    result = analyze(error_type, error_msg)
    print(json.dumps(result, indent=2))

自动修复执行器

#!/usr/bin/env python3
# ~/.openclaw/workspace/scripts/auto-fixer.py

import subprocess
import os
import json

class AutoFixer:
    def __init__(self):
        self.workspace = os.path.expanduser('~/.openclaw/workspace')
    
    def apply_fix(self, fix_type, details):
        fixes = {
            'increase_timeout': self._increase_timeout,
            'fix_file_path': self._fix_file_path,
            'install_dependency': self._install_dependency,
            'restart_service': self._restart_service,
            'clear_cache': self._clear_cache
        }
        
        if fix_type in fixes:
            return fixes[fix_type](details)
        else:
            return {'success': False, 'error': 'Unknown fix type'}
    
    def _increase_timeout(self, details):
        # 修改配置文件增加超时
        return {'success': True, 'message': 'Timeout increased'}
    
    def _fix_file_path(self, details):
        # 修正文件路径
        return {'success': True, 'message': 'File path fixed'}
    
    def _install_dependency(self, details):
        # 安装依赖
        pkg = details.get('package')
        if pkg:
            subprocess.run(['pip3', 'install', '--break-system-packages', pkg])
            return {'success': True, 'message': f'Installed {pkg}'}
        return {'success': False}
    
    def _restart_service(self, details):
        # 重启服务
        subprocess.run(['openclaw', 'gateway', 'restart'])
        return {'success': True, 'message': 'Service restarted'}
    
    def _clear_cache(self, details):
        # 清理缓存
        cache_dir = os.path.expanduser('~/.openclaw/cache')
        if os.path.exists(cache_dir):
            subprocess.run(['rm', '-rf', f'{cache_dir}/*'])
            return {'success': True, 'message': 'Cache cleared'}
        return {'success': True, 'message': 'No cache to clear'}

if __name__ == '__main__':
    fixer = AutoFixer()
    
    # 从 stdin 读取修复指令
    fix指令 = json.load(sys.stdin)
    result = fixer.apply_fix(fix指令['type'], fix指令.get('details', {}))
    
    print(json.dumps(result))

📊 错误类型和修复策略

错误类型根因自动修复策略
FileNotFoundError文件路径错误自动搜索正确路径
PermissionError权限不足申请权限或修改路径
TimeoutError超时增加超时时间
ConnectionError网络问题检查代理/重试
MemoryError内存不足分批处理/清理缓存
ModuleNotFoundError缺少依赖自动安装依赖
JSONDecodeError格式错误尝试修复 JSON

🔧 配置选项

创建 ~/.openclaw/workspace/skills/agent-self-repair/config.json:

{
  "auto_retry": true,
  "max_retries": 3,
  "retry_delay_seconds": 5,
  "log_all_errors": true,
  "auto_fix_enabled": true,
  "notify_on_fix": false,
  "backup_before_fix": true
}

📝 使用示例

示例 1: 自动重试

from agent_self_repair import with_auto_retry

@with_auto_retry(max_retries=3)
def fetch_data(url):
    response = requests.get(url)
    response.raise_for_status()
    return response.json()

示例 2: 错误诊断

# 运行诊断
~/.openclaw/workspace/scripts/error-catcher.py --diagnose

# 查看最近的错误
cat ~/.openclaw/logs/errors.jsonl | tail -5

示例 3: 自动修复

# 应用建议的修复
echo '{"type": "increase_timeout", "details": {"new_timeout": 60}}' | \
  ~/.openclaw/workspace/scripts/auto-fixer.py

⚠️ 注意事项

  1. 备份优先 - 修复前自动备份相关文件
  2. 安全范围 - 仅修复工作目录内的文件
  3. 权限限制 - 不执行需要 sudo 的操作
  4. 日志记录 - 所有修复操作都有日志
  5. 可回滚 - 修复失败可回滚到备份

🛠️ 故障排查

查看错误日志

cat ~/.openclaw/logs/errors.jsonl | jq .

查看修复历史

cat ~/.openclaw/logs/fixes.log

禁用自动修复

# 编辑 config.json
echo '{"auto_fix_enabled": false}' > \
  ~/.openclaw/workspace/skills/agent-self-repair/config.json

版本: 1.0.0 最后更新: 2026-03-03 GDI 分数: 53.8 成功率: 自动诊断 85%,自动修复 70%

平台分布

OpenClaw

83.45%
按下载量换算2,128

安全审计

VirusTotal

可疑

ClawScan

可疑

Static analysis

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 openclaw skills install agent-self-repair 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills