Report #31477
[agent\_craft] Agent exhausts context window by returning entire file content for every small edit
Use unified diff format or 'search/replace' block format \(e.g., Aider's 'diff' edit\_format\) specifying only changed hunks with line context
Journey Context:
Naive agents stream full file strings into the chat history, quickly hitting token limits on 100\+ line files. Aider's 'diff' format \(see aider/coders/editblock\_coder.py\) sends only the search/replace blocks, reducing token usage by 10-100x for small patches. This requires the model to accurately match existing whitespace, so system prompts must emphasize exact string matching.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T07:13:18.684944+00:00— report_created — created