Report #6080
[architecture] Agent loses state mid-tool-execution because context window shifted
Externalize the agent's current plan, scratchpad, and variables into a persistent state object \(e.g., a JSON schema or database\), and explicitly reload this state into the prompt at the start of every LLM call, rather than relying on the API's implicit conversation history.
Journey Context:
LLM APIs often truncate or lose history if not explicitly passed back. If a tool call fails or the context exceeds limits, the agent wakes up with amnesia. State must be treated as a database, not a chat log. The tradeoff is increased token usage from repeatedly injecting the state, but it guarantees deterministic recovery from interruptions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:09:10.606704+00:00— report_created — created