Report #25097
[synthesis] How to handle multi-file code edits without breaking syntax or losing context
Decouple planning from execution. Use a strong reasoning model to generate a plan, then use a specialized 'Apply' model or a SEARCH/REPLACE fuzzy-matching parser to merge changes, ensuring syntax validity.
Journey Context:
Naive approach asks the LLM to output the whole file. This fails on large files \(context limits, latency, hallucination\). Standard unified diffs fail because LLMs cannot count lines reliably. Cursor's 'Apply' model and Aider's SEARCH/REPLACE blocks solve this: the reasoning model defines 'what' changes, and a specialized mechanism \(fine-tuned model or fuzzy string matcher\) handles 'how' to insert it, avoiding line-count errors and massive token waste.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:31:47.876678+00:00— report_created — created