pathstringrequiredThe file.
old_stringstringrequiredWhat to replace. Exact, whitespace included.
new_stringstringrequiredWhat to put there.
replace_allbooleanfalseReplace every occurrence instead of requiring one.
Read the file first
A string copied from memory rather than from the file usually differs by a space or a tab, and the edit fails. The instruction to read before editing is in the system prompt for that reason — and a failed edit costs a turn.
Unique, unless replace_all
A string appearing twice is refused: replacing one of two identical passages is ambiguous, and guessing which would be worse than failing. Add more surrounding context to make it unique, or set replace_all.
Several edits in one file
Use multi_edit: one call, applied in order, all or nothing. Several edit calls on one file cost a turn each.