Workspace checkpoint
project_snapshotCreate a checkpoint of workspace files before multi-file refactors or renames, then restore all changed files in one call if edits go wrong. Content-addressed and deduplicated.
Instructions
Checkpoint/rollback for the workspace: snapshot the current bytes before a large edit chain, then restore in one call. Content-addressed and deduplicated (only changed files cost new space). Use when: before a multi-file refactor/rename: action=create (paths defaults to ['.']) then action=restore with the returned id if the change goes wrong. Avoid when: the repo is clean in git (git is cheaper), or only one file changed and can be re-edited. Speed: create walks/hashes the captured files (skips .git/node_modules/dist, symlinks, huge files); repeats only store new blobs. restore is atomic per file, concurrency 4, sha256-verified by default. Output: snapshot_create: id, label, file_count, total_bytes, new_blob_bytes, skipped[], truncated; snapshot_list: checkpoints[]; snapshot_restore: restored_count/restored[], deleted_count, skipped[]; snapshot_delete: deleted, bytes_freed. Batch-safe: no
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Checkpoint id (required for restore/delete; returned by create/list). | |
| label | No | Human label for the checkpoint, e.g. "before refactor auth". | |
| limit | No | list only: max checkpoints to return (default 20). | |
| paths | No | Paths to capture (default ['.']); restore accepts a subset to filter files. | |
| action | No | create | |
| reason | No | Why this change is made (e.g. "sua loi null pointer o dong 45"). Recorded in the audit trail so later sessions know the intent. Single line, max 400 chars, secrets are redacted. | |
| verify | No | restore only: sha256-verify each blob before writing (default true). | |
| dry_run | No | restore only: report what would change without writing. | |
| exclude | No | Extra directory/file names to skip. | |
| max_files | No | ||
| delete_extra | No | restore only: also delete files inside captured dirs that are not in the checkpoint (default false, capped at 500). | |
| max_total_bytes | No | ||
| respect_default_excludes | No | Default true: skip .git/node_modules/dist/build/.next/.venv/__pycache__ and the snapshot store itself. |