# Back up and restore the board

Everything the board knows lives in one folder, so a backup is one copy. This page shows what is
in it, how to back it up and restore it, how to free the space old workspaces take, and how to
move tickets to another board or another machine.

## Where the data lives

The binary and the desktop app keep everything the board writes in `~/.rev0`.
`REV0_DATA_ROOT` moves the whole tree.

| Path | What it holds |
| --- | --- |
| `rev0.db` (with `rev0.db-wal` and `rev0.db-shm`) | The database: every board, ticket, comment, plan, setting and the agents' timelines. |
| `.env` | Environment variables the board loads at start, such as `REV0_AUTH_TOKEN`. |
| `uploads/` | Files you attached and artifacts agents uploaded. |
| `scratch/` | One folder per ticket that runs with no repository. |
| `background_jobs/` | Background tasks' state and their logs. |
| `plugins/` | Checkouts of external plugins. |
| `skills/` | The index of skills the board installs for every agent engine. |
| `extensions/` | Browser extensions for tickets' browsers, such as a password manager. |
| `computers/` | Each ticket's browser profile. |
| `runner-stalls.log` | Diagnostics written when something holds up the runner for everyone. |

Git worktrees are not in here: each sits next to its repository, in a
`<repo>.agent_worktrees` folder. Your repositories hold the agents' branches and commits, so back
them up as you already do.

The older, narrower overrides `REV0_DB`, `REV0_SCRATCH_ROOT`, `REV0_PLUGIN_CACHE` and
`REV0_BGJOBS_DIR` still work. All of them are listed in
[Configuration](../reference/configuration.md).

## Make a backup

1. Stop the board: **Quit rev0** in the desktop app, or Ctrl+C in the terminal that runs it.
2. Copy the whole root as one unit:

   ```bash
   cp -a "${REV0_DATA_ROOT:-$HOME/.rev0}" "$HOME/rev0-backup"
   ```

3. Start the board again.

**Result:** `~/rev0-backup` is a complete, consistent copy. Copying while the board runs can
catch the database halfway through a write, so stop it first.

## Restore a backup

1. Stop the board.
2. Move the current root aside, for example `mv ~/.rev0 ~/.rev0-old`.
3. Copy the backup back to the same path: `cp -a ~/rev0-backup ~/.rev0`.
4. Start the board.

**Result:** the board is back to where it was when you took the backup. Restore the whole root,
never only the database: its tickets refer to uploads and workspaces in the rest of the tree.

## Free space

Scratch folders and worktrees stay on disk after their tickets finish, so you can go back to them.
To delete the ones you no longer need:

1. Open **Settings > System > Storage**. It lists every scratch folder and worktree across all
   boards, with its ticket, kind, size and path.
2. Tick the rows marked **Ready to clean**. The others say why they are kept: an agent may still
   use it, uncommitted files need preserving, or its branch is not fully merged.
3. Click **Clean selected**, then confirm.

**Result:** the selected folders are deleted, and the space is free. The tickets, their branches
and your database are untouched. On a ticket that is merged, Done or Discarded, **Delete
worktree** under **More**, on the bar under its header, does the same for one ticket.

To keep the database from growing, set **Agent transcript retention (days)** in
**Settings > General > Global preferences**: agents' raw transcripts on finished tickets are deleted once
they are that old, while comments, plans and history stay.

## Move tickets between boards or machines

To move a ticket to another board on the same machine, open it, click **…** (**Ticket actions**)
and pick a board under **Move to board**. Its whole tree moves with it. See
[Organize the board](organize-the-board.md#move-a-ticket-to-another-board).

To move a ticket to another machine, export it from one board and import it into the other. There
is no button for this yet, so use the API:

1. Export the ticket and all its subtickets as JSON:

   ```bash
   curl -H "Authorization: Bearer $REV0_AUTH_TOKEN" \
     http://127.0.0.1:8000/tickets/42/export > ticket-42.json
   ```

2. On the other machine, import it into a board, here the board with id 1 (`GET /boards` lists
   the ids):

   ```bash
   curl -H "Authorization: Bearer $REV0_AUTH_TOKEN" -H "Content-Type: application/json" \
     -d "{\"data\": $(cat ticket-42.json), \"board_id\": 1}" \
     http://127.0.0.1:8000/tickets/import
   ```

**Result:** the ticket tree is recreated with new ids, with its description, plan, comments, tags
and artifact list. Branches, worktrees, agent sessions and permission requests do not travel: the
tree arrives ready to run again, not mid run. Drop the `Authorization` header on a board with no
token.

To move a whole board to a new machine, [make a backup](#make-a-backup) and restore it there.

## Related

- [Fix common problems](troubleshooting.md), for refused starts and where the logs are.
- [Install rev0](install.md#updating), for how upgrades are taken.
- [Organize the board](organize-the-board.md), to split tickets across boards.
