simgit

Running a handful of coding agents on one repository means a handful of full
copies of it on disk. simgit removes the copies and keeps the isolation.

Each agent gets its own real, separate Git working tree — its own branch, index
and checkout — but unchanged files share physical disk instead of being
duplicated, so an extra microsoft/vscode worktree costs 10 MiB instead of
567 MiB. There is no daemon and no server: Git owns the refs, the filesystem
owns the data.
simgit is the canonical executable, used in every example below. Every
installation also provides sg as a fully equivalent short alias.
What a worktree costs
Plain git worktree gives each agent a full copy of the working tree — N
agents × repo size on disk. simgit add keeps the isolation and drops the
duplication: every worktree is a real .git/worktrees checkout whose
unchanged data is copy-on-write shared with one cached baseline (reflink, or a
fuse-overlayfs mount where reflink is unavailable).
The number that matters is the marginal cost of one more worktree, not a
multiple — a multiple is just the worktree count restated. That cost is
filesystem and index metadata, so it scales with how many paths a repository
has and how long they are, not with how much content it holds. Measured on
APFS, df deltas, four worktrees per run:
| Repository | Tracked paths | Tree | Each extra git worktree | Each extra simgit worktree |
|---|
microsoft/vscode | 18,707 | 553 MiB | 567 MiB | 9.8–10.8 MiB (1.1%) |
git/git | 4,850 | 72 MiB | 74 MiB | ~2.2 MiB (3.1%) |
| 100k × 4 KiB files | 100,000 | 390 MiB | 398 MiB | 37.5–38.3 MiB (9.4%) |
| 200 × 8 MiB files | 200 | 1600 MiB | 1608 MiB | 107 KiB (0.007%) |
Roughly 60 KiB + 0.4–0.6 KiB × tracked-paths per worktree, the upper end for
long, deeply nested paths, so 5k paths cost 2–3 MiB and 250k cost 100–150 MiB.
Estimate yours:
git ls-files | wc -l
Content size does not enter into it: a 4 KiB file and a 64 MiB file cost the
same, because clonefile shares the extent tree by reference. Many small files
with short names is the worst case (~10% of the tree per worktree, where eight
simgit worktrees still cost about what one plain git worktree copy does);
large files approach free. Creation is also faster: eight vscode worktrees in
6.4–7.0 s against 14.0–14.2 s, because macOS clones the whole tree in
one clonefile(2) call and the worktree adopts the baseline's index.
Measure with df, not du. du reports logical size and cannot see
clonefile/reflink block sharing, so a CoW worktree looks like a full copy to
it. Only df shows what a worktree actually allocated.
Method and full results:
docs/scaling_benchmark.md.
How a worktree lives
flowchart TD
subgraph allocate ["Allocate"]
direction LR
A["<b>Request</b><br/>add · run ·<br/>WorktreeCreate hook"]
B["<b>Baseline</b><br/>one cached checkout<br/>per commit, reused"]
C["<b>Register</b><br/>a real linked worktree:<br/>own branch, index, HEAD"]
D["<b>Populate</b><br/>clonefile · reflink ·<br/>fuse-overlayfs, else a<br/>plain checkout"]
A --> B --> C --> D
end
E["<b>Work</b><br/>ordinary Git; run holds a lock so gc can't reap it"]
subgraph teardown ["Tear down"]
direction LR
F["<b>Clean up</b><br/>remove · gc · hooks keep dirty<br/>or unreached work unless<br/>--discard-dirty / --delete-unmerged"]
G["<b>Reclaim</b><br/>prune drops baselines<br/>no ref reaches,<br/>never one in use"]
F --> G
end
allocate --> E --> teardown
Install
simgit needs Git 2.39 or newer, and building it from source needs Rust 1.89
or newer; CI tests both.
On macOS, prefer the Homebrew formula: it uses a versioned release asset with a
pinned SHA-256 digest.
# macOS (preferred)
brew install abendrothj/tap/simgit
# From crates.io (either one)
cargo install simgit-cli --locked
cargo binstall simgit-cli
# Verify the install. `doctor` runs anywhere, so this works before there is a
# repository to check.
simgit doctor --json