Skip to main content

Module gc

Module gc 

Source
Expand description

gc subcommand for the management CLI (issue #66, Phase 5 of #52).

Runs the two-phase mark-and-sweep flow defined in crate::packchain::gc. Three operating modes:

  • Default: mark, then sweep. Tombstones from the current mark pass do not become eligible for sweep until at least grace_hours elapse, so the same invocation only sweeps tombstones from earlier runs. This is the cron-friendly shape: schedule gc weekly and previous weeks’ tombstones age out while the current week’s tombstones wait.
  • --mark-only: produce a tombstone but do not sweep. Useful in CI to surface orphan counts without bucket mutation.
  • --sweep-only: skip mark, only process pre-existing tombstones. Operators use this after a manual mark phase or to re-attempt deletions a previous sweep skipped.

All output is human-readable on stdout; the management CLI may write to stdout per .claude/rules/protocol-stdout.md. The formatter lives in [super::gc_output] so this subcommand and compact --with-gc (see super::compact) cannot drift apart.

Structs§

Gc
gc runner. Held by the CLI for the lifetime of one invocation.
GcOpts
Tunables for Gc::run. Field semantics mirror the CLI flags.

Enums§

GcMode
Which phases of the mark-and-sweep flow Gc::run executes.