Rudder
article 03 · version control architecture 2026-12-01 · 10 min read · jujutsu 0.40.0 · git · vcs-bridge

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.

source vcs-bridge/src/lib.rs vcs-bridge/src/working_copy.rs vcs-bridge/src/publication.rs vcs-bridge/src/journal_adapter.rs

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 worktree checkouts, reference updates, packed-refs rewrites, and submodule metadata touch shared files inside the common $GIT_COMMON_DIR. Concurrent status/fetch/commit loops trip Unable to create '.git/index.lock': File exists or 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 rebase halts mid-flight on the first conflict, writes .git/rebase-merge/ state onto disk, and leaves the working tree half-applied until an interactive operator runs git rebase --continue or --abort.
  • Staging area mismatch: Agents edit files directly via filesystem syscalls and shell tools. A forgotten git add -N leaves newly created modules out of diffs; an accidental git add -A sweeps 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.

Engine Authority (SQLite) owner_epoch · run_epoch idempotency receipts journal_adapter.rs uncertain-effect fence publication.rs CAS pin before ref export rudder-vcs-bridge (0.40.0) working_copy.rs local · rudder-overlay · vfs accepted_git_import.rs user Git commit intake projection.rs (read-only) Colocated Repo Root .jj/repo/op_store/ DAG of repo views .git/objects + refs shared backing store .git/info/exclude
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 main bookmark does publication.rs enforce 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.
  1. One version, everywhere: Both Rudder's custom rudder-overlay working-copy backend (Article 01) and VFS provider (vcs-bridge/src/vfs_provider.rs) register directly with jj-lib 0.40.0's WorkingCopyFactory table, guaranteeing identical protobuf serialization on macOS and Fly Cloud Linux.
  2. Projector, never scheduler: projection.rs and rpc_view.rs expose read-only commit graphs and per-file diffs without mutating workspaces; background snapshot passes run with --ignore-working-copy whenever reading shared metadata so observers never race an active worker's checkout.
  3. Explicit user Git intake: Because developers still run git commit, git stash, or IDE commits in their primary checkout, accepted_git_import.rs imports 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 an UncertainEffect journal row recording the expected base operation ID and target change ID.
  • Deterministic reconciliation on restart: On crash recovery, if an UncertainEffect row exists, rudder-vcs-bridge inspects the op_store heads 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 to origin are stored as distinct state transitions. Nothing advances refs/heads/main until 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