Reflection
After completing any action or step, pause and reflect before proceeding. Reflection prevents cascading errors and ensures steady progress.
Process
Review the outcome. Look at the result of the last action:
- Did it return the expected output?
- Were there errors, warnings, or unexpected side effects?
- Did the output match the success criteria from the plan?
Classify the result.
- Success — The step completed as intended. Move to the next step.
- Partial success — Some parts worked but others did not. Identify what remains.
- Failure — The step did not produce the desired result. Diagnose why.
Diagnose failures. If the step failed:
- Re-read the error message carefully.
- Check inputs—were they correct?
- Check assumptions—did the environment match expectations?
- Determine whether to retry, adjust, or skip.
Decide next action.
- If successful: proceed to the next planned step.
- If partially successful: complete the remaining parts, then proceed.
- If failed: fix the root cause and retry, or revise the plan.
Update the plan. If reflection reveals a flaw in the original plan, revise it before continuing.
Output Format
Last step: <description>
Result: success | partial | failure
Observation: <what happened>
Next action: <what to do next>
Plan change: <none | description of revision>
Guidelines
- Never skip reflection after a tool invocation.
- Be honest about failures — hiding them leads to compounding errors.
- If you are stuck after two retries, step back and reconsider the approach.
- Use reflection to confirm you are still on track toward the original goal.