--- name: space-backup description: Operate Space Backup, the backup app that copies a company's folders to its own computers and drives (Windows, macOS, Linux, iPhone). Use when the user asks to back up a folder, run a backup now, check whether backups are healthy, find or restore a file, folder or photo, see what happened last night, or manage destinations, paired PCs, the company key, albums or sharing. Works through the Space Backup MCP tools (status, folders_add, now, restore, ...) or the command line (sbctl on Windows, spacebackup on macOS/Linux) with --json. --- # Space Backup Space Backup copies folders of this computer to its **destinations**: drives of this PC and the drives of the company's other PCs (**peers**, paired by the same company key; backups stored on another PC are encrypted). Every run writes a **date folder** (`YYYY-MM-DD`) per destination; unchanged files are hard links, so each date folder is a full, browsable copy. Photos from iPhones, iCloud Photos and Google Drive are backed up the same way. ## How to call it - **MCP tools** (preferred when present): one tool per command, the command's words joined by `_`: `status`, `folders_add`, `runs_show`, `photos_search`. Positional arguments go in `args` (an array, in order), each option is a property of the same name without `--` (`{"args": ["/home/me/Projects"], "frequency": "weekly"}`), a flag is `true`. The result is the command's JSON plus `exitCode`. - **Command line**: `sbctl --json` (Windows), `spacebackup --json` (macOS, Linux). Always use `--json` and read the exit code. The CLI never prompts. - Give paths **absolute**. Windows paths as Windows writes them (`D:\Projects`). Exit codes: **0** ok · **1** error · **2** bad usage (nothing was done) · **3** Space Backup is not running (`start`) · **4** partial: it ran, but some files or destinations failed (read the document, then `runs_show last`) · **5** needs admin/root · **6** not invited to the company yet · **7** this computer needs another name (`settings set machine-name `). Details: [references/exit-codes.md](references/exit-codes.md). ## Rules 1. **Never delete, remove, forget, overwrite, stop, change keys or change who can read what unless the user asked for exactly that, in this conversation.** That means `folders_remove`, `dest_remove`, `dest_forget`, `key_*` (except `key_fingerprint`), `account_members`, `account_groups`, `devices_remove`, `devices_approve`, `approvals_*`, `share_*`, `albums_delete`/`_remove`/`_unshare`/`_share`, `photos_delete`, public links, `account_signout`, `stop`, `cancel`, `restore` with `overwrite`. These tools are marked destructive; ask first and say what it will do. 2. **Restore to a new folder first** (`restore` with `to` = an empty folder), let the user compare, and restore in place only when they ask. Never pass `overwrite` unless the user said to replace the current files. 3. **Do not print the company key.** Answers show key material as `[hidden]` (status's `companyKey` too); that is normal, not an error. `key_show` (the key) and `photos_open` (the viewer's secret) are refused unless `reveal` is their command's name (`"key show"`, `"photos open"`): give it only when the user asked for exactly that by name, and never put the secret in a file, a commit, a chat message or a log. To compare two PCs' keys use `key_fingerprint`. To set a key, prefer `key_set` with `file`. 4. Removing a folder or destination never deletes backups that already exist; say so when the user worries. 5. Report what the tool answered (numbers, paths, dates, failures), not what you expected. Exit 4 is not success. ## Common jobs **Is everything OK?** (health check) `status` → `state` (`idle`, `backing-up`, `busy`, `warning`, `error`), `warnings`, `lastSuccessUtc`, `lastRun`, `incomplete`, `damaged`; then `runs_show` `["last"]` (result, per destination, failed items), `dest_list` (online, `full`, `freeBytes`), `peers_list` (`online`, `reached`, `lastSeenUtc`, `version`), `folders_list` (`lastBackupUtc`, `nextRunUtc`). Summarise: last good run, anything failing, destinations offline or nearly full, folders never backed up. More: [references/health.md](references/health.md). **Back up a folder.** `folders_add` `{"args": [""]}`; options: `frequency` (`once`, `daily` (default), `weekly`, `monthly`, or `hourly`, `every:6` (hours), `daily:02:30`, `manual`, …), `dest` (`all`, `selected:` from `dest_list`, `auto:` = N copies on different PCs), `encrypt` (`on` default when signed in / `off`). Then confirm with `folders_list`. **Run now and wait.** `now` `{"wait": true}` (or `{"args": [""], "wait": true}` for just those files). Exit 0 = fully OK, 4 = finished with warnings (read `runs_show last`), 1 = nothing backed up. A long run: the call stops waiting after `timeoutSeconds` (default 600, up to 3600) but the run goes on; poll `status` (or `status` with `watch` + `until-idle`) and then `runs_show last`. **Find a file in the backups.** `history` (date folders per destination, complete or not), `browse` `{"args": [""], "date": "YYYY-MM-DD"}` (what was in a folder on that date), `explain` `{"args": [""]}` (every copy of one file and why it was or was not copied), `tx` with `path` (a glob) and `since`. **Restore safely.** See [references/restore.md](references/restore.md). In short: 1. `history` / `browse` to pick the date (`latest` = newest complete). 2. `restore` `{"args": [""], "to": "", "date": ""}`; conflicts default to `skip`, `keep-both` keeps both, `overwrite` only when the user asked. 3. Check the answer: files, bytes, `errors` (exit 4 = some failed). Tell the user where the files are. Another PC's backups: `restore` with `pc` and `to` (needs a share or an approved `recover_request`). **Find photos.** `photos_search` `{"args": ["beach 2025"]}` (albums, devices, places, periods, photos), `photos_list` with `search`, `type` (`video`, `selfie`, `screenshot`, …), `from`/`to` dates, `source`; `photos_show` / `photos_details` for one id; `photos_save` `{"args": [ids…], "to": ""}` copies originals out (safe); `photos_restore` puts them back in place (ask first). Albums: `albums_list`, `albums_show`. **What happened?** `runs_list` with `since` (`yesterday`, `7d`), `runs_show` `["last"]` or an id, `events` with `since`, `tx` with `result: "fail"`, `log` with `tail`. Live: `events`/`tx`/`log` with `follow` and `for` (bounded, at most 5 minutes per call). **Destinations and PCs.** `dest_list`, `peers_list`, `dest_add` `{"args": [""]}`; a PC appears as a destination once it runs Space Backup with the same company (`account_status`, `devices_list`). ## When something fails - Exit 3: Space Backup is not running → `start` (then retry). - `status` `warning`/`error`: read `warnings`; `runs_show last` lists failed items and destinations. - A destination offline: its PC is off or unreachable (`peers_list`: `online`, `reached`, `lastSeenUtc`); the backup goes on to the others and catches up when it is back. - Nearly full: `dest_list` `full: true`; suggest another destination or fewer kept versions (`settings_get` `max-backups`), never delete backups yourself. - Not signed in / encryption `waiting`: `account_status`; signing in is the user's step (`account_signin `, then the mailed code with `account_code`). - Still unclear: `diag` `{"out": ".zip"}` makes a support bundle without secrets; the manual is at https://spacebackup.net/manual/ (`help` `{"manual": true, "args": [""]}` gives a topic's address). References: [references/commands.md](references/commands.md) (the commands an agent uses most, with their tool names), [references/restore.md](references/restore.md), [references/health.md](references/health.md), [references/exit-codes.md](references/exit-codes.md). Full CLI reference: https://spacebackup.net/manual/cli/ · MCP setup: https://spacebackup.net/developers/