Clean up stored data
Preview a retention policy and remove eligible runtime data while preserving recoverable work.
Use a preview first, on the repository or transport that owns the data. Keep recovery material until you have inspected it. Cleaning stored objects does not prove that an abandoned sandbox or worker has stopped.
Preview a policy
Section titled “Preview a policy”Start by previewing a retention policy. The report shows which runtime entries could be removed and which remain protected. Apply it only after reviewing the result.
Without --apply, the command only prints its plan: one line per entry of .outpost, then the projected size.
--json prints { dryRun, plan } instead. --repository defaults to the current directory.
Apply it
Section titled “Apply it”Each candidate is checked again right before removal. One that changed since the plan stays, with reason PLAN_CHANGED. The output adds a REMOVED line per deleted entry.
The command exits with status 1 when the inventory is incomplete, when what remains exceeds maxBytes or maxWorkspaces, or when a candidate could not be removed.
Write the policy
Section titled “Write the policy”API reference: RecoveryRetentionPolicy.
maxBytes and maxWorkspaces never make more entries eligible: they tell you whether the policy frees enough space.
Read why an entry stays
Section titled “Read why an entry stays”An entry stays when it is too recent, active, changed since the preview or outside the selected scope. Review and save uncommitted worktree files before cleanup. Branches, conversations and recovery data deliberately remain outside this policy; their presence is not a deletion failure.
API reference: RecoveryRetentionEntry.
Prune from code
Section titled “Prune from code”planRecoveryRetention() builds the same plan as the dry run. pruneRecoveryRetention() applies it and returns what it removed and kept.
For data kept in a remote transport, pass transporter to planRecoveryRetention() and { transporter } to pruneRecoveryRetention(). Only closed-logs and task-cache apply there.
Transport pruning removes closed journal segments before their index. If a deletion fails, create a fresh retention plan and retry; the retained index keeps the remaining objects eligible. A partially pruned journal no longer provides a complete readable history.
Clean what retention keeps
Section titled “Clean what retention keeps”- Named branchesPruning a worktree keeps its branch. Delete merged ones with
git branch -d outpost/fix-tests. - Worktrees with changesCommit, copy or discard the files, after a look with Recover work.
git -C <worktree> clean -ndXpreviews ignored files; after inspection,git -C <worktree> clean -fdXdeletes only ignored files. - Cache volumesThey outlive sandboxes and images. Remove them with the container engine, label
io.outpost.cache=true(Prepare the environment).
A worktree that became clean is removed by the next run of a clean-workspaces policy.
Reserve storage between writers
Section titled “Reserve storage between writers”A reservation claims bytes in .outpost before a job writes them. It is refused when current usage, active reservations and the new request exceed maxBytes.
API reference: RecoveryQuotaOptions and RecoveryStorageReservationOptions.
A refused reservation rejects with code configuration; a failed assertRecoveryQuota() rejects with code workspace (Errors).
Inspect and recover reservations
Section titled “Inspect and recover reservations”New reservation entries record a process instance ID, host name, PID, creation time and repository, with Linux process identity when available. These are owner identifiers, not proof of remote liveness. Select the exact entry and stop its owner before recovery. The example uses the default repository Transport; use your original Transport when storage is customized.
The ledger writes format 2 and reads legacy format 1. Existing legacy byte claims remain counted and have no owner metadata; stop every potential writer before recovering such an entry. Stop old-version writers before upgrading a shared ledger: older versions cannot read format 2. Neither recovery nor release recreates a removed reservation, and recovery preserves every other entry through a conditional write.
Limits
Section titled “Limits”- Reservations coordinate writers that use them. They are not a filesystem quota: any other process can still write to
.outpost. - A reservation whose process died stays in the ledger (
reservations/ledgerin the transport) and keeps counting. UseinspectStorageReservations()to identify its owner, thenrecoverStorageReservation()with the inspected revision andprocessesStopped: trueafter stopping that owner. A concurrent ledger change refuses recovery and requires fresh inspection. - Retention never removes branches, checkpoints, artifacts, conversations, recovery transfers or locks.
- A remote transport cannot use the
clean-workspacesscope ormaxWorkspaces. - Do not delete
.outpostby hand: it can hold the only copy of unfinished work.
API: planRecoveryRetention · pruneRecoveryRetention · RecoveryRetentionPolicy · RecoveryRetentionPlan · reserveRecoveryStorage · assertRecoveryQuota · WorkspaceOptions.

