self-improving-agent

Self-improving agent system for OpenClaw. Enables continuous learning from interactions, errors, and recoveries. Automatically improves performance over time.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "self-improving-agent" with this command: npx skills add leohuang8688/self-improver

Self-Improving Agent

A continuous learning agent system for OpenClaw that learns from:

  • Interactions - Learn from every conversation
  • Errors - Learn from mistakes to avoid them
  • Recoveries - Learn what works to recover successfully

✨ Features

  • 🧠 Continuous Learning - Learns from every interaction
  • Error Learning - Learns from mistakes to avoid repetition
  • Recovery Learning - Learns successful recovery patterns
  • 🔄 Auto-Improvement - Automatically applies improvements
  • 📚 Memory System - Stores and retrieves learnings
  • 🔌 Hook System - Extensible hook system for custom improvements
  • 📊 Progress Tracking - Track improvement over time
  • 🔧 Python CLI - Easy to use command-line interface
  • 🧩 OpenClaw Skill - Seamless integration with OpenClaw

🚀 Quick Start

Prerequisites

  • Python 3.10+
  • OpenClaw installed
  • pip or uv package manager

Installation

As OpenClaw Skill

# Clone to OpenClaw skills directory
cd ~/.openclaw/workspace/skills
git clone https://github.com/leohuang8688/self-improving-agent.git

Auto-learning is enabled by default! After each OpenClaw session, the agent will automatically learn and improve.

As Python Package

# Clone the repository
git clone https://github.com/leohuang8688/self-improving-agent.git
cd self-improving-agent

# Install with pip
pip install -e .

# Or install with uv
uv pip install -e .

Basic Usage

Automatic Mode (Recommended)

Just use OpenClaw normally! Learning happens automatically after each session, error, or recovery.

# Start OpenClaw
openclaw

# Use it normally...

# Exit OpenClaw
# → Auto-learning triggers automatically!

Manual Mode

# Run the self-improving agent
python -m self_improving_agent run

# Learn from last session
python -m self_improving_agent learn

# Learn from errors
python -m self_improving_agent learn-errors

# Learn from recoveries
python -m self_improving_agent learn-recoveries

# Review all learnings
python -m self_improving_agent review

# Export learnings to file
python -m self_improving_agent export

📖 Commands

run - Run the Agent

Executes the self-improving agent with all applied improvements.

python -m self_improving_agent run --workspace /path/to/workspace

learn - Learn from Session

Analyzes the last session and extracts learnings.

python -m self_improving_agent learn --verbose

learn-errors - Learn from Errors

Analyzes error logs and extracts learnings.

python -m self_improving_agent learn-errors --verbose

learn-recoveries - Learn from Recoveries

Analyzes recovery logs and extracts successful patterns.

python -m self_improving_agent learn-recoveries --verbose

review - Review Learnings

Reviews all stored learnings.

python -m self_improving_agent review --verbose

export - Export Learnings

Exports all learnings to a markdown file.

python -m self_improving_agent export

🪝 Hook System

Available Hooks

onSessionEnd(session)

  • Triggered: When session ends
  • Purpose: Post-session learning, cleanup, save state
  • Parameter: session - Session object

onError(error)

  • Triggered: When an error occurs
  • Purpose: Error logging, learning from mistakes
  • Parameter: error - Error object

onRecovery()

  • Triggered: When recovering from error
  • Purpose: Learn successful recovery patterns
  • Parameter: None

📝 Learning Types

1. Session Learning

  • Triggered by: onSessionEnd
  • Learns from: Conversation patterns, user preferences
  • Stored in: learnings/sessions.json

2. Error Learning

  • Triggered by: onError
  • Learns from: Mistakes, errors, failures
  • Stored in: learnings/errors.json
  • Purpose: Avoid repeating mistakes

3. Recovery Learning

  • Triggered by: onRecovery
  • Learns from: Successful recoveries
  • Stored in: learnings/recoveries.json
  • Purpose: Repeat successful recovery patterns

📁 Project Structure

self-improving-agent/
├── src/
│   ├── hooks.py              # Hook manager
│   └── ...
├── hooks/
│   └── error_learning.py     # Error learning hook
├── learnings/
│   ├── sessions.json         # Session learnings
│   ├── errors.json           # Error learnings
│   └── recoveries.json       # Recovery learnings
├── main.py
├── README.md
└── SKILL.md

🔧 Configuration

In OpenClaw configuration file:

{
  "hooks": {
    "internal": {
      "enabled": true,
      "entries": {
        "self-improve": {
          "enabled": true
        },
        "error-learning": {
          "enabled": true
        }
      }
    }
  }
}

📊 Learning Files

learnings/errors.json

[
  {
    "timestamp": "2026-03-15T12:30:00",
    "error_type": "ValueError",
    "error_message": "Invalid parameter",
    "context": {
      "traceback": "..."
    }
  }
]

learnings/recoveries.json

[
  {
    "timestamp": "2026-03-15T12:35:00",
    "recovery_method": "automatic_recovery"
  }
]

🎯 Best Practices

  1. Review learnings regularly - Review and apply learnings weekly
  2. Export learnings - Export learnings for backup
  3. Apply learnings - Apply learnings to improve future performance
  4. Clean old learnings - Remove outdated learnings periodically

📝 License

MIT License

👨‍💻 Author

PocketAI for Leo - OpenClaw Community

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

Discord

Use when you need to control Discord from Clawdbot via the discord tool: send messages, react, post or upload stickers, upload emojis, run polls, manage threads/pins/search, fetch permissions or member/role/channel info, or handle moderation actions in Discord DMs or channels.

Registry SourceRecently Updated
33.6K72steipete
Automation

AgentCall

Give your agent real phone numbers for SMS, OTP verification, and voice calls via the AgentCall API.

Registry SourceRecently Updated
Automation

clawbus-skill

clawbus skill marketplace for AI agents. Search, download, install, and activate skills from the clawbus library. Use when the user asks for a capability you...

Registry SourceRecently Updated
Automation

chat2workflow

A design-only workflow designer for the Dify and Coze platforms. Through multi-round conversation, it produces a structured workflow JSON (nodes, edges, vari...

Registry SourceRecently Updated