Report #92158
[agent\_craft] Agent context window overflows or degrades when reading large files or command outputs
Implement aggressive, structured truncation of tool outputs \(e.g., head/tail of files, line limits\) and externalize full outputs to a local filesystem scratchpad, providing the agent only the truncated view and a tool to read specific line ranges.
Journey Context:
Naively loading entire large files or long terminal outputs into the agent's context window quickly leads to context rot and token limit errors. Agents don't need the whole 5000-line file in context to fix a bug on line 42. By truncating and providing a read\_file\(start, end\) tool, you keep the context lean and force the agent to seek only what it needs, mimicking human IDE navigation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:16:44.655140+00:00— report_created — created