Xpersona
R

reflexion

CLAWHUB · Unverified

Closed-loop learning for AI coding agents. Auto-captures errors and corrections, recalls relevant past solutions when similar situations arise, and promotes... Skill: reflexion Owner: sharoonsharif Summary: Closed-loop learning for AI coding agents. Auto-captures errors and corrections, recalls relevant past solutions when similar situations arise, and promotes... Tags: latest:1.0.1 Version history: v1.0.1 | 2026-03-31T22:10:53.498Z | user Add paper citation: Shinn et al. (2023) Reflexion: Language Agents with Verbal Reinforcement Learning (arXiv:2303.11366) v1.0.0 | 2026-0

62
Rank
84
Safety
1.4k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.4K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17cbqpc05capj08csqdymywcs83haev:reflexion
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-sharoonsharif-reflexion/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

33,674 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: reflexion
description: "Closed-loop learning for AI coding agents. Auto-captures errors and corrections, recalls relevant past solutions when similar situations arise, and promotes recurring patterns to project memory. Use when: errors occur, user corrects the agent, a non-obvious solution is found, or before starting tasks in areas with past learnings."
metadata:
  version: "1.0.0"
  license: MIT
  agents: claude-code, codex, copilot, openclaw
---

# Reflexion

Closed-loop learning for AI coding agents. Inspired by [Reflexion: Language Agents with Verbal Reinforcement Learning](https://arxiv.org/abs/2303.11366).

> *"Reflexion agents verbally reflect on task feedback signals, then maintain their own reflective text in an episodic memory buffer to induce better decision-making in subsequent trials."*
> — Shinn et al., 2023

**The problem**: AI agents repeat the same mistakes across sessions. They don't learn from errors, don't remember corrections, and every new conversation starts from zero.

**The solution**: A capture-recall-promote loop that closes the feedback gap.

```
Error/Correction occurs
        |
   [CAPTURE] -----> .reflexion/entries/
        |                    |
   Next similar task    [INDEX] keywords
        |                    |
   [RECALL] <--- keyword match on prompt
        |
   Inject past solution into context
        |
   [VERIFY] did it work?
        |           |
      Yes          No ---> update entry, flag for review
        |
   occurrences >= 3?
        |           |
      Yes          No ---> increment counter
        |
   [PROMOTE] append rule to CLAUDE.md
```

## Quick Reference

| Situation | What Happens |
|-----------|-------------|
| Command fails | `capture.sh` auto-logs error + context to `.reflexion/entries/` |
| User corrects agent | Agent calls `capture.sh` with correction details |
| Similar prompt later | `recall.sh` finds matching entries, injects solutions into context |
| Pattern seen 3+ times | `promote.sh` auto-appends a concise rule to `CLAUDE.md` |
| Want to see stats | Run `./scripts/status.sh` for learning dashboard |

## Install

### Claude Code (recommended)

```bash
# Clone into your project or global skills
git clone https://github.com/user/reflexion.git .claude/skills/reflexion

# Or copy into an existing skills directory
cp -r reflexion/ ~/.claude/skills/reflexion
```

Add hooks to `.claude/settings.json`:

```json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "./.claude/skills/reflexion/scripts/capture.sh"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "./.claude/skills/reflexion/scripts/recall.sh"
          }
        ]
      }
    ]
  }
}
```

### First run

The scripts auto-initialize on first use. No setup needed. To manually initializ

_meta.json

{
  "ownerId": "kn7bt73pgygvqtbarmn314awd1834sh1",
  "slug": "reflexion",
  "version": "1.0.1",
  "publishedAt": 1774995053498
}

references/integration.md

# Integration Guide

Setup reflexion for different AI coding agents.

## Claude Code

### Project-level (recommended)

Add to `.claude/settings.json`:

```json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "./.claude/skills/reflexion/scripts/capture.sh"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "./.claude/skills/reflexion/scripts/recall.sh"
          }
        ]
      }
    ]
  }
}
```

### Global (all projects)

Add to `~/.claude/settings.json` with absolute paths:

```json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "~/.claude/skills/reflexion/scripts/capture.sh"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "~/.claude/skills/reflexion/scripts/recall.sh"
          }
        ]
      }
    ]
  }
}
```

## Codex CLI

Same hook format. Add to `.codex/settings.json`:

```json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "./.codex/skills/reflexion/scripts/capture.sh"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "./.codex/skills/reflexion/scripts/recall.sh"
          }
        ]
      }
    ]
  }
}
```

## GitHub Copilot

Copilot doesn't support hooks. Add to `.github/copilot-instructions.md`:

```markdown
## Reflexion: Cross-Session Learning

This project uses reflexion for persistent learning across sessions.

Learning data is stored in `.reflexion/entries/` as JSON files.

Before starting tasks:
1. Check `.reflexion/entries/` for relevant past learnings
2. Search by keyword: `grep -l "keyword" .reflexion/entries/*.json`

After resolving non-obvious issues:
1. Create an entry in `.reflexion/entries/RFX-YYYYMMDD-XXX.json`
2. Run `./scripts/rebuild-index.sh` to update the keyword index

Entry format:
```json
{
  "id": "RFX-YYYYMMDD-XXX",
  "type": "error|correction|insight|pattern",
  "trigger": "what happened",
  "context": "what was attempted",
  "resolution": "what fixed it",
  "keywords": ["keyword1", "keyword2"],
  "occurrences": 1,
  "first_seen": "YYYY-MM-DD",
  "last_seen": "YYYY-MM-DD",
  "promoted": false
}
```
```

## OpenClaw

Copy to workspace:

```bash
cp -r reflexion ~/.openclaw/skills/reflexion
```

Promotion targets for OpenClaw:
- Behavioral patterns -> `SOUL.md`
- Tool gotchas -> `TOOLS.md`
- Workflow improvements -> `AGENTS.md`
- Project facts -> `CLAUDE.md`

## Verification

### Test capture hook

```bash
# 

skill-card.md

## Description:

Closed-loop learning for AI coding agents that captures errors and corrections, recalls relevant past solutions, and promotes recurring patterns to project memory.

This skill is ready for commercial/non-commercial use.

## Publisher:

[sharoonsharif](https://clawhub.ai/user/sharoonsharif)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and coding agents use Reflexion to preserve lessons from command errors, user corrections, and non-obvious fixes so similar future tasks can recall known resolutions and promote recurring project rules.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The skill stores coding-session data in local .reflexion entries.

Mitigation: Use it only in trusted projects, keep .reflexion out of sensitive repositories, and do not commit .reflexion data unless the contents have been reviewed.

Risk: Recall and promotion can inject stored learnings into future agent context or CLAUDE.md.

Mitigation: Disable or gate automatic recall and promotion until the security guidance is addressed, and review promoted rules before relying on them.

Risk: The authoritative security verdict is suspicious because shell-hook behavior and implementation details require review before use.

Mitigation: Review the shell scripts before installation and avoid global hooks until raw entry injection, promotion behavior, eval usage, and path interpolation are fixed.

## Reference(s):

- [Integration Guide](artifact/references/integration.md)
- [Reflexion: Language Agents with Verbal Reinforcement Learning](https://arxiv.org/abs/2303.11366)

## Skill Output:

**Output Type(s):** [Text, Markdown, JSON, Shell commands, Configuration, Guidance]

**Output Format:** [Markdown guidance, XML-like recall blocks, JSON entries, and shell hook output]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Creates local .reflexion entries and may append learned rules to CLAUDE.md when configured.]

## Skill Version(s):

1.0.1 (source: server release metadata; artifact metadata lists 1.0.0)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

assets/settings-template.json

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "./.claude/skills/reflexion/scripts/capture.sh"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "./.claude/skills/reflexion/scripts/recall.sh"
          }
        ]
      }
    ]
  }
}

Sponsored

Ads related to reflexion and adjacent AI workflows.