backups
CLI reference for the apothem backups command group.
Manage the install backups and ledger history Apothem keeps.
backups is a command group with one subcommand: prune.
Synopsis
apothem backups prune [--keep N] [--harness NAME|all] [--dry-run]
[--quiet|-q] [--verbose|-v]
[--format plain|json] [--json] [--no-color]Subcommands
backups prune
Delete backup sets and install records beyond the newest N per harness.
Every install, uninstall and rollback first copies what it changes into a
timestamped backup set under ~/.apothem/backups/<timestamp>/<harness>/, and
appends a record to the harness's install ledger under
~/.apothem/state/<harness>/ledger.jsonl. After each of those passes Apothem
already keeps the newest 10 of each. backups prune runs the same retention on
demand, with your own bound:
- For each selected harness it keeps the newest
Nbackup sets and deletes the older ones. A timestamp directory left empty is removed too. - In the harness ledger it keeps, per install root, the newest
Ninstalls whose changes are still in place, and every record after the oldest of them. An older install can no longer be rolled back by id. - It never deletes a backup set that a kept ledger record, or the latest
install record of any install root, still references.
apothem rollbackof the latest install therefore still restores after any prune. Uninstall and rollback records reference the backups those passes took, so they stay while the record is kept. So does theuninstall-incompleterecord an unfinished uninstall leaves (see uninstall), which is kept with the install it belongs to. A root with nothing installed keeps the record of its last uninstall that finished and every record after it, or only its last record when no uninstall there finished, and the backups those records reference stay with them. - It never deletes a backup set holding a path that earlier releases
removed whole though it held your own files, such as a folder of your own
commands, hooks or rules (the changelog lists examples),
including such a path under a custom
CODEX_HOME. Those sets stay until you delete them yourself. To list them, runapothem backups prune --keep 1 --dry-run --verbose: each such set shows askept (holds a path an earlier release removed), and nothing is deleted.
prune follows a link at ~/.apothem. When ~/.apothem is a link, it
deletes the old backup sets at the far end of that link, also when the link
leads out of your home directory. Automatic retention after each install,
uninstall and rollback does the same. A link inside a backup set is removed as
a link; prune does not enter it.
With --dry-run nothing is changed: the command reports what a real prune
would remove. Backups and the ledger are kept per harness, not per project, so
prune takes no --project; a project-scope harness is pruned across every
project it was installed into.
| Option | Description |
|---|---|
--keep N | Backup sets per harness, and install records per install root, to keep (default: 10; at least 1). |
--harness NAME | Harness adapter to prune, or all for every registered harness (default: all). |
--dry-run | Report what would be pruned; delete nothing. |
--quiet, -q | Suppress informational output; only errors are emitted. |
--verbose, -v | Also list each backup set removed, and each one kept, with why: kept (still referenced) for a set a record references, kept (holds a path an earlier release removed) for a set holding a copy of a path an earlier release removed whole. |
--format plain|json | Output format (default: plain). |
--json | Shorthand for --format json. |
--no-color | Disable ANSI color codes in output. |
-h, --help | Show help and exit. |
JSON output
{
"schema_version": 1,
"status": "success",
"command": "backups prune",
"action": "pruned",
"harness": "cursor",
"profile_path": null,
"project": null,
"files_written": [],
"results": [
{
"harness": "cursor",
"outcome": "updated",
"operation": "prune",
"path": "/home/example/.apothem/backups/20260101T120000Z/cursor",
"message": "removed backup set 20260101T120000Z"
},
{
"harness": "cursor",
"outcome": "updated",
"operation": "prune",
"path": "/home/example/.apothem/state/cursor/ledger.jsonl",
"message": "dropped 3 of 4 install ledger records"
}
],
"warnings": [],
"error": null
}Every row has "operation": "prune":
"outcome": "updated"— a backup set removed, or ledger records dropped (under--dry-run, the same rows describe what would be removed, and the message starts withwould removeorwould drop);"outcome": "skipped"— a backup set older than the newestNthat is kept, either because a ledger record still references it (the message endsa ledger record still references it) or because it holds a copy of a path an earlier release removed whole (the message endsit holds a path an earlier release removed, which may be your only copy);"outcome": "unchanged"— a harness with nothing to prune;"outcome": "error"— a harness whose ledger could not be read (nothing is pruned for it), or a backup set that could not be fully removed.
status is success, dry_run, partial, or error, following the exit
code.
Examples
apothem backups prune
apothem backups prune --keep 3 --dry-run
apothem backups prune --harness claude-code --keep 1 --jsonExit codes
| Code | Meaning |
|---|---|
| 0 | Pruned, or nothing to prune |
| 1 | Expected error — unknown harness, or no harness could be pruned (an unreadable ledger, or a backup set that could not be removed) |
| 2 | Partial prune: at least one harness was pruned before a failure |
| 64 | Usage error: an unknown option or command, or a missing or invalid option value (including --keep below 1). Under --json the error is a JSON envelope with code cli.usage. |
See also
- apothem rollback — restore a harness to the state before its recorded install
- apothem uninstall — remove a harness configuration
- Uninstalling — remove Apothem and its state