Self-Reflection AI Agent Skill for Openclaw

A recursive optimization skill that enables AI agents to analyze their own performance and update their knowledge base automatically.

brennerspear
v1.0.0
Feb 26, 2026
0
3k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install agent-self-reflection

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install agent-self-reflection using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Self-Reflection AI Agent Skill?

The Self-Reflection skill is a cornerstone of the Openclaw Skills ecosystem, designed to create a continuous improvement loop for autonomous agents. It functions by periodically reviewing recent interaction transcripts to identify what went well, what failed, and how to improve future performance. Instead of leaving lessons in ephemeral logs, this skill synthesizes actionable insights and writes them directly into the agent's long-term memory and configuration files.

By systematically updating documents like AGENTS.md and TOOLS.md, the agent evolves its own internal logic and tool-handling capabilities. This ensures that the agent learns from its mistakes, remembers user preferences, and refines its technical workflows without manual developer intervention, making it a vital utility for any self-hosted agent architecture.

Self-Reflection AI Agent Skill Use Cases

  • Automatically updating tool documentation when new parameter quirks are discovered during runtime.
  • Capturing evolving user preferences and project details into a persistent about-user.md file.
  • Refining system prompts in AGENTS.md based on observed misunderstandings or intent gaps.
  • Generating daily summaries of agent activity to maintain a chronological record of decisions.

How Self-Reflection AI Agent Skill Works

  1. The skill triggers (typically via cron) and queries the openclaw CLI to list sessions active within a specific recent window.
  2. It retrieves the tail end of JSONL transcripts for relevant sessions, ensuring token efficiency by avoiding full-file reads.
  3. The agent analyzes the transcript to isolate specific, non-obvious lessons regarding tool usage, user intent, and error patterns.
  4. Insights are routed to the appropriate destination files based on their type (e.g., tool tips go to TOOLS.md, user facts go to memory files).
  5. The agent uses surgical editing tools to append or modify these files, then generates a brief summary of the optimization work performed.

Self-Reflection AI Agent Skill Setup

To deploy this skill within your environment, ensure you have the openclaw CLI installed and the following structure ready:

# Ensure the memory directory exists
mkdir -p memory/

# Schedule the skill to run hourly via cron
echo "0 * * * * openclaw run self-reflection" >> my_crontab

Verify that the agent has write permissions for AGENTS.md, TOOLS.md, and the memory directory to allow for successful insight routing.

Self-Reflection AI Agent Skill Data Schema & Taxonomy

The skill organizes extracted knowledge across several key files to maintain a clean taxonomy of information:

File Path Description Insight Type
AGENTS.md Core agent instructions Process improvements, safety rules, and high-level workflows.
TOOLS.md Tool configuration and tips Environment paths, parameter requirements, and execution gotchas.
memory/YYYY-MM-DD.md Daily journal Chronological log of sessions, events, and temporary project context.
memory/about-user.md User profile Long-term preferences, communication styles, and personal interests.
skills/<name>/SKILL.md Skill documentation Direct improvements to the logic or parameters of specific skills.

Self-Reflection AI Agent Skill Advanced Features

  • Smart session filtering: Automatically skips subagent worker sessions to focus on high-value human interactions.
  • Token-budget awareness: Uses tailing and offset limits to prevent massive context window consumption during reflection.
  • Surgical editing: Employs specific line-editing tools rather than overwriting files to preserve existing agent knowledge.
  • Multi-destination routing: Intelligently identifies whether an insight is a permanent rule change or a temporary contextual fact.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*