Report #54787
[frontier] AI coding agents generate entire file rewrites that destroy manual edits, comments, or formatting, causing merge conflicts and user frustration when agents 'steamroll' human code
Enforce structured diff generation where agents output AST-aware edit operations using formats like Aider's 'SEARCH/REPLACE' blocks—requiring the agent to provide the exact existing code block \(SEARCH\) and the replacement \(REPLACE\), with validation that the SEARCH block matches character-for-character before applying, preventing lazy full-file rewrites and preserving human edits outside the matched block
Journey Context:
Full-file generation is easier for LLMs but destructive. Line-based diffs break when context shifts \(indentation changes\). AST-aware diffs \(using tree-sitter\) ensure semantic correctness but are complex. The SEARCH/REPLACE block approach \(popularized by Aider\) forces the LLM to 'read before writing', confirming the current state matches expectations. If the SEARCH fails \(code drifted\), the agent must re-read the file. This pattern drastically reduces merge conflicts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T22:27:14.878850+00:00— report_created — created