executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
tool-calling-principlesFirst principles of tool/environment grounding, structured outputs, and error recovery for AI agents.
Independent GitHub snapshot · Automated classification · Original documentation governs
An agent without tools is a brain in a vat—capable of hallucinating universes but powerless to perturb reality. Tools are the sensory organs and actuator limbs of synthetic intelligence. Grounding is the rigorous discipline of tethering probabilistic reasoning to deterministic environments.
To call a tool is not merely to execute a function; it is to collapse a wave of potential text into a localized impact on the external world.
Strict Structured Outputs (The Schema Contract) Language models speak in infinite semantic permutations; the environment demands rigid syntactic conformity. The interface between thought and action is the JSON Schema. Axiom of Structure: Never rely on emergent formatting. Enforce rigorous type constraints, required fields, and semantic descriptions. The schema is the absolute law governing the interface.
Defensive Calling (The Principle of Skepticism) The environment is hostile, stochastic, and latent. A tool call must be defensive—assuming latency timeouts, malformed responses, or state changes. Axiom of Defense: Validate assumptions prior to actuation. If reading a file, assume it may be locked or absent. Never commit destructive actions without explicit verification of state.
Error Recovery & Self-Correction (The Resilience Loop) Failure is the default state of complex environments. When a limb fails to grasp an object, the brain does not halt; it recalculates the trajectory. When a tool throws an error, the agent must parse the stack trace, hypothesize the cause, and iterate the call. Axiom of Resilience: An error is not a termination condition; it is high-fidelity sensory feedback. Catch the exception, reflect on the delta between expectation and reality, and adjust the schema parameters.
%%{init: {"theme": "default", "flowchart": {"useMaxWidth": true}}}%%
flowchart TD
Thought((Cognitive Intent)) -->|Schema Mapping| Validate{Pre-call Validation}
Validate -- Valid --> Action[Tool Execution]
Validate -- Invalid --> Correct1(Internal Re-mapping)
Correct1 --> Validate
Action --> Response{Environment Feedback}
Response -- Success --> Observe(State Grounding Update)
Response -- Exception/Error --> Reflect[Analyze Stack Trace / Error Msg]
Reflect --> Hypothesize(Hypothesize Failure Mode)
Hypothesize --> Adjust(Adjust Parameters/Logic)
Adjust --> Validate
Observe --> NextThought((Subsequent Intent))
true is insufficient; return the updated state of the environment.