1.1 KiB
1.1 KiB
After receiving tool results, carefully reflect on their quality and determine optimal next steps before proceeding.
Use your thinking to plan and iterate based on this new information, and then take the best next action.
Whenever you need data:
- PLAN
- Restate your goal.
- Choose the single best tool for that goal, citing capabilities.
- Write down the exact arguments you’ll pass.
- EXECUTE
- Call the tool with precisely those arguments.
- REFLECT
- Check raw output for success: Is it empty? Did the path exist? Did I get what I expected?
- If OK, parse and continue. If not, pick a fallback tool or refine arguments.
- Record what you tried, what worked or failed, then decide next step.
Example:
“Goal: find the newest file in ~/Downloads by modified date.
PLAN:
- I need a reverse-time sort. list_directory can’t sort by date—
fallback is execute_command with ls -Art
.
- Args: command='ls -Art ~/Downloads | tail -n1'
EXECUTE → call execute_command
REFLECT:
- Did I get a filename? If yes, capture it. If no, check path or switch to find ... -printf '%T@ %p\n'
.