Catalog/P family/P20
Proposed specificationSource-located exemplarH2H3

Reflection-augmented loop

Use feedback to revise attempts.

JOIN POINTfailed_attempt_feedbackRECORD STATUSCandidate · v0.1.0
UML class view for Reflection-augmented loop, showing participant roles, received calls, and analytical dependencies
FIG. P20 / UML CLASS VIEW
Object interaction diagram for Reflection-augmented loop, showing role collaboration and a numbered message sequence
FIG. P20 / OBJECT INTERACTIONS
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.
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.

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 SKETCH
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.
CODE DESIGN / PYTHON
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.

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-sdkexamples/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 ↗

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.

ANY-EVIDENCE FAMILY COVERAGE29/36

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 / 41
Exploratory retrieval cue Regex / v0.1.0
(?i)\b(?:reflection|self[_-]?critique|critique|reflexion)\b

This expression is a discovery instrument only. A match is a retrieval cue—not a confirmed implementation, pointcut match, or contract proof.