Skip to main content

reflexion

After a failed attempt (test fails, command errors, wrong output), write a short reflection on WHY it failed and what to change, then retry with that lesson in context, instead of blindly trying again. Use on the 2nd attempt at any failing task. Trigger with /reflexion or "that failed, rethink", "why did it fail", "learn from this and retry".

Jump to install

Source facts

Repository
Zavelinski/reflexion
Last source activity
June 30, 2026 at 02:57
Detected SKILL.md language
English
Stars
0
Forks
0

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
reflexion
description
After a failed attempt (test fails, command errors, wrong output), write a short reflection on WHY it failed and what to change, then retry with that lesson in context, instead of blindly trying again. Use on the 2nd attempt at any failing task. Trigger with /reflexion or "that failed, rethink", "why did it fail", "learn from this and retry".
version
0.1.0
user-invocable
true
metadata
{"emoji":"🔁"}
# reflexion Blind retry repeats the same mistake. After a failure, turn the failure signal into a written lesson, then retry WITH that lesson in front of you. Verbal self-reflection as memory between attempts. ## Why this exists (evidence) - Reflexion (Shinn et al., arXiv:2303.11366): agents that verbally reflect on failure feedback and keep it as episodic memory across attempts get large gains, e.g. up to 91% pass@1 on HumanEval vs 80% for the prior best at the time, and big jumps on decision-making/reasoning tasks, without finetuning. - Mechanism: the failure (stack trace, failed test, wrong result) is signal; a concrete "what went wrong + what to change" note steers the next attempt instead of resampling the same path. ## When to use - The 2nd (and later) attempt at any task that just failed: failing test, runtime error, wrong answer, rejected approach. - A loop that is about to retry: insert a reflection step first. - NOT on the first attempt (nothing to reflect on yet) and not when the fix is obvious (just fix it). ## The loop 1. **Capture the failure precisely:** exact error / failing assertion / wrong output. Quote it, do not paraphrase. 2. **Reflect (short, concrete):** WHY did it fail? What specific assumption was wrong? What is the ONE change that addresses the root cause (not the symptom)? 3. **Record the lesson** as a one-line note kept in context (e.g. "the API returns cents not dollars -> divide by 100"). 4. **Retry** with the lesson explicit. Change the approach the lesson implies, do not just rerun. 5. **If it fails again:** add a new lesson; after 2-3 failed reflections on the same root, STOP and escalate (you are stuck in a local minimum) rather than looping. ## Persist across sessions For recurring failures, write the lesson to memory (see recall / memory-persistence) so a future session does not relearn it. That is the "episodic memory" part of Reflexion. ## Composes with - `systematic-debugging`: reflexion is the between-attempts memory; debugging is the within-attempt method. - `testsmith` / `adversarial-verify`: produce the failure signal reflexion learns from. - `self-consistency`: when reflection is uncertain, sample a few candidate root causes and take the consistent one. ## Honest limits - Garbage reflection = garbage retry. The lesson must name a ROOT cause, not "try harder". - Cap the loop (2-3 reflections); reflexion does not rescue a fundamentally wrong approach, it just stops you repeating one mistake. - Reported numbers are from the paper's benchmarks; measure your own.
View on GitHub