Running Parallel Coding Agents on Jujutsu (jj) Colocated with Git: Why We Built rudder-vcs-bridge
Git was designed for one human typing one command at a time against one staging area. Point ten autonomous coding agents at a shared Git repository and you immediately hit .git/index.lock races, aborted rebases, detached HEAD drift, and untracked file clobbering. Here is why Rudder treats Jujutsu (jj) colocated with Git as its version control authority, and how rudder-vcs-bridge fences every mutation.
Why raw Git fails when ten agents commit concurrently
Every developer tool ecosystem speaks Git, so Rudder's external contract is non-negotiable: your checkout stays a normal Git repository, git log and IDE gutters continue to work, and GitHub sees ordinary commits and branches. Yet using raw git CLI invocations as the internal coordination substrate for parallel agents breaks down along four structural seams:
- Global lock contention: Even with separate
git worktreecheckouts, reference updates, packed-refs rewrites, and submodule metadata touch shared files inside the common$GIT_COMMON_DIR. Concurrent status/fetch/commit loops tripUnable to create '.git/index.lock': File existsor ref-lock retries at precisely the moment multiple subagents finish a wave. - Stateful rebase stops: When trunk advances while three agents are editing related modules,
git rebasehalts mid-flight on the first conflict, writes.git/rebase-merge/state onto disk, and leaves the working tree half-applied until an interactive operator runsgit rebase --continueor--abort. - Staging area mismatch: Agents edit files directly via filesystem syscalls and shell tools. A forgotten
git add -Nleaves newly created modules out of diffs; an accidentalgit add -Asweeps multi-megabyte scratch outputs or temporary test fixtures into history. - Destructive branch pointers: Git branches must point to one commit per worktree (refusing to check out the same branch twice). Parallel agents forced onto throwaway branch names pollute remote namespaces and lose clear parent-child lineage when retargeted.
Colocated Jujutsu (jj 0.40.0) and the lock-free operation log
Jujutsu (jj) separates the object store from the repository view. In a colocated repository (both .git/ and .jj/ at the project root), Jujutsu stores blobs, trees, and commits directly inside .git/objects, so zero object bytes are duplicated. Above that Git object store, .jj/repo/op_store/ maintains an append-only operation log.
Instead of taking a pessimistic lock on a mutable index file, every workspace snapshots its working copy into an immutable commit object identified by a stable change ID (such as yypruory) distinct from its cryptographic Git commit SHA. If two agents record operations concurrently against the same base operation, Jujutsu does not fail either writer: the next read deterministically merges the divergent operation heads in memory and writes a reconciled view operation.
rudder-vcs-bridge isolates jj-lib =0.40.0 behind typed publication and journal boundaries so VCS state never acts as an uncoordinated second scheduler.Algebraic conflict trees keep rebases total
The single biggest productivity win for multi-agent DAG execution is how Jujutsu models merge conflicts. In Git, a tree entry can only reference a single blob OID; a conflict cannot be stored in a commit object, which is why git rebase must stop on disk. In Jujutsu, a tree value is an algebraic sum of positive and negative terms (Merge<Option<TreeValue>>).
When Agent A lands a change on main while Agent B and Agent C are mid-edit, rebasing B and C onto the new main always succeeds in O(changed paths) without touching either agent's live terminal or stopping in an interactive state:
- Non-overlapping hunks merge cleanly and update the workspace's parent commit automatically.
- Overlapping hunks are recorded as structured multi-sided trees inside the commit metadata itself. If a subsequent commit resolves the conflict or edits another part of the file, Jujutsu simplifies the algebraic diff algebraically without corrupting history.
- Only when Rudder's integration gate prepares to advance the user's
mainbookmark doespublication.rsenforce a conflict-free tree check, routing any genuine semantic overlap to a dedicated resolver pass instead of leaving half-merged conflict markers in your main checkout.
Why we pinned jj-lib =0.40.0 inside rudder-vcs-bridge
Shelling out to whatever jj binary happens to sit on a machine's $PATH breaks rapidly in production: Jujutsu's internal proto schemas in .jj/working_copy/ and colocated Git requirements evolve across minor releases, and newer colocated workspaces can demand a newer system Git than macOS or minimal Linux images ship.
Rudder solves this by compiling jj-lib and jj-cli at an exact workspace pin (0.40.0) into a dedicated crate, vcs-bridge/, governed by three strict architectural rules:
// vcs-bridge/src/lib.rs
// Private jj metadata and typed filesystem/history publication boundaries.
// This crate is not a scheduler or an authority journal. The engine owns
// retention and the final owner/run/decision integration gate.
- One version, everywhere: Both Rudder's custom
rudder-overlayworking-copy backend (Article 01) and VFS provider (vcs-bridge/src/vfs_provider.rs) register directly withjj-lib 0.40.0'sWorkingCopyFactorytable, guaranteeing identical protobuf serialization on macOS and Fly Cloud Linux. - Projector, never scheduler:
projection.rsandrpc_view.rsexpose read-only commit graphs and per-file diffs without mutating workspaces; background snapshot passes run with--ignore-working-copywhenever reading shared metadata so observers never race an active worker's checkout. - Explicit user Git intake: Because developers still run
git commit,git stash, or IDE commits in their primary checkout,accepted_git_import.rsimports external Git HEAD movements into the Jujutsu op log under an explicit epoch check rather than letting implicit auto-imports clobber concurrent agent bookmarks.
Keeping Rudder surfaces invisible across secondary jj workspaces
Rudder writes local coordination files such as RUDDER.md and per-project metadata under .rudder/, and keeps those paths out of commits without dirtying the repository's tracked .gitignore. In the primary checkout, writing to .git/info/exclude is straightforward because .git exists at the workspace root.
Secondary jj workspaces (.rudder-workspaces/<repo>/<agent>) and rudder-overlay forks, however, have only a .jj/ directory and no .git entry at all. Their backing Git directory lives in the shared repository store referenced by .jj/repo (a pointer file containing the relative path back to the primary .jj/repo). When Rudder ensures local ignore rules or resolves the shared Git store for warm snapshots, src/surfaces.ts and native/src/gitio.rs resolve:
// Secondary jj workspaces have no .git entry; ask jj for the backing Git store
// without snapshotting the live agent's working copy.
jj git root --ignore-working-copy -R <workspace>
Using --ignore-working-copy is essential here: it reads the static store pointer in under 2 milliseconds without taking a working-copy snapshot lock while an agent is compiling or writing files.
Transactional publication and crash-safe uncertain effects
A local VCS mutation is an external side effect relative to Rudder's SQLite engine database: if the process receives SIGKILL after jj writes a new operation head but before SQLite commits the command receipt, naive retry logic would either double-apply a commit or orphan workspace lineage.
journal_adapter.rs and publication.rs close this window using a two-phase intent record keyed by (owner_epoch, run_epoch, idempotency_key):
- Pre-flight pin & intent: Before calling into
jj-lib, the engine pins every referenced CAS object and commits anUncertainEffectjournal row recording the expected base operation ID and target change ID. - Deterministic reconciliation on restart: On crash recovery, if an
UncertainEffectrow exists,rudder-vcs-bridgeinspects theop_storeheads for the recorded deterministic metadata tag. If the operation landed, the receipt completes idempotently; if not, the working copy rewinds cleanly to the recorded base operation. - Separate facts: Completing a turn in an agent's terminal, passing verification checks, integrating into local
main, and pushing tooriginare stored as distinct state transitions. Nothing advancesrefs/heads/mainuntil the owner epoch matches and the target tree has zero unresolved conflicts.
Parallel branches without index.lock collisions.
Keep your existing GitHub remotes and PR workflow while every Claude Code, Codex, Gemini, and OpenCode agent works in its own isolated, auto-snapshotted Jujutsu workspace.
$ npm install -g @exla/rudder@latest