Write tool behavior
The Write tool creates a new file or overwrites an existing one with the full content provided. It doesn't append or merge.
Whether Claude must read an existing file in the current conversation before overwriting it depends on the model and the file:
- Claude Opus 4.6, Claude Haiku 4.5, and older models always require the read, so a Write to an unread existing file fails with an error.
- Newer models can overwrite a file they never read this session under the same conditions as read-before-edit: reading it wouldn't need a permission prompt and the Read tool is available.
- Jupyter notebooks, and files Claude has read only partially with a
PARTIAL viewnotice, require the read on every model.
This constraint doesn't apply to new files. Before v2.1.228, every model required the read before overwriting an existing file.
Viewing the file with Bash also satisfies this requirement under the same rules described in Edit tool behavior.
For partial changes to an existing file, Claude uses Edit instead of Write.