Elffuss BraidHub

utopia-ia/elffuss-braid public

Changeset: 2dd40509e7e2
2dd40509e7e2 Agents: install the braid the guide describes, keep git out of workspaces KikoCis,
.github/
bench/
crates/
docs/
fuzz/
scripts/
site/
.gitignore65 B
AGENTS.md20.3 KiB
CLAUDE.md11 B
CONTRIBUTING.md2.0 KiB
Cargo.lock56.8 KiB
Cargo.toml1.4 KiB
LICENSE11.1 KiB
NOTICE160 B
README.md24.0 KiB
SECURITY.md1.2 KiB
deny.toml1.0 KiB

README.md

<img src="docs/assets/braid.svg" alt="Three strands braided together" width="320">

✳ Elffuss Braid

Version control for repositories where many agents land changes at the same time.

A from-scratch version control system in Rust. Creating a change costs what the change touches, not what the repository weighs. Agents commit in parallel, and landing on main is one short step they take in turn. Git stays at the edges, so GitHub keeps working.

License CI Rust Status

elffuss.com · Code · Claw · Translator · Copilot · Blog · Hugging Face · Dev log


In this repository: why braid · how it works · use it from your agent · quick start · working with git · design · status · what is honest about this · measured against git · credits


Why braid

Git was designed for people who work offline and sync now and then. Agents work differently: there are many of them, each change is small, they are always connected, and they all want to land on main at once. In git that shows up as:

  • Shared mutable state. One index per working tree, and a push that is rejected whenever someone else landed first, so every agent ends up in a fetch, rebase, push and retry loop.
  • Costs that grow with the repository. Status and commit walk the whole index, and a directory with many files is rewritten whole on every change.
  • Transfers built per client. Each fetch negotiates and builds its own pack, so a cache in front of the server cannot help.
  • Large files need a side system.

Braid starts from the opposite assumptions:

gitbraid
Unit of changea commit: a full tree snapshota changeset: the files that changed against the first parent, plus the root tree id
Landing on mainthe client pushes and is rejected if behindland rebases in one short step that landings take in turn, at a cost that follows the change
Many writersone index per working treeone workspace per agent over a shared append-only store; creating a change takes no repository lock
Fetchingnegotiated packs, unique per clientimmutable objects by id, so any cache (local daemon, nginx, CDN) can serve them
Large directoriesrewritten whole on every changesplit into content-defined nodes; an edit rewrites only its path
Large filesa separate extensioncontent-defined chunks, deduplicated across versions
HashSHA-1BLAKE3
For agentsparse human output--json everywhere; changes can be created through the API without a checkout

This is the design. Status says what exists today.

How it works

flowchart LR
    subgraph machine["One machine"]
        A1["agent 1 · workspace"] --> ST
        A2["agent 2 · workspace"] --> ST
        A3["agent N · workspace"] --> ST
        ST[("shared store<br/>immutable objects + op log")]
    end
    ST -- "land: one short step, taken in turn" --> MAIN(["main"])
    ST <-- "objects by id" --> SRV["braid server (optional)"]
    ST <-- "import / export" --> GIT["git bridge"]
    GIT <--> GH["GitHub · Gitea"]
  1. Everything is an immutable object named by its BLAKE3 hash: file contents, directories, and changesets. Nothing is ever rewritten in place.
  2. A changeset records what changed against its first parent, plus the root tree it produces. History, blame and rebase read the short list; the root id commits to the whole repository.
  3. Agents commit in parallel; landing is one short step they take in turn. If the change was built on the current head it fast-forwards. If not, braid rebases it path by path and merges only the files both sides touched. Conflicts come back as data that an agent can act on.
  4. Many processes share one store without a daemon. Segments are leased with locks the kernel releases if a process dies, objects are published before anything refers to them, and an append-only op log records every operation so it can be undone.
  5. The same API at every tier. A local store, a per-machine daemon, a cache and a server answer the same requests, so a client never cares which one it talks to.

Use it from your agent

Braid comes with instructions written for coding agents. In a project that is a git repository, ask your agent, whatever harness runs it:

Install braid in this project and set it up for agents, following https://braid.elffuss.com/agents.md (read it whole, with curl -fsSL)

It installs braid with cargo, tells you what in the project braid does not run, such as git hooks, imports the project's git history, and writes the rules for agents into the project's AGENTS.md with braid agents init. From then on, every agent session works in a braid workspace of its own, where git refuses to run, lands through braid, and tells you when what it landed is waiting for a sync to the git remote. Git stays the source of truth, and in a clone where braid is not set up, agents work with git as before. The instructions are part 1 of AGENTS.md, which the site serves as braid.elffuss.com/agents.md, next to an llms.txt.

