reflexion-pattern
Installation
SKILL.md
Reflexion Pattern
Overview
When an agent fails, retrying with the same prompt produces the same failure. Reflexion adds a critic that reads the failed trajectory, writes a short verbal lesson, and stores it in episodic memory. The actor reads the lesson on next attempt. Bounded by a retry budget so it can't loop forever.
When to use
- Same task fails 2+ times with the same prompt
- You have a clear success signal (tests, golden, judge)
- Failure modes are recognizable in the trajectory (wrong tool, wrong arg, wrong plan)
- Combined with
ralphfor spec-first persistent loops
Don't use when
- One-shot tasks with no retry capacity
- Failure signal is noisy (judge LLM disagrees with itself)
- Budget too tight for 2+ attempts