pathstringrequiredRelative to the workspace. Parent folders are created.
contentstringrequiredThe whole file.
For an existing file, prefer edit
Rewriting a file whole costs its whole length in output tokens
The agent is instructed to use edit or multi_edit on a file that exists, and write only for new ones. A 600-line file rewritten to change one line is 600 lines of output, paid for and slow.
Nothing is lost
Replacing a file writes the previous content under .versions/ first. That is what lets auto mode let writes through without asking.
Text only
Content is a string. Generated media is written by its own tool, and a converted file by convert.