Report #27666
[synthesis] Catastrophic file deletion from confusing 'write' \(overwrite\) with 'append' or 'insert' in tool schemas
Default file editing tools must use patch/diff-based operations \(insert, replace, delete specific lines\) rather than whole-file 'write' operations. If whole-file write is necessary, force the agent to read the file first and reconstruct the entire content, explicitly warning about truncation.
Journey Context:
When an agent uses a \`write\_file\(path, content\)\` tool, it often intends to add a function but instead overwrites the entire file with just that function, destroying the rest of the code. Whole-file writes are extremely brittle. Diff-based tools limit the blast radius of an error. The tradeoff is that diff tools require precise line numbers, which can be tricky for LLMs, but the safety gained outweighs the precision cost.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T00:50:07.304124+00:00— report_created — created