Quick start

Braid stores history, moves it in and out of git bit for bit, and gives each agent a workspace of its own that lands on main in one short step.

git clone https://github.com/KikoCis/elffuss-braid
cd elffuss-braid
cargo build --release
export PATH="$PWD/target/release:$PATH"
SRC="$PWD"                       # any git repository will do; this one is at hand

braid init /tmp/demo
cd /tmp/demo
braid git import "$SRC"          # every branch and tag
braid log main -n 5
braid log main -- README.md      # only the changes to a path
braid blame main README.md       # who last changed each line
braid show main --json
braid fsck
braid stats        # objects by kind, and how they are stored: whole, deltas, chunks

Exporting writes the same commits back, with the same ids:

git init --bare /tmp/mirror.git
braid git export /tmp/mirror.git

Every operation is in the op log, and any of them can be undone:

braid op log      # who did what, newest first
braid undo        # takes the whole import back

Ids can be checked with any BLAKE3 implementation, for example the reference b3sum tool:

b3sum --derive-key "elffuss-braid 2026 blob v1" README.md

Many agents, one repository

Each agent gets its own workspace. There is no staging area and no shared index: an agent commits what it changed and lands it, and braid rebases it onto whatever the others landed first.

export BRAID_AUTHOR="Ada Lovelace <ada@example.org>"
export BRAID_AGENT=agent-1           # recorded with everything this agent does
braid workspace add agent-1          # .braid/work/agent-1, tracking main
cd .braid/work/agent-1
echo 'fn main() {}' > main.rs
braid status
braid commit -m "Add main.rs"
braid land                           # fast-forward, or a rebase onto main

When two agents change the same lines, the second land exits with status 2, prints the conflicts as data and leaves main where it was. With --json, each conflict names its sides from the agent's point of view: base, branch (what is on the branch now) and workspace (its own change), with the hunks in conflict, and next says what to run: braid update, which rebases the change and writes git-style conflict markers. Fix the file, then braid commit (the change keeps its message unless -m gives another) and braid land.

  • land and update report the same fields: where each changeset went (landed, from its id to the one that holds it now), the paths merged, the paths of the working copy they wrote or removed, and for a landing its op log entry.
  • braid status --json says how far the branch is ahead (behind_by), which changesets have not landed, including one whose rebase is in progress, and whether a commit would go through (ready_to_commit), with every reason it would not (blocking), which braid commit refuses with too.
  • Every changeset names the agent that made it, and keeps it when it is rebased; braid log, braid show and braid op log show who did what, and the op log says what each landing did. Signatures use the local time zone.
  • Revisions can be given as short ids, six hex digits or more; an ambiguous one is an error that lists the candidates.
  • braid show and braid diff <from> <to> list the files a change adds, modifies, deletes or turns into another type (A, M, D, T), as git diff --name-status does.
  • braid log [rev] -- <path>... lists the changesets that touched a path, along first parents, and braid blame <rev> <path> names the changeset, the agent and the date of each line. Both read derived data kept in the store: generation numbers and skip pointers for ancestry, changed-path filters, and blame records, computed the first time they are needed. braid derive --all computes them ahead of time, after a large import.
  • A workspace goes in .braid/work/<name> unless workspace add is given a directory, and tracks a branch the repository has, unless it has none yet; --new-branch starts one on purpose. It holds a .git file that points nowhere, so that git run inside it stops with "not a git repository" instead of acting on the checkout around it. braid cat-object <rev>:<path> prints a file as a changeset has it: braid cat-object <base>:<path> | diff -u - <path> shows what an edit in the workspace changed.
  • Hints, and next in the JSON, repeat the --agent, --workspace and --repo a command was given, so that an agent that follows them acts as the same session.
  • braid agents init writes the rules for agents into a project's AGENTS.md, in a section between a <!-- braid:start --> line and a <!-- braid:end --> line: each session works in a workspace of its own under .braid/work/ and lands on the branch the section names, one the repository has. Running it again rewrites the section in place and touches nothing else; markers that do not pair up are refused, and marker lines in code blocks are not markers. It also adds @AGENTS.md to a CLAUDE.md or a GEMINI.md that does not include it (--no-claude and --no-gemini leave them alone). It writes through a link only inside the project, never a read-only file, and replaces no file until every one is ready. --dry-run shows what it would write, and --json lists the files created, updated and unchanged, and the file each one is.

