Skip to content

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.

ActionUse
listRecent backups. Optional filter_path, filter_operation, limit, newer_than_hours.
infoOne backup. Requires backup_id.
compareBackup vs a file.
restorePut bytes back. Requires the full backup_id. Optional file_path. preview:true shows a diff and does not write.
undo_lastWalk one step back. Pass file_path to follow that file’s chain. preview:true shows the next step.
undo_chainList the chain for file_path.
cleanupDelete old backups. dry_run defaults to true. older_than_days defaults to 7.
list_trashSoft-deleted files, when --backup-dir is set.
restore_trashRequires sd_id.
purge_trashdry_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.