Report #66325
[synthesis] What structured output format should AI coding agents use for code edits
Use fuzzy search/replace blocks \(approximate-match code snippet \+ replacement snippet\), not unified diff, not full-file rewrite, and not line-number-based patches.
Journey Context:
Unified diffs require exact line counts and line numbers, which LLMs reliably get wrong. Full-file rewrites are token-expensive and have unbounded error surface. Line-number patches cascade errors on any offset mistake. Fuzzy search/replace works because LLMs are good at reproducing approximate code snippets and the matching algorithm tolerates minor discrepancies. Aider pioneered this with SEARCH/REPLACE blocks; Cursor's 'apply' independently converged on the same pattern; Copilot's inline diff is a UI-layer version of the same idea. The tradeoff: fuzzy matching can misfire on highly repetitive boilerplate, mitigated by including enough surrounding context in the search block to disambiguate.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:48:25.222799+00:00— report_created — created