braid status --help, braid land --help, braid update --help and braid agents init --help describe every JSON field.

An agent that knows exactly what it changes needs no checkout at all, and can check that nobody changed the file under it:

braid change create --base main --set src/lib.rs=@new-lib.rs \
  --expect src/lib.rs=<blob id it read> -m "Fix the parser" --land main

New files that look like secrets (.env*, *.pem, id_*) or are larger than 1 MiB are not committed until braid track <path> says so: braid commit refuses while they wait, naming them, and --force leaves them out.

Working with git

Repositories come in with their whole history and keep a git mirror.

  • braid git import reads a git repository through gitoxide. Each commit is exported again and compared with the original, so the round trip is bit for bit. Running it again imports only what is new, and a braid branch follows git's only forward: one where braid has work git does not have stays where it is, and the import lists it under kept.

  • braid git sync keeps a branch of GitHub, Gitea or any git remote in step with a braid branch: it fetches and imports the remote branch, then fast-forwards braid, or pushes braid's branch, merging first when both moved. The push carries a lease on what the sync just fetched, so the remote only ever fast-forwards and its history is never rewritten. Conflicts move nothing and exit with status 2.

    braid git sync https://github.com/you/project.git --branch main
    braid git sync https://github.com/you/project.git --dry-run --json
    
  • Braid contains no code from git itself, which is GPLv2. It reads and writes git data with gitoxide (MIT or Apache-2.0); git sync also runs the git binary as a subprocess, to set up its mirror, fetch and push.

Design

  • Design overview: store, landing, workspaces, the git bridge, the server, and how it is tested.
  • Format v1: the exact bytes of ids, trees and changesets, with golden vectors.

Status and roadmap

MilestoneScopeState
0Public repository, CI, object ids, braid hash-object✅ done
1Format v1: canonical codec, trees (flat and split), changesets, name rules; frozen✅ done
2Local store and op log: many processes, crash-safe, fsck, undo✅ done
3History and the git bridge: import, export, log, show✅ done
4Many agents on one machine: workspaces, land, conflicts, git sync✅ done
5Performance: deltas, chunking, derived indexes, blame, benchmarks against gitin progress
6Server: lazy sparse clones, tokens, caching tiersplanned
7Daemon, virtual file system, WebAssembly coreplanned

Each milestone ships when its tests pass: golden vectors and fuzzing for the format, crash and many-process tests for the store, bit-for-bit round trips and differential tests against git for the bridge, deterministic simulation for landing.

What is honest about this

  • It is pre-alpha. Today it stores history, round-trips git repositories, and runs workspaces for many agents on one machine. Keep your git repository as the source of truth, and do not keep anything only in braid.
  • Slower than git at most things today. Measured against git gives every result as a ratio against git on the same machine, with the script that reproduces it, never numbers nobody can check. Braid is faster when many agents land at once, and slower at importing and storing history, and at status and commit on large trees.
  • The hashed format is frozen and every golden vector is recomputed by a second implementation written from the specification alone. Storage and protocols can still change.
  • Braid is not Scion. It starts from the ideas Anthropic described in public about its own source control system. It is an independent implementation, contains no code from Anthropic, and is not affiliated with or endorsed by Anthropic.
  • Platforms. CI tests Linux and other Unix-like systems. Windows is not tested yet.

Measured against git

Each number is braid's time, or the size of its store, divided by git's for the same work on the same machine: below 1 braid is faster or smaller, above 1 it is slower or larger. They are medians from one run of bench/run.py, which describes every scenario, measuring braid at commit 5330054; the run held rounds back while other work kept the machine busy (--max-load). The numbers come from that one machine, and yours will differ: run the script before relying on any of them.

