Undo
edit_file and multi_edit create a backup before they write, unless you turned backup off for that call. backup is in every profile, including strict.
| Action | Use |
|---|---|
list | Recent backups. Optional filter_path, filter_operation, limit, newer_than_hours. |
info | One backup. Requires backup_id. |
compare | Backup vs a file. |
restore | Put bytes back. Requires the full backup_id. Optional file_path. preview:true shows a diff and does not write. |
undo_last | Walk one step back. Pass file_path to follow that file’s chain. preview:true shows the next step. |
undo_chain | List the chain for file_path. |
cleanup | Delete old backups. dry_run defaults to true. older_than_days defaults to 7. |
list_trash | Soft-deleted files, when --backup-dir is set. |
restore_trash | Requires sd_id. |
purge_trash | dry_run defaults to true. |
delete_file soft-deletes by default, including directories. permanent:true hard-deletes. Trash actions need --backup-dir.
The response includes a backup id. Use the full id for restore. parent_backup_id in structured edit output is the previous link in the chain. Do not scrape it from the text.
Undo restores backup bytes. It is not git restore. A later writer is not rolled back by restoring an older backup on top of their file unless you intend that.
HIGH and CRITICAL edits include a post-edit integrity check (readable, size, hash). Edits are not blocked by risk. They proceed with a backup. Path floors raise risk for .github/workflows/*, **/Dockerfile, go.mod, go.sum, and *.csproj. They never lower it. Tests and docs do not raise it.