Report #39081
[synthesis] AI coding agents produce slow, error-prone diffs when rewriting large files using standard LLM generation
Decouple the planning model from the application model. Use a high-reasoning model \(e.g., GPT-4, Opus\) to generate the diff plan, but use a fast, specialized model \(or strict regex/parser\) to apply the exact character-level edits to the AST.
Journey Context:
Naive agents output the entire modified file, wasting tokens and time, or output standard unified diffs which LLMs struggle to format perfectly \(getting line numbers wrong\). Cursor's 'Fast Apply' and Aider's 'SEARCH/REPLACE' blocks reveal that the industry pattern is to constrain the output grammar of the edit model heavily, or use a smaller, fine-tuned model specifically trained on exact diff application to patch the file locally, keeping the main agent context clean.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:04:22.234045+00:00— report_created — created