SHEPHERDdocs Search the docs/ v0.5.3-beta
On this pageSnapshotsGo back after a bad edit

Snapshots

Automatic copies of each agent worktree, with a diff and a restore that saves what was there first.

Works inDesktop appTerminal UICLI

Snapshots

Shepherd photographs an agent's worktree on its own: when the agent goes idle, when it finishes, and every interval_secs while it works. You can also take one by hand. Before a destructive action (restore, kill) it saves a pre-restore or pre-kill snapshot first.

shepherd snapshot capture coder-1
shepherd snapshot list --agent coder-1
shepherd snapshot diff coder-1/1                      # against the current state
shepherd snapshot restore coder-1/1 --confirm         # saves 'pre-restore' first
shepherd snapshot restore coder-1/1 --path main.go --confirm
shepherd snapshot prune --agent coder-1 --keep 10

The native app and the terminal UI offer the same: capture, compare with the current worktree, restore, delete and prune.

Snapshots live in refs/shepherd/snapshots/<agent>/<n> inside your repository. They do not touch your branch or your index.

Go back after a bad edit

Snapshots are copies of an agent's worktree. The server takes them when an agent goes idle or finishes; you can take one by hand.

$ shepherd snapshot capture coder-1
created snapshot coder-1/1 (manual, 6 file(s), +20 -0)

# ... a bad edit happens ...

$ shepherd snapshot diff coder-1/1
coder-1/1 -> current
M f.txt +1 -0
1 file(s), +1 -0

$ shepherd snapshot restore coder-1/1 --confirm
restored 6 file(s) from coder-1/1
previous state saved as coder-1/2 (pre-restore)

The restore saved what was there first, so you can undo the undo. To bring back one file: snapshot restore coder-1/1 --path f.txt --confirm. Keep only the newest ones:

$ shepherd snapshot prune --agent coder-1 --keep 1
pruned 1 snapshot(s): coder-1/1 (1 kept)

In the app: Snapshots, Compare with the worktree now, Restore worktree, Prune older ones. In the terminal UI: t on an agent.

Was this page useful?Suggest an edit on GitHub