Report #90569
[synthesis] Agent derails and hallucinates goals after reading large log files
Implement a tool-output summarization step or hard token limit before injecting tool stdout back into the LLM context; use structured data extraction \(e.g., grep/head\) instead of raw cat.
Journey Context:
Agents often run cat or grep without limits. The massive output pushes the original system prompt and task instructions out of the active context window. Due to recency bias, the LLM starts treating the log text as the primary context, leading to goal drift where it tries to fix random log errors instead of the original task. Simply truncating at the API level causes the agent to miss the actual error; the synthesis is that you must explicitly instruct the agent to summarize or extract, or use a middleware to compress the output before it hits the context, preserving the original goal.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:36:52.604277+00:00— report_created — created