# Files, history and restore

> Where your agent's files live, how they are backed up, how to see and restore past versions, and how to take everything with you.

Everything an agent knows and builds is in ordinary files on its own disk: its instructions, memory, notes,
databases, the apps it wrote. Nothing is locked in a format of ours.

## What persists

- The **home directory** (`/home/agent`) persists: it survives restarts, stops and updates.
- Anything installed **outside** the home directory (system packages) is gone after a restart. Install tools
  in the home directory, or keep a setup script there.
- **Processes** the agent started itself (a server, a bot) are not restarted for it after a restart. Run them
  as [routines](routines.md), or note how to start them again.
- On Mue, to save space, the agent's housekeeping cleans up what can be rebuilt when it sits idle: build outputs (`target/`,
  `.next`…) and download caches, and, when the disk is well over its size, `node_modules` and Git clones whose
  work is all pushed. Chat attachments not touched for 30 days are removed (7 days when the disk is nearly
  full).

## Backups and restore points

Every instance is backed up automatically:

- **Restore points** of the whole agent every **15 minutes**.
- **File history**: each file keeps its **3 latest versions** plus its state at each of the **last 7
  midnights** (UTC), for up to **7 days**. Deleted files can be brought back within the same window.

To go back in time:

- **One file**: open the file explorer of the instance, open the file's history, compare two versions side by
  side and restore the one you want. A Mue agent can do it for you: ask it.
- **The whole agent**: open the instance's **Storage** tab, choose a restore point and confirm. The instance
  restarts on that state after a few seconds.

We back up every instance by this rule. For data that is critical to you, keep a copy of your own as well
(see [Taking your data with you](#taking-your-data-with-you)).

## Browsing and editing files

- **Dashboard**: the file explorer shows the agent's files, lets you search, read, edit and download them,
  and opens SQLite databases read-only.
- **Agent**: it works on its own files directly, of course.
- **SSH**: `scp` and `sftp` work with the instance's SSH access. See [SSH](network.md#ssh).
- **API**: the `/v2/instances/{id}/fs/*` routes list, search, read, write and delete files, show recent changes,
  and read and restore versions. They work **whatever the instance's state**, even when it is stopped. See the
  [API reference](https://www.molted.net/api/docs/v2).

Paths in the API are relative to the home directory: `workspace/notes.md`, not `/home/agent/workspace/notes.md`.

## Taking your data with you

Your files are yours. To take everything:

- copy the home directory over SSH (`scp -r` or `sftp`), or
- ask your agent to make an archive and download it from the file explorer, or
- walk the tree with the file API and download each file.

## Limits

- Chat attachments: up to 10 MiB per file.
- Disk size: the size of the instance ([Sizes](sizes.md)). Change the size to get more.

> **With Enterprise, on request:** we can offer longer retention, larger disks, and backups kept where you
> choose, including on your own infrastructure. See [What Enterprise adds](enterprise.md#talk-to-us).
