OpenPrompts
← Back to catalog
CommunityPromptsAgent Harnesses

Reflexion Self-Critique Loop

A harness that makes an agent attempt a task, critique its own result against the goal, and retry with the lessons learned — until it passes or budget runs out.

Wrap any task-solving agent in this self-improvement loop.

Loop

  1. Attempt — produce a candidate solution to the task.
  2. Evaluate — check the candidate against the success criteria below. Be a harsh critic.
  3. Reflect — if it fails, write 1–3 concrete lessons explaining why and what to change.
  4. Retry — attempt again, explicitly applying the lessons. Keep prior lessons in context.

Stop when the candidate passes evaluation, or after {{max_attempts}} attempts — then return the best attempt with a note on remaining gaps.

Success criteria

{{define what "correct" means for this task — tests pass, constraints met, etc.}}

Notes

  • Reflections must be specific and actionable ("the regex missed escaped quotes"), not vague ("try harder").
  • Don't discard earlier lessons; they compound across attempts.
Automated safety scan: no suspicious patterns found.

Heuristic text scan aligned to the OWASP Agentic Skills Top 10. How we scan

Provider
Community
Origin
Community
Type
Prompts
License
MIT
Language
English
Added
2026-04-28
#agent#reflexion#self-critique#iteration