# Review and undo what your AI agent changed

Let Claude Code, Codex or Cursor work in a fork of your drive, review exactly what changed, merge only what you approve, and undo a whole run in one step.

**Let your agents loose on real files. Merge only what you approve.**

An agent can rename a hundred files or rewrite every document, and it can get one of those changes wrong. In Orbit it can do that work in a fork. You see what it added, changed and removed, merge the parts you approve, and take back a whole run if it was wrong. Which kind of rollback fits which mistake is in [Fork and rollback](https://docs.orbitfs.io/guides/fork-and-rollback).

## How it works in one minute

1. The agent calls `fork_drive` and works in the fork. A fork copies no file data.
2. You open **Review changes**, or the agent calls `compare_fork`.
3. You merge what you approve, or you delete the fork.
4. If a merged or in-place run was wrong, undo it from **Activity**, or the agent calls `undo_changes`. Undo adds a new change. It does not erase history.

The MCP names `fork_drive`, `compare_fork`, `merge_fork` and `undo_changes` are the tool names the server publishes. `compare_fork` is how the agent reads the same comparison you see in Review changes.

## Give the agent the right access

Connect the agent with [the MCP setup](https://docs.orbitfs.io/guides/agents). On the consent page:

| Choice | Why |
| --- | --- |
| **Can edit** | Change files, restore versions, create checkpoints, merge and undo. |
| **May create and copy drives** | Call `fork_drive`. This needs **Can edit** and an owner or admin role. |
| **Only these drives** | Limit the agent to the drives the task needs. |

Leave **May delete drives** off unless the task needs it. Without **May create and copy drives**, `fork_drive` is not in the tool list.

## Have the agent fork the drive

Ask for the fork in the prompt, or fork it yourself. In the web app, open the drive's menu and choose **Fork**. In the Mac app, choose **Fork…** from the drive's **…** menu. Forking in the apps needs the owner or admin role.

A fork starts with every file, folder and version the source held at that moment. After that the two drives are independent. Nothing written to one appears in the other.

## Review the changes

In the web app, open the fork and choose **Review changes**, or **Compare with the original**. Orbit compares three states of every path the fork touched: the fork point, the fork now, and the original now.

| Mark | Meaning |
| --- | --- |
| **Ready to merge** | Only the fork changed it. Merging applies it. |
| **Already in the original** | Both drives ended with the same content. Nothing to do. |
| **Conflicts** | Both drives changed it differently. It is skipped unless you choose the fork's version for that file. The original's version stays in its history. |

Orbit does not combine two edits to the same file. A file both sides changed is a conflict, whatever its format.

`compare_fork` returns the same split. Each entry is `clean`, `same` or `conflict`, plus `fork_seq` and `source_seq`. Pass those two numbers to `merge_fork` so a drive that moved after the comparison stops the merge.

## Merge what you approve, or throw the fork away

- **Merge.** The fork's changes land on the original as one change you can undo. No file data is copied. The original takes over the fork's stored blocks. If either drive changed after the comparison you reviewed, the merge fails and changes nothing.
- **Keep some files.** Copy them into the original with any S3 client, for example rclone between the two drives.
- **Discard.** Delete the fork. The original is untouched.

`merge_fork` does this from the agent. Call it with `dry_run: true` first. Conflicts are skipped unless `on_conflict` is `fork`, and that option is for paths you have already decided. The fork itself is not changed or deleted.

## Undo a merge or a whole run

Open **Activity** on the drive that changed. It lists recent saves grouped by person, agent connection, or access key. See [Activity](https://docs.orbitfs.io/guides/activity).

- **Undo a run.** **Undo** on that entry shows the files it would change, then applies the change.
- **Undo a merge.** Undo the merge entry on the original drive. Files someone changed afterwards are left alone.

Undo adds a new change. It does not rewind history, so the undo can be undone too. A viewer can read Activity and cannot undo.

Over MCP, `list_activity` returns each run's `session`, `since_seq` and `until_seq`. `undo_changes` takes exactly one of: `mine: true` for this connection's own changes, `session` with those sequence numbers for one run, or `checkpoint_id` for everything after a checkpoint. `dry_run: true` changes nothing.

## Mark a checkpoint before a big job

A checkpoint names the drive as it is now. Create one in Activity, or have the agent call `create_checkpoint`, before in-place work. Returning to it undoes everything changed since, whoever changed it. Deleting a checkpoint removes the name only. For a broad change, `fork_drive` is still safer than a checkpoint on the original.

## Restore a single file

**Version history** on a file, then **Restore**, adds a new version with the old contents. The versions in between stay. A deleted file comes back from **Deleted files** in the drive's **⋯** menu. Over S3, `POST /<drive>/<key>?x-uls-restore&versionId=<version ID>` does the same, and `x-uls-as-of` reads a file at an RFC 3339 time. See [History and restore](https://docs.orbitfs.io/guides/history).

## From a script

Fork with a full-control key, then give the job a child key that reaches only the fork:

```http
PUT /specs-agent
x-uls-fork-source: specs
```

```json
{ "drives": ["<fork_id>"], "access": "write", "label": "agent-run-42" }
```

:::note
**Coming soon.** Orbit does not ship a command-line tool. Review in the web app, or have the agent call `compare_fork`, `merge_fork` and `undo_changes`. On a Mac, open the fork in Finder.
:::

## What this does not do

- It does not merge two edits into one file. If both sides changed a file, you pick a version.
- History is not a backup. It lives in the same drive. Keep an independent copy of data you cannot lose.
- You cannot delete one version. `DeleteObject` with a `versionId` returns `501`.
- Versions and deleted files count toward storage. A version shares the bytes it has in common with its neighbors. A fork uses no storage until it diverges.
- A workspace can have 50 forks at a time, 8 levels deep. Forks do not count toward the Individual plan's one-drive limit.

## FAQ

### Does this work with Claude Code, Codex and Cursor?

Yes, when the connection has **Can edit** and **May create and copy drives**. Those are the tools `fork_drive`, `compare_fork`, `merge_fork`, `create_checkpoint` and `undo_changes`. Without permission to create drives, `fork_drive` is not offered.

### Can I review in a terminal?

**Coming soon.** There is no command-line tool to install. Review in the web app, have the connected agent call `compare_fork`, or open the fork in Finder on a Mac.

### The agent already edited the original.

Every save is still a version. Undo that run from **Activity**, or restore files from **Version history**.

### Is the original safe while the agent uses a fork?

Yes. A write to the fork does not appear on the original until you merge.

## Related

- [Fork and rollback](https://docs.orbitfs.io/guides/fork-and-rollback)
- [Fork a drive](https://docs.orbitfs.io/guides/forks)
- [History and restore](https://docs.orbitfs.io/guides/history)
- [Activity](https://docs.orbitfs.io/guides/activity)
- [Browse and upload](https://docs.orbitfs.io/web/files)
- [Connect an agent](https://docs.orbitfs.io/guides/agents)
- [S3 for agents](https://docs.orbitfs.io/guides/s3-for-agents)
