Skip to content
Edith

Agent docs

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.

  1. On the Crew page, open Filter (⇧⌘F) and choose Edit launch settings.
  2. Under Thread engine, turn Save a checkpoint each turn on or off.

See what a turn changed

  1. Open a thread and press Diff (⌘D) in its toolbar.
  2. 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

  1. In the thread's Diff (⌘D), pick the turn.
  2. 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.

Terminal
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 200
  • ls lists checkpoints newest first. --pane and --thread narrow it to one agent.
  • diff compares a checkpoint with the next one, which is what that turn changed. --to worktree compares it with your files as they are now.
  • create takes a checkpoint before you try something risky by hand.
  • restore refuses while another agent works in the repository, unless you pass --force.
  • rm deletes checkpoints, and prune keeps the newest, 2000 unless --keep says otherwise. Deleting a thread also deletes its checkpoints.
  • ed crew thread rollback th_01 run_03 is the same as Edit from here, and --keep-files only 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.

Where to go next