sow gc
Collect unreachable local payloads or perform conservative maintenance for one publication target.
sow gc has two deliberately separate modes. With no positional target it collects unreachable
local pool payloads. With TARGET it maintains one configured publication target.
Synopsis
| Flag | Meaning | Default |
|---|---|---|
-C, --workdir DIR |
Workspace discovery start directory | current directory |
-r, --repo NAME |
Select a Repository for local GC only | selection rules |
-T, --timeout DUR |
Maximum Repository-lock wait; 0 waits indefinitely |
0 |
-N, --no-wait |
Fail immediately when the lock is held | false |
--json |
Emit the sow.cli/v1 envelope |
false |
gc TARGET -r NAME is a usage error because the target already binds a Repository. --dist is not
accepted in either mode.
Local GC
Local GC deletes only pool payloads unreachable from every safety root:
- the current Built Generation;
- explicit
retainrecords; - recovery and non-terminal Operation state;
- publication attempts and evidence;
- active maintenance work.
The operation is journaled. When payloads are removed, the Repository advances to a new Generation. When nothing is eligible, it is an idempotent no-op.
Target GC
Target maintenance is provider-specific and uses publication checkpoints, absence evidence, and configured cache grace:
| Provider | Behavior |
|---|---|
filesystem |
Conditionally delete eligible objects only after grace and recorded storage/public absence checks |
r2 |
Persist an exact report-only retained-candidate set; never issue object deletion |
A no-op means no maintenance is due, not that the target was exhaustively revalidated.
Exit behavior
| Code | Trigger |
|---|---|
0 |
GC completed or nothing was eligible |
1 |
Filesystem, provider, network, or runtime failure |
2 |
Usage, Workspace discovery, invalid sow.yml, or implicit Repository ambiguity |
4 |
Repository write lock unavailable |
5 |
Recovery, state, receipt, or manifest evidence is inconsistent |
6 |
Explicit Repository/target is not configured or safe, or deletion is rejected by a safety precondition |
See also
sow retain— create and remove explicit local rootssow publish— create target checkpoints and receipts- Publication Model — provider guarantees and cache grace