Token Efficiency Encyclopedia

Stateful Tracking in Agent Loops

Maintain explicit state of what the agent already knows so it does not re-fetch information that was retrieved in a prior turn unless it has changed.

How It Works

A lightweight state object tracks file contents, directory listings, tool results, and user preferences across turns. Before making a tool call, the agent checks its state to see if the information is already available and still fresh.

What to Track

Benefits

Anti-patterns

See Also

Tools