Coding agentsBeta
Crew checkpoints: file snapshots around agent turns
When an agent in a git repository starts working, and again when it stops, the agents engine records a checkpoint of the whole working tree, untracked files included. You can see exactly what a turn changed and put files back, without touching your branches.
Turn checkpoints on or off
Checkpoints for threads are on unless you turn them off.
- On the Crew page, open Filter (⇧⌘F) and choose Edit launch settings.
- Under Thread engine, turn Save a checkpoint each turn on or off.
See what a turn changed
- Open a thread and press Diff (⌘D) in its toolbar.
- Pick All turns, Latest turn or one turn from the list.
The diff shows the files that turn changed. Use the diff options to show changes side by side or stacked, hide whitespace changes or hide test files.
Revert a turn
- In the thread's Diff (⌘D), pick the turn.
- Press Revert, then Revert files to confirm. Files go back to the checkpoint before that turn.
If another agent is using the same folder, Crew warns that restoring could erase its changes and asks you to confirm with Restore anyway.
Rewind the conversation too
Hover one of your messages and press Edit from here (the undo button) to remove that message and everything after it from the conversation. The agent must not be in the middle of a turn, and not every agent supports it:
- Revert and keep changes only rewinds the conversation.
- Revert files too also puts the worktree back to the checkpoint from before that message, including edits you made yourself. It shows for threads that work in a worktree.
How checkpoints are stored
Checkpoints are commits stored under hidden refs, refs/edith/checkpoints/, in the same repository. They never touch your index, your branches or your stash, so git status and git log look the same as before.
Each checkpoint has an id such as cp_01 and belongs to an agent pane or a thread.
What a restore does
Restoring puts the repository, or only the paths you name, back the way the checkpoint had them:
- Tracked files are rewritten.
- Untracked files that did not exist in the checkpoint are removed.
- Ignored files are left alone.
The engine takes a safety checkpoint first, so a restore can itself be undone with another restore.
From the terminal
The terminal also reaches checkpoints of terminal agents, takes checkpoints by hand and cleans up old ones.
ed crew checkpoints ls --cwd ~/code/apped crew checkpoints diff cp_01 --stated crew checkpoints create --label "before the refactor"ed crew checkpoints restore cp_01 --path Sources/App.swifted crew checkpoints prune --keep 200lslists checkpoints newest first.--paneand--threadnarrow it to one agent.diffcompares a checkpoint with the next one, which is what that turn changed.--to worktreecompares it with your files as they are now.createtakes a checkpoint before you try something risky by hand.restorerefuses while another agent works in the repository, unless you pass--force.rmdeletes checkpoints, andprunekeeps the newest, 2000 unless--keepsays otherwise. Deleting a thread also deletes its checkpoints.ed crew thread rollback th_01 run_03is the same as Edit from here, and--keep-filesonly undoes the conversation.
Every command takes --machine box to work on a machine you added in Machines, with that machine's paths. See ed crew checkpoints for every option.