snapback — undo for your machine
snapback run -- <any command> # cheap snapshot first, then run it
snapback undo # didn't like it? put everything back
We hand filesystem access to AI agents, migration scripts, and codemods every
day — and the rollback story below "restore the whole VM" is usually nothing.
git checkout doesn't cover your SQLite file, your untracked uploads dir, or
the Postgres volume your migration just mangled.
snapback is that missing layer: one command to checkpoint the working tree, your databases, and your container volumes — and one command to snap back.
Quickstart
pip install snapback-cli
snapback run -- python migrate.py # snapshot, then run
snapback undo # roll back the tree (and undo is undoable: `snapback redo`)
snapback snap -m "before letting the agent loose" # manual checkpoint
snapback list # what can I go back to?
snapback diff # what changed since the last snapshot?
snapback gc --keep 5 # prune old snapshots
No config needed — by default snapback snapshots the working tree (minus
.snapback/ itself). Zero dependencies, Python ≥ 3.11.
Beyond files: databases and volumes
Drop a snapback.toml in the project root to declare extra targets:
[snapshot]
ignore = ["node_modules", "*.log", "app.db"] # skip in tree snapshots
[[target]]
backend = "sqlite" # consistent even while the app holds the db open
path = "app.db" # (uses SQLite's online backup API, not file copy)
[[target]]
backend = "docker-volume" # tar the named volume via a helper container
volume = "pgdata"
Every snapback run / snap / undo now covers all three: tree + db +
volume, atomically bookended around your risky command.
How it works
- Snapshots live in
.snapback/snapshots/<id>/with ameta.jsonrecording the command, targets, and per-backend payloads. undorestores the newest snapshot — but first it saves the current state as apre-undosnapshot, soredogets you back. Undo is never a trap.runpasses the wrapped command's exit code through untouched, so it slots into scripts and CI:snapback run -- make deploy-staging.diff [id]shows what changed since a snapshot (A/D/Mper path) — check what the agent actually did before deciding whether to undo it.- Backends are one file each in
snapback/backends/, discovered automatically.snapback backendslists what your install supports.
Storage backends
| Backend | Status | Strategy |
|---|---|---|
copytree |
✅ shipped | portable file copies; works everywhere, no privileges |
sqlite |
✅ shipped | SQLite online backup API; consistent under live connections |
docker-volume |
✅ shipped | tar via throwaway alpine container |
apfs |
✅ shipped | tmutil localsnapshot on macOS — O(1), copy-on-write; run sudo -v before restore, snapshots auto-purge in ~24 h |
btrfs |
🙋 help wanted | btrfs subvolume snapshot — O(1), copy-on-write |
zfs |
🙋 help wanted | zfs snapshot / zfs rollback |
overlayfs |
🙋 help wanted | run the command in an overlay, commit or discard |
postgres |
🙋 help wanted | pg_dump / restore, or template-database clone |
mysql |
🙋 help wanted | mysqldump / restore |
restic |
🙋 help wanted | dedup'd remote snapshots via restic repo |
A backend is one file. It exposes NAME, snapshot(spec, payload_dir, root) -> payload, and restore(spec, payload_dir, root, payload) — see
snapback/backends/sqlite_db.py for the
shape (60 lines). One backend or one integration per PR; see
CONTRIBUTING.md.
What snapback is not
- Not a backup tool — snapshots are local, short-lived checkpoints, not
disaster recovery.
gcthem freely. - Not filesystem magic by default — the portable backend copies files. Switch
the tree target to
apfs(or a futurebtrfs/zfs) for O(1) CoW snapshots. - Not a sandbox — the command really runs. snapback makes it reversible, not contained.
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snapback_cli-0.1.0.tar.gz.
File metadata
- Download URL: snapback_cli-0.1.0.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c376c23d023b614e7e3a3ba311d3fe644307bb2e21129539620f05fd8579e59b
|
|
| MD5 |
03d68f6063ee8d0ffd8ef96df0fb9aed
|
|
| BLAKE2b-256 |
25c459a0597a1c302ba56c6f73edeb88d8d916def2a66b2c07f2541045bb9c43
|
Provenance
The following attestation bundles were made for snapback_cli-0.1.0.tar.gz:
Publisher:
release.yml on sophie-nguyenthuthuy/snapback
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
snapback_cli-0.1.0.tar.gz -
Subject digest:
c376c23d023b614e7e3a3ba311d3fe644307bb2e21129539620f05fd8579e59b - Sigstore transparency entry: 2388634561
- Sigstore integration time:
-
Permalink:
sophie-nguyenthuthuy/snapback@59a4e3c9185e280fb6dc520be013daaca8c96265 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sophie-nguyenthuthuy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@59a4e3c9185e280fb6dc520be013daaca8c96265 -
Trigger Event:
push
-
Statement type:
File details
Details for the file snapback_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: snapback_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37667742d64a82a7dfb2dbe7da6d73e957eec4ea13b2c492aa71eac7ff8f3fd8
|
|
| MD5 |
a3dfa55ea85bca411d07d6f1abb94783
|
|
| BLAKE2b-256 |
4620c01afdad144cd31a15524f7a6cfa499154d9ea95646847591cb35ac63cb3
|
Provenance
The following attestation bundles were made for snapback_cli-0.1.0-py3-none-any.whl:
Publisher:
release.yml on sophie-nguyenthuthuy/snapback
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
snapback_cli-0.1.0-py3-none-any.whl -
Subject digest:
37667742d64a82a7dfb2dbe7da6d73e957eec4ea13b2c492aa71eac7ff8f3fd8 - Sigstore transparency entry: 2388634579
- Sigstore integration time:
-
Permalink:
sophie-nguyenthuthuy/snapback@59a4e3c9185e280fb6dc520be013daaca8c96265 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sophie-nguyenthuthuy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@59a4e3c9185e280fb6dc520be013daaca8c96265 -
Trigger Event:
push
-
Statement type: