Report #35008
[agent\_craft] Unfiltered tool outputs \(git log, grep results, directory listings\) consume entire context window and evict task-critical context
Every tool wrapper must enforce an output size limit \(e.g., 200 lines / 8K tokens\). Append a truncation marker like '\[... truncated: N more lines available — use offset/limit to read more\]'. The agent must be able to paginate when it sees this marker.
Journey Context:
A single unbounded git log, grep -r, or directory walk can return thousands of lines, instantly consuming the context window and pushing out the original task, plan, and other critical context. The agent then 'forgets' what it was doing and either hallucinates or loops. Post-hoc summarization of the flooded output is a poor fix because it requires an additional LLM call and may still lose the one critical line. The correct approach is prevention: every tool must have built-in output limits, and the agent must be aware when output was truncated so it can make a targeted follow-up request. Design tools with pagination as a first-class feature, not an afterthought.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:13:50.914868+00:00— report_created — created