transaction_apply
Apply coordinated multi-file edits atomically with full validation and rollback, ensuring changes land as one unit or none at all.
Instructions
Apply str_replace edits across multiple files atomically. Every operation is validated against the on-disk content first; if any old_string is missing or ambiguous, NO files are written. If writes start succeeding but one fails partway, the already-written files are rolled back to their pre-transaction content. Writes are crash-durable: each temp file is fsynced before its rename and every touched parent directory is fsynced before the call returns. Per-path locks prevent interleaving with other write tools. Use for refactors that must land as one unit (cross-file rename of a string, coordinated config + caller updates, etc.). Up to 50 operations per call. The response lists each file with a per-file unified diff (unless show_write_diff is disabled).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dirty_ok | No | Allow editing files that have uncommitted changes in their git repository. Default false — the transaction is refused if any target file is dirty. Pass true to proceed anyway. | |
| operations | No | Ordered list of per-file edit groups. Every file is validated first; only if all validate do any writes happen. |