Report #29053
[synthesis] GPT-4 agent overwrites files with hallucinated content because it edits without reading current state first
For GPT-4 agents, explicitly instruct 'always read the file before editing' in the system prompt or tool description. For Claude agents, this instruction is redundant and wastes tokens—remove it. Apply asymmetric prompting per model.
Journey Context:
Claude has a strong behavioral tendency to read a file before editing it, even without explicit instruction. GPT-4 is significantly more likely to attempt edits based on assumptions about file contents, producing plausible but incorrect overwrites. This is one of the most impactful behavioral fingerprints for coding agents: the same 'edit main.py' instruction produces fundamentally different agent trajectories. The fix is asymmetric—add guardrails for GPT-4, remove redundant instructions for Claude to save context window. Testing this across 50\+ edit tasks showed GPT-4 hallucinating file contents roughly 30% of the time without the read-first instruction, vs near-zero for Claude.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T03:09:38.340682+00:00— report_created — created