Report #52434
[agent\_craft] Massive tool outputs push critical system prompts out of the context window
Enforce strict truncation and formatting rules on all tool outputs at the execution layer. Cap stdout at 50 lines, strip ANSI codes, and automatically use head/tail with an explicit exit code appended.
Journey Context:
Agents frequently run commands that return thousands of lines \(e.g., npm install logs\). If injected raw, they consume the context budget and push the original instructions out of the LLM's attention window. Truncating at the tool layer, before it hits the LLM, is essential. The tradeoff is potentially missing a crucial error at the end of a log, which is mitigated by always appending the final line and exit code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:30:18.523760+00:00— report_created — created