After a failed attempt, attach the failure evidence to that attempt and make it visible to the next revision. Stop when the retry budget is exhausted rather than retrying without new information.Reflection-augmented loop
Use feedback to revise attempts.
failed_attempt_feedbackRECORD STATUSCandidate · v0.1.0UML class view
The proposed contract drawn as participant roles, received calls, and numbered dependencies.
Object interactions
The same roles and calls as a class collaboration and a numbered message sequence.
Pointcut
Where the mechanism applies. All four dimensions belong to the proposed match, not just its vocabulary.
- Context
- An attempt can be evaluated before a further attempt.
- Trigger
- The attempt fails or receives a critique.
- Structure
- Attempt record, feedback producer, revision input, and retry bound.
- Effect
- A revised attempt uses recorded feedback while preserving attempt lineage.
Protected contract
The obligation that clients, operators, and auditors should be able to rely on.
- Requires
- Failure evidence and remaining retry budget are available.
- Ensures
- Feedback is attached to the attempt that produced it and is visible to revision.
- Invariant
- Self-critique is not represented as independent verification.
- Violation
- Empty, contradictory, or exhausted feedback terminates or escalates.
Negative control
A static system prompt asking the model to reflect is not enough.
Variation & lifecycle
The hot spot is admitted only where the protected semantics survive.
Permitted variation
Self-critique, external evaluator, memory injection, and iterative refinement.
Test obligation
Test useful feedback, contradictory feedback, exhaustion, and repeated error.
Evolution question
Did reflection add independent evaluation and bounded convergence?
Prompt + code design
An illustrative prompt and a small design sketch for the proposed contract. Names and APIs are invented; this is not a repository excerpt.
def revise(task, attempt, budget):
if not budget.remaining:
return Failed(task, attempt, reason="retry budget exhausted")
feedback = evaluator.diagnose(attempt)
next_prompt = task.prompt.with_feedback(
attempt_id=attempt.id,
feedback=feedback,
)
return attempt.run(next_prompt, budget.decrement())Illustrative design sketch. Reflection is useful only when the feedback is linked to the attempt that produced it. This example is a teaching aid, not implementation evidence or a conformance claim.
Detection & matching
The frozen rule that retrieves this record, the canonical source exemplar, and the control that should stay unmatched.
- Join point
failed_attempt_feedback- Source locator
- See the source record.
- Lexical cue
(?i)\b(?:reflection|self[_-]?critique|critique|reflexion)\bFrozen expression, v0.1.0. A match is a retrieval cue, not a confirmed implementation.- Aliases
- None
- Canonical exemplar
- OpenHands/software-agent-sdk
examples/01_standalone_sdk/31_iterative_refinement.py:370Support: tests/sdk/agent/test_iterative_refinement.py:111 - Negative control
- A static system prompt asking the model to reflect is not enough.
Scope-anchored review. pohe-agent analyze <repo> --pattern P20 anchors the cue to its enclosing declaration and checks a separate operational signature for all four pointcut dimensions. Missing roles and negative-control risks remain visible; a structural match is not E2/E3. Calibration report ↗
Repository files
Up to five public files retrieved by the frozen cue and pinned to the audited commit. A match is a place to inspect, not a confirmed implementation.
examples/01_standalone_sdk/31_iterative_refinement.py:370CANONICAL SOURCE02affaan-m/ECCskills/council-multi-model/scripts/review-with-codex.js:46RETRIEVAL CUE03agno-agi/agnolibs/agno/agno/db/base.py:396RETRIEVAL CUE04Aider-AI/aideraider/io.py:1081RETRIEVAL CUE05bytedance/deer-flowbackend/app/channels/service.py:771RETRIEVAL CUEEvidence & provenance
Each layer answers a different question. Do not substitute retrieval for review.
Source-located exemplar
A concrete source anchor is available for this proposed record. It is one exemplar, not evidence that all repositories—or every contract field—conform.
Review boundary: this candidate and its specification come from an AI-assisted study. Independent human validation remains open.
80.6% of repository families in the frozen panel have at least one current cue, historical cue, or canonical source layer. This is not confirmed prevalence.
Current lexical-cue repositories: 32 / 415c524ad65d81examples/01_standalone_sdk/31_iterative_refinement.py:370tests/sdk/agent/test_iterative_refinement.py:111Attempt-feedback-refinement loop.
Exploratory retrieval cue Regex / v0.1.0
(?i)\b(?:reflection|self[_-]?critique|critique|reflexion)\bThis expression is a discovery instrument only. A match is a retrieval cue—not a confirmed implementation, pointcut match, or contract proof.