Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 --prune calls lose compare-and-swap races on refs/remotes/origin/* (error: cannot lock ref ... is at A but expected B).
  • Unscheduled git gc --auto collides with active worktrees.
  • Shell wrappers add ~7 ms of per-call overhead, slowing down small repositories by 3-4x on git status and rev-parse.
  • Unscoped core.fsmonitor=true spawns background watch daemons on every small repo and churns over build directories like target/.
  • Service daemons (orchestrators, MCP servers, IDE backends) often inherit a PATH with /usr/bin ahead of ~/.local/bin, bypassing user-local shims.

Architecture

  • Compiled dual-mode binary (drawbar / git): invoked via a ~/.local/bin/git symlink, it acts as a sub-millisecond shim; invoked as drawbar, it runs management commands (install, uninstall, build-git, gc-daemons, maintenance, status, doctor, and bench).
  • 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 (exit 75 and an actionable fuser diagnostic).
  • Scoped fsmonitor: passes -c core.fsmonitor=true -c core.untrackedCache=true only when the real git is >= 2.55 and the repository is above the tracked-file threshold (or opted in via ~/.config/drawbar/config.toml). Never writes core.fsmonitor into shared git config files, so older system git callers keep working.
  • Background maintenance: suppresses mid-swarm auto-GC (-c gc.auto=0) and runs git maintenance run --auto on a user timer under the same per-repo lease.
  • Files ref backend guard: sets init.defaultRefFormat=files so linked worktrees avoid cross-worktree reftable stack-lock errors.

Where to go next