drawbar
System-wide Git shim and maintenance toolkit for machines running many concurrent coding agents across linked worktrees.
In a multi-horse harness, the drawbar is the rigid bar every team member
pulls through to move the load together. drawbar plays the same role in front
of git: concurrent worktrees keep using plain upstream git, GitHub/GitLab,
and git-lfs, while shared-state operations serialize cleanly instead of
failing with cannot lock ref or auto-GC lock races.
Why
When 10+ coding agents work simultaneously in linked worktrees of a shared clone:
- Concurrent
git fetch --prunecalls lose compare-and-swap races onrefs/remotes/origin/*(error: cannot lock ref ... is at A but expected B). - Unscheduled
git gc --autocollides with active worktrees. - Shell wrappers add ~7 ms of per-call overhead, slowing down small repositories
by 3-4x on
git statusandrev-parse. - Unscoped
core.fsmonitor=truespawns background watch daemons on every small repo and churns over build directories liketarget/. - Service daemons (orchestrators, MCP servers, IDE backends) often inherit a
PATHwith/usr/binahead of~/.local/bin, bypassing user-local shims.
Architecture
- Compiled dual-mode binary (
drawbar/git): invoked via a~/.local/bin/gitsymlink, it acts as a sub-millisecond shim; invoked asdrawbar, it runs management commands (install,uninstall,build-git,gc-daemons,maintenance,status,doctor, andbench). - Per-repo lease (
flock): serializes shared-state commands (fetch,pull,gc,maintenance,repack,pack-refs,prune,remote prune,remote update,worktree prune) on<common-dir>/drawbar-lease.lock, with configurable timeout (exit75and an actionablefuserdiagnostic). - Scoped
fsmonitor: passes-c core.fsmonitor=true -c core.untrackedCache=trueonly when the realgitis>= 2.55and the repository is above the tracked-file threshold (or opted in via~/.config/drawbar/config.toml). Never writescore.fsmonitorinto shared git config files, so older systemgitcallers keep working. - Background maintenance: suppresses mid-swarm auto-GC (
-c gc.auto=0) and runsgit maintenance run --autoon a user timer under the same per-repo lease. - Files ref backend guard: sets
init.defaultRefFormat=filesso linked worktrees avoid cross-worktreereftablestack-lock errors.
Where to go next
- Installing: the install script, what
drawbar installchanges, and how uninstall puts it back. - Configuration: the config file and its defaults.
- Which repositories get fsmonitor: the rules the shim applies.
- Per-repo lease: which commands take the lease and what happens when it times out.
- Building Git: build a real git of 2.55 or newer.
- Stopping fsmonitor daemons:
drawbar gc-daemons. - Scheduled maintenance:
drawbar maintenanceand the systemd timers. - Status and doctor: check an install and its health.
- Measuring shim overhead: time what the shim adds to each git call.
- Exit codes and auto-GC guard: when the shim exits with a status of its own.
- Troubleshooting: the usual refusals and failed checks, and their fixes.
- Security model: the trust boundary, how the shim finds the real git, and what install, build and the units check.
- Architecture decisions: the ADRs behind the design.
- Contributing and Roadmap.