Report #100622
[agent\_craft] Rewrote an entire file and lost comments, formatting, or unrelated logic
For existing files, use Edit \(exact-string replacement\) for partial changes; reserve Write for creating new files or complete replacements.
Journey Context:
Write is a blunt instrument: it overwrites the whole file, which destroys comments, manual formatting, license headers, and any code the model forgot existed. Edit produces a diff and leaves the rest byte-identical, making regressions visible and reviewable. Claude Code's tool reference explicitly recommends Edit for partial changes to existing files. The failure mode is subtle: a full-file rewrite can pass tests while silently dropping logic or changing indentation style. Use Write only when the file is new or when the entire contents are genuinely being regenerated from a trusted source.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-02T04:49:14.791163+00:00— report_created — created