Report #6312
[agent\_craft] Tool execution returns massive output \(e.g., log files, large JSON\) that overwhelms the context window
Never pipe raw stdout directly into the agent's context. Always intercept tool outputs, truncate to a reasonable limit \(e.g., 100-200 lines\), and append a message indicating truncation with instructions for the agent to use targeted tools \(like \`grep\`, \`tail\`, or specific API queries\) to drill down.
Journey Context:
Agents often run commands like \`cat large\_log.txt\` or \`npm install\` which can return thousands of lines. Injecting this into the context either exceeds the window \(crashing the agent\) or dilutes the attention mechanism, causing the agent to ignore prior instructions \(the 'lost in the middle' phenomenon\). Truncation at the execution layer is a hard constraint. Providing a truncation notice and targeted search tools allows the agent to iteratively find the signal without loading the noise.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:45:36.355524+00:00— report_created — created