What was comparedbraid / gitReproduce
Import tmux 3.5a, 10,287 commits: braid init + braid git import vs git clone --no-local --bare17.6python3 bench/run.py --only import
Import it and check it out: braid init + braid git import + braid workspace add vs git clone --no-local17.1python3 bench/run.py --only import
Size after that import: du of .braid/store vs the bare clone after git gc --aggressive25.1python3 bench/run.py --only store
Status of a tree of 100,000 files, clean: braid status vs git status, no untracked cache, no fsmonitor2.6python3 bench/run.py --only status
Status of that tree, clean: braid status vs git status with core.untrackedCache=true, no fsmonitor5.8python3 bench/run.py --only status
Status of that tree, 10 files modified: braid status vs git status, no untracked cache, no fsmonitor3.0python3 bench/run.py --only status
Status of that tree, 10 files modified: braid status vs git status with core.untrackedCache=true, no fsmonitor5.7python3 bench/run.py --only status
Commit one changed file of that tree: braid commit vs git add + git commit5.0python3 bench/run.py --only commit
Commit one new file in a directory of 20,000 files, 200 times: braid commit vs git add + git commit1.8python3 bench/run.py --only wide
Commit one new file in that directory without a working copy, 200 times: braid change create --land vs git add + git commit0.9python3 bench/run.py --only wide
4 agents land 10 commits each, at once: braid commit + braid land, a workspace each, vs git commit + git push, a clone each, with git pull --rebase and a new push when rejected0.4python3 bench/run.py --only agents
8 agents, the same0.3python3 bench/run.py --only agents
16 agents, the same0.2python3 bench/run.py --only agents
Newest 1,000 changesets of tmux: braid log -n 1000 vs git log --first-parent -n 1000 --format=%H after git gc --aggressive1.7python3 bench/run.py --only history

braid log -- <path> and braid blame came after this run, so it does not measure them; the script does now.

At commit 5330054, braid was slower than git at most of this, for the reasons below. Much of it has been worked on since: braid now stores deltas and cuts large files into chunks, walks the working copy in parallel through directory handles, edits a large directory in place, and looks objects up through the store's indexes instead of mapping the whole store first. The ratios above show none of that; it takes a new run of the script to say how much it changed.

  • Importing and storing history. Braid kept every version of a file whole, compressed on its own, where git stores most versions as a delta against another. The import converted and checked every object on one thread, and much of that time went to checking every entry name against the aliases of .git, with Unicode normalisation and case folding, each time a tree was read or built.
  • Status and commit on a large tree. braid status walked the working copy one directory at a time on one core, opening each directory from the root one name at a time, so that it never follows a symlink, and looking for .gitignore and .braidignore in each; it also read the whole base tree and rewrote the whole stat cache every time. It used less CPU time than git status, which spreads its checks over several cores and, with the untracked cache, skips the directories that did not change. braid commit has no staging area, so it ran a whole status first.
  • A new file in a wide directory. Braid wrote only the few nodes of a large directory that change, but it read and rebuilt the whole directory in memory to find them, checking every name again. From 2,500 to 20,000 files, the cost of one commit grew 5.2 times for braid commit, 3.6 times for braid change create and 3.5 times for git.
  • Opening the store. Every command first built a map of where each object of the store is, which on a history the size of tmux's was a large part of braid log -n 1000; git looks each object up in its pack index when it needs it.

Braid is faster where it was designed to be: many agents landing at once. A push to git goes in only from a clone that has the latest commit, so each agent that loses the race fetches, rebases and pushes again: on average 1.1 times per push with 4 agents, 2.5 times with 8 and 5.2 times with 16. braid land rebases onto whatever landed first, in one short step that landings take in turn, so no agent retried, and nearly every landing was such a rebase.

Part of Elffuss

Braid is part of Elffuss, a family of tools for building software with agents.

Prior art and credits

Contributing and security

License

Apache-2.0. Copyright 2026 UtopiaIA. See NOTICE.


En castellano

Braid es un sistema de control de versiones escrito de cero en Rust, para repositorios en los que muchos agentes aterrizan cambios a la vez.

  • Crear un cambio cuesta lo que toca el cambio, no lo que pesa el repositorio.
  • Los agentes hacen commit en paralelo, y aterrizar en main es un paso corto que dan por turnos.
  • Git se queda en los bordes, así que GitHub y Gitea siguen funcionando.

Parte de las ideas que Anthropic contó en público sobre Scion, su sistema interno. Es una implementación independiente, sin código de Anthropic y sin relación con la empresa.

Hoy está en pre-alfa: guarda historia, la mete y saca de git bit a bit, y cada agente tiene su propio espacio de trabajo y aterriza en main en un paso corto. Las fases dicen qué llega después y qué pruebas tiene que pasar cada una.

Para usarlo en un proyecto, pídeselo a tu agente:

Instala braid en este proyecto y configúralo para agentes siguiendo https://braid.elffuss.com/agents.md (léelo entero, con curl -fsSL)

Lo instala con cargo, te avisa de lo que braid no ejecuta, como los hooks de git, importa la historia de git del proyecto y, con braid agents init, escribe en su AGENTS.md las reglas para que cada sesión trabaje en su propio espacio de trabajo y aterrice sus cambios con braid.