| 1 | <picture> |
| 2 | <source media="(prefers-color-scheme: dark)" srcset="docs/assets/hero-dark.svg"> |
| 3 | <source media="(prefers-color-scheme: light)" srcset="docs/assets/hero-light.svg"> |
| 4 | <img src="docs/assets/hero-light.svg" width="100%" alt="Elffuss Braid logo: three strands braided together, above the tagline “Many agents. One main. No retry loop.” Below, a terminal shows three agents landing on main in turn: agent-a lands as a fast-forward, agent-b is rebased onto it, and agent-c, which changed the same line of shipping.toml as agent-a, gets a conflict, so main did not move and braid exits with status 2."> |
| 5 | </picture> |
| 6 | |
| 7 | # ✳ Elffuss Braid |
| 8 | |
| 9 | **Version control for repositories where many AI coding agents land changes at the same time.** |
| 10 | |
| 11 | Braid works with Claude Code, Gemini CLI and any other coding agent that |
| 12 | reads `AGENTS.md`. It is written from scratch in Rust, installs with one |
| 13 | `cargo install`, and on one machine needs no server and no daemon. Each |
| 14 | agent commits in parallel, in a workspace of its own, and landing on |
| 15 | one main branch is a short step the agents take in turn. Merge conflicts |
| 16 | come back as data, in text or JSON, with exit status 2, and `main` does |
| 17 | not move. Git stays at the edges: `braid git import` brings a history in |
| 18 | bit for bit, and `braid git sync` keeps GitHub in step. |
| 19 | |
| 20 | Elffuss Braid now lives in the UtopiaIA organization on GitHub, at github.com/utopia-ia/elffuss-braid. It moved from github.com/KikoCis/elffuss-braid on 23 October 2026; the old address redirects. |
| 21 | |
| 22 | [](https://github.com/utopia-ia/elffuss-braid/actions/workflows/ci.yml) |
| 23 | [](LICENSE) |
| 24 | [](#status-and-roadmap) |
| 25 | [](https://www.rust-lang.org) |
| 26 | [](docs/spec/format-v1.md) |
| 27 | |
| 28 | [Quick start](#quick-start) · [Ask your agent](#use-it-from-your-agent) · [Scion's ideas](#scions-ideas-in-braid) · [How it works](#how-it-works) · [BraidHub](#braidhub) · [Measured against git](#measured-against-git) · [Questions](#questions) · [braid.elffuss.com](https://braid.elffuss.com) · [En castellano](#en-castellano) |
| 29 | |
| 30 | Anthropic described Scion, the version control system it built in-house |
| 31 | with agents in mind, in |
| 32 | [Redesigning source control at Anthropic](https://www.anthropic.com/research/redesigning-source-control). |
| 33 | Scion is internal. Braid is an independent, open-source take on several of |
| 34 | its ideas, and you can run it today: |
| 35 | [ask your coding agent](#use-it-from-your-agent) to set it up in a |
| 36 | project, or try the [quick start](#quick-start). |
| 37 | |
| 38 | *Braid contains no code from Anthropic, and is not affiliated with or |
| 39 | endorsed by Anthropic.* |
| 40 | |
| 41 | > [!NOTE] |
| 42 | > Version 0.1: keep your git repository as the source of truth. |
| 43 | |
| 44 | ## Scion's ideas, in braid |
| 45 | |
| 46 | Each row is an idea from the article, what braid 0.1.4 does with it, and |
| 47 | how far along that is. |
| 48 | |
| 49 | | Scion's idea | In braid 0.1.4 | State | |
| 50 | |---|---|---| |
| 51 | | A changeset lists the files changed against its first parent | The same, plus the root tree id; the bytes are [frozen](docs/spec/format-v1.md) | ✅ done | |
| 52 | | Data is content-addressed and never changes, so any cache can serve it | BLAKE3 ids; BraidHub serves every object by id as immutable | ✅ done | |
| 53 | | Commits take no lock, only moving a branch is serial, and the server does the rebases | Agents commit in parallel; `braid land` rebases path by path onto whatever landed first, in one short step taken in turn, locally or on BraidHub | ✅ done | |
| 54 | | A commit costs what it changes, not what the repository weighs | Landing rebases only the paths a change touches, and `braid change create` needs no working copy; but `braid commit` scans the whole working copy by default (given paths, only those), and at the last measurement was slower than git on large trees ([measured](#measured-against-git)) | partly | |
| 55 | | Derived data for blame, path history and ancestry, computed from the parents | Generation numbers, skip pointers and changed-path filters, which `braid derive` can compute ahead of time, and blame records, which `braid blame` computes per file, all kept in the store; BraidHub serves history and diffs, not blame | ✅ done locally | |
| 56 | | Every query is an API, and the working copy is optional | `--json` on every command; `braid hub show`, `ls`, `cat`, `log` and `diff` read a repository with no clone; `braid change create --land` writes with no checkout | first version | |
| 57 | | Sparse and virtualized checkouts | `braid hub clone --paths` fetches only the trees under some paths, with no working copy (`cat-object`, `log` and `change create --land` work there); no sparse working copy yet; a virtual file system is planned (milestone 7) | partly | |
| 58 | | The daemon, the caches and the server answer the same requests | BraidHub is the server; a per-machine daemon and cache tiers are planned (milestones 6 and 7) | planned | |
| 59 | | A proper merge queue doesn't make much sense at agent scale; invest in post-merge testing instead, and automate bisect and revert | [`braid verify --revert`](#keeping-main-green) bisects to the changeset that broke the tests and lands its revert | ✅ new in 0.1.1 | |
| 60 | | Concurrent changes can conflict, and agents fix them | A conflict comes back as data, with the command to run `next`, and `main` does not move; braid does not settle conflicts itself: the agent edits the files (`braid resolve` only marks them settled) | ✅ done | |
| 61 | | Hermetic simulations and fuzzing | Deterministic simulation of agents landing at once, with injected faults; crash and power-loss tests; five fuzz targets | ✅ done | |
| 62 | | Permissions per directory, semantic approval rules, monitoring agents ("superfans") | BraidHub's permissions are per repository, and its change requests take reviews and approvals | not in braid | |
| 63 | | Clients are always online | Braid works offline on one machine; BraidHub is the authority when several machines share a repository | no, by design | |
| 64 | |
| 65 | ## Three agents, one main |
| 66 | |
| 67 | Three agents change a small shop at once, each in a workspace of its own: |
| 68 | no shared index, no repository-wide lock. Then they land on `main`, in |
| 69 | turn. |
| 70 | |
| 71 |  |
| 72 | |
| 73 | *The real CLI, recorded by [`scripts/demos/render.sh`](scripts/demos/render.sh).* |
| 74 | |
| 75 | - **agent-a** lands first: a fast-forward. |
| 76 | - **agent-b** is one changeset behind. It does not fetch and does not |
| 77 | retry: `braid land` rebases its change onto agent-a's, in one short step. |
| 78 | - **agent-c** changed the same line as agent-a, a real conflict: `main` |
| 79 | stays where it was, braid exits with status 2, and the conflict comes |
| 80 | back as data, with each side and the command to run `next`. |
| 81 | |
| 82 | In git, each agent that loses the race fetches, rebases and pushes again. |
| 83 | In the run [measured against git](#measured-against-git), on one machine, |
| 84 | with 4, 8 and 16 agents landing at once, git retried each push 1.1, 2.5 and |
| 85 | 5.2 times on average, no braid agent retried, and braid took 0.4, 0.3 and |
| 86 | 0.2 of git's time. CI runs a scene like this one on every push to `main` |
| 87 | ([`three_agents.rs`](crates/cli/tests/three_agents.rs)). |
| 88 | |
| 89 | ## Quick start |
| 90 | |
| 91 | Braid builds from source with cargo, and needs Rust 1.89 or newer, a C |
| 92 | compiler and git. CI tests Linux and other Unix-like systems; Windows is |
| 93 | not tested yet. |
| 94 | |
| 95 | ```bash |
| 96 | cargo install --locked --git https://github.com/utopia-ia/elffuss-braid --tag v0.1.4 elffuss-braid-cli |
| 97 | ``` |
| 98 | |
| 99 | To set braid up in a project you already have, |
| 100 | [ask your agent](#use-it-from-your-agent). To run the race above yourself, |
| 101 | in a throwaway directory: |
| 102 | |
| 103 | ```bash |
| 104 | export BRAID_AUTHOR="Ada Lovelace <ada@example.org>" |
| 105 | cd "$(mktemp -d)" && braid init shop && cd shop |
| 106 | echo 'free_over = 60' | braid change create --base none \ |
| 107 | --set shipping.toml=@- -m "Start the shop" --land main > /dev/null |
| 108 | for a in a b c; do braid workspace add agent-$a; done # under .braid/work/ |
| 109 | |
| 110 | echo 'free_over = 50' > .braid/work/agent-a/shipping.toml |
| 111 | echo 'Ships in a day.' > .braid/work/agent-b/README.md |
| 112 | echo 'free_over = 40' > .braid/work/agent-c/shipping.toml |
| 113 | braid commit --workspace agent-a --agent agent-a -m "Free shipping from 50" |
| 114 | braid commit --workspace agent-b --agent agent-b -m "Next-day shipping" |
| 115 | braid commit --workspace agent-c --agent agent-c -m "Free shipping from 40" |
| 116 | |
| 117 | braid land --workspace agent-a --agent agent-a # fast-forward |
| 118 | braid land --workspace agent-b --agent agent-b # rebased onto agent-a's change |
| 119 | braid land --workspace agent-c --agent agent-c # a conflict: exit status 2 |
| 120 | ``` |
| 121 | |
| 122 | The three landings print this; your ids will differ, since every signature |
| 123 | carries its time: |
| 124 | |
| 125 | ```console |
| 126 | Landed 9b6231894f8d on main (fast-forward) |
| 127 | Landed on main as 76b20fe96330, rebased onto 9b6231894f8d |
| 128 | Updated 1 path in the working copy |
| 129 | bdc82892d520 conflicts with main at 76b20fe96330; main did not move: |
| 130 | CONTENT shipping.toml (1 region) |
| 131 | Run `braid --agent agent-c --workspace agent-c update` to bring the conflicts into the working copy. |
| 132 | ``` |
| 133 | |
| 134 | <details> |
| 135 | <summary>The same conflict as an agent reads it, with --json</summary> |
| 136 | |
| 137 | `braid land --workspace agent-c --agent agent-c --json`, abridged: |
| 138 | |
| 139 | ```json |
| 140 | { |
| 141 | "outcome": "conflicts", |
| 142 | "next": "braid --agent agent-c --workspace agent-c update", |
| 143 | "conflicts": [{ |
| 144 | "path": "shipping.toml", |
| 145 | "kind": "CONTENT", |
| 146 | "hunks": [{ |
| 147 | "base": { "start": 0, "end": 1, "text": "free_over = 60\n" }, |
| 148 | "branch": { "start": 0, "end": 1, "text": "free_over = 50\n" }, |
| 149 | "workspace": { "start": 0, "end": 1, "text": "free_over = 40\n" } |
| 150 | }] |
| 151 | }] |
| 152 | } |
| 153 | ``` |
| 154 | |
| 155 | `base` is what both sides started from, `branch` what `main` holds now and |
| 156 | `workspace` the agent's own change; lines count from 0, and a range stops |
| 157 | before `end`. Exit status 2 also means a command line that braid could not |
| 158 | parse, so an agent reads `outcome` too. `braid land --help` describes every |
| 159 | field. |
| 160 | |
| 161 | </details> |
| 162 | |
| 163 | Settle the conflict as an agent would, then look back: |
| 164 | |
| 165 | ```bash |
| 166 | braid update --workspace agent-c --agent agent-c # exit status 2: markers in its shipping.toml |
| 167 | echo 'free_over = 45' > .braid/work/agent-c/shipping.toml |
| 168 | braid commit --workspace agent-c --agent agent-c -m "Free shipping from 45" |
| 169 | braid land --workspace agent-c --agent agent-c # fast-forward |
| 170 | braid log main # every changeset names the agent that made it |
| 171 | braid op log # every landing, newest first |
| 172 | braid undo # takes agent-c's landing back; the change stays in its workspace |
| 173 | ``` |
| 174 | |
| 175 |  |
| 176 | |
| 177 | *The recording goes on the same way, and asks for the conflict as JSON first.* |
| 178 | |
| 179 | ## Use it from your agent |
| 180 | |
| 181 | Braid comes with instructions written for coding agents. In a project that |
| 182 | is a git repository, ask your agent, whatever harness runs it: |
| 183 | |
| 184 | ```text |
| 185 | Install braid in this project and set it up for agents, following https://braid.elffuss.com/agents.md (read it whole, with curl -fsSL) |
| 186 | ``` |
| 187 | |
| 188 | It installs braid with cargo, tells you what in the project braid does not |
| 189 | run, such as git hooks, offers to make a git remote if the project has |
| 190 | none, imports the project's git history, and writes the rules for agents |
| 191 | into the project's `AGENTS.md` with `braid agents init`. From then on, |
| 192 | every agent session works in a braid workspace of its own, where git |
| 193 | refuses to run, lands through braid, and tells you when what it landed is |
| 194 | waiting for a sync to the git remote. In a clone where braid is not set up, |
| 195 | agents work with git as before. |
| 196 | |
| 197 |  |
| 198 | |
| 199 | - **`AGENTS.md`** gets a section between `<!-- braid:start -->` and |
| 200 | `<!-- braid:end -->` with the rules every session follows; running |
| 201 | `braid agents init` again rewrites only that section. **`CLAUDE.md`** and |
| 202 | **`GEMINI.md`**, where they exist, get the line `@AGENTS.md`. They are |
| 203 | committed with git, so every clone and every new session has them. |
| 204 | - **Nothing of braid's own goes into git.** `.braid/` holds the store, the |
| 205 | workspaces and `.braid/config`, the name and e-mail address that sign |
| 206 | what agents land. |
| 207 | |
| 208 | Agents get `--json` on every command, exit status 2 for a conflict that |
| 209 | left the branch where it was, and a guard that holds back new files that |
| 210 | look like secrets (`.env*`, `*.pem`, `id_*`) or are larger than 1 MiB until |
| 211 | `braid track` lets them in. The guide is part 1 of [AGENTS.md](AGENTS.md), |
| 212 | served as [braid.elffuss.com/agents.md](https://braid.elffuss.com/agents.md) |
| 213 | next to an [llms.txt](https://braid.elffuss.com/llms.txt). To set a project |
| 214 | up by hand, follow its [Set up a project](AGENTS.md#set-up-a-project): the |
| 215 | same steps, what to check first, and what to do when one fails. |
| 216 | |
| 217 | ## Why braid |
| 218 | |
| 219 | Git was designed for people who work offline and sync now and then. Agents |
| 220 | are many, always connected, and all want to land on `main` at once. With |
| 221 | git, every agent that loses the race to push fetches, rebases and pushes |
| 222 | again. A merge queue ends the race by testing each change before it lands, |
| 223 | so every landing waits for CI; Anthropic's article puts it plainly: "A |
| 224 | proper merge queue, for example, doesn't make much sense at agent scale." |
| 225 | |
| 226 | | | git, a clone per agent | a merge queue | braid | |
| 227 | |---|---|---|---| |
| 228 | | Landing | `git push`, rejected whenever another agent got in first | waits for CI on the changes ahead of it | `braid land`: one short step, taken in turn | |
| 229 | | Retries | grow with the agents: 5.2 per push with 16, [in one run](#measured-against-git) | none | none: a change that fell behind is rebased | |
| 230 | | A conflict | markers, and messages written for people | the change leaves the queue | exit status 2, `main` does not move, JSON with `next` | |
| 231 | | A change that breaks the build | lands | is stopped before it lands | lands, and [`braid verify --revert`](#keeping-main-green) then lands its revert | |
| 232 | |
| 233 | So braid trades the queue's guarantee for landings that never wait for CI: |
| 234 | between a landing and the next `braid verify`, `main` can be red, and |
| 235 | `braid/green/main` names the newest changeset that passed. |
| 236 | |
| 237 | <details> |
| 238 | <summary>The design, against git's</summary> |
| 239 | |
| 240 | | | git | braid | |
| 241 | |---|---|---| |
| 242 | | Unit of change | a commit: a full tree snapshot | a changeset: the files that changed against the first parent, plus the root tree id | |
| 243 | | Many writers | one index per working tree | one workspace per agent over a shared append-only store; creating a change takes no repository lock | |
| 244 | | Fetching | negotiated packs, built for each client | immutable objects by id; any HTTP cache can serve a public repository's, and a private one's carry `Cache-Control: private` | |
| 245 | | Large directories | rewritten whole on every change | split into content-defined nodes; an edit rewrites only its path | |
| 246 | | Large files | a separate extension | content-defined chunks, deduplicated across versions | |
| 247 | | Hash | SHA-1 by default | BLAKE3 | |
| 248 | | For agents | output written for people | `--json` everywhere; changes can be created without a checkout | |
| 249 | |
| 250 | This is the design. [Status and roadmap](#status-and-roadmap) says what |
| 251 | exists today. |
| 252 | |
| 253 | </details> |
| 254 | |
| 255 | ## How it works |
| 256 | |
| 257 | <picture> |
| 258 | <source media="(prefers-color-scheme: dark)" srcset="docs/assets/how-it-works-dark.svg"> |
| 259 | <source media="(prefers-color-scheme: light)" srcset="docs/assets/how-it-works-light.svg"> |
| 260 | <img src="docs/assets/how-it-works-light.svg" alt="Three workspaces, a, b and c, each with its own working copy and no index, sit on one shared store of immutable objects named by BLAKE3 and an append-only op log, and commit in parallel. Landing is one short step, taken in turn: a goes straight in as a fast-forward, b is rebased onto it, and c hits a conflict, exit 2, so main did not move; c runs update, fixes the file and commits, then lands as a fast-forward. The strands braid into main, which git sync sends to any git remote as a fast-forward, with a lease. A dashed box marks a daemon and caches as planned."> |
| 261 | </picture> |
| 262 | |
| 263 | 1. **Everything is an immutable object named by its BLAKE3 hash,** and a |
| 264 | changeset records the files that changed against its first parent, plus |
| 265 | the root tree it produces: history, blame and rebase read the short |
| 266 | list, and the root id commits to the whole repository. |
| 267 | 2. **Landing is the one step agents take in turn, and it is short:** a |
| 268 | fast-forward, or a rebase path by path that merges only the files both |
| 269 | sides touched. Conflicts come back as data, and the branch does not |
| 270 | move. |
| 271 | 3. **Many processes share one store without a daemon,** through locks the |
| 272 | kernel releases if a process dies, and an append-only op log records |
| 273 | every operation, so that `braid undo` can step back. |
| 274 | 4. **The same requests at every tier:** a local store, a per-machine |
| 275 | daemon, a cache and a server are meant to answer the same requests. The |
| 276 | server has its first version, BraidHub; the daemon and the caches are |
| 277 | planned (milestones 6 and 7). |
| 278 | |
| 279 | ## Working with git |
| 280 | |
| 281 | Repositories come in with their whole history, and git hosts keep working |
| 282 | as mirrors. |
| 283 | |
| 284 |  |
| 285 | |
| 286 | ```bash |
| 287 | cd "$(mktemp -d)" && braid init demo && cd demo |
| 288 | braid git import /path/to/project # every local branch and tag |
| 289 | braid log main -- README.md # only the changes to a path |
| 290 | braid blame main README.md # who last changed each line |
| 291 | git init --quiet --bare ../mirror.git |
| 292 | braid git export ../mirror.git # the same commits, with the same ids |
| 293 | braid git sync https://github.com/you/project.git --branch main |
| 294 | ``` |
| 295 | |
| 296 | - **Bit for bit.** `braid git import` reads git through |
| 297 | [gitoxide](https://github.com/GitoxideLabs/gitoxide), exports each commit |
| 298 | again as it imports it, and stops unless the id comes back the same. |
| 299 | Shallow and SHA-256 repositories are refused for now. |
| 300 | - **The remote only fast-forwards.** `braid git sync` fetches and imports, |
| 301 | then fast-forwards braid or pushes, merging first when both moved. The |
| 302 | push carries a lease on what it just fetched, so history on GitHub, Gitea |
| 303 | or any git remote is never rewritten; a conflict moves nothing and exits |
| 304 | with status 2. |
| 305 | - **No git code.** Braid contains no code from git itself, which is GPLv2. |
| 306 | It reads and writes git data with gitoxide (MIT or Apache-2.0); |
| 307 | `git sync` also runs the `git` binary, to set up its mirror, fetch and |
| 308 | push. |
| 309 | |
| 310 | ## Keeping main green |
| 311 | |
| 312 | New in 0.1.1. Braid has no merge queue: changes land as they come, and |
| 313 | `braid verify` checks afterwards. It runs the project's tests on the head |
| 314 | of a branch, in a fresh copy of its files, and keeps `braid/green/<branch>` |
| 315 | at the newest changeset that passed. When they fail, it bisects the |
| 316 | changesets since the green one, and with `--revert` it lands the revert of |
| 317 | the first that fails. One run is one pass: run it after landings, or on a |
| 318 | schedule. |
| 319 | |
| 320 | ```bash |
| 321 | braid verify --branch main --revert --json -- cargo test --workspace |
| 322 | ``` |
| 323 | |
| 324 | Here three changesets landed after the green one, and the second broke the |
| 325 | tests. A failing run is run once more before it counts: |
| 326 | |
| 327 | ```console |
| 328 | $ braid verify --branch main --revert -- sh -c 'grep -qx ok status.txt' |
| 329 | braid verify: 60fb322bafea failed (exit status: 1) |
| 330 | braid verify: 60fb322bafea failed (exit status: 1) |
| 331 | braid verify: c4b445c63d60 passed |
| 332 | braid verify: 51108ceb6ded failed (exit status: 1) |
| 333 | braid verify: 51108ceb6ded failed (exit status: 1) |
| 334 | main at 60fb322bafea: reverted (5 runs) |
| 335 | the tests fail from 51108ceb6ded, the first changeset that fails; its revert landed on main |
| 336 | Revert: dbc25836e20d |
| 337 | ``` |
| 338 | |
| 339 | - **A fresh copy, not a sandbox.** The command runs as given, with no |
| 340 | shell, in a copy of the changeset's files in the system's temporary |
| 341 | directory, outside the repository: every run builds from scratch, and |
| 342 | the copy is removed after it. `BRAID_VERIFY_CHANGESET` and |
| 343 | `BRAID_VERIFY_BRANCH` say what it tests, and `PWD` names the copy; |
| 344 | `BRAID_TOKEN`, every variable whose name starts with `BRAID_HUB`, and |
| 345 | `OLDPWD` are taken out of its environment. That is all the isolation |
| 346 | there is: the command runs as you, with your access to every file, the |
| 347 | network, the `braid` command and any hub login saved in braid's |
| 348 | configuration directory. For code you do not trust, run verify in a |
| 349 | container, a sandbox or as a user of its own. |
| 350 | - **A process group and a watchdog, on Unix.** The command runs in a |
| 351 | process group of its own. When it exits, or runs past `--timeout` |
| 352 | (10 minutes by default), the group is killed, with whatever it started |
| 353 | that is still in it; a process that left the group, as a daemon does, is |
| 354 | not. A watchdog process, started before the command, kills the group and |
| 355 | removes the copy if braid is killed or exits while the tests run. When |
| 356 | the watchdog cannot start, or stops, verify ends there with an error |
| 357 | (exit status 1) rather than go on unwatched, and runs no more tests. On |
| 358 | other systems (Windows is not verified) only the command itself is |
| 359 | killed, and nothing watches braid. |
| 360 | - **In a container,** run braid under an init such as |
| 361 | [tini](https://github.com/krallin/tini) (`docker run --init`), not as |
| 362 | PID 1: PID 1 gets no default handling of signals, and has to reap the |
| 363 | processes others leave behind, which braid does not. |
| 364 | - **Flaky tests.** A run fails when the command exits with a status other |
| 365 | than 0, is killed or runs past `--timeout`, and a failing run is run |
| 366 | again (`--reruns`, once by default) before it counts. One that then |
| 367 | passes is `flaky`: green, but the green ref stays where it was unless |
| 368 | `--flaky-moves-green`. |
| 369 | - **Bisecting** tests the changesets it picks as they are, along first |
| 370 | parents. When the first that fails was reverted later in the range, |
| 371 | verify tests the revert and, if it passes, bisects again after it. A |
| 372 | changeset whose files cannot be written on this system is skipped, and |
| 373 | listed in `skipped`. |
| 374 | - **Limits on reverts.** Verify never reverts a merge, nor a revert it |
| 375 | made, which it tells by the revert's `reverts` field and its agent, |
| 376 | `braid-verify`; braid warns anyone else who acts as `braid-verify`. It |
| 377 | lands at most three reverts an hour (`--max-reverts-per-hour`), each |
| 378 | counted by its own committer time among the last 10,000 changesets of |
| 379 | the branch, whatever the dates of those between them. Both rules are |
| 380 | read from the branch, so a clone without verify's local record in |
| 381 | `.braid/verify/` follows them too. After a revert the green ref does not |
| 382 | move: the next pass tests the new head. |
| 383 | - **The green ref is local.** It is never exported or sent to a hub, and a |
| 384 | fresh clone, as CI has, has none: verify then tests only the head, unless |
| 385 | `--from` names a changeset to bisect from. `braid status --json` shows |
| 386 | it as `green`. `--dry-run` runs the tests, but moves no ref, records |
| 387 | nothing, lands nothing and does not fetch from a hub. |
| 388 | - **Exit status** 0 means green (`pass` or `flaky`); 4 red (`red`, |
| 389 | `reverted`, `refused` or `no_culprit`), whether or not a revert landed; |
| 390 | 2 a revert that conflicts; and 1 an error. Once the tests have started, |
| 391 | an error prints the report too, with what was done until then. |
| 392 | |
| 393 | `braid revert <rev>` undoes one changeset by hand: it lands a new |
| 394 | changeset that puts the files it changed back as they were before it, and |
| 395 | when a later change touched the same lines, it stops with exit status 2 |
| 396 | and the branch does not move. `braid verify --help` describes every JSON |
| 397 | field, and [the design](docs/design.md#landing-on-a-branch) has the rules. |
| 398 | |
| 399 | ## BraidHub |
| 400 | |
| 401 | [BraidHub](https://braidhub.elffuss.com) is the hosted service for agents |
| 402 | on many machines. In a repository linked to it, `braid land` lands on the |
| 403 | hub, rebased there path by path in turn with every other landing, with the |
| 404 | output and exit statuses of a local landing. A repository is private unless |
| 405 | its owner makes it public, and can keep a GitHub repository as its mirror, |
| 406 | which every landing on its default branch reaches as a fast-forward. |
| 407 | |
| 408 | A public repository can be read, and cloned, with no account. This one is |
| 409 | on the hub too: |
| 410 | |
| 411 | ```bash |
| 412 | braid hub show -R kikocis/elffuss-braid # its description, counts and README |
| 413 | braid hub log -R kikocis/elffuss-braid # its history, newest first |
| 414 | braid hub cat -R kikocis/elffuss-braid Cargo.toml |
| 415 | braid hub clone kikocis/elffuss-braid spec --paths docs/spec # only the trees under docs/spec |
| 416 | ``` |
| 417 | |
| 418 | Landing from several machines takes an account, with GitHub sign-in: |
| 419 | `braid login`, then `braid hub publish` to put a repository on the hub and |
| 420 | `braid hub clone` to make a linked copy of it elsewhere. The same CLI |
| 421 | covers change requests that land exactly as they were reviewed, issues, an |
| 422 | inbox and forks, every command with `--json`. Coding agents have |
| 423 | [their own guide](https://braidhub.elffuss.com/agents.md) |
| 424 | ([docs/hub-agents.md](docs/hub-agents.md)), and [docs/hub.md](docs/hub.md) |
| 425 | documents the protocol. BraidHub is new in version 0.1: for anything that |
| 426 | matters, keep a GitHub mirror as the source of truth. |
| 427 | |
| 428 | ## Design |
| 429 | |
| 430 | - [Design overview](docs/design.md): the store, landing, history, |
| 431 | workspaces, the git bridge, the server, and how it is tested. |
| 432 | - [Format v1](docs/spec/format-v1.md): the exact bytes of ids, trees and |
| 433 | changesets, with golden vectors. |
| 434 | - [The BraidHub protocol](docs/hub.md) and |
| 435 | [BraidHub for coding agents](docs/hub-agents.md). |
| 436 | - [Benchmarks against git](bench/README.md): how every ratio here is |
| 437 | measured. |
| 438 | |
| 439 | ## Status and roadmap |
| 440 | |
| 441 | | Milestone | Scope | State | |
| 442 | |---|---|---| |
| 443 | | 0 | Public repository, CI, object ids, `braid hash-object` | ✅ done | |
| 444 | | 1 | Format v1: canonical codec, trees (flat and split), changesets, name rules; frozen | ✅ done | |
| 445 | | 2 | Local store and op log: many processes, crash-safe, `fsck`, `undo` | ✅ done | |
| 446 | | 3 | History and the git bridge: import, export, `log`, `show` | ✅ done | |
| 447 | | 4 | Many agents on one machine: workspaces, `land`, conflicts, `git sync` | ✅ done | |
| 448 | | 5 | Performance: deltas, chunking, derived indexes, `blame`, benchmarks against git | in progress | |
| 449 | | 6 | Server: [BraidHub](#braidhub) with GitHub sign-in, landing over HTTP, GitHub mirrors and sparse clones; caching tiers | first version; caching planned | |
| 450 | | 7 | Daemon, virtual file system, WebAssembly core | planned | |
| 451 | |
| 452 | New in 0.1.4: the repository moved to the UtopiaIA organization; no change to the program. |
| 453 | |
| 454 | New in 0.1.1: `braid revert`, and `braid verify`, which runs when you run |
| 455 | it: one run tests a branch's head, bisects a failure to the changeset that |
| 456 | caused it and, with `--revert`, lands that changeset's revert. |
| 457 | |
| 458 | New in 0.1.3: the client side of verification on a hub. `braid hub verify` |
| 459 | reads and sets a repository's verification policy, posts the outcome of a |
| 460 | CI run for a pushed head with a token that may only report, and shows the |
| 461 | hub's green and red changesets; landings say when the branch is red. The |
| 462 | hub keeps `braid/green` and `braid/red` from those reports and never runs a |
| 463 | repository's code (docs/hub.md, section 25). |
| 464 | |
| 465 | New in 0.1.2: a sturdier `braid verify`. On Unix its watchdog starts |
| 466 | before the tests, and when it cannot, or stops, verify ends with an error |
| 467 | rather than go on unwatched. Its limit on reverts an hour counts each of |
| 468 | its reverts by the revert's own committer time, among the last 10,000 |
| 469 | changesets of the branch, whatever the dates of those between them. Cut |
| 470 | short by an error once its tests have started, it still prints its report, |
| 471 | counting every run that started. And any other command run as the agent |
| 472 | `braid-verify` warns that verify takes that agent's reverts for its own. |
| 473 | |
| 474 | Each milestone ships when its tests pass: golden vectors and fuzzing for |
| 475 | the format, crash and many-process tests for the store, bit-for-bit round |
| 476 | trips and differential tests against git for the bridge, deterministic |
| 477 | simulation for landing. |
| 478 | |
| 479 | ## What is honest about this |
| 480 | |
| 481 | - **It is version 0.1.** Today it stores history, round-trips git |
| 482 | repositories, runs workspaces for many agents on one machine, lands |
| 483 | their work from many machines through BraidHub, and finds and reverts |
| 484 | what broke the tests. Keep your git repository as the source of truth, |
| 485 | and do not keep anything only in braid. |
| 486 | - **Slower than git at most things, at the last measurement.** |
| 487 | [Measured against git](#measured-against-git) gives every result as a |
| 488 | ratio against git on the same machine, with the script that reproduces |
| 489 | it. At commit `5330054`, braid was faster when many agents landed at |
| 490 | once, and slower at importing and storing history, and at status and |
| 491 | commit on large trees. Much of that has been worked on since, but |
| 492 | `bench/run.py` has not been run again for the ratio table. A later |
| 493 | measurement of the store's size, on the imported histories of four |
| 494 | public repositories, found 2.5 to 3.1 times what `git gc --aggressive` |
| 495 | packs them into |
| 496 | ([format v1, section 7](docs/spec/format-v1.md#7-storage-not-hashed-versioned-on-its-own)). |
| 497 | - **`main` can be red for a while.** Braid lands first and tests after, |
| 498 | and merges are textual: two changes can merge cleanly and still break |
| 499 | the build together, until |
| 500 | [`braid verify --revert`](#keeping-main-green) reverts one of them. |
| 501 | - **Not there yet:** garbage collection, so nothing is ever removed from a |
| 502 | store, and shallow or SHA-256 git repositories, which the git bridge |
| 503 | refuses. `log -- <path>` and `blame` follow first parents and, on |
| 504 | purpose, not renames. |
| 505 | - **The hashed format is frozen,** and every golden vector is recomputed by |
| 506 | a second implementation written from the specification alone. Storage |
| 507 | and protocols can still change. |
| 508 | - **Braid is not Scion.** It starts from the ideas Anthropic described in |
| 509 | public about its own source control system. It is an independent |
| 510 | implementation, contains no code from Anthropic, and is not affiliated |
| 511 | with or endorsed by Anthropic. |
| 512 | - **Platforms.** CI tests Linux and other Unix-like systems. Windows is not |
| 513 | tested yet. |
| 514 | |
| 515 | ## Measured against git |
| 516 | |
| 517 | Each number is braid's time, or the size of its store, divided by git's for |
| 518 | the same work on the same machine: below 1 braid is faster or smaller, |
| 519 | above 1 it is slower or larger. They are medians from one run of |
| 520 | [`bench/run.py`](bench/README.md), measuring braid at commit `5330054`. Git |
| 521 | ran with its defaults, except that automatic garbage collection and |
| 522 | maintenance were off, and so were its file system monitor and, unless a row |
| 523 | says otherwise, its untracked cache. [The benchmark's README](bench/README.md) |
| 524 | describes every scenario. Yours will differ: run |
| 525 | `python3 bench/run.py --only <scenario>` before relying on any of them. |
| 526 | |
| 527 | | What was compared | braid / git | `--only` | |
| 528 | |---|---|---| |
| 529 | | 4, 8 and 16 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 rejected | 0.4, 0.3, 0.2 | `agents` | |
| 530 | | Import [tmux](https://github.com/tmux/tmux) 3.5a, 10,287 commits: `braid init` + `braid git import` vs `git clone --no-local --bare`; then checking it out too, with `braid workspace add` vs `git clone --no-local` | 17.6, 17.1 | `import` | |
| 531 | | Size after that import: `du` of `.braid/store` vs the bare clone after `git gc --aggressive` | 25.1 | `store` | |
| 532 | | Status of a tree of 100,000 files, clean: `braid status` vs `git status`, without the untracked cache, then with `core.untrackedCache=true` | 2.6, 5.8 | `status` | |
| 533 | | The same, with 10 files modified | 3.0, 5.7 | `status` | |
| 534 | | Commit one changed file of that tree: `braid commit` vs `git add` + `git commit` | 5.0 | `commit` | |
| 535 | | Commit one new file in a directory of 20,000 files, 200 times: `braid commit` vs `git add` + `git commit` | 1.8 | `wide` | |
| 536 | | The same without a working copy: `braid change create --land` | 0.9 | `wide` | |
| 537 | | Newest 1,000 changesets of tmux: `braid log -n 1000` vs `git log --first-parent -n 1000 --format=%H` after `git gc --aggressive` | 1.7 | `history` | |
| 538 | |
| 539 | Git retried each push 1.1, 2.5 and 5.2 times on average with 4, 8 and 16 |
| 540 | agents; no braid agent retried, and nearly every braid landing was a |
| 541 | rebase. Since this run, braid stores deltas, cuts large files into chunks, |
| 542 | edits a large directory in place, walks the working copy in parallel, and |
| 543 | looks objects up through the store's indexes instead of mapping the whole |
| 544 | store first. The ratios show none of that, and leave out |
| 545 | `braid log -- <path>` and `braid blame`, which came later. |
| 546 | |
| 547 | <details> |
| 548 | <summary>Why braid was slower at that commit</summary> |
| 549 | |
| 550 | - **Importing and storing history.** Braid kept every version of a file |
| 551 | whole, compressed on its own, where git stores most versions as a delta |
| 552 | against another. The import converted and checked every object on one |
| 553 | thread, and much of that time went to checking every entry name against |
| 554 | the aliases of `.git`, with Unicode normalisation and case folding, each |
| 555 | time a tree was read or built. |
| 556 | - **Status and commit on a large tree.** `braid status` walked the working |
| 557 | copy one directory at a time on one core, opening each directory from the |
| 558 | root one name at a time, so that it never follows a symlink; it also read |
| 559 | the whole base tree and rewrote the whole stat cache every time. |
| 560 | `git status` spreads its checks over several cores and, with the |
| 561 | untracked cache, skips the directories that did not change. |
| 562 | `braid commit` has no staging area, so it ran a whole status first. |
| 563 | - **A new file in a wide directory.** Braid wrote only the few nodes of a |
| 564 | large directory that change, but read and rebuilt the whole directory in |
| 565 | memory to find them. From 2,500 to 20,000 files, the cost of one commit |
| 566 | grew 5.2 times for `braid commit`, 3.6 times for `braid change create` |
| 567 | and 3.5 times for git. |
| 568 | - **Opening the store.** Every command first built a map of where each |
| 569 | object of the store is, which on a history the size of tmux's was a |
| 570 | large part of `braid log -n 1000`; git looks each object up in its pack |
| 571 | index when it needs it. |
| 572 | |
| 573 | </details> |
| 574 | |
| 575 | ## Questions |
| 576 | |
| 577 | **Is braid an open-source Scion?** No. Scion is internal to Anthropic. |
| 578 | Braid is an independent implementation of the ideas Anthropic published |
| 579 | about it, contains no code from Anthropic, and on one machine needs no |
| 580 | server. The site's [page on Scion's ideas](https://braid.elffuss.com/scion.html) |
| 581 | says what braid takes from Scion and where it differs. |
| 582 | |
| 583 | **Does braid need a server?** Not on one machine: the agents' workspaces |
| 584 | share one store, and landings take their turn with no server and no |
| 585 | daemon. When agents on several machines share a repository, |
| 586 | [BraidHub](#braidhub) is the server, and `braid land` lands there, in turn |
| 587 | with every other landing. |
| 588 | |
| 589 | **Why not a git worktree per agent?** A git worktree gives each agent its |
| 590 | own files and index, but landing works as before: each branch still has |
| 591 | to be rebased or merged onto `main`, and when the agents push to one |
| 592 | remote, every agent that loses the race fetches, rebases and pushes again, |
| 593 | and stops at conflict markers when two changes clash. `braid land` rebases |
| 594 | a change onto whatever landed first, in one short step taken in turn, and |
| 595 | a conflict comes back as data while `main` stays put. |
| 596 | |
| 597 | **Do coding agents need a merge queue?** Not to land. Agents land in turn |
| 598 | and never wait for CI; [`braid verify`](#keeping-main-green) tests after |
| 599 | landing, bisects a failure and, with `--revert`, lands the revert, and |
| 600 | `main` can be red in between. Where people review each change before it |
| 601 | lands, pull requests and a merge queue still make sense, and |
| 602 | `braid git sync` keeps the GitHub repository they use in step. |
| 603 | |
| 604 | ## Part of Elffuss |
| 605 | |
| 606 | Braid is part of [Elffuss](https://elffuss.com), a family of tools for |
| 607 | building software with agents: |
| 608 | [elffuss.com](https://elffuss.com) · |
| 609 | [Code](https://code.elffuss.com) · |
| 610 | [Claw](https://claw.elffuss.com) · |
| 611 | [Translator](https://translator.elffuss.com) · |
| 612 | [Copilot](https://copilot.elffuss.com) · |
| 613 | [Blog](https://elffuss.com/blog/) · |
| 614 | [Hugging Face](https://huggingface.co/KikoCis) · |
| 615 | [Dev log](https://bitacora.utopiaia.com/). |
| 616 | Braid has a [Space on Hugging Face](https://huggingface.co/spaces/KikoCis/elffuss-braid) |
| 617 | too. |
| 618 | |
| 619 | - [elffuss](https://github.com/utopia-ia/elffuss): the shared browser-agent core behind Code and Claw. |
| 620 | - [elffuss-code](https://github.com/utopia-ia/elffuss-code): an IDE with an AI agent that runs entirely in your browser ([Space](https://huggingface.co/spaces/KikoCis/elffuss-code)). |
| 621 | - [elffuss-claw](https://github.com/utopia-ia/elffuss-claw): an agentic OS in your browser, with apps generated on demand ([Space](https://huggingface.co/spaces/KikoCis/elffuss-claw)). |
| 622 | - [elffuss-engine](https://github.com/utopia-ia/elffuss-engine): an LLM runtime that runs GGUF models on WebGPU. |
| 623 | - [elffuss-translator](https://github.com/utopia-ia/elffuss-translator): real-time conversation translation in the browser. |
| 624 | |
| 625 | ## Prior art and credits |
| 626 | |
| 627 | - Anthropic, [Redesigning source control at Anthropic](https://www.anthropic.com/research/redesigning-source-control): |
| 628 | changesets stored against the first parent, server-side merges, minimal |
| 629 | branch state, immutable objects served by any cache tier, and testing |
| 630 | after merging instead of a merge queue. The article credits many of its |
| 631 | techniques to Sapling's server, |
| 632 | [Mononoke](https://github.com/facebook/sapling/blob/main/eden/mononoke/README.md), |
| 633 | and its Bonsai data model. |
| 634 | - [Jujutsu](https://github.com/jj-vcs/jj): the operation log and undo. |
| 635 | - [Sapling](https://sapling-scm.com): history served at scale, and compressing |
| 636 | a file version against the previous one. |
| 637 | - [gitoxide](https://github.com/GitoxideLabs/gitoxide): the git bridge. |
| 638 | - [BLAKE3](https://github.com/BLAKE3-team/BLAKE3), [FastCDC](https://www.usenix.org/conference/atc16/technical-sessions/presentation/xia), |
| 639 | [prolly trees](https://docs.dolthub.com/architecture/storage-engine/prolly-tree) |
| 640 | and [imara-diff](https://github.com/pascalkuthe/imara-diff). |
| 641 | |
| 642 | ## Contributing and security |
| 643 | |
| 644 | - [CONTRIBUTING.md](CONTRIBUTING.md): how to build, test and propose |
| 645 | changes. Pull requests are welcome. |
| 646 | - [SECURITY.md](SECURITY.md): how to report a vulnerability privately. |
| 647 | |
| 648 | ## License |
| 649 | |
| 650 | [Apache-2.0](LICENSE). Copyright 2026 UtopiaIA. See [NOTICE](NOTICE). |
| 651 | |
| 652 | --- |
| 653 | |
| 654 | ## En castellano |
| 655 | |
| 656 | **Muchos agentes. Un solo main. Sin reintentos.** Braid es un sistema de |
| 657 | control de versiones escrito desde cero en Rust, para repositorios en los |
| 658 | que muchos agentes de IA aterrizan cambios a la vez. Cada agente hace |
| 659 | commit en su propio espacio de trabajo, y aterrizar en `main` es un paso |
| 660 | corto que dan por turnos: si un cambio se ha quedado atrás, braid le hace |
| 661 | rebase sobre lo que haya aterrizado antes, y un conflicto vuelve como |
| 662 | datos, sin mover `main`. `braid verify`, nuevo en la 0.1.1, ejecuta los |
| 663 | tests cada vez que lo lanzas tras aterrizar; si fallan, localiza con bisect |
| 664 | el changeset que los rompió y, con `--revert`, aterriza el cambio que lo |
| 665 | deshace. Git se queda en los bordes, así que GitHub y Gitea siguen |
| 666 | funcionando. |
| 667 | |
| 668 | Elffuss Braid vive ahora en la organización UtopiaIA de GitHub, en github.com/utopia-ia/elffuss-braid. Se mudó desde github.com/KikoCis/elffuss-braid el 23 de octubre de 2026; la dirección antigua redirige. |
| 669 | |
| 670 | Se inspira en las ideas que Anthropic publicó sobre Scion, su sistema |
| 671 | interno de control de versiones. Es una implementación independiente: no |
| 672 | contiene código de Anthropic y no tiene relación con Anthropic ni cuenta |
| 673 | con su respaldo. |
| 674 | |
| 675 | Está en la versión 0.1, así que tu repositorio de git sigue siendo la |
| 676 | fuente de verdad. Para trabajar desde varias máquinas está |
| 677 | [BraidHub](https://braidhub.elffuss.com), el servicio alojado de braid: los |
| 678 | repositorios son privados salvo que su dueño diga lo contrario, y cada uno |
| 679 | puede tener un repositorio de GitHub como espejo, al que el hub sube como |
| 680 | fast-forward cada aterrizaje en su rama por defecto. Las |
| 681 | [fases](#status-and-roadmap) dicen qué llega después y qué pruebas tiene |
| 682 | que pasar cada una. |
| 683 | |
| 684 | Para usarlo en un proyecto, pídeselo a tu agente: |
| 685 | |
| 686 | ```text |
| 687 | Instala braid en este proyecto y configúralo para agentes siguiendo https://braid.elffuss.com/agents.md (léelo entero, con curl -fsSL) |
| 688 | ``` |
| 689 | |
| 690 | Lo instala con cargo, te avisa de lo que braid no ejecuta, como los hooks |
| 691 | de git, importa la historia de git del proyecto y, con `braid agents init`, |
| 692 | escribe en su `AGENTS.md` las reglas para que cada sesión trabaje en su |
| 693 | propio espacio de trabajo y aterrice sus cambios con braid. La web, |
| 694 | [braid.elffuss.com](https://braid.elffuss.com/?lang=es), también está en |
| 695 | castellano. |