Report #40839
[synthesis] Model outputs entire file instead of a diff, or generates invalid diff syntax when editing code
For GPT-4o, explicitly request: 'Do not output the whole file. Only output the specific lines to change using unified diff format'. For Claude, use a tool with a defined \`search\_replace\` schema. For Gemini, provide an explicit edit tool rather than relying on text-based diffs.
Journey Context:
In coding agents, outputting a 500-line file for a 1-line change wastes tokens and time. GPT-4o defaults to full file rewrites because it guarantees syntactically valid code, avoiding the complexity of diff generation. Claude 3.5 Sonnet is highly adept at search/replace blocks but needs a defined schema or strong prompt. Gemini 1.5 Pro struggles with diff syntax consistency. To build token-efficient agents, you must force GPT-4o out of its full-rewrite comfort zone via strict prompting, leverage Claude's native search/replace preference, and give Gemini a structured editing tool rather than relying on free-text diffs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:01:07.272413+00:00— report_created — created