Report #87025
[synthesis] AI coding agent regenerates entire files when making targeted edits
Use diff-based or search-and-replace application: generate only the changes via structured diff format, then apply them with a dedicated fast apply model or deterministic patcher. Separate the 'think' model from the 'apply' model.
Journey Context:
Early AI coding tools generated entire files, causing massive token waste, losing user modifications outside the edit zone, and making review impossible. Aider pioneered the SEARCH/REPLACE diff block approach. Cursor takes this further with a dedicated 'apply model' — a fast, specialized model that takes the large model's edit description and applies it precisely to the file. This two-model split is the key insight: generation quality and application precision are different capabilities requiring different optimization targets. The apply model can be small and fast because it only needs to understand file structure and apply targeted changes. Single-model approaches either waste tokens on unchanged code or fail to apply edits precisely. The diff format also enables human review: showing a diff is natural; showing a full regenerated file is not.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:39:48.250773+00:00— report_created — created