gabriel / muse public
gc.md markdown
72 lines 2.3 KB
Raw
sha256:b636f72dcba9e190afb980bece906fa5b717fbde014b76ef023df8cb96e01eb9 docs: expand cache plan with all seven testing tiers and do… Sonnet 4.6 132 days ago

muse gc — garbage-collect unreachable objects

Muse stores every tracked file as a content-addressed blob under .muse/objects/. Over time — after branch deletions, abandoned experiments, or squash merges — blobs that are no longer reachable from any live commit accumulate and waste disk space. muse gc identifies and removes them.

How it works

  1. Reachability walk: Starting from every live branch head and tag, Muse walks the commit graph:
    branch HEAD → CommitRecord → SnapshotRecord → manifest → object SHA-256
    
  2. Unreachable detection: Any object not reachable from step 1 is garbage.
  3. Deletion (if not --dry-run): Unreachable objects are deleted. Empty prefix directories are also cleaned up.

Usage

muse gc                  # remove unreachable objects (safe default)
muse gc --dry-run        # show what would be removed without touching anything
muse gc --verbose        # print each removed object ID

Options

Flag Default Description
--dry-run, -n false Preview only — no files are deleted
--verbose, -v false Print each collected object ID

Output

Removed 12 object(s) (48.3 KiB) in 0.031s  [247 reachable]

In --dry-run mode:

[dry-run] Would remove 12 object(s) (48.3 KiB) in 0.028s  [247 reachable]

Safety guarantees

  • The reachability walk always completes before any deletion begins.
  • --dry-run is always safe to run — even in production, even by agents.
  • GC never touches commit or snapshot records — only content blobs.
  • Running GC is idempotent: running it twice produces the same result.

When to run

Trigger Recommendation
After deleting branches muse gc
Weekly CI maintenance muse gc --dry-run to audit, then muse gc
Before muse archive muse gc to shrink the repo
After a large squash merge muse gc to free replaced blobs

Agent workflows

# Audit unreachable bloat before a deployment:
muse gc --dry-run

# Automated nightly cleanup:
muse gc 2>&1 | logger -t muse-gc

Exit codes

Code Meaning
0 Success (even if nothing was collected)
1 Internal error (corrupt store, permission issue)
File History 3 commits
sha256:b636f72dcba9e190afb980bece906fa5b717fbde014b76ef023df8cb96e01eb9 docs: expand cache plan with all seven testing tiers and do… Sonnet 4.6 132 days ago
sha256:7f9e2ef5286aedad9c1e6011b4c46ca27f39dbdad6e3409357e36b26e46b3b7c docs: docstring sprint for-each-ref→hotspots — idiomatic ru… Sonnet 4.6 patch 138 days ago
sha256:a09b1b4f6838754495547f200aa0ce88e2f56ffc5b20b900f6f0cff2c3cdede9 fix(cursorignore): remove git-ism (.git/worktrees) Human minor 141 days ago