Skip to content

[Feature] Mission repo copies use full rsync -a — switch to APFS clonefile / hardlinks to stop duplicating repo storage per mission #15

Description

@ro0mquy

Problem

internal/mission/repo.go's CopyRepo copies the repo-library repo into each mission's agent/ directory with plain rsync -a (no --link-dest, no clonefile). This produces a full, independent copy of the working tree, including .git. Nothing is shared between missions, even when many missions clone the exact same repo.

Impact (real numbers from one user's machine)

  • Each mission that uses a repo carries a complete copy. Example: every Exobrain mission has a ~600 MB .git pack and totals ~1.1 GB.
  • Across 442 missions this reached ~161 GB, the large majority of it redundant (a handful of repos cloned hundreds of times). Verified independent copies: no alternates, link count 1, distinct physical blocks.

Request

Make the mission agent/ copy space-efficient. Options, best-first on macOS:

  1. APFS clonefile / cp -c — copy-on-write clone from the repo-library copy. Instant, shares physical blocks, and diverges only on write. Ideal on APFS.
  2. git clone --local — hardlinks .git/objects from the source repo.
  3. rsync --link-dest=<repo-library-copy> — hardlinks unchanged files.

Since ~/.agenc/repos/<repo> already holds the canonical copy, the mission agent/ could be a COW clone / hardlink of it rather than a fresh rsync.

Caveat to acknowledge

In-mission git repack / gc will diverge hardlinked packs over time (so git clone --local savings erode as missions age). APFS clonefile handles this gracefully via copy-on-write, which makes it the most robust choice on APFS. Even the initial savings are large.

Secondary suggestion

Add a first-class agenc mission gc / prune command that deletes old missions' agent/ directories while keeping the mission record + session transcript (for provenance). Today the manual method is deleting the agent/ dir inside each old mission; a built-in command (e.g. "delete agent/ for missions older than N days") would make reclaiming existing bloat easy.


Filed via Adjutant

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions