OpenCode Backups
opencode_backupsBack up the opencode database and config with rotation and disk guard. Create, list, restore, prune, or delete backups to recover data when needed.
Instructions
Backup the opencode database and config with rotation + disk guard; restore when needed.
Return Format
{"success": bool, "message": str, "data": dict}
Examples
opencode_backups(action="status") opencode_backups(action="create", kind="all") opencode_backups(action="list", kind="db") opencode_backups(action="restore", name="opencode-db-20260802-120000.sqlite3", confirm=True)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | Target: database, config directory, or both (create/prune) | all |
| name | No | Backup filename (required for restore/delete) | |
| force | No | Allow restore while opencode serve is running | |
| action | Yes | status: paths, free space, counts, last backup. create: take a snapshot of the database (kind=db), config (kind=config), or both (kind=all). list: backups with sizes/dates. prune: drop old backups beyond retention. restore: overwrite the database or config from a backup (confirm=True; refuses while opencode serve is running unless force=True). delete: remove one backup file. | |
| confirm | No | Must be True for restore (overwrites live data) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||