Report #91956
[frontier] Code agents waste tokens rewriting entire files and generate syntax errors on large files
Use unified diff format \(SEARCH/REPLACE blocks\) for code edits instead of full-file rewrite, requiring the model to generate only the changed hunks with context lines
Journey Context:
Standard agent tutorials teach 'read file, rewrite entire content' which consumes context window linearly with file size and invites 'lazy coding' where the model omits unchanged sections. The Aider diff format uses 'search/replace' blocks identical to git diff hunks. This reduces token usage by 10-50x on large files and allows editing files larger than the context window. The model must precisely match existing lines before applying changes, preventing hallucinated modifications. Tradeoff: requires the LLM to follow strict diff syntax; use structured output \(JSON mode\) to enforce block formatting rather than free-form text. Proven in production: Aider consistently outperforms full-rewrite agents on SWE-bench.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T12:56:19.602723+00:00— report_created — created