utopia-ia/elffuss-braid public
Changesets · Branches · Tags · Compare
| Changeset | d10c558a569f7bfe7bd0cac47731fbf58fe950a0706a92cf56c3aee8fffbf4a6 |
|---|---|
| Author | KikoCis <KikoCis@users.noreply.github.com> · 2026-10-21 18:56 +02:00 |
| Committer | KikoCis <KikoCis@users.noreply.github.com> · 2026-10-21 18:56 +02:00 |
| Parents | 3297f228f20c, c77b4e2014b9 |
8 files changed
modified README.md +517 −513
| @@ -1,109 +1,178 @@ | ||
| 1 | -<div align="center"> | |
| 2 | - | |
| 3 | -<img src="docs/assets/braid-animated.svg" alt="Three strands braided together" width="320"> | |
| 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> | |
| 4 | 6 | |
| 5 | 7 | # ✳ Elffuss Braid |
| 6 | 8 | |
| 7 | -**Version control for repositories where many agents land changes at the same time.** | |
| 9 | +**Version control for repositories where many AI coding agents land changes at the same time.** | |
| 8 | 10 | |
| 9 | -A from-scratch version control system in Rust. Creating a change costs what the | |
| 10 | -change touches, not what the repository weighs. Agents commit in parallel, and | |
| 11 | -landing on `main` is one short step they take in turn. Git stays at the edges, | |
| 12 | -so GitHub keeps working. | |
| 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. | |
| 13 | 19 | |
| 14 | -[](LICENSE) | |
| 15 | 20 | [](https://github.com/KikoCis/elffuss-braid/actions/workflows/ci.yml) |
| 16 | -[](https://www.rust-lang.org) | |
| 21 | +[](LICENSE) | |
| 17 | 22 | [](#status-and-roadmap) |
| 23 | +[](https://www.rust-lang.org) | |
| 18 | 24 | [](docs/spec/format-v1.md) |
| 19 | 25 | |
| 20 | -[](https://braid.elffuss.com) | |
| 21 | -[](https://huggingface.co/spaces/KikoCis/elffuss-braid) | |
| 22 | -[](AGENTS.md) | |
| 23 | -[](https://braid.elffuss.com/llms.txt) | |
| 24 | -[](https://braidhub.elffuss.com) | |
| 25 | -[](CONTRIBUTING.md) | |
| 26 | -[](https://github.com/KikoCis/elffuss-braid/commits/main) | |
| 26 | +[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) | |
| 27 | 27 | |
| 28 | -[elffuss.com](https://elffuss.com) · [Code](https://code.elffuss.com) · [Claw](https://claw.elffuss.com) · [Translator](https://translator.elffuss.com) · [Copilot](https://copilot.elffuss.com) · [Blog](https://elffuss.com/blog/) · [Hugging Face](https://huggingface.co/KikoCis) · [Dev log](https://bitacora.utopiaia.com/) | |
| 28 | +Anthropic described Scion, the version control system it built in-house | |
| 29 | +with agents in mind, in | |
| 30 | +[Redesigning source control at Anthropic](https://www.anthropic.com/research/redesigning-source-control). | |
| 31 | +Scion is internal. Braid is an independent, open-source take on several of | |
| 32 | +its ideas, and you can run it today: | |
| 33 | +[ask your coding agent](#use-it-from-your-agent) to set it up in a | |
| 34 | +project, or try the [quick start](#quick-start). | |
| 29 | 35 | |
| 30 | -<br> | |
| 36 | +*Braid contains no code from Anthropic, and is not affiliated with or | |
| 37 | +endorsed by Anthropic.* | |
| 31 | 38 | |
| 32 | -<img src="docs/assets/demo-agents.gif" alt="Three agents commit at the same time, each in its own workspace, and land on main in turn: the first is a fast-forward, the second is rebased onto it, and the third changed the same line as the first, so main does not move and braid reports the conflict with exit status 2" width="860"> | |
| 39 | +> [!NOTE] | |
| 40 | +> Version 0.1: keep your git repository as the source of truth. | |
| 33 | 41 | |
| 34 | -<sub>The real CLI, recorded by <a href="scripts/demos/render.sh"><code>scripts/demos/render.sh</code></a>: three agents, one <code>main</code>.</sub> | |
| 42 | +## Scion's ideas, in braid | |
| 35 | 43 | |
| 36 | -</div> | |
| 44 | +Each row is an idea from the article, what braid 0.1.1 does with it, and | |
| 45 | +how far along that is. | |
| 37 | 46 | |
| 38 | ---- | |
| 47 | +| Scion's idea | In braid 0.1.1 | State | | |
| 48 | +|---|---|---| | |
| 49 | +| 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 | | |
| 50 | +| Data is content-addressed and never changes, so any cache can serve it | BLAKE3 ids; BraidHub serves every object by id as immutable | ✅ done | | |
| 51 | +| 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 | | |
| 52 | +| 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 | | |
| 53 | +| 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 | | |
| 54 | +| 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 | | |
| 55 | +| 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 | | |
| 56 | +| 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 | | |
| 57 | +| 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 | | |
| 58 | +| 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 | | |
| 59 | +| Hermetic simulations and fuzzing | Deterministic simulation of agents landing at once, with injected faults; crash and power-loss tests; five fuzz targets | ✅ done | | |
| 60 | +| 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 | | |
| 61 | +| Clients are always online | Braid works offline on one machine; BraidHub is the authority when several machines share a repository | no, by design | | |
| 62 | + | |
| 63 | +## Three agents, one main | |
| 64 | + | |
| 65 | +Three agents change a small shop at once, each in a workspace of its own: | |
| 66 | +no shared index, no repository-wide lock. Then they land on `main`, in | |
| 67 | +turn. | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | +*The real CLI, recorded by [`scripts/demos/render.sh`](scripts/demos/render.sh).* | |
| 72 | + | |
| 73 | +- **agent-a** lands first: a fast-forward. | |
| 74 | +- **agent-b** is one changeset behind. It does not fetch and does not | |
| 75 | + retry: `braid land` rebases its change onto agent-a's, in one short step. | |
| 76 | +- **agent-c** changed the same line as agent-a, a real conflict: `main` | |
| 77 | + stays where it was, braid exits with status 2, and the conflict comes | |
| 78 | + back as data, with each side and the command to run `next`. | |
| 79 | + | |
| 80 | +In git, each agent that loses the race fetches, rebases and pushes again. | |
| 81 | +In the run [measured against git](#measured-against-git), on one machine, | |
| 82 | +with 4, 8 and 16 agents landing at once, git retried each push 1.1, 2.5 and | |
| 83 | +5.2 times on average, no braid agent retried, and braid took 0.4, 0.3 and | |
| 84 | +0.2 of git's time. CI runs a scene like this one on every push to `main` | |
| 85 | +([`three_agents.rs`](crates/cli/tests/three_agents.rs)). | |
| 39 | 86 | |
| 40 | -**In this repository:** [why braid](#why-braid) · [how it works](#how-it-works) · [use it from your agent](#use-it-from-your-agent) · [quick start](#quick-start) · [working with git](#working-with-git) · [BraidHub](#braidhub) · [design](#design) · [status](#status-and-roadmap) · [what is honest about this](#what-is-honest-about-this) · [measured against git](#measured-against-git) · [credits](#prior-art-and-credits) | |
| 87 | +## Quick start | |
| 41 | 88 | |
| 42 | ---- | |
| 89 | +Braid builds from source with cargo, and needs Rust 1.89 or newer, a C | |
| 90 | +compiler and git. CI tests Linux and other Unix-like systems; Windows is | |
| 91 | +not tested yet. | |
| 43 | 92 | |
| 44 | -## Why braid | |
| 93 | +```bash | |
| 94 | +cargo install --locked --git https://github.com/KikoCis/elffuss-braid --tag v0.1.1 elffuss-braid-cli | |
| 95 | +``` | |
| 45 | 96 | |
| 46 | -Git was designed for people who work offline and sync now and then. Agents work | |
| 47 | -differently: there are many of them, each change is small, they are always | |
| 48 | -connected, and they all want to land on `main` at once. In git that shows up as: | |
| 97 | +To set braid up in a project you already have, | |
| 98 | +[ask your agent](#use-it-from-your-agent). To run the race above yourself, | |
| 99 | +in a throwaway directory: | |
| 100 | + | |
| 101 | +```bash | |
| 102 | +export BRAID_AUTHOR="Ada Lovelace <ada@example.org>" | |
| 103 | +cd "$(mktemp -d)" && braid init shop && cd shop | |
| 104 | +echo 'free_over = 60' | braid change create --base none \ | |
| 105 | + --set shipping.toml=@- -m "Start the shop" --land main > /dev/null | |
| 106 | +for a in a b c; do braid workspace add agent-$a; done # under .braid/work/ | |
| 107 | + | |
| 108 | +echo 'free_over = 50' > .braid/work/agent-a/shipping.toml | |
| 109 | +echo 'Ships in a day.' > .braid/work/agent-b/README.md | |
| 110 | +echo 'free_over = 40' > .braid/work/agent-c/shipping.toml | |
| 111 | +braid commit --workspace agent-a --agent agent-a -m "Free shipping from 50" | |
| 112 | +braid commit --workspace agent-b --agent agent-b -m "Next-day shipping" | |
| 113 | +braid commit --workspace agent-c --agent agent-c -m "Free shipping from 40" | |
| 114 | + | |
| 115 | +braid land --workspace agent-a --agent agent-a # fast-forward | |
| 116 | +braid land --workspace agent-b --agent agent-b # rebased onto agent-a's change | |
| 117 | +braid land --workspace agent-c --agent agent-c # a conflict: exit status 2 | |
| 118 | +``` | |
| 49 | 119 | |
| 50 | -- **Shared mutable state.** One index per working tree, and a push that is | |
| 51 | - rejected whenever someone else landed first, so every agent ends up in a | |
| 52 | - fetch, rebase, push and retry loop. | |
| 53 | -- **Costs that grow with the repository.** Status and commit walk the whole | |
| 54 | - index, and a directory with many files is rewritten whole on every change. | |
| 55 | -- **Transfers built per client.** Each fetch negotiates and builds its own pack, | |
| 56 | - so a cache in front of the server cannot help. | |
| 57 | -- **Large files need a side system.** | |
| 120 | +The three landings print this; your ids will differ, since every signature | |
| 121 | +carries its time: | |
| 122 | + | |
| 123 | +```console | |
| 124 | +Landed 9b6231894f8d on main (fast-forward) | |
| 125 | +Landed on main as 76b20fe96330, rebased onto 9b6231894f8d | |
| 126 | +Updated 1 path in the working copy | |
| 127 | +bdc82892d520 conflicts with main at 76b20fe96330; main did not move: | |
| 128 | + CONTENT shipping.toml (1 region) | |
| 129 | +Run `braid --agent agent-c --workspace agent-c update` to bring the conflicts into the working copy. | |
| 130 | +``` | |
| 58 | 131 | |
| 59 | -Braid starts from the opposite assumptions: | |
| 132 | +<details> | |
| 133 | +<summary>The same conflict as an agent reads it, with --json</summary> | |
| 134 | + | |
| 135 | +`braid land --workspace agent-c --agent agent-c --json`, abridged: | |
| 136 | + | |
| 137 | +```json | |
| 138 | +{ | |
| 139 | + "outcome": "conflicts", | |
| 140 | + "next": "braid --agent agent-c --workspace agent-c update", | |
| 141 | + "conflicts": [{ | |
| 142 | + "path": "shipping.toml", | |
| 143 | + "kind": "CONTENT", | |
| 144 | + "hunks": [{ | |
| 145 | + "base": { "start": 0, "end": 1, "text": "free_over = 60\n" }, | |
| 146 | + "branch": { "start": 0, "end": 1, "text": "free_over = 50\n" }, | |
| 147 | + "workspace": { "start": 0, "end": 1, "text": "free_over = 40\n" } | |
| 148 | + }] | |
| 149 | + }] | |
| 150 | +} | |
| 151 | +``` | |
| 60 | 152 | |
| 61 | -| | git | braid | | |
| 62 | -|---|---|---| | |
| 63 | -| Unit of change | a commit: a full tree snapshot | a changeset: the files that changed against the first parent, plus the root tree id | | |
| 64 | -| Landing on `main` | the client pushes and is rejected if behind | `land` rebases in one short step that landings take in turn, at a cost that follows the change | | |
| 65 | -| Many writers | one index per working tree | one workspace per agent over a shared append-only store; creating a change takes no repository lock | | |
| 66 | -| Fetching | negotiated packs, unique per client | immutable objects by id, so any cache (local daemon, nginx, CDN) can serve them | | |
| 67 | -| Large directories | rewritten whole on every change | split into content-defined nodes; an edit rewrites only its path | | |
| 68 | -| Large files | a separate extension | content-defined chunks, deduplicated across versions | | |
| 69 | -| Hash | SHA-1 | BLAKE3 | | |
| 70 | -| For agents | parse human output | `--json` everywhere; changes can be created through the API without a checkout | | |
| 153 | +`base` is what both sides started from, `branch` what `main` holds now and | |
| 154 | +`workspace` the agent's own change; lines count from 0, and a range stops | |
| 155 | +before `end`. Exit status 2 also means a command line that braid could not | |
| 156 | +parse, so an agent reads `outcome` too. `braid land --help` describes every | |
| 157 | +field. | |
| 71 | 158 | |
| 72 | -This is the design. [Status](#status-and-roadmap) says what exists today. | |
| 159 | +</details> | |
| 73 | 160 | |
| 74 | -## How it works | |
| 161 | +Settle the conflict as an agent would, then look back: | |
| 75 | 162 | |
| 76 | -```mermaid | |
| 77 | -flowchart LR | |
| 78 | - subgraph machine["One machine"] | |
| 79 | - A1["agent 1 · workspace"] --> ST | |
| 80 | - A2["agent 2 · workspace"] --> ST | |
| 81 | - A3["agent N · workspace"] --> ST | |
| 82 | - ST[("shared store<br/>immutable objects + op log")] | |
| 83 | - end | |
| 84 | - ST -- "land: one short step, taken in turn" --> MAIN(["main"]) | |
| 85 | - ST <-- "objects by id" --> SRV["BraidHub (optional)"] | |
| 86 | - ST <-- "import / export" --> GIT["git bridge"] | |
| 87 | - GIT <--> GH["GitHub · Gitea"] | |
| 163 | +```bash | |
| 164 | +braid update --workspace agent-c --agent agent-c # exit status 2: markers in its shipping.toml | |
| 165 | +echo 'free_over = 45' > .braid/work/agent-c/shipping.toml | |
| 166 | +braid commit --workspace agent-c --agent agent-c -m "Free shipping from 45" | |
| 167 | +braid land --workspace agent-c --agent agent-c # fast-forward | |
| 168 | +braid log main # every changeset names the agent that made it | |
| 169 | +braid op log # every landing, newest first | |
| 170 | +braid undo # takes agent-c's landing back; the change stays in its workspace | |
| 88 | 171 | ``` |
| 89 | 172 | |
| 90 | -1. **Everything is an immutable object named by its BLAKE3 hash:** file | |
| 91 | - contents, directories, and changesets. Nothing is ever rewritten in place. | |
| 92 | -2. **A changeset records what changed against its first parent,** plus the | |
| 93 | - root tree it produces. History, blame and rebase read the short list; the | |
| 94 | - root id commits to the whole repository. | |
| 95 | -3. **Agents commit in parallel; landing is one short step they take in turn.** | |
| 96 | - If the change was built on the current head it fast-forwards. If not, | |
| 97 | - braid rebases it path by path and merges only the files both sides | |
| 98 | - touched. Conflicts come back as data that an agent can act on. | |
| 99 | -4. **Many processes share one store without a daemon.** Segments are leased | |
| 100 | - with locks the kernel releases if a process dies, objects are published | |
| 101 | - before anything refers to them, and an append-only op log records every | |
| 102 | - operation so it can be undone. | |
| 103 | -5. **The same API at every tier.** A local store, a per-machine daemon, a | |
| 104 | - cache and a server answer the same requests, so a client never cares which | |
| 105 | - one it talks to. The server has its first version, BraidHub; the caches | |
| 106 | - and the daemon are planned (milestones 6 and 7). | |
| 173 | + | |
| 174 | + | |
| 175 | +*The recording goes on the same way, and asks for the conflict as JSON first.* | |
| 107 | 176 | |
| 108 | 177 | ## Use it from your agent |
| 109 | 178 | |
| @@ -117,371 +186,252 @@ | ||
| 117 | 186 | It installs braid with cargo, tells you what in the project braid does not |
| 118 | 187 | run, such as git hooks, offers to make a git remote if the project has |
| 119 | 188 | none, imports the project's git history, and writes the rules for agents |
| 120 | -into the project's `AGENTS.md` with `braid agents init`. | |
| 121 | -From then on, every agent session works in a braid workspace of its own, | |
| 122 | -where git refuses to run, lands through braid, and tells you when what it | |
| 123 | -landed is waiting for a sync to the git remote. Git stays the source of | |
| 124 | -truth, and in a clone where braid is not set up, agents work with git as | |
| 125 | -before. The instructions are part 1 of [AGENTS.md](AGENTS.md), which the | |
| 126 | -site serves as | |
| 127 | -[braid.elffuss.com/agents.md](https://braid.elffuss.com/agents.md), next to | |
| 128 | -an [llms.txt](https://braid.elffuss.com/llms.txt). | |
| 129 | - | |
| 130 | -<p align="center"><img src="docs/assets/demo-agents-init.gif" alt="Setting braid up in a project's git checkout: braid init, git told to ignore .braid, braid git import brings in the history, braid agents init writes the braid section into AGENTS.md, the section's rules are listed, and a new session starts in a workspace of its own under .braid/work" width="860"></p> | |
| 131 | - | |
| 132 | -### Set it up by hand | |
| 133 | - | |
| 134 | -The same steps, for a git checkout on its main branch with nothing to | |
| 135 | -commit, where git has a `user.name` and a `user.email`. [agents.md](https://braid.elffuss.com/agents.md) says what to check | |
| 136 | -first (git hooks, submodules, LFS, a branch that takes only pull requests) | |
| 137 | -and what to do when a step fails. | |
| 138 | - | |
| 139 | -```bash | |
| 140 | -cargo install --locked --git https://github.com/KikoCis/elffuss-braid --tag v0.1.1 elffuss-braid-cli | |
| 141 | -braid init # .braid/: the store and the agents' workspaces | |
| 142 | -mkdir -p "$(git rev-parse --git-path info)" | |
| 143 | -echo .braid >> "$(git rev-parse --git-path info/exclude)" # git ignores braid, in this checkout only | |
| 144 | -printf 'name = %s\nemail = %s\n' "$(git config user.name)" "$(git config user.email)" > .braid/config | |
| 145 | -braid git import . # the project's whole history | |
| 146 | -touch CLAUDE.md # only if agents work here with Claude Code | |
| 147 | -braid agents init # the rules for agents, into AGENTS.md | |
| 148 | -git add AGENTS.md CLAUDE.md # leave CLAUDE.md out if there is none | |
| 149 | -git commit -m "Set up braid for agents" | |
| 150 | -braid git import . # braid's main takes that commit | |
| 151 | -``` | |
| 152 | - | |
| 153 | -### What goes into your Markdown files | |
| 154 | - | |
| 155 | -Agents follow braid because the project tells them to, in the files their | |
| 156 | -harness reads at the start of every session. `braid agents init` writes | |
| 157 | -them, and they are committed with git, so every clone and every new session | |
| 158 | -has them: | |
| 159 | - | |
| 160 | -- **`AGENTS.md`**, which most coding agents read: a section between two | |
| 161 | - marker lines, with the rules every session follows. Running | |
| 162 | - `braid agents init` again, after a braid upgrade for example, rewrites the | |
| 163 | - section in place and never touches the rest of the file. It begins: | |
| 164 | - | |
| 165 | - ```markdown | |
| 166 | - <!-- braid:start --> | |
| 167 | - <!-- Written by `braid agents init` (branch: main). Running it | |
| 168 | - again rewrites everything between the braid markers. --> | |
| 169 | - ## Version control with braid | |
| 170 | - | |
| 171 | - Agents land their changes on `main` through [braid](https://braid.elffuss.com), | |
| 172 | - each in a braid workspace of its own. Git stays the source of truth, and | |
| 173 | - `braid git sync` keeps the git remote in step. | |
| 174 | - ``` | |
| 175 | - | |
| 176 | - The rules, in short: they apply only where the checkout has a `.braid` | |
| 177 | - directory, so a fresh clone or CI works with git as before; never edit | |
| 178 | - files or use git in the project root, which is the user's shared | |
| 179 | - checkout; each session works in a workspace of its own under | |
| 180 | - `.braid/work/`, and commits and lands with braid, naming itself with | |
| 181 | - `--agent`; on a conflict (exit status 2), `braid update`, fix the | |
| 182 | - markers, commit and land again; `braid update` before a new task; and at | |
| 183 | - the end, tell the user and offer `braid git sync` to the git remote. | |
| 184 | -- **`CLAUDE.md`** for Claude Code and **`GEMINI.md`** for Gemini CLI: the | |
| 185 | - line `@AGENTS.md`, so that they read the same section. `braid agents init` | |
| 186 | - adds it to each of them that exists. | |
| 187 | -- **Nothing of braid's goes into git:** `.braid/`, which the exclude line | |
| 188 | - hides from git, holds the store, the workspaces and `.braid/config`, the | |
| 189 | - name and e-mail address that sign what agents land. In Claude Code, allow | |
| 190 | - braid's commands once with `"Bash(braid:*)"` in `permissions.allow` of | |
| 191 | - `.claude/settings.local.json`, your own settings for this checkout. | |
| 192 | - | |
| 193 | -## Quick start | |
| 189 | +into the project's `AGENTS.md` with `braid agents init`. From then on, | |
| 190 | +every agent session works in a braid workspace of its own, where git | |
| 191 | +refuses to run, lands through braid, and tells you when what it landed is | |
| 192 | +waiting for a sync to the git remote. In a clone where braid is not set up, | |
| 193 | +agents work with git as before. | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | +- **`AGENTS.md`** gets a section between `<!-- braid:start -->` and | |
| 198 | + `<!-- braid:end -->` with the rules every session follows; running | |
| 199 | + `braid agents init` again rewrites only that section. **`CLAUDE.md`** and | |
| 200 | + **`GEMINI.md`**, where they exist, get the line `@AGENTS.md`. They are | |
| 201 | + committed with git, so every clone and every new session has them. | |
| 202 | +- **Nothing of braid's own goes into git.** `.braid/` holds the store, the | |
| 203 | + workspaces and `.braid/config`, the name and e-mail address that sign | |
| 204 | + what agents land. | |
| 205 | + | |
| 206 | +Agents get `--json` on every command, exit status 2 for a conflict that | |
| 207 | +left the branch where it was, and a guard that holds back new files that | |
| 208 | +look like secrets (`.env*`, `*.pem`, `id_*`) or are larger than 1 MiB until | |
| 209 | +`braid track` lets them in. The guide is part 1 of [AGENTS.md](AGENTS.md), | |
| 210 | +served as [braid.elffuss.com/agents.md](https://braid.elffuss.com/agents.md) | |
| 211 | +next to an [llms.txt](https://braid.elffuss.com/llms.txt). To set a project | |
| 212 | +up by hand, follow its [Set up a project](AGENTS.md#set-up-a-project): the | |
| 213 | +same steps, what to check first, and what to do when one fails. | |
| 194 | 214 | |
| 195 | -Braid stores history, moves it in and out of git bit for bit, and gives each | |
| 196 | -agent a workspace of its own that lands on `main` in one short step. | |
| 215 | +## Why braid | |
| 197 | 216 | |
| 198 | -```bash | |
| 199 | -git clone https://github.com/KikoCis/elffuss-braid | |
| 200 | -cd elffuss-braid | |
| 201 | -cargo build --release | |
| 202 | -export PATH="$PWD/target/release:$PATH" | |
| 203 | -SRC="$PWD" # any git repository will do; this one is at hand | |
| 204 | - | |
| 205 | -braid init /tmp/demo | |
| 206 | -cd /tmp/demo | |
| 207 | -braid git import "$SRC" # every branch and tag | |
| 208 | -braid log main -n 5 | |
| 209 | -braid log main -- README.md # only the changes to a path | |
| 210 | -braid blame main README.md # who last changed each line | |
| 211 | -braid show main --json | |
| 212 | -braid fsck | |
| 213 | -braid stats # objects by kind, and how they are stored: whole, deltas, chunks | |
| 214 | -``` | |
| 217 | +Git was designed for people who work offline and sync now and then. Agents | |
| 218 | +are many, always connected, and all want to land on `main` at once. With | |
| 219 | +git, every agent that loses the race to push fetches, rebases and pushes | |
| 220 | +again. A merge queue ends the race by testing each change before it lands, | |
| 221 | +so every landing waits for CI; Anthropic's article puts it plainly: "A | |
| 222 | +proper merge queue, for example, doesn't make much sense at agent scale." | |
| 223 | + | |
| 224 | +| | git, a clone per agent | a merge queue | braid | | |
| 225 | +|---|---|---|---| | |
| 226 | +| 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 | | |
| 227 | +| 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 | | |
| 228 | +| A conflict | markers, and messages written for people | the change leaves the queue | exit status 2, `main` does not move, JSON with `next` | | |
| 229 | +| A change that breaks the build | lands | is stopped before it lands | lands, and [`braid verify --revert`](#keeping-main-green) then lands its revert | | |
| 230 | + | |
| 231 | +So braid trades the queue's guarantee for landings that never wait for CI: | |
| 232 | +between a landing and the next `braid verify`, `main` can be red, and | |
| 233 | +`braid/green/main` names the newest changeset that passed. | |
| 234 | + | |
| 235 | +<details> | |
| 236 | +<summary>The design, against git's</summary> | |
| 215 | 237 | |
| 216 | -Exporting writes the same commits back, with the same ids: | |
| 238 | +| | git | braid | | |
| 239 | +|---|---|---| | |
| 240 | +| Unit of change | a commit: a full tree snapshot | a changeset: the files that changed against the first parent, plus the root tree id | | |
| 241 | +| Many writers | one index per working tree | one workspace per agent over a shared append-only store; creating a change takes no repository lock | | |
| 242 | +| 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` | | |
| 243 | +| Large directories | rewritten whole on every change | split into content-defined nodes; an edit rewrites only its path | | |
| 244 | +| Large files | a separate extension | content-defined chunks, deduplicated across versions | | |
| 245 | +| Hash | SHA-1 by default | BLAKE3 | | |
| 246 | +| For agents | output written for people | `--json` everywhere; changes can be created without a checkout | | |
| 217 | 247 | |
| 218 | -```bash | |
| 219 | -git init --bare /tmp/mirror.git | |
| 220 | -braid git export /tmp/mirror.git | |
| 221 | -``` | |
| 248 | +This is the design. [Status and roadmap](#status-and-roadmap) says what | |
| 249 | +exists today. | |
| 222 | 250 | |
| 223 | -Every operation is in the op log, and the newest can be undone, one at a | |
| 224 | -time: | |
| 251 | +</details> | |
| 225 | 252 | |
| 226 | -```bash | |
| 227 | -braid op log # who did what, newest first | |
| 228 | -braid undo # takes the whole import back | |
| 229 | -``` | |
| 253 | +## How it works | |
| 230 | 254 | |
| 231 | -Ids can be checked with any BLAKE3 implementation, for example the reference | |
| 232 | -[`b3sum`](https://github.com/BLAKE3-team/BLAKE3/tree/master/b3sum) tool: | |
| 255 | +<picture> | |
| 256 | + <source media="(prefers-color-scheme: dark)" srcset="docs/assets/how-it-works-dark.svg"> | |
| 257 | + <source media="(prefers-color-scheme: light)" srcset="docs/assets/how-it-works-light.svg"> | |
| 258 | + <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."> | |
| 259 | +</picture> | |
| 260 | + | |
| 261 | +1. **Everything is an immutable object named by its BLAKE3 hash,** and a | |
| 262 | + changeset records the files that changed against its first parent, plus | |
| 263 | + the root tree it produces: history, blame and rebase read the short | |
| 264 | + list, and the root id commits to the whole repository. | |
| 265 | +2. **Landing is the one step agents take in turn, and it is short:** a | |
| 266 | + fast-forward, or a rebase path by path that merges only the files both | |
| 267 | + sides touched. Conflicts come back as data, and the branch does not | |
| 268 | + move. | |
| 269 | +3. **Many processes share one store without a daemon,** through locks the | |
| 270 | + kernel releases if a process dies, and an append-only op log records | |
| 271 | + every operation, so that `braid undo` can step back. | |
| 272 | +4. **The same requests at every tier:** a local store, a per-machine | |
| 273 | + daemon, a cache and a server are meant to answer the same requests. The | |
| 274 | + server has its first version, BraidHub; the daemon and the caches are | |
| 275 | + planned (milestones 6 and 7). | |
| 233 | 276 | |
| 234 | -```bash | |
| 235 | -b3sum --derive-key "elffuss-braid 2026 blob v1" README.md | |
| 236 | -``` | |
| 277 | +## Working with git | |
| 237 | 278 | |
| 238 | -### Many agents, one repository | |
| 279 | +Repositories come in with their whole history, and git hosts keep working | |
| 280 | +as mirrors. | |
| 239 | 281 | |
| 240 | -Each agent gets its own workspace. There is no staging area and no shared | |
| 241 | -index: an agent commits what it changed and lands it, and braid rebases it | |
| 242 | -onto whatever the others landed first. | |
| 282 | + | |
| 243 | 283 | |
| 244 | 284 | ```bash |
| 245 | -export BRAID_AUTHOR="Ada Lovelace <ada@example.org>" | |
| 246 | -export BRAID_AGENT=agent-1 # recorded with everything this agent does | |
| 247 | -braid workspace add agent-1 # .braid/work/agent-1, tracking main | |
| 248 | -cd .braid/work/agent-1 | |
| 249 | -echo 'fn main() {}' > main.rs | |
| 250 | -braid status | |
| 251 | -braid commit -m "Add main.rs" | |
| 252 | -braid land # fast-forward, or a rebase onto main | |
| 285 | +cd "$(mktemp -d)" && braid init demo && cd demo | |
| 286 | +braid git import /path/to/project # every local branch and tag | |
| 287 | +braid log main -- README.md # only the changes to a path | |
| 288 | +braid blame main README.md # who last changed each line | |
| 289 | +git init --quiet --bare ../mirror.git | |
| 290 | +braid git export ../mirror.git # the same commits, with the same ids | |
| 291 | +braid git sync https://github.com/you/project.git --branch main | |
| 253 | 292 | ``` |
| 254 | 293 | |
| 255 | -When two agents change the same lines, the second `land` exits with status 2, | |
| 256 | -prints the conflicts as data and leaves `main` where it was. With `--json`, | |
| 257 | -each conflict names its sides from the agent's point of view: `base`, | |
| 258 | -`branch` (what is on the branch now) and `workspace` (its own change), with | |
| 259 | -the hunks in conflict, and `next` says what to run: `braid update`, which | |
| 260 | -rebases the change and writes git-style conflict markers. Fix the file, then | |
| 261 | -`braid commit` (the change keeps its message unless `-m` gives another) and | |
| 262 | -`braid land`. | |
| 263 | - | |
| 264 | -<p align="center"><img src="docs/assets/demo-conflict.gif" alt="The third agent asks for the conflict as JSON and gets the base, branch and workspace text of the line; braid update writes conflict markers into the file; the agent settles the line, commits and lands, and braid log shows the three agents' changesets on main" width="860"></p> | |
| 265 | - | |
| 266 | -- `land` and `update` report the same fields: where each changeset went | |
| 267 | - (`landed`, from its id to the one that holds it now), the paths merged, the | |
| 268 | - paths of the working copy they wrote or removed, and for a landing its op | |
| 269 | - log entry. | |
| 270 | -- `braid status --json` says how far the branch is ahead (`behind_by`), which | |
| 271 | - changesets have not landed, including one whose rebase is in progress, and | |
| 272 | - whether a commit would go through (`ready_to_commit`), with every reason | |
| 273 | - it would not (`blocking`), a missing author among them, which | |
| 274 | - `braid commit` refuses with too. | |
| 275 | -- Every changeset names the agent that made it, and keeps it when it is | |
| 276 | - rebased; `braid log`, `braid show` and `braid op log` show who did what, | |
| 277 | - and the op log says what each landing did. Signatures use the local time | |
| 278 | - zone. | |
| 279 | -- Revisions can be given as short ids, six hex digits or more; an ambiguous | |
| 280 | - one is an error that lists the candidates. | |
| 281 | -- `braid show` and `braid diff <from> <to>` list the files a change adds, | |
| 282 | - modifies, deletes or turns into another type (`A`, `M`, `D`, `T`), as | |
| 283 | - `git diff --name-status` does. | |
| 284 | -- `braid log [rev] -- <path>...` lists the changesets that touched a path, | |
| 285 | - along first parents, and `braid blame <rev> <path>` names the changeset, | |
| 286 | - the agent and the date of each line. Both read derived data kept in the | |
| 287 | - store: generation numbers and skip pointers for ancestry, changed-path | |
| 288 | - filters, and blame records, computed the first time they are needed. | |
| 289 | - `braid derive --all` computes them ahead of time, after a large import. | |
| 290 | -- A workspace goes in `.braid/work/<name>` unless `workspace add` is given | |
| 291 | - a directory, and tracks a branch the repository has, unless it has none | |
| 292 | - yet; `--new-branch` starts one on purpose. It holds a `.git` file that | |
| 293 | - points nowhere, so that git run inside | |
| 294 | - it stops with "not a git repository" instead of acting on the checkout | |
| 295 | - around it. `braid cat-object <rev>:<path>` prints a file as a changeset | |
| 296 | - has it: `braid cat-object <base>:<path> | diff -u - <path>` shows what an | |
| 297 | - edit in the workspace changed. | |
| 298 | -- Hints, and `next` in the JSON, repeat the `--agent`, `--workspace` and | |
| 299 | - `--repo` a command was given, so that an agent that follows them acts as | |
| 300 | - the same session. | |
| 301 | -- `braid agents init` writes the rules for agents into a project's | |
| 302 | - `AGENTS.md`, in a section between a `<!-- braid:start -->` line and a | |
| 303 | - `<!-- braid:end -->` line: each session works in a workspace of its own | |
| 304 | - under `.braid/work/` and lands on the branch the section names, one the | |
| 305 | - repository has. Running it again rewrites the section in place and | |
| 306 | - touches nothing else; markers that do not pair up are refused, and | |
| 307 | - marker lines in code blocks are not markers. It also adds `@AGENTS.md` to | |
| 308 | - a `CLAUDE.md` or a `GEMINI.md` that does not include it (`--no-claude` and | |
| 309 | - `--no-gemini` leave them alone). It writes through a link only inside the | |
| 310 | - project, never a read-only file, and replaces no file until every one is | |
| 311 | - ready. `--dry-run` shows what it would write, and `--json` lists the | |
| 312 | - files created, updated and unchanged, and the file each one is. | |
| 313 | - | |
| 314 | -`braid status --help`, `braid land --help`, `braid update --help` and | |
| 315 | -`braid agents init --help` describe every JSON field. | |
| 316 | - | |
| 317 | -An agent that knows exactly what it changes needs no checkout at all, and can | |
| 318 | -check that nobody changed the file under it: | |
| 294 | +- **Bit for bit.** `braid git import` reads git through | |
| 295 | + [gitoxide](https://github.com/GitoxideLabs/gitoxide), exports each commit | |
| 296 | + again as it imports it, and stops unless the id comes back the same. | |
| 297 | + Shallow and SHA-256 repositories are refused for now. | |
| 298 | +- **The remote only fast-forwards.** `braid git sync` fetches and imports, | |
| 299 | + then fast-forwards braid or pushes, merging first when both moved. The | |
| 300 | + push carries a lease on what it just fetched, so history on GitHub, Gitea | |
| 301 | + or any git remote is never rewritten; a conflict moves nothing and exits | |
| 302 | + with status 2. | |
| 303 | +- **No git code.** Braid contains no code from git itself, which is GPLv2. | |
| 304 | + It reads and writes git data with gitoxide (MIT or Apache-2.0); | |
| 305 | + `git sync` also runs the `git` binary, to set up its mirror, fetch and | |
| 306 | + push. | |
| 307 | + | |
| 308 | +## Keeping main green | |
| 309 | + | |
| 310 | +New in 0.1.1. Braid has no merge queue: changes land as they come, and | |
| 311 | +`braid verify` checks afterwards. It runs the project's tests on the head | |
| 312 | +of a branch, in a fresh copy of its files, and keeps `braid/green/<branch>` | |
| 313 | +at the newest changeset that passed. When they fail, it bisects the | |
| 314 | +changesets since the green one, and with `--revert` it lands the revert of | |
| 315 | +the first that fails. One run is one pass: run it after landings, or on a | |
| 316 | +schedule. | |
| 319 | 317 | |
| 320 | 318 | ```bash |
| 321 | -braid change create --base main --set src/lib.rs=@new-lib.rs \ | |
| 322 | - --expect src/lib.rs=<blob id it read> -m "Fix the parser" --land main | |
| 319 | +braid verify --branch main --revert --json -- cargo test --workspace | |
| 323 | 320 | ``` |
| 324 | 321 | |
| 325 | -New files that look like secrets (`.env*`, `*.pem`, `id_*`) or are larger than | |
| 326 | -1 MiB are not committed until `braid track <path>` says so: `braid commit` | |
| 327 | -refuses while they wait, naming them, and `--force` leaves them out. | |
| 328 | - | |
| 329 | -A changeset that landed and should not have is undone with another: | |
| 330 | -`braid revert <rev>` makes a changeset that puts its files back, modes and | |
| 331 | -links included, names the one it undoes in a `reverts` field, and lands it, | |
| 332 | -rebased over whatever landed since. When later work touched the same lines, | |
| 333 | -it stops with conflicts and exit status 2, as `land` does, and nothing | |
| 334 | -moves. `--no-land` only makes the changeset, and a merge needs | |
| 335 | -`--mainline 1`. | |
| 336 | - | |
| 337 | -### Keeping main green | |
| 338 | - | |
| 339 | -`braid verify` runs the project's tests on the head of a branch and keeps | |
| 340 | -`braid/green/<branch>` at the newest changeset that passed. When they fail, | |
| 341 | -it bisects the changesets since the green one, along first parents, to find | |
| 342 | -the first that fails, and with `--revert` it reverts that one and lands the | |
| 343 | -revert. One run is one pass: run it after landings, or on a schedule. | |
| 344 | - | |
| 345 | -```bash | |
| 346 | -braid verify --branch main --revert --json -- cargo test --workspace | |
| 322 | +Here three changesets landed after the green one, and the second broke the | |
| 323 | +tests. A failing run is run once more before it counts: | |
| 324 | + | |
| 325 | +```console | |
| 326 | +$ braid verify --branch main --revert -- sh -c 'grep -qx ok status.txt' | |
| 327 | +braid verify: 60fb322bafea failed (exit status: 1) | |
| 328 | +braid verify: 60fb322bafea failed (exit status: 1) | |
| 329 | +braid verify: c4b445c63d60 passed | |
| 330 | +braid verify: 51108ceb6ded failed (exit status: 1) | |
| 331 | +braid verify: 51108ceb6ded failed (exit status: 1) | |
| 332 | +main at 60fb322bafea: reverted (5 runs) | |
| 333 | +the tests fail from 51108ceb6ded, the first changeset that fails; its revert landed on main | |
| 334 | +Revert: dbc25836e20d | |
| 347 | 335 | ``` |
| 348 | 336 | |
| 349 | -- The command runs as given, with no shell, in a fresh copy of the | |
| 350 | - changeset's files in the system's temporary directory: outside the | |
| 351 | - repository, so every run builds from scratch, and the copy is removed | |
| 352 | - after the run. `BRAID_VERIFY_CHANGESET` and `BRAID_VERIFY_BRANCH` say what | |
| 353 | - it tests. `BRAID_TOKEN`, every variable whose name starts with | |
| 354 | - `BRAID_HUB`, and `OLDPWD` are taken out of its environment, and `PWD` | |
| 355 | - names the copy. | |
| 356 | -- That is not a sandbox. The command runs as you, with your access to your | |
| 357 | - files, the network, the `braid` command and any hub login saved in | |
| 358 | - braid's configuration directory. To test code you do not trust, run | |
| 359 | - verify in a container, a sandbox or as a user of its own. | |
| 360 | -- On Unix it runs in a process group of its own. When it exits, or runs | |
| 361 | - past `--timeout` (10 minutes by default), the group is killed, with | |
| 362 | - whatever it started that is still in it; a process that left the group, | |
| 363 | - as a daemon does, is not. A watchdog process, started before the | |
| 364 | - command, kills the group and removes the copy if braid is killed or | |
| 365 | - exits while the tests run, and when the watchdog cannot start, or stops, | |
| 366 | - the run fails rather than go on unwatched. On other systems (Windows is | |
| 367 | - not verified) only the command itself is killed, and nothing watches | |
| 368 | - braid. | |
| 369 | -- In a container, run braid under an init such as | |
| 337 | +- **A fresh copy, not a sandbox.** The command runs as given, with no | |
| 338 | + shell, in a copy of the changeset's files in the system's temporary | |
| 339 | + directory, outside the repository: every run builds from scratch, and | |
| 340 | + the copy is removed after it. `BRAID_VERIFY_CHANGESET` and | |
| 341 | + `BRAID_VERIFY_BRANCH` say what it tests, and `PWD` names the copy; | |
| 342 | + `BRAID_TOKEN`, every variable whose name starts with `BRAID_HUB`, and | |
| 343 | + `OLDPWD` are taken out of its environment. That is all the isolation | |
| 344 | + there is: the command runs as you, with your access to every file, the | |
| 345 | + network, the `braid` command and any hub login saved in braid's | |
| 346 | + configuration directory. For code you do not trust, run verify in a | |
| 347 | + container, a sandbox or as a user of its own. | |
| 348 | +- **A process group and a watchdog, on Unix.** The command runs in a | |
| 349 | + process group of its own. When it exits, or runs past `--timeout` | |
| 350 | + (10 minutes by default), the group is killed, with whatever it started | |
| 351 | + that is still in it; a process that left the group, as a daemon does, is | |
| 352 | + not. A watchdog process, started before the command, kills the group and | |
| 353 | + removes the copy if braid is killed or exits while the tests run, and | |
| 354 | + when the watchdog cannot start, or stops, the run fails rather than go | |
| 355 | + on unwatched. On other systems (Windows is not verified) only the | |
| 356 | + command itself is killed, and nothing watches braid. | |
| 357 | +- **In a container,** run braid under an init such as | |
| 370 | 358 | [tini](https://github.com/krallin/tini) (`docker run --init`), not as |
| 371 | 359 | PID 1: PID 1 gets no default handling of signals, and has to reap the |
| 372 | 360 | processes others leave behind, which braid does not. |
| 373 | -- A failing run is run again (`--reruns`, once by default) before it counts. | |
| 374 | - One that then passes is `flaky`, and leaves the green ref where it was | |
| 375 | - unless `--flaky-moves-green`. | |
| 376 | -- The green ref is local to the repository: it is never exported or sent | |
| 377 | - to a hub, and a fresh clone, as CI has, has none. With no green ref, | |
| 378 | - verify tests only the head, unless `--from` names a changeset to bisect | |
| 379 | - from. | |
| 380 | -- It never reverts a merge, nor a revert it made, which it tells by the | |
| 381 | - revert's `reverts` field and its agent, `braid-verify`, and it lands at | |
| 382 | - most three reverts an hour (`--max-reverts-per-hour`), counted by each | |
| 383 | - revert's own committer time among the last 10,000 changesets of the | |
| 384 | - branch, whatever the dates of those between them. Both rules are read | |
| 385 | - from the branch, so a clone without verify's local record in | |
| 386 | - `.braid/verify/` follows them too; braid warns anyone else who acts as | |
| 387 | - `braid-verify`. The green ref does not move after a revert: the next | |
| 388 | - pass tests the new head. `--dry-run` reports, changes nothing and does | |
| 389 | - not fetch from a hub. | |
| 390 | -- Bisecting tests each changeset as it is. When the first that fails was | |
| 391 | - reverted later in the range, verify tests the revert and, if it passes, | |
| 392 | - bisects again after it. A changeset whose files cannot be written on this | |
| 393 | - system is skipped, and listed in `skipped`. | |
| 394 | -- Exit status 0 means green (`pass` or `flaky`), 4 red (`red`, `reverted`, | |
| 395 | - `refused` or `no_culprit`), 2 a revert that conflicts, and 1 an error; | |
| 396 | - once the tests have started, an error prints the report too. | |
| 397 | - `braid status --json` shows the green changeset as `green`, and | |
| 398 | - `braid verify --help` describes every JSON field. | |
| 399 | - | |
| 400 | -## Working with git | |
| 401 | - | |
| 402 | -Repositories come in with their whole history and keep a git mirror. | |
| 403 | - | |
| 404 | -<p align="center"><img src="docs/assets/demo-git-sync.gif" alt="braid git sync takes a branch of a git repository with its history; after agents land two changes in braid and a person pushes one to the git repository, the next sync merges both and pushes a fast-forward, and git log shows the original commits with their ids unchanged" width="860"></p> | |
| 405 | - | |
| 406 | -- `braid git import` reads a git repository through | |
| 407 | - [gitoxide](https://github.com/GitoxideLabs/gitoxide). Each commit is exported | |
| 408 | - again and compared with the original, so the round trip is bit for bit. | |
| 409 | - Running it again imports only what is new, and a braid branch follows git's | |
| 410 | - only forward: one where braid has work git does not have stays where it is, | |
| 411 | - and the import lists it under `kept`. | |
| 412 | -- `braid git sync` keeps a branch of GitHub, Gitea or any git remote in step | |
| 413 | - with a braid branch: it fetches and imports the remote branch, then | |
| 414 | - fast-forwards braid, or pushes braid's branch, merging first when both | |
| 415 | - moved. The push carries a lease on what the sync just fetched, so the | |
| 416 | - remote only ever fast-forwards and its history is never rewritten. | |
| 417 | - Conflicts move nothing and exit with status 2. | |
| 418 | - | |
| 419 | - By default a sync goes both ways, so a commit that someone else pushed to | |
| 420 | - the remote is merged into braid. `--direction publish` only pushes: it | |
| 421 | - stops, with exit status 3 and outcome `diverged`, unless the remote branch | |
| 422 | - is braid's or one of its ancestors. `--direction follow` only takes the | |
| 423 | - remote's commits in, and stops the same way when braid has changesets of | |
| 424 | - its own or the remote went back. Neither records, merges or pushes | |
| 425 | - anything when it stops. | |
| 426 | - | |
| 427 | - ```bash | |
| 428 | - braid git sync https://github.com/you/project.git --branch main | |
| 429 | - braid git sync https://github.com/you/project.git --dry-run --json | |
| 430 | - braid git sync https://github.com/you/project.git --direction publish | |
| 431 | - ``` | |
| 432 | -- Braid contains no code from git itself, which is GPLv2. It reads and writes | |
| 433 | - git data with gitoxide (MIT or Apache-2.0); `git sync` also runs the `git` | |
| 434 | - binary as a subprocess, to set up its mirror, fetch and push. | |
| 361 | +- **Flaky tests.** A run fails when the command exits with a status other | |
| 362 | + than 0, is killed or runs past `--timeout`, and a failing run is run | |
| 363 | + again (`--reruns`, once by default) before it counts. One that then | |
| 364 | + passes is `flaky`: green, but the green ref stays where it was unless | |
| 365 | + `--flaky-moves-green`. | |
| 366 | +- **Bisecting** tests each changeset as it is, along first parents. When | |
| 367 | + the first that fails was reverted later in the range, verify tests the | |
| 368 | + revert and, if it passes, bisects again after it. A changeset whose | |
| 369 | + files cannot be written on this system is skipped, and listed in | |
| 370 | + `skipped`. | |
| 371 | +- **Limits on reverts.** Verify never reverts a merge, nor a revert it | |
| 372 | + made, which it tells by the revert's `reverts` field and its agent, | |
| 373 | + `braid-verify`; braid warns anyone else who acts as `braid-verify`. It | |
| 374 | + lands at most three reverts an hour (`--max-reverts-per-hour`), each | |
| 375 | + counted by its own committer time among the last 10,000 changesets of | |
| 376 | + the branch, whatever the dates of those between them. Both rules are | |
| 377 | + read from the branch, so a clone without verify's local record in | |
| 378 | + `.braid/verify/` follows them too. After a revert the green ref does not | |
| 379 | + move: the next pass tests the new head. | |
| 380 | +- **The green ref is local.** It is never exported or sent to a hub, and a | |
| 381 | + fresh clone, as CI has, has none: verify then tests only the head, unless | |
| 382 | + `--from` names a changeset to bisect from. `braid status --json` shows | |
| 383 | + it as `green`. `--dry-run` runs the tests, but moves no ref, records | |
| 384 | + nothing, lands nothing and does not fetch from a hub. | |
| 385 | +- **Exit status** 0 means green (`pass` or `flaky`); 4 red (`red`, | |
| 386 | + `reverted`, `refused` or `no_culprit`), whether or not a revert landed; | |
| 387 | + 2 a revert that conflicts; and 1 an error. Once the tests have started, | |
| 388 | + an error prints the report too, with what was done until then. | |
| 389 | + | |
| 390 | +`braid revert <rev>` undoes one changeset by hand: it lands a new | |
| 391 | +changeset that puts the files it changed back as they were before it, and | |
| 392 | +when a later change touched the same lines, it stops with exit status 2 | |
| 393 | +and the branch does not move. `braid verify --help` describes every JSON | |
| 394 | +field, and [the design](docs/design.md#landing-on-a-branch) has the rules. | |
| 435 | 395 | |
| 436 | 396 | ## BraidHub |
| 437 | 397 | |
| 438 | -[BraidHub](https://braidhub.elffuss.com) keeps repositories that agents on | |
| 439 | -any machine land on. People and agents sign in with GitHub; a repository is | |
| 440 | -private unless its owner makes it public; and each one can keep a GitHub | |
| 441 | -repository as its mirror: every landing on its default branch is pushed | |
| 442 | -there as a fast-forward, so the people who work with git keep doing so. | |
| 443 | -[The protocol](docs/hub.md) braid speaks with it is documented. Signing up | |
| 444 | -takes one click: <https://braidhub.elffuss.com/login> signs you in with | |
| 445 | -GitHub and makes your account. | |
| 398 | +[BraidHub](https://braidhub.elffuss.com) is the hosted service for agents | |
| 399 | +on many machines. In a repository linked to it, `braid land` lands on the | |
| 400 | +hub, rebased there path by path in turn with every other landing, with the | |
| 401 | +output and exit statuses of a local landing. A repository is private unless | |
| 402 | +its owner makes it public, and can keep a GitHub repository as its mirror, | |
| 403 | +which every landing on its default branch reaches as a fast-forward. | |
| 404 | + | |
| 405 | +A public repository can be read, and cloned, with no account. This one is | |
| 406 | +on the hub too: | |
| 446 | 407 | |
| 447 | 408 | ```bash |
| 448 | -braid login # GitHub's device flow: open the link anywhere, enter the code | |
| 449 | -braid hub publish # create the repository on the hub, upload every branch and tag | |
| 450 | -braid hub clone you/project # on another machine: a linked copy, with a workspace on main | |
| 451 | -cd project/.braid/work/main | |
| 452 | -braid commit -m "Fix the parser" | |
| 453 | -braid land # lands on the hub, then moves the workspace onto the new head | |
| 409 | +braid hub show -R kikocis/elffuss-braid # its description, counts and README | |
| 410 | +braid hub log -R kikocis/elffuss-braid # its history, newest first | |
| 411 | +braid hub cat -R kikocis/elffuss-braid Cargo.toml | |
| 412 | +braid hub clone kikocis/elffuss-braid spec --paths docs/spec # only the trees under docs/spec | |
| 454 | 413 | ``` |
| 455 | 414 | |
| 456 | -Coding agents have [their own guide](https://braidhub.elffuss.com/agents.md) | |
| 457 | -([docs/hub-agents.md](docs/hub-agents.md)): sign in once per machine, ask | |
| 458 | -the user once whether to publish the new projects they start | |
| 459 | -(`braid hub autopublish on|off` keeps the answer), and work from the hub | |
| 460 | -from then on. | |
| 461 | - | |
| 462 | -- In a repository linked to a hub (by `.braid/hub`), `braid land` fetches, | |
| 463 | - uploads what the hub lacks, lands there and fetches again, with the output | |
| 464 | - and exit statuses of a local landing. `braid update` fetches first, and | |
| 465 | - `braid change create --land` lands on the hub too. `--local`, or | |
| 466 | - `BRAID_HUB=off`, keeps them in the local repository. | |
| 467 | -- `braid hub fetch` brings the hub's branches and tags in, moving local | |
| 468 | - branches forward and keeping back one with changesets the hub lacks; | |
| 469 | - `braid hub status` compares each branch with the hub's. | |
| 470 | -- `braid hub publish --mirror https://github.com/you/project.git` keeps that | |
| 471 | - GitHub repository as the mirror, once you grant the hub access to your | |
| 472 | - repositories on its website; `braid hub status` shows how the mirror is | |
| 473 | - doing, including when someone pushed to it directly. | |
| 474 | -- `braid login` saves the token in `~/.config/braid/hub.json`, which only | |
| 475 | - you can read; agents and CI can set `BRAID_TOKEN` instead. The token only | |
| 476 | - ever travels in a header, over `https://`. `braid hub whoami` says who is | |
| 477 | - signed in, and `braid logout` revokes the token on the hub. | |
| 415 | +Landing from several machines takes an account, with GitHub sign-in: | |
| 416 | +`braid login`, then `braid hub publish` to put a repository on the hub and | |
| 417 | +`braid hub clone` to make a linked copy of it elsewhere. The same CLI | |
| 418 | +covers change requests that land exactly as they were reviewed, issues, an | |
| 419 | +inbox and forks, every command with `--json`. Coding agents have | |
| 420 | +[their own guide](https://braidhub.elffuss.com/agents.md) | |
| 421 | +([docs/hub-agents.md](docs/hub-agents.md)), and [docs/hub.md](docs/hub.md) | |
| 422 | +documents the protocol. BraidHub is new in version 0.1: for anything that | |
| 423 | +matters, keep a GitHub mirror as the source of truth. | |
| 478 | 424 | |
| 479 | 425 | ## Design |
| 480 | 426 | |
| 481 | -- [Design overview](docs/design.md): store, landing, workspaces, the git | |
| 482 | - bridge, the server, and how it is tested. | |
| 427 | +- [Design overview](docs/design.md): the store, landing, history, | |
| 428 | + workspaces, the git bridge, the server, and how it is tested. | |
| 483 | 429 | - [Format v1](docs/spec/format-v1.md): the exact bytes of ids, trees and |
| 484 | 430 | changesets, with golden vectors. |
| 431 | +- [The BraidHub protocol](docs/hub.md) and | |
| 432 | + [BraidHub for coding agents](docs/hub-agents.md). | |
| 433 | +- [Benchmarks against git](bench/README.md): how every ratio here is | |
| 434 | + measured. | |
| 485 | 435 | |
| 486 | 436 | ## Status and roadmap |
| 487 | 437 | |
| @@ -496,69 +446,85 @@ | ||
| 496 | 446 | | 6 | Server: [BraidHub](#braidhub) with GitHub sign-in, landing over HTTP, GitHub mirrors and sparse clones; caching tiers | first version; caching planned | |
| 497 | 447 | | 7 | Daemon, virtual file system, WebAssembly core | planned | |
| 498 | 448 | |
| 499 | -Each milestone ships when its tests pass: golden vectors and fuzzing for the | |
| 500 | -format, crash and many-process tests for the store, bit-for-bit round trips and | |
| 501 | -differential tests against git for the bridge, deterministic simulation for | |
| 502 | -landing. | |
| 449 | +New in 0.1.1: `braid revert`, and `braid verify`, which runs when you run | |
| 450 | +it: one run tests a branch's head, bisects a failure to the changeset that | |
| 451 | +caused it and, with `--revert`, lands that changeset's revert. | |
| 452 | + | |
| 453 | +Each milestone ships when its tests pass: golden vectors and fuzzing for | |
| 454 | +the format, crash and many-process tests for the store, bit-for-bit round | |
| 455 | +trips and differential tests against git for the bridge, deterministic | |
| 456 | +simulation for landing. | |
| 503 | 457 | |
| 504 | 458 | ## What is honest about this |
| 505 | 459 | |
| 506 | 460 | - **It is version 0.1.** Today it stores history, round-trips git |
| 507 | - repositories, runs workspaces for many agents on one machine, and lands | |
| 508 | - their work from many machines through BraidHub. Keep your | |
| 509 | - git repository as the source of truth, and do not keep anything only in | |
| 510 | - braid. | |
| 511 | -- **Slower than git at most things today.** [Measured against | |
| 512 | - git](#measured-against-git) gives every result as a ratio against git on | |
| 513 | - the same machine, with the script that reproduces it, never numbers nobody | |
| 514 | - can check. Braid is faster when many agents land at once, and slower at | |
| 515 | - importing and storing history, and at status and commit on large trees. | |
| 516 | -- **The hashed format is frozen** and every golden vector is recomputed by a | |
| 517 | - second implementation written from the specification alone. Storage and | |
| 518 | - protocols can still change. | |
| 461 | + repositories, runs workspaces for many agents on one machine, lands | |
| 462 | + their work from many machines through BraidHub, and finds and reverts | |
| 463 | + what broke the tests. Keep your git repository as the source of truth, | |
| 464 | + and do not keep anything only in braid. | |
| 465 | +- **Slower than git at most things, at the last measurement.** | |
| 466 | + [Measured against git](#measured-against-git) gives every result as a | |
| 467 | + ratio against git on the same machine, with the script that reproduces | |
| 468 | + it. At commit `5330054`, braid was faster when many agents landed at | |
| 469 | + once, and slower at importing and storing history, and at status and | |
| 470 | + commit on large trees. Much of that has been worked on since, but | |
| 471 | + `bench/run.py` has not been run again for the ratio table. A later | |
| 472 | + measurement of the store's size, on the imported histories of four | |
| 473 | + public repositories, found 2.5 to 3.1 times what `git gc --aggressive` | |
| 474 | + packs them into | |
| 475 | + ([format v1, section 7](docs/spec/format-v1.md#7-storage-not-hashed-versioned-on-its-own)). | |
| 476 | +- **`main` can be red for a while.** Braid lands first and tests after, | |
| 477 | + and merges are textual: two changes can merge cleanly and still break | |
| 478 | + the build together, until | |
| 479 | + [`braid verify --revert`](#keeping-main-green) reverts one of them. | |
| 480 | +- **Not there yet:** garbage collection, so nothing is ever removed from a | |
| 481 | + store, and shallow or SHA-256 git repositories, which the git bridge | |
| 482 | + refuses. `log -- <path>` and `blame` follow first parents and, on | |
| 483 | + purpose, not renames. | |
| 484 | +- **The hashed format is frozen,** and every golden vector is recomputed by | |
| 485 | + a second implementation written from the specification alone. Storage | |
| 486 | + and protocols can still change. | |
| 519 | 487 | - **Braid is not Scion.** It starts from the ideas Anthropic described in |
| 520 | 488 | public about its own source control system. It is an independent |
| 521 | - implementation, contains no code from Anthropic, and is not affiliated with | |
| 522 | - or endorsed by Anthropic. | |
| 523 | -- **Platforms.** CI tests Linux and other Unix-like systems. Windows is not tested yet. | |
| 489 | + implementation, contains no code from Anthropic, and is not affiliated | |
| 490 | + with or endorsed by Anthropic. | |
| 491 | +- **Platforms.** CI tests Linux and other Unix-like systems. Windows is not | |
| 492 | + tested yet. | |
| 524 | 493 | |
| 525 | 494 | ## Measured against git |
| 526 | 495 | |
| 527 | 496 | Each number is braid's time, or the size of its store, divided by git's for |
| 528 | -the same work on the same machine: below 1 braid is faster or smaller, above | |
| 529 | -1 it is slower or larger. They are medians from one run of | |
| 530 | -[`bench/run.py`](bench/README.md), which describes every scenario, measuring | |
| 531 | -braid at commit `5330054`; the run held rounds back while other work kept | |
| 532 | -the machine busy (`--max-load`). The numbers come from that one machine, and | |
| 533 | -yours will differ: run the script before relying on any of them. | |
| 534 | - | |
| 535 | -| What was compared | braid / git | Reproduce | | |
| 497 | +the same work on the same machine: below 1 braid is faster or smaller, | |
| 498 | +above 1 it is slower or larger. They are medians from one run of | |
| 499 | +[`bench/run.py`](bench/README.md), measuring braid at commit `5330054`. Git | |
| 500 | +ran with its defaults, except that automatic garbage collection and | |
| 501 | +maintenance were off, and so were its file system monitor and, unless a row | |
| 502 | +says otherwise, its untracked cache. [The benchmark's README](bench/README.md) | |
| 503 | +describes every scenario. Yours will differ: run | |
| 504 | +`python3 bench/run.py --only <scenario>` before relying on any of them. | |
| 505 | + | |
| 506 | +| What was compared | braid / git | `--only` | | |
| 536 | 507 | |---|---|---| |
| 537 | -| Import [tmux](https://github.com/tmux/tmux) 3.5a, 10,287 commits: `braid init` + `braid git import` vs `git clone --no-local --bare` | 17.6 | `python3 bench/run.py --only import` | | |
| 538 | -| Import it and check it out: `braid init` + `braid git import` + `braid workspace add` vs `git clone --no-local` | 17.1 | `python3 bench/run.py --only import` | | |
| 539 | -| Size after that import: `du` of `.braid/store` vs the bare clone after `git gc --aggressive` | 25.1 | `python3 bench/run.py --only store` | | |
| 540 | -| Status of a tree of 100,000 files, clean: `braid status` vs `git status`, no untracked cache, no fsmonitor | 2.6 | `python3 bench/run.py --only status` | | |
| 541 | -| Status of that tree, clean: `braid status` vs `git status` with `core.untrackedCache=true`, no fsmonitor | 5.8 | `python3 bench/run.py --only status` | | |
| 542 | -| Status of that tree, 10 files modified: `braid status` vs `git status`, no untracked cache, no fsmonitor | 3.0 | `python3 bench/run.py --only status` | | |
| 543 | -| Status of that tree, 10 files modified: `braid status` vs `git status` with `core.untrackedCache=true`, no fsmonitor | 5.7 | `python3 bench/run.py --only status` | | |
| 544 | -| Commit one changed file of that tree: `braid commit` vs `git add` + `git commit` | 5.0 | `python3 bench/run.py --only commit` | | |
| 545 | -| Commit one new file in a directory of 20,000 files, 200 times: `braid commit` vs `git add` + `git commit` | 1.8 | `python3 bench/run.py --only wide` | | |
| 546 | -| Commit one new file in that directory without a working copy, 200 times: `braid change create --land` vs `git add` + `git commit` | 0.9 | `python3 bench/run.py --only wide` | | |
| 547 | -| 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 rejected | 0.4 | `python3 bench/run.py --only agents` | | |
| 548 | -| 8 agents, the same | 0.3 | `python3 bench/run.py --only agents` | | |
| 549 | -| 16 agents, the same | 0.2 | `python3 bench/run.py --only agents` | | |
| 550 | -| 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 | `python3 bench/run.py --only history` | | |
| 551 | - | |
| 552 | -`braid log -- <path>` and `braid blame` came after this run, so it does not | |
| 553 | -measure them; the script does now. | |
| 554 | - | |
| 555 | -At commit `5330054`, braid was slower than git at most of this, for the | |
| 556 | -reasons below. Much of it has been worked on since: braid now stores deltas | |
| 557 | -and cuts large files into chunks, walks the working copy in parallel through | |
| 558 | -directory handles, edits a large directory in place, and looks objects up | |
| 559 | -through the store's indexes instead of mapping the whole store first. The | |
| 560 | -ratios above show none of that; it takes a new run of the script to say how | |
| 561 | -much it changed. | |
| 508 | +| 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` | | |
| 509 | +| 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` | | |
| 510 | +| Size after that import: `du` of `.braid/store` vs the bare clone after `git gc --aggressive` | 25.1 | `store` | | |
| 511 | +| 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` | | |
| 512 | +| The same, with 10 files modified | 3.0, 5.7 | `status` | | |
| 513 | +| Commit one changed file of that tree: `braid commit` vs `git add` + `git commit` | 5.0 | `commit` | | |
| 514 | +| Commit one new file in a directory of 20,000 files, 200 times: `braid commit` vs `git add` + `git commit` | 1.8 | `wide` | | |
| 515 | +| The same without a working copy: `braid change create --land` | 0.9 | `wide` | | |
| 516 | +| 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` | | |
| 517 | + | |
| 518 | +Git retried each push 1.1, 2.5 and 5.2 times on average with 4, 8 and 16 | |
| 519 | +agents; no braid agent retried, and nearly every braid landing was a | |
| 520 | +rebase. Since this run, braid stores deltas, cuts large files into chunks, | |
| 521 | +edits a large directory in place, walks the working copy in parallel, and | |
| 522 | +looks objects up through the store's indexes instead of mapping the whole | |
| 523 | +store first. The ratios show none of that, and leave out | |
| 524 | +`braid log -- <path>` and `braid blame`, which came later. | |
| 525 | + | |
| 526 | +<details> | |
| 527 | +<summary>Why braid was slower at that commit</summary> | |
| 562 | 528 | |
| 563 | 529 | - **Importing and storing history.** Braid kept every version of a file |
| 564 | 530 | whole, compressed on its own, where git stores most versions as a delta |
| @@ -568,34 +534,66 @@ | ||
| 568 | 534 | time a tree was read or built. |
| 569 | 535 | - **Status and commit on a large tree.** `braid status` walked the working |
| 570 | 536 | copy one directory at a time on one core, opening each directory from the |
| 571 | - root one name at a time, so that it never follows a symlink, and looking | |
| 572 | - for `.gitignore` and `.braidignore` in each; it also read the whole base | |
| 573 | - tree and rewrote the whole stat cache every time. It used less CPU time | |
| 574 | - than `git status`, which spreads its checks over several cores and, with | |
| 575 | - the untracked cache, skips the directories that did not change. | |
| 537 | + root one name at a time, so that it never follows a symlink; it also read | |
| 538 | + the whole base tree and rewrote the whole stat cache every time. | |
| 539 | + `git status` spreads its checks over several cores and, with the | |
| 540 | + untracked cache, skips the directories that did not change. | |
| 576 | 541 | `braid commit` has no staging area, so it ran a whole status first. |
| 577 | 542 | - **A new file in a wide directory.** Braid wrote only the few nodes of a |
| 578 | - large directory that change, but it read and rebuilt the whole directory | |
| 579 | - in memory to find them, checking every name again. From 2,500 to 20,000 | |
| 580 | - files, the cost of one commit grew 5.2 times for `braid commit`, 3.6 times | |
| 581 | - for `braid change create` and 3.5 times for git. | |
| 543 | + large directory that change, but read and rebuilt the whole directory in | |
| 544 | + memory to find them. From 2,500 to 20,000 files, the cost of one commit | |
| 545 | + grew 5.2 times for `braid commit`, 3.6 times for `braid change create` | |
| 546 | + and 3.5 times for git. | |
| 582 | 547 | - **Opening the store.** Every command first built a map of where each |
| 583 | - object of the store is, which on a history the size of tmux's was a large | |
| 584 | - part of `braid log -n 1000`; git looks each object up in its pack index | |
| 585 | - when it needs it. | |
| 586 | - | |
| 587 | -Braid is faster where it was designed to be: many agents landing at once. A | |
| 588 | -push to git goes in only from a clone that has the latest commit, so each | |
| 589 | -agent that loses the race fetches, rebases and pushes again: on average 1.1 | |
| 590 | -times per push with 4 agents, 2.5 times with 8 and 5.2 times with 16. | |
| 591 | -`braid land` rebases onto whatever landed first, in one short step that | |
| 592 | -landings take in turn, so no agent retried, and nearly every landing was | |
| 593 | -such a rebase. | |
| 548 | + object of the store is, which on a history the size of tmux's was a | |
| 549 | + large part of `braid log -n 1000`; git looks each object up in its pack | |
| 550 | + index when it needs it. | |
| 551 | + | |
| 552 | +</details> | |
| 553 | + | |
| 554 | +## Questions | |
| 555 | + | |
| 556 | +**Is braid an open-source Scion?** No. Scion is internal to Anthropic. | |
| 557 | +Braid is an independent implementation of the ideas Anthropic published | |
| 558 | +about it, contains no code from Anthropic, and on one machine needs no | |
| 559 | +server. The site's [page on Scion's ideas](https://braid.elffuss.com/scion.html) | |
| 560 | +says what braid takes from Scion and where it differs. | |
| 561 | + | |
| 562 | +**Does braid need a server?** Not on one machine: the agents' workspaces | |
| 563 | +share one store, and landings take their turn with no server and no | |
| 564 | +daemon. When agents on several machines share a repository, | |
| 565 | +[BraidHub](#braidhub) is the server, and `braid land` lands there, in turn | |
| 566 | +with every other landing. | |
| 567 | + | |
| 568 | +**Why not a git worktree per agent?** A git worktree gives each agent its | |
| 569 | +own files and index, but landing works as before: each branch still has | |
| 570 | +to be rebased or merged onto `main`, and when the agents push to one | |
| 571 | +remote, every agent that loses the race fetches, rebases and pushes again, | |
| 572 | +and stops at conflict markers when two changes clash. `braid land` rebases | |
| 573 | +a change onto whatever landed first, in one short step taken in turn, and | |
| 574 | +a conflict comes back as data while `main` stays put. | |
| 575 | + | |
| 576 | +**Do coding agents need a merge queue?** Not to land. Agents land in turn | |
| 577 | +and never wait for CI; [`braid verify`](#keeping-main-green) tests after | |
| 578 | +landing, bisects a failure and, with `--revert`, lands the revert, and | |
| 579 | +`main` can be red in between. Where people review each change before it | |
| 580 | +lands, pull requests and a merge queue still make sense, and | |
| 581 | +`braid git sync` keeps the GitHub repository they use in step. | |
| 594 | 582 | |
| 595 | 583 | ## Part of Elffuss |
| 596 | 584 | |
| 597 | -Braid is part of [Elffuss](https://elffuss.com), a family of tools for building | |
| 598 | -software with agents. | |
| 585 | +Braid is part of [Elffuss](https://elffuss.com), a family of tools for | |
| 586 | +building software with agents: | |
| 587 | +[elffuss.com](https://elffuss.com) · | |
| 588 | +[Code](https://code.elffuss.com) · | |
| 589 | +[Claw](https://claw.elffuss.com) · | |
| 590 | +[Translator](https://translator.elffuss.com) · | |
| 591 | +[Copilot](https://copilot.elffuss.com) · | |
| 592 | +[Blog](https://elffuss.com/blog/) · | |
| 593 | +[Hugging Face](https://huggingface.co/KikoCis) · | |
| 594 | +[Dev log](https://bitacora.utopiaia.com/). | |
| 595 | +Braid has a [Space on Hugging Face](https://huggingface.co/spaces/KikoCis/elffuss-braid) | |
| 596 | +too. | |
| 599 | 597 | |
| 600 | 598 | - [elffuss](https://github.com/KikoCis/elffuss): the shared browser-agent core behind Code and Claw. |
| 601 | 599 | - [elffuss-code](https://github.com/KikoCis/elffuss-code): an IDE with an AI agent that runs entirely in your browser ([Space](https://huggingface.co/spaces/KikoCis/elffuss-code)). |
| @@ -605,9 +603,13 @@ | ||
| 605 | 603 | |
| 606 | 604 | ## Prior art and credits |
| 607 | 605 | |
| 608 | -- Anthropic, [Redesigning source control at Anthropic](https://www.anthropic.com/engineering/redesigning-source-control): | |
| 606 | +- Anthropic, [Redesigning source control at Anthropic](https://www.anthropic.com/research/redesigning-source-control): | |
| 609 | 607 | changesets stored against the first parent, server-side merges, minimal |
| 610 | - branch state, immutable objects served by any cache tier. | |
| 608 | + branch state, immutable objects served by any cache tier, and testing | |
| 609 | + after merging instead of a merge queue. The article credits many of its | |
| 610 | + techniques to Sapling's server, | |
| 611 | + [Mononoke](https://github.com/facebook/sapling/blob/main/eden/mononoke/README.md), | |
| 612 | + and its Bonsai data model. | |
| 611 | 613 | - [Jujutsu](https://github.com/jj-vcs/jj): the operation log and undo. |
| 612 | 614 | - [Sapling](https://sapling-scm.com): history served at scale, and compressing |
| 613 | 615 | a file version against the previous one. |
| @@ -618,7 +620,8 @@ | ||
| 618 | 620 | |
| 619 | 621 | ## Contributing and security |
| 620 | 622 | |
| 621 | -- [CONTRIBUTING.md](CONTRIBUTING.md): how to build, test and propose changes. | |
| 623 | +- [CONTRIBUTING.md](CONTRIBUTING.md): how to build, test and propose | |
| 624 | + changes. Pull requests are welcome. | |
| 622 | 625 | - [SECURITY.md](SECURITY.md): how to report a vulnerability privately. |
| 623 | 626 | |
| 624 | 627 | ## License |
| @@ -629,32 +632,31 @@ | ||
| 629 | 632 | |
| 630 | 633 | ## En castellano |
| 631 | 634 | |
| 632 | -Braid es un sistema de control de versiones escrito de cero en Rust, para | |
| 633 | -repositorios en los que muchos agentes aterrizan cambios a la vez. | |
| 634 | - | |
| 635 | -- Crear un cambio cuesta lo que toca el cambio, no lo que pesa el repositorio. | |
| 636 | -- Los agentes hacen commit en paralelo, y aterrizar en `main` es un paso | |
| 637 | - corto que dan por turnos. | |
| 638 | -- Git se queda en los bordes, así que GitHub y Gitea siguen funcionando. | |
| 639 | - | |
| 640 | -Parte de las ideas que Anthropic contó en público sobre Scion, su sistema interno. | |
| 641 | -Es una implementación independiente, sin código de Anthropic y sin relación con | |
| 642 | -la empresa. | |
| 643 | - | |
| 644 | -Hoy, en su versión 0.1, guarda historia, la mete y saca de git bit a bit, y cada | |
| 645 | -agente tiene su propio espacio de trabajo y aterriza en `main` en un paso corto. | |
| 646 | - | |
| 647 | -Para trabajar desde varias máquinas está [BraidHub](https://braidhub.elffuss.com): | |
| 648 | -se entra con GitHub, los repositorios son privados salvo que su dueño diga | |
| 649 | -lo contrario, y cada uno puede tener un repositorio de GitHub como espejo, | |
| 650 | -al que el hub empuja cada aterrizaje. Los agentes tienen su propia guía en | |
| 651 | -<https://braidhub.elffuss.com/agents.md>: preguntan una sola vez si deben | |
| 652 | -publicar ahí los proyectos nuevos que empiezan y, desde entonces, trabajan | |
| 653 | -desde el hub. Para darte de alta basta un clic: | |
| 654 | -<https://braidhub.elffuss.com/login> te hace entrar con GitHub y crea tu | |
| 655 | -cuenta. | |
| 656 | -Las [fases](#status-and-roadmap) dicen qué llega después y qué pruebas tiene que | |
| 657 | -pasar cada una. | |
| 635 | +**Muchos agentes. Un solo main. Sin reintentos.** Braid es un sistema de | |
| 636 | +control de versiones escrito desde cero en Rust, para repositorios en los | |
| 637 | +que muchos agentes de IA aterrizan cambios a la vez. Cada agente hace | |
| 638 | +commit en su propio espacio de trabajo, y aterrizar en `main` es un paso | |
| 639 | +corto que dan por turnos: si un cambio se ha quedado atrás, braid le hace | |
| 640 | +rebase sobre lo que haya aterrizado antes, y un conflicto vuelve como | |
| 641 | +datos, sin mover `main`. `braid verify`, nuevo en la 0.1.1, ejecuta los | |
| 642 | +tests cada vez que lo lanzas tras aterrizar; si fallan, localiza con bisect | |
| 643 | +el changeset que los rompió y, con `--revert`, aterriza el cambio que lo | |
| 644 | +deshace. Git se queda en los bordes, así que GitHub y Gitea siguen | |
| 645 | +funcionando. | |
| 646 | + | |
| 647 | +Se inspira en las ideas que Anthropic publicó sobre Scion, su sistema | |
| 648 | +interno de control de versiones. Es una implementación independiente: no | |
| 649 | +contiene código de Anthropic y no tiene relación con Anthropic ni cuenta | |
| 650 | +con su respaldo. | |
| 651 | + | |
| 652 | +Está en la versión 0.1, así que tu repositorio de git sigue siendo la | |
| 653 | +fuente de verdad. Para trabajar desde varias máquinas está | |
| 654 | +[BraidHub](https://braidhub.elffuss.com), el servicio alojado de braid: los | |
| 655 | +repositorios son privados salvo que su dueño diga lo contrario, y cada uno | |
| 656 | +puede tener un repositorio de GitHub como espejo, al que el hub sube como | |
| 657 | +fast-forward cada aterrizaje en su rama por defecto. Las | |
| 658 | +[fases](#status-and-roadmap) dicen qué llega después y qué pruebas tiene | |
| 659 | +que pasar cada una. | |
| 658 | 660 | |
| 659 | 661 | Para usarlo en un proyecto, pídeselo a tu agente: |
| 660 | 662 | |
| @@ -665,4 +667,6 @@ | ||
| 665 | 667 | Lo instala con cargo, te avisa de lo que braid no ejecuta, como los hooks |
| 666 | 668 | de git, importa la historia de git del proyecto y, con `braid agents init`, |
| 667 | 669 | escribe en su `AGENTS.md` las reglas para que cada sesión trabaje en su |
| 668 | -propio espacio de trabajo y aterrice sus cambios con braid. | |
| 670 | +propio espacio de trabajo y aterrice sus cambios con braid. La web, | |
| 671 | +[braid.elffuss.com](https://braid.elffuss.com/?lang=es), también está en | |
| 672 | +castellano. |
added docs/assets/hero-dark.svg +61 −0
| @@ -0,0 +1,61 @@ | ||
| 1 | +<!-- SPDX-License-Identifier: Apache-2.0 | |
| 2 | + Copyright (c) 2026 UtopiaIA | |
| 3 | + Made by scripts/demos/hero.py from the agents recording: edit that, not this. --> | |
| 4 | +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 582" width="1280" height="582" role="img" aria-labelledby="hero-title hero-desc"> | |
| 5 | +<title id="hero-title">Elffuss Braid: Many agents. One main. No retry loop.</title> | |
| 6 | +<desc id="hero-desc">Three agents land on main in turn: agent-a as a fast-forward, agent-b rebased onto it, and agent-c with a conflict, so main did not move and braid exits with status 2.</desc> | |
| 7 | +<style> | |
| 8 | +.s { fill: none; stroke-width: 9.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 2; stroke-dashoffset: 0; } | |
| 9 | +.sa { stroke: #c8a06a; } .sb { stroke: #54dcc6; } .sc { stroke: #8272ff; } | |
| 10 | +.tag { font-family: 'Iowan Old Style', Georgia, 'Palatino Linotype', Palatino, serif; font-size: 50px; font-weight: 600; letter-spacing: -0.3px; fill: #eae8f2; } | |
| 11 | +.url { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; font-size: 22px; letter-spacing: 1px; fill: #7f7ca0; } | |
| 12 | +.ln { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; font-size: 24px; white-space: pre; } | |
| 13 | +/* plays once, then holds: the last frame is the file as written */ | |
| 14 | +@media (prefers-reduced-motion: no-preference) { | |
| 15 | + .s { animation: draw 1.5s cubic-bezier(.22, .61, .36, 1) both; } | |
| 16 | + .sb { animation-delay: .15s; } .sc { animation-delay: .3s; } | |
| 17 | + .tag { animation: show .8s ease-out .45s both; } | |
| 18 | + .url { animation: show .8s ease-out .8s both; } | |
| 19 | + .term { animation: show .5s ease-out 1s both; } | |
| 20 | + .ln { animation: show .3s ease-out both; } | |
| 21 | +} | |
| 22 | +@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } } | |
| 23 | +@keyframes show { from { opacity: 0; } to { opacity: 1; } } | |
| 24 | +</style> | |
| 25 | +<defs> | |
| 26 | +<clipPath id="hero-card"><rect width="1280" height="582" rx="24"/></clipPath> | |
| 27 | +<radialGradient id="hero-glow0" cx="0.12" cy="0.02" r="0.62"><stop offset="0" stop-color="#54dcc6" stop-opacity="0.2"/><stop offset="1" stop-color="#54dcc6" stop-opacity="0"/></radialGradient> | |
| 28 | +<radialGradient id="hero-glow1" cx="0.9" cy="0.02" r="0.66"><stop offset="0" stop-color="#8272ff" stop-opacity="0.24"/><stop offset="1" stop-color="#8272ff" stop-opacity="0"/></radialGradient> | |
| 29 | +<radialGradient id="hero-glow2" cx="0.3" cy="1.05" r="0.7"><stop offset="0" stop-color="#c8a06a" stop-opacity="0.12"/><stop offset="1" stop-color="#c8a06a" stop-opacity="0"/></radialGradient> | |
| 30 | +</defs> | |
| 31 | +<g clip-path="url(#hero-card)"> | |
| 32 | +<rect width="1280" height="582" fill="#090a11"/> | |
| 33 | +<rect width="1280" height="582" fill="url(#hero-glow0)"/> | |
| 34 | +<rect width="1280" height="582" fill="url(#hero-glow1)"/> | |
| 35 | +<rect width="1280" height="582" fill="url(#hero-glow2)"/> | |
| 36 | +</g> | |
| 37 | +<rect x=".5" y=".5" width="1279" height="581" rx="23.5" fill="none" stroke="rgba(150,146,184,.22)"/> | |
| 38 | +<g transform="translate(35.25 24) scale(0.75)"> | |
| 39 | +<defs><mask id="hero-cut0" maskUnits="userSpaceOnUse" x="0" y="0" width="320" height="96"><rect x="0" y="0" width="320" height="96" fill="#fff"/><path d="M38.67 21.01C41.17 21.11 43.67 22.42 46.17 24.77C48.67 27.12 51.17 30.51 53.67 34.5C56.17 38.49 58.67 43.08 61.17 47.69C63.67 52.3 66.17 56.92 68.67 60.96M84.67 74.99C87.17 74.89 89.67 73.58 92.17 71.23C94.67 68.88 97.17 65.49 99.67 61.5C102.17 57.51 104.67 52.92 107.17 48.31C109.67 43.7 112.17 39.08 114.67 35.04M130.67 21.01C133.17 21.11 135.67 22.42 138.17 24.77C140.67 27.12 143.17 30.51 145.67 34.5C148.17 38.49 150.67 43.08 153.17 47.69C155.67 52.3 158.17 56.92 160.67 60.96M176.67 74.99C179.17 74.89 181.67 73.58 184.17 71.23C186.67 68.88 189.17 65.49 191.67 61.5C194.17 57.51 196.67 52.92 199.17 48.31C201.67 43.7 204.17 39.08 206.67 35.04M222.67 21.01C225.17 21.11 227.67 22.42 230.17 24.77C232.67 27.12 235.17 30.51 237.67 34.5C240.17 38.49 242.67 43.08 245.17 47.69C247.67 52.3 250.17 56.92 252.67 60.96M268.67 74.99C271.11 74.89 273.56 73.64 276 71.38C278.44 69.13 280.89 65.88 283.33 62.03C285.78 58.18 288.22 53.73 290.67 49.23C293.11 44.73 295.56 40.18 298 36.13" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/></mask><mask id="hero-cut1" maskUnits="userSpaceOnUse" x="0" y="0" width="320" height="96"><rect x="0" y="0" width="320" height="96" fill="#fff"/><path d="M22 32.94C23.78 35.66 25.56 38.71 27.33 41.91C29.11 45.1 30.89 48.43 32.67 51.68C34.44 54.92 36.22 58.09 38 60.96M54 74.99C56.5 74.89 59 73.58 61.5 71.23C64 68.88 66.5 65.49 69 61.5C71.5 57.51 74 52.92 76.5 48.31C79 43.7 81.5 39.08 84 35.04M100 21.01C102.5 21.11 105 22.42 107.5 24.77C110 27.12 112.5 30.51 115 34.5C117.5 38.49 120 43.08 122.5 47.69C125 52.3 127.5 56.92 130 60.96M146 74.99C148.5 74.89 151 73.58 153.5 71.23C156 68.88 158.5 65.49 161 61.5C163.5 57.51 166 52.92 168.5 48.31C171 43.7 173.5 39.08 176 35.04M192 21.01C194.5 21.11 197 22.42 199.5 24.77C202 27.12 204.5 30.51 207 34.5C209.5 38.49 212 43.08 214.5 47.69C217 52.3 219.5 56.92 222 60.96M238 74.99C240.5 74.89 243 73.58 245.5 71.23C248 68.88 250.5 65.49 253 61.5C255.5 57.51 258 52.92 260.5 48.31C263 43.7 265.5 39.08 268 35.04" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/></mask><mask id="hero-cut2" maskUnits="userSpaceOnUse" x="0" y="0" width="320" height="96"><rect x="0" y="0" width="320" height="96" fill="#fff"/><path d="M23.33 74.99C25.83 74.89 28.33 73.58 30.83 71.23C33.33 68.88 35.83 65.49 38.33 61.5C40.83 57.51 43.33 52.92 45.83 48.31C48.33 43.7 50.83 39.08 53.33 35.04M69.33 21.01C71.83 21.11 74.33 22.42 76.83 24.77C79.33 27.12 81.83 30.51 84.33 34.5C86.83 38.49 89.33 43.08 91.83 47.69C94.33 52.3 96.83 56.92 99.33 60.96M115.33 74.99C117.83 74.89 120.33 73.58 122.83 71.23C125.33 68.88 127.83 65.49 130.33 61.5C132.83 57.51 135.33 52.92 137.83 48.31C140.33 43.7 142.83 39.08 145.33 35.04M161.33 21.01C163.83 21.11 166.33 22.42 168.83 24.77C171.33 27.12 173.83 30.51 176.33 34.5C178.83 38.49 181.33 43.08 183.83 47.69C186.33 52.3 188.83 56.92 191.33 60.96M207.33 74.99C209.83 74.89 212.33 73.58 214.83 71.23C217.33 68.88 219.83 65.49 222.33 61.5C224.83 57.51 227.33 52.92 229.83 48.31C232.33 43.7 234.83 39.08 237.33 35.04M253.33 21.01C255.83 21.11 258.33 22.42 260.83 24.77C263.33 27.12 265.83 30.51 268.33 34.5C270.83 38.49 273.33 43.08 275.83 47.69C278.33 52.3 280.83 56.92 283.33 60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/></mask></defs> | |
| 40 | +<path class="s sa" d="M22 74.94C25.83 75.42 29.67 73 33.5 68.35C37.33 63.7 41.17 56.89 45 49.84C48.83 42.79 52.67 35.58 56.5 30.26C60.33 24.93 64.17 21.55 68 21.06C71.83 20.58 75.67 23 79.5 27.65C83.33 32.3 87.17 39.11 91 46.16C94.83 53.21 98.67 60.42 102.5 65.74C106.33 71.07 110.17 74.45 114 74.94C117.83 75.42 121.67 73 125.5 68.35C129.33 63.7 133.17 56.89 137 49.84C140.83 42.79 144.67 35.58 148.5 30.26C152.33 24.93 156.17 21.55 160 21.06C163.83 20.58 167.67 23 171.5 27.65C175.33 32.3 179.17 39.11 183 46.16C186.83 53.21 190.67 60.42 194.5 65.74C198.33 71.07 202.17 74.45 206 74.94C209.83 75.42 213.67 73 217.5 68.35C221.33 63.7 225.17 56.89 229 49.84C232.83 42.79 236.67 35.58 240.5 30.26C244.33 24.93 248.17 21.55 252 21.06C255.83 20.58 259.67 23 263.5 27.65C267.33 32.3 271.17 39.11 275 46.16C278.83 53.21 282.67 60.42 286.5 65.74C290.33 71.07 294.17 74.45 298 74.94" mask="url(#hero-cut0)" pathLength="1"/> | |
| 41 | +<path class="s sb" d="M22 36.13C25.83 29.78 29.67 24.75 33.5 22.46C37.33 20.17 41.17 20.64 45 23.75C48.83 26.86 52.67 32.56 56.5 39.25C60.33 45.94 64.17 53.52 68 59.87C71.83 66.22 75.67 71.25 79.5 73.54C83.33 75.83 87.17 75.36 91 72.25C94.83 69.14 98.67 63.44 102.5 56.75C106.33 50.06 110.17 42.48 114 36.13C117.83 29.78 121.67 24.75 125.5 22.46C129.33 20.17 133.17 20.64 137 23.75C140.83 26.86 144.67 32.56 148.5 39.25C152.33 45.94 156.17 53.52 160 59.87C163.83 66.22 167.67 71.25 171.5 73.54C175.33 75.83 179.17 75.36 183 72.25C186.83 69.14 190.67 63.44 194.5 56.75C198.33 50.06 202.17 42.48 206 36.13C209.83 29.78 213.67 24.75 217.5 22.46C221.33 20.17 225.17 20.64 229 23.75C232.83 26.86 236.67 32.56 240.5 39.25C244.33 45.94 248.17 53.52 252 59.87C255.83 66.22 259.67 71.25 263.5 73.54C267.33 75.83 271.17 75.36 275 72.25C278.83 69.14 282.67 63.44 286.5 56.75C290.33 50.06 294.17 42.48 298 36.13" mask="url(#hero-cut1)" pathLength="1"/> | |
| 42 | +<path class="s sc" d="M22 32.94C25.83 38.8 29.67 46.26 33.5 53.19C37.33 60.13 41.17 66.46 45 70.41C48.83 74.35 52.67 75.86 56.5 74.5C60.33 73.14 64.17 68.93 68 63.06C71.83 57.2 75.67 49.74 79.5 42.81C83.33 35.87 87.17 29.54 91 25.59C94.83 21.65 98.67 20.14 102.5 21.5C106.33 22.86 110.17 27.07 114 32.94C117.83 38.8 121.67 46.26 125.5 53.19C129.33 60.13 133.17 66.46 137 70.41C140.83 74.35 144.67 75.86 148.5 74.5C152.33 73.14 156.17 68.93 160 63.06C163.83 57.2 167.67 49.74 171.5 42.81C175.33 35.87 179.17 29.54 183 25.59C186.83 21.65 190.67 20.14 194.5 21.5C198.33 22.86 202.17 27.07 206 32.94C209.83 38.8 213.67 46.26 217.5 53.19C221.33 60.13 225.17 66.46 229 70.41C232.83 74.35 236.67 75.86 240.5 74.5C244.33 73.14 248.17 68.93 252 63.06C255.83 57.2 259.67 49.74 263.5 42.81C267.33 35.87 271.17 29.54 275 25.59C278.83 21.65 282.67 20.14 286.5 21.5C290.33 22.86 294.17 27.07 298 32.94" mask="url(#hero-cut2)" pathLength="1"/> | |
| 43 | +</g> | |
| 44 | +<text class="url" x="1232" y="70" text-anchor="end">braid.elffuss.com</text> | |
| 45 | +<text class="tag" x="48" y="158">Many agents. One main. No retry loop.</text> | |
| 46 | +<g class="term"> | |
| 47 | +<rect x="48" y="194" width="1184" height="348" rx="16" fill="#0e0f18" stroke="rgba(150,146,184,.28)"/> | |
| 48 | +<rect x="49" y="216" width="3" height="304" fill="#c8a06a"/> | |
| 49 | +<rect x="52" y="216" width="3" height="304" fill="#54dcc6"/> | |
| 50 | +<rect x="55" y="216" width="3" height="304" fill="#8272ff"/> | |
| 51 | +</g> | |
| 52 | +<text class="ln" x="82" y="238" xml:space="preserve" style="animation-delay: 1.10s"><tspan fill="#7f7ca0"># landing on main is one short step that they take in turn</tspan></text> | |
| 53 | +<text class="ln" x="82" y="273" xml:space="preserve" style="animation-delay: 1.32s"><tspan fill="#c8a06a">[agent-a]</tspan><tspan fill="#7f7ca0"> $ </tspan><tspan fill="#eae8f2">braid land</tspan></text> | |
| 54 | +<text class="ln" x="82" y="308" xml:space="preserve" style="animation-delay: 1.54s"><tspan fill="#b3afce">Landed 0b042deed1e6 on main (fast-forward)</tspan></text> | |
| 55 | +<text class="ln" x="82" y="343" xml:space="preserve" style="animation-delay: 1.76s"><tspan fill="#54dcc6">[agent-b]</tspan><tspan fill="#7f7ca0"> $ </tspan><tspan fill="#eae8f2">braid land</tspan></text> | |
| 56 | +<text class="ln" x="82" y="378" xml:space="preserve" style="animation-delay: 1.98s"><tspan fill="#b3afce">Landed on main as 4ac41391a609, rebased onto 0b042deed1e6</tspan></text> | |
| 57 | +<text class="ln" x="82" y="413" xml:space="preserve" style="animation-delay: 2.20s"><tspan fill="#8272ff">[agent-c]</tspan><tspan fill="#7f7ca0"> $ </tspan><tspan fill="#eae8f2">braid land</tspan></text> | |
| 58 | +<text class="ln" x="82" y="448" xml:space="preserve" style="animation-delay: 2.42s"><tspan fill="#b3afce">fc89c7629ad1 conflicts with main at 4ac41391a609; main did not move:</tspan></text> | |
| 59 | +<text class="ln" x="82" y="483" xml:space="preserve" style="animation-delay: 2.64s"><tspan fill="#b3afce"> CONTENT shipping.toml (1 region)</tspan></text> | |
| 60 | +<text class="ln" x="82" y="518" xml:space="preserve" style="animation-delay: 2.86s"><tspan fill="#e779cf">exit status 2</tspan></text> | |
| 61 | +</svg> |
added docs/assets/hero-light.svg +61 −0
| @@ -0,0 +1,61 @@ | ||
| 1 | +<!-- SPDX-License-Identifier: Apache-2.0 | |
| 2 | + Copyright (c) 2026 UtopiaIA | |
| 3 | + Made by scripts/demos/hero.py from the agents recording: edit that, not this. --> | |
| 4 | +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 582" width="1280" height="582" role="img" aria-labelledby="hero-title hero-desc"> | |
| 5 | +<title id="hero-title">Elffuss Braid: Many agents. One main. No retry loop.</title> | |
| 6 | +<desc id="hero-desc">Three agents land on main in turn: agent-a as a fast-forward, agent-b rebased onto it, and agent-c with a conflict, so main did not move and braid exits with status 2.</desc> | |
| 7 | +<style> | |
| 8 | +.s { fill: none; stroke-width: 9.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 2; stroke-dashoffset: 0; } | |
| 9 | +.sa { stroke: #a77a3a; } .sb { stroke: #13917f; } .sc { stroke: #5b4ae6; } | |
| 10 | +.tag { font-family: 'Iowan Old Style', Georgia, 'Palatino Linotype', Palatino, serif; font-size: 50px; font-weight: 600; letter-spacing: -0.3px; fill: #15141f; } | |
| 11 | +.url { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; font-size: 22px; letter-spacing: 1px; fill: #5f5b7d; } | |
| 12 | +.ln { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace; font-size: 24px; white-space: pre; } | |
| 13 | +/* plays once, then holds: the last frame is the file as written */ | |
| 14 | +@media (prefers-reduced-motion: no-preference) { | |
| 15 | + .s { animation: draw 1.5s cubic-bezier(.22, .61, .36, 1) both; } | |
| 16 | + .sb { animation-delay: .15s; } .sc { animation-delay: .3s; } | |
| 17 | + .tag { animation: show .8s ease-out .45s both; } | |
| 18 | + .url { animation: show .8s ease-out .8s both; } | |
| 19 | + .term { animation: show .5s ease-out 1s both; } | |
| 20 | + .ln { animation: show .3s ease-out both; } | |
| 21 | +} | |
| 22 | +@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } } | |
| 23 | +@keyframes show { from { opacity: 0; } to { opacity: 1; } } | |
| 24 | +</style> | |
| 25 | +<defs> | |
| 26 | +<clipPath id="hero-card"><rect width="1280" height="582" rx="24"/></clipPath> | |
| 27 | +<radialGradient id="hero-glow0" cx="0.12" cy="0.02" r="0.62"><stop offset="0" stop-color="#13917f" stop-opacity="0.1"/><stop offset="1" stop-color="#13917f" stop-opacity="0"/></radialGradient> | |
| 28 | +<radialGradient id="hero-glow1" cx="0.9" cy="0.02" r="0.66"><stop offset="0" stop-color="#5b4ae6" stop-opacity="0.09"/><stop offset="1" stop-color="#5b4ae6" stop-opacity="0"/></radialGradient> | |
| 29 | +<radialGradient id="hero-glow2" cx="0.3" cy="1.05" r="0.7"><stop offset="0" stop-color="#a77a3a" stop-opacity="0.08"/><stop offset="1" stop-color="#a77a3a" stop-opacity="0"/></radialGradient> | |
| 30 | +</defs> | |
| 31 | +<g clip-path="url(#hero-card)"> | |
| 32 | +<rect width="1280" height="582" fill="#f6f4ee"/> | |
| 33 | +<rect width="1280" height="582" fill="url(#hero-glow0)"/> | |
| 34 | +<rect width="1280" height="582" fill="url(#hero-glow1)"/> | |
| 35 | +<rect width="1280" height="582" fill="url(#hero-glow2)"/> | |
| 36 | +</g> | |
| 37 | +<rect x=".5" y=".5" width="1279" height="581" rx="23.5" fill="none" stroke="rgba(21,20,31,.12)"/> | |
| 38 | +<g transform="translate(35.25 24) scale(0.75)"> | |
| 39 | +<defs><mask id="hero-cut0" maskUnits="userSpaceOnUse" x="0" y="0" width="320" height="96"><rect x="0" y="0" width="320" height="96" fill="#fff"/><path d="M38.67 21.01C41.17 21.11 43.67 22.42 46.17 24.77C48.67 27.12 51.17 30.51 53.67 34.5C56.17 38.49 58.67 43.08 61.17 47.69C63.67 52.3 66.17 56.92 68.67 60.96M84.67 74.99C87.17 74.89 89.67 73.58 92.17 71.23C94.67 68.88 97.17 65.49 99.67 61.5C102.17 57.51 104.67 52.92 107.17 48.31C109.67 43.7 112.17 39.08 114.67 35.04M130.67 21.01C133.17 21.11 135.67 22.42 138.17 24.77C140.67 27.12 143.17 30.51 145.67 34.5C148.17 38.49 150.67 43.08 153.17 47.69C155.67 52.3 158.17 56.92 160.67 60.96M176.67 74.99C179.17 74.89 181.67 73.58 184.17 71.23C186.67 68.88 189.17 65.49 191.67 61.5C194.17 57.51 196.67 52.92 199.17 48.31C201.67 43.7 204.17 39.08 206.67 35.04M222.67 21.01C225.17 21.11 227.67 22.42 230.17 24.77C232.67 27.12 235.17 30.51 237.67 34.5C240.17 38.49 242.67 43.08 245.17 47.69C247.67 52.3 250.17 56.92 252.67 60.96M268.67 74.99C271.11 74.89 273.56 73.64 276 71.38C278.44 69.13 280.89 65.88 283.33 62.03C285.78 58.18 288.22 53.73 290.67 49.23C293.11 44.73 295.56 40.18 298 36.13" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/></mask><mask id="hero-cut1" maskUnits="userSpaceOnUse" x="0" y="0" width="320" height="96"><rect x="0" y="0" width="320" height="96" fill="#fff"/><path d="M22 32.94C23.78 35.66 25.56 38.71 27.33 41.91C29.11 45.1 30.89 48.43 32.67 51.68C34.44 54.92 36.22 58.09 38 60.96M54 74.99C56.5 74.89 59 73.58 61.5 71.23C64 68.88 66.5 65.49 69 61.5C71.5 57.51 74 52.92 76.5 48.31C79 43.7 81.5 39.08 84 35.04M100 21.01C102.5 21.11 105 22.42 107.5 24.77C110 27.12 112.5 30.51 115 34.5C117.5 38.49 120 43.08 122.5 47.69C125 52.3 127.5 56.92 130 60.96M146 74.99C148.5 74.89 151 73.58 153.5 71.23C156 68.88 158.5 65.49 161 61.5C163.5 57.51 166 52.92 168.5 48.31C171 43.7 173.5 39.08 176 35.04M192 21.01C194.5 21.11 197 22.42 199.5 24.77C202 27.12 204.5 30.51 207 34.5C209.5 38.49 212 43.08 214.5 47.69C217 52.3 219.5 56.92 222 60.96M238 74.99C240.5 74.89 243 73.58 245.5 71.23C248 68.88 250.5 65.49 253 61.5C255.5 57.51 258 52.92 260.5 48.31C263 43.7 265.5 39.08 268 35.04" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/></mask><mask id="hero-cut2" maskUnits="userSpaceOnUse" x="0" y="0" width="320" height="96"><rect x="0" y="0" width="320" height="96" fill="#fff"/><path d="M23.33 74.99C25.83 74.89 28.33 73.58 30.83 71.23C33.33 68.88 35.83 65.49 38.33 61.5C40.83 57.51 43.33 52.92 45.83 48.31C48.33 43.7 50.83 39.08 53.33 35.04M69.33 21.01C71.83 21.11 74.33 22.42 76.83 24.77C79.33 27.12 81.83 30.51 84.33 34.5C86.83 38.49 89.33 43.08 91.83 47.69C94.33 52.3 96.83 56.92 99.33 60.96M115.33 74.99C117.83 74.89 120.33 73.58 122.83 71.23C125.33 68.88 127.83 65.49 130.33 61.5C132.83 57.51 135.33 52.92 137.83 48.31C140.33 43.7 142.83 39.08 145.33 35.04M161.33 21.01C163.83 21.11 166.33 22.42 168.83 24.77C171.33 27.12 173.83 30.51 176.33 34.5C178.83 38.49 181.33 43.08 183.83 47.69C186.33 52.3 188.83 56.92 191.33 60.96M207.33 74.99C209.83 74.89 212.33 73.58 214.83 71.23C217.33 68.88 219.83 65.49 222.33 61.5C224.83 57.51 227.33 52.92 229.83 48.31C232.33 43.7 234.83 39.08 237.33 35.04M253.33 21.01C255.83 21.11 258.33 22.42 260.83 24.77C263.33 27.12 265.83 30.51 268.33 34.5C270.83 38.49 273.33 43.08 275.83 47.69C278.33 52.3 280.83 56.92 283.33 60.96" fill="none" stroke="#000" stroke-width="18.5" stroke-linecap="butt"/></mask></defs> | |
| 40 | +<path class="s sa" d="M22 74.94C25.83 75.42 29.67 73 33.5 68.35C37.33 63.7 41.17 56.89 45 49.84C48.83 42.79 52.67 35.58 56.5 30.26C60.33 24.93 64.17 21.55 68 21.06C71.83 20.58 75.67 23 79.5 27.65C83.33 32.3 87.17 39.11 91 46.16C94.83 53.21 98.67 60.42 102.5 65.74C106.33 71.07 110.17 74.45 114 74.94C117.83 75.42 121.67 73 125.5 68.35C129.33 63.7 133.17 56.89 137 49.84C140.83 42.79 144.67 35.58 148.5 30.26C152.33 24.93 156.17 21.55 160 21.06C163.83 20.58 167.67 23 171.5 27.65C175.33 32.3 179.17 39.11 183 46.16C186.83 53.21 190.67 60.42 194.5 65.74C198.33 71.07 202.17 74.45 206 74.94C209.83 75.42 213.67 73 217.5 68.35C221.33 63.7 225.17 56.89 229 49.84C232.83 42.79 236.67 35.58 240.5 30.26C244.33 24.93 248.17 21.55 252 21.06C255.83 20.58 259.67 23 263.5 27.65C267.33 32.3 271.17 39.11 275 46.16C278.83 53.21 282.67 60.42 286.5 65.74C290.33 71.07 294.17 74.45 298 74.94" mask="url(#hero-cut0)" pathLength="1"/> | |
| 41 | +<path class="s sb" d="M22 36.13C25.83 29.78 29.67 24.75 33.5 22.46C37.33 20.17 41.17 20.64 45 23.75C48.83 26.86 52.67 32.56 56.5 39.25C60.33 45.94 64.17 53.52 68 59.87C71.83 66.22 75.67 71.25 79.5 73.54C83.33 75.83 87.17 75.36 91 72.25C94.83 69.14 98.67 63.44 102.5 56.75C106.33 50.06 110.17 42.48 114 36.13C117.83 29.78 121.67 24.75 125.5 22.46C129.33 20.17 133.17 20.64 137 23.75C140.83 26.86 144.67 32.56 148.5 39.25C152.33 45.94 156.17 53.52 160 59.87C163.83 66.22 167.67 71.25 171.5 73.54C175.33 75.83 179.17 75.36 183 72.25C186.83 69.14 190.67 63.44 194.5 56.75C198.33 50.06 202.17 42.48 206 36.13C209.83 29.78 213.67 24.75 217.5 22.46C221.33 20.17 225.17 20.64 229 23.75C232.83 26.86 236.67 32.56 240.5 39.25C244.33 45.94 248.17 53.52 252 59.87C255.83 66.22 259.67 71.25 263.5 73.54C267.33 75.83 271.17 75.36 275 72.25C278.83 69.14 282.67 63.44 286.5 56.75C290.33 50.06 294.17 42.48 298 36.13" mask="url(#hero-cut1)" pathLength="1"/> | |
| 42 | +<path class="s sc" d="M22 32.94C25.83 38.8 29.67 46.26 33.5 53.19C37.33 60.13 41.17 66.46 45 70.41C48.83 74.35 52.67 75.86 56.5 74.5C60.33 73.14 64.17 68.93 68 63.06C71.83 57.2 75.67 49.74 79.5 42.81C83.33 35.87 87.17 29.54 91 25.59C94.83 21.65 98.67 20.14 102.5 21.5C106.33 22.86 110.17 27.07 114 32.94C117.83 38.8 121.67 46.26 125.5 53.19C129.33 60.13 133.17 66.46 137 70.41C140.83 74.35 144.67 75.86 148.5 74.5C152.33 73.14 156.17 68.93 160 63.06C163.83 57.2 167.67 49.74 171.5 42.81C175.33 35.87 179.17 29.54 183 25.59C186.83 21.65 190.67 20.14 194.5 21.5C198.33 22.86 202.17 27.07 206 32.94C209.83 38.8 213.67 46.26 217.5 53.19C221.33 60.13 225.17 66.46 229 70.41C232.83 74.35 236.67 75.86 240.5 74.5C244.33 73.14 248.17 68.93 252 63.06C255.83 57.2 259.67 49.74 263.5 42.81C267.33 35.87 271.17 29.54 275 25.59C278.83 21.65 282.67 20.14 286.5 21.5C290.33 22.86 294.17 27.07 298 32.94" mask="url(#hero-cut2)" pathLength="1"/> | |
| 43 | +</g> | |
| 44 | +<text class="url" x="1232" y="70" text-anchor="end">braid.elffuss.com</text> | |
| 45 | +<text class="tag" x="48" y="158">Many agents. One main. No retry loop.</text> | |
| 46 | +<g class="term"> | |
| 47 | +<rect x="48" y="194" width="1184" height="348" rx="16" fill="#0e0f18" stroke="rgba(21,20,31,.22)"/> | |
| 48 | +<rect x="49" y="216" width="3" height="304" fill="#c8a06a"/> | |
| 49 | +<rect x="52" y="216" width="3" height="304" fill="#54dcc6"/> | |
| 50 | +<rect x="55" y="216" width="3" height="304" fill="#8272ff"/> | |
| 51 | +</g> | |
| 52 | +<text class="ln" x="82" y="238" xml:space="preserve" style="animation-delay: 1.10s"><tspan fill="#7f7ca0"># landing on main is one short step that they take in turn</tspan></text> | |
| 53 | +<text class="ln" x="82" y="273" xml:space="preserve" style="animation-delay: 1.32s"><tspan fill="#c8a06a">[agent-a]</tspan><tspan fill="#7f7ca0"> $ </tspan><tspan fill="#eae8f2">braid land</tspan></text> | |
| 54 | +<text class="ln" x="82" y="308" xml:space="preserve" style="animation-delay: 1.54s"><tspan fill="#b3afce">Landed 0b042deed1e6 on main (fast-forward)</tspan></text> | |
| 55 | +<text class="ln" x="82" y="343" xml:space="preserve" style="animation-delay: 1.76s"><tspan fill="#54dcc6">[agent-b]</tspan><tspan fill="#7f7ca0"> $ </tspan><tspan fill="#eae8f2">braid land</tspan></text> | |
| 56 | +<text class="ln" x="82" y="378" xml:space="preserve" style="animation-delay: 1.98s"><tspan fill="#b3afce">Landed on main as 4ac41391a609, rebased onto 0b042deed1e6</tspan></text> | |
| 57 | +<text class="ln" x="82" y="413" xml:space="preserve" style="animation-delay: 2.20s"><tspan fill="#8272ff">[agent-c]</tspan><tspan fill="#7f7ca0"> $ </tspan><tspan fill="#eae8f2">braid land</tspan></text> | |
| 58 | +<text class="ln" x="82" y="448" xml:space="preserve" style="animation-delay: 2.42s"><tspan fill="#b3afce">fc89c7629ad1 conflicts with main at 4ac41391a609; main did not move:</tspan></text> | |
| 59 | +<text class="ln" x="82" y="483" xml:space="preserve" style="animation-delay: 2.64s"><tspan fill="#b3afce"> CONTENT shipping.toml (1 region)</tspan></text> | |
| 60 | +<text class="ln" x="82" y="518" xml:space="preserve" style="animation-delay: 2.86s"><tspan fill="#e779cf">exit status 2</tspan></text> | |
| 61 | +</svg> |
added docs/assets/how-it-works-dark.svg +35 −0
| @@ -0,0 +1,35 @@ | ||
| 1 | +<!-- SPDX-License-Identifier: Apache-2.0 | |
| 2 | + Copyright (c) 2026 UtopiaIA | |
| 3 | + Made by scripts/demos/diagram.py from the site's diagram: edit that, not this. --> | |
| 4 | +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 408" width="1000" height="408" role="img" aria-labelledby="dgm-title"> | |
| 5 | +<title id="dgm-title">How braid works: workspaces commit in parallel over one shared store, land on main in turn, and git sync sends main to any git remote</title> | |
| 6 | +<style> | |
| 7 | +.band { fill: rgba(22, 23, 38, .62); stroke: rgba(150, 146, 184, .28); } | |
| 8 | +.card { fill: rgb(22, 23, 38); stroke: rgba(150, 146, 184, .28); } | |
| 9 | +.acc-a { fill: #c8a06a; } | |
| 10 | +.acc-b { fill: #54dcc6; } | |
| 11 | +.acc-c { fill: #8272ff; } | |
| 12 | +.lb { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; } | |
| 13 | +.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; } | |
| 14 | +.hi { fill: #eae8f2; } | |
| 15 | +.dim { fill: #b3afce; } | |
| 16 | +.muted { fill: #8e8bb0; } | |
| 17 | +.strong { font-weight: 600; } | |
| 18 | +.t-a { fill: #c8a06a; } | |
| 19 | +.t-b { fill: #54dcc6; } | |
| 20 | +.t-c { fill: #8272ff; } | |
| 21 | +.t-x { fill: #e779cf; } | |
| 22 | +.strand { fill: none; stroke-linecap: round; stroke-linejoin: round; } | |
| 23 | +.st-a { stroke: #c8a06a; } | |
| 24 | +.st-b { stroke: #54dcc6; } | |
| 25 | +.st-c { stroke: #8272ff; } | |
| 26 | +.post { fill: #7f7ca0; } | |
| 27 | +.knot { fill: none; stroke: #e779cf; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; } | |
| 28 | +.loop { fill: none; stroke: #8272ff; stroke-width: 2; stroke-dasharray: 5 5; stroke-linecap: round; } | |
| 29 | +.ar { fill: #b3afce; } | |
| 30 | +.ar-c { fill: #8272ff; } | |
| 31 | +.flow { fill: none; stroke: #b3afce; stroke-width: 2; } | |
| 32 | +.box { fill: rgb(22, 23, 38); stroke: rgba(150, 146, 184, .28); } | |
| 33 | +.ghost { fill: none; stroke: #7f7ca0; stroke-dasharray: 6 6; } | |
| 34 | +</style> | |
| 35 | +<rect class="band" x="12" y="12" width="254" height="390" rx="16"/><text class="lb mono dim" font-size="13.5"><tspan x="28" y="36">commit: in parallel</tspan></text><rect class="card" x="28" y="49" width="222" height="62" rx="10"/><rect class="acc-b" x="40" y="60" width="4" height="40" rx="2"/><text class="lb mono hi" font-size="15"><tspan x="56" y="75">workspace b</tspan></text><text class="lb dim" font-size="13.5"><tspan x="56" y="96">own working copy · no index</tspan></text><rect class="card" x="28" y="137" width="222" height="62" rx="10"/><rect class="acc-a" x="40" y="148" width="4" height="40" rx="2"/><text class="lb mono hi" font-size="15"><tspan x="56" y="163">workspace a</tspan></text><text class="lb dim" font-size="13.5"><tspan x="56" y="184">own working copy · no index</tspan></text><rect class="card" x="28" y="225" width="222" height="62" rx="10"/><rect class="acc-c" x="40" y="236" width="4" height="40" rx="2"/><text class="lb mono hi" font-size="15"><tspan x="56" y="251">workspace c</tspan></text><text class="lb dim" font-size="13.5"><tspan x="56" y="272">own working copy · no index</tspan></text><text class="lb hi strong" font-size="14"><tspan x="28" y="318">one shared store</tspan></text><text class="lb dim" font-size="13.5"><tspan x="28" y="340">immutable objects</tspan><tspan x="28" y="357.5">named by BLAKE3</tspan><tspan x="28" y="375">append-only op log</tspan></text><defs><mask id="dw-m-b" maskUnits="userSpaceOnUse" x="0" y="0" width="1000" height="408"><rect width="1000" height="408" fill="#fff"/><path d="M636.9 192.29C639.15 192.2 641.4 191.02 643.65 188.9C645.9 186.79 648.15 183.74 650.4 180.15C652.65 176.56 654.9 172.43 657.15 168.28C659.4 164.13 661.65 159.97 663.9 156.33" fill="none" stroke="#000" stroke-width="16.65"/><path d="M678.3 143.71C680.55 143.8 682.8 144.98 685.05 147.1C687.3 149.21 689.55 152.26 691.8 155.85C694.05 159.44 696.3 163.57 698.55 167.72C700.8 171.87 703.05 176.03 705.3 179.67" fill="none" stroke="#000" stroke-width="16.65"/><path d="M719.7 192.29C721.95 192.2 724.2 191.02 726.45 188.9C728.7 186.79 730.95 183.74 733.2 180.15C735.45 176.56 737.7 172.43 739.95 168.28C742.2 164.13 744.45 159.97 746.7 156.33" fill="none" stroke="#000" stroke-width="16.65"/></mask><mask id="dw-m-a" maskUnits="userSpaceOnUse" x="0" y="0" width="1000" height="408"><rect width="1000" height="408" fill="#fff"/><path d="M630 147.24C632.23 149.38 634.47 152.43 636.7 156.01C638.93 159.59 641.17 163.7 643.4 167.82C645.63 171.93 647.87 176.06 650.1 179.67" fill="none" stroke="#000" stroke-width="16.65"/><path d="M664.5 192.29C666.75 192.2 669 191.02 671.25 188.9C673.5 186.79 675.75 183.74 678 180.15C680.25 176.56 682.5 172.43 684.75 168.28C687 164.13 689.25 159.97 691.5 156.33" fill="none" stroke="#000" stroke-width="16.65"/><path d="M705.9 143.71C708.15 143.8 710.4 144.98 712.65 147.1C714.9 149.21 717.15 152.26 719.4 155.85C721.65 159.44 723.9 163.57 726.15 167.72C728.4 171.87 730.65 176.03 732.9 179.67" fill="none" stroke="#000" stroke-width="16.65"/></mask><mask id="dw-m-c" maskUnits="userSpaceOnUse" x="0" y="0" width="1000" height="408"><rect width="1000" height="408" fill="#fff"/><path d="M650.7 143.71C652.95 143.8 655.2 144.98 657.45 147.1C659.7 149.21 661.95 152.26 664.2 155.85C666.45 159.44 668.7 163.57 670.95 167.72C673.2 171.87 675.45 176.03 677.7 179.67" fill="none" stroke="#000" stroke-width="16.65"/><path d="M692.1 192.29C694.35 192.2 696.6 191.02 698.85 188.9C701.1 186.79 703.35 183.74 705.6 180.15C707.85 176.56 710.1 172.43 712.35 168.28C714.6 164.13 716.85 159.97 719.1 156.33" fill="none" stroke="#000" stroke-width="16.65"/><path d="M733.5 143.71C735.23 143.78 736.95 144.48 738.67 145.77C740.4 147.05 742.12 148.91 743.85 151.21C745.58 153.51 747.3 156.25 749.02 159.21C750.75 162.18 752.48 165.37 754.2 168.55" fill="none" stroke="#000" stroke-width="16.65"/></mask></defs><rect class="post" x="596" y="88.72" width="8" height="44" rx="4"/><rect class="post" x="596" y="203.28" width="8" height="44" rx="4"/><text class="lb hi" text-anchor="middle" font-size="13.5"><tspan x="600" y="74.72">land · one short step, taken in turn</tspan></text><path class="strand st-a" d="M250 168C368.33 168 486.67 168 605 168C620 168 632.35 160.63 640.35 150.43C643.8 146.04 647.25 143.56 650.7 143.71C654.15 143.85 657.6 146.61 661.05 151.21C664.5 155.81 667.95 162.19 671.4 168.55C674.85 174.91 678.3 181.17 681.75 185.57C685.2 189.96 688.65 192.44 692.1 192.29C695.55 192.15 699 189.39 702.45 184.79C705.9 180.19 709.35 173.81 712.8 167.45C716.25 161.09 719.7 154.83 723.15 150.43C726.6 146.04 730.05 143.56 733.5 143.71C736.95 143.85 740.4 146.61 743.85 151.21C747.3 155.81 750.75 162.19 754.2 168.55" stroke-width="8.55" mask="url(#dw-m-a)"/><path class="strand st-b" d="M250 80C323.33 80 396.67 80 470 80C555 80 535 146 570 146C580 146 590 146 600 146C610 146 620 137.66 630 147.24C633.45 150.54 636.9 156.07 640.35 162.25C643.8 168.43 647.25 175.19 650.7 180.63C654.15 186.06 657.6 190.1 661.05 191.61C664.5 193.12 667.95 192.07 671.4 188.76C674.85 185.46 678.3 179.93 681.75 173.75C685.2 167.57 688.65 160.81 692.1 155.37C695.55 149.94 699 145.9 702.45 144.39C705.9 142.88 709.35 143.93 712.8 147.24C716.25 150.54 719.7 156.07 723.15 162.25C726.6 168.43 730.05 175.19 733.5 180.63C736.95 186.06 740.4 190.1 743.85 191.61C747.3 193.12 750.75 192.07 754.2 188.76" stroke-width="8.55" mask="url(#dw-m-b)"/><path class="strand st-c" d="M250 256C323.33 256 396.67 256 470 256C560 256 540 190 570 190C580 190 590 190 600 190C610 190 620 180.46 630 189.32C633.45 192.37 636.9 193.11 640.35 191.32C643.8 189.54 647.25 185.25 650.7 179.67C654.15 174.09 657.6 167.28 661.05 161.18C664.5 155.07 667.95 149.74 671.4 146.68C674.85 143.63 678.3 142.89 681.75 144.68C685.2 146.46 688.65 150.75 692.1 156.33C695.55 161.91 699 168.72 702.45 174.82C705.9 180.93 709.35 186.26 712.8 189.32C716.25 192.37 719.7 193.11 723.15 191.32C726.6 189.54 730.05 185.25 733.5 179.67C736.95 174.09 740.4 167.28 743.85 161.18C747.3 155.07 750.75 149.74 754.2 146.68" stroke-width="8.55" mask="url(#dw-m-c)"/><text class="lb mono t-b" font-size="13"><tspan x="284" y="106">rebased</tspan></text><text class="lb mono t-a" font-size="13"><tspan x="290" y="154">fast-forward</tspan></text><path class="knot" d="M334 256 C352.2 256 371.7 252.1 371.7 237.8 C371.7 223.5 350.9 223.5 350.9 237.8 C350.9 252.1 369.1 256 386 256"/><text class="lb t-x" font-size="13"><tspan x="290" y="222">conflict · exit 2 · main did not move</tspan></text><path class="loop" d="M334 266C316 308 264 312 260 272"/><path class="ar ar-c" d="M260 267 L264.36 273.71 L256.87 274.36 Z"/><text class="lb mono t-c" font-size="13"><tspan x="274" y="332">update · fix · commit</tspan></text><text class="lb mono t-c" text-anchor="end" font-size="13"><tspan x="588" y="282">fast-forward</tspan></text><text class="lb mono hi" text-anchor="middle" font-size="15"><tspan x="692.1" y="124">main</tspan></text><path class="flow" d="M766.2 168 L789.2 168"/><path class="ar" d="M795.2 168 L788.14 171.76 L788.14 164.24 Z"/><rect class="box" x="798.2" y="137" width="197.8" height="62" rx="12"/><text class="lb mono hi" font-size="15"><tspan x="814.2" y="163">git sync</tspan></text><text class="lb dim" font-size="13.5"><tspan x="814.2" y="184">any git remote</tspan></text><text class="lb dim" font-size="13.5"><tspan x="800.2" y="222">fast-forward, with a lease</tspan></text><rect class="ghost" x="798.2" y="268" width="197.8" height="58" rx="12"/><text class="lb muted" font-size="13.5"><tspan x="814.2" y="292">planned:</tspan></text><text class="lb muted" font-size="13.5"><tspan x="814.2" y="312">daemon · caches</tspan></text></svg> |
added docs/assets/how-it-works-light.svg +35 −0
| @@ -0,0 +1,35 @@ | ||
| 1 | +<!-- SPDX-License-Identifier: Apache-2.0 | |
| 2 | + Copyright (c) 2026 UtopiaIA | |
| 3 | + Made by scripts/demos/diagram.py from the site's diagram: edit that, not this. --> | |
| 4 | +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 408" width="1000" height="408" role="img" aria-labelledby="dgm-title"> | |
| 5 | +<title id="dgm-title">How braid works: workspaces commit in parallel over one shared store, land on main in turn, and git sync sends main to any git remote</title> | |
| 6 | +<style> | |
| 7 | +.band { fill: rgba(255, 255, 255, .72); stroke: rgba(21, 20, 31, .22); } | |
| 8 | +.card { fill: #fff; stroke: rgba(21, 20, 31, .22); } | |
| 9 | +.acc-a { fill: #a77a3a; } | |
| 10 | +.acc-b { fill: #13917f; } | |
| 11 | +.acc-c { fill: #5b4ae6; } | |
| 12 | +.lb { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; } | |
| 13 | +.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; } | |
| 14 | +.hi { fill: #15141f; } | |
| 15 | +.dim { fill: #3f3c57; } | |
| 16 | +.muted { fill: #5f5b7d; } | |
| 17 | +.strong { font-weight: 600; } | |
| 18 | +.t-a { fill: #7d5a1f; } | |
| 19 | +.t-b { fill: #0b6f61; } | |
| 20 | +.t-c { fill: #4b3bd1; } | |
| 21 | +.t-x { fill: #a2307f; } | |
| 22 | +.strand { fill: none; stroke-linecap: round; stroke-linejoin: round; } | |
| 23 | +.st-a { stroke: #a77a3a; } | |
| 24 | +.st-b { stroke: #13917f; } | |
| 25 | +.st-c { stroke: #5b4ae6; } | |
| 26 | +.post { fill: #5f5b7d; } | |
| 27 | +.knot { fill: none; stroke: #a2307f; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; } | |
| 28 | +.loop { fill: none; stroke: #5b4ae6; stroke-width: 2; stroke-dasharray: 5 5; stroke-linecap: round; } | |
| 29 | +.ar { fill: #3f3c57; } | |
| 30 | +.ar-c { fill: #5b4ae6; } | |
| 31 | +.flow { fill: none; stroke: #3f3c57; stroke-width: 2; } | |
| 32 | +.box { fill: #fff; stroke: rgba(21, 20, 31, .22); } | |
| 33 | +.ghost { fill: none; stroke: #5f5b7d; stroke-dasharray: 6 6; } | |
| 34 | +</style> | |
| 35 | +<rect class="band" x="12" y="12" width="254" height="390" rx="16"/><text class="lb mono dim" font-size="13.5"><tspan x="28" y="36">commit: in parallel</tspan></text><rect class="card" x="28" y="49" width="222" height="62" rx="10"/><rect class="acc-b" x="40" y="60" width="4" height="40" rx="2"/><text class="lb mono hi" font-size="15"><tspan x="56" y="75">workspace b</tspan></text><text class="lb dim" font-size="13.5"><tspan x="56" y="96">own working copy · no index</tspan></text><rect class="card" x="28" y="137" width="222" height="62" rx="10"/><rect class="acc-a" x="40" y="148" width="4" height="40" rx="2"/><text class="lb mono hi" font-size="15"><tspan x="56" y="163">workspace a</tspan></text><text class="lb dim" font-size="13.5"><tspan x="56" y="184">own working copy · no index</tspan></text><rect class="card" x="28" y="225" width="222" height="62" rx="10"/><rect class="acc-c" x="40" y="236" width="4" height="40" rx="2"/><text class="lb mono hi" font-size="15"><tspan x="56" y="251">workspace c</tspan></text><text class="lb dim" font-size="13.5"><tspan x="56" y="272">own working copy · no index</tspan></text><text class="lb hi strong" font-size="14"><tspan x="28" y="318">one shared store</tspan></text><text class="lb dim" font-size="13.5"><tspan x="28" y="340">immutable objects</tspan><tspan x="28" y="357.5">named by BLAKE3</tspan><tspan x="28" y="375">append-only op log</tspan></text><defs><mask id="dw-m-b" maskUnits="userSpaceOnUse" x="0" y="0" width="1000" height="408"><rect width="1000" height="408" fill="#fff"/><path d="M636.9 192.29C639.15 192.2 641.4 191.02 643.65 188.9C645.9 186.79 648.15 183.74 650.4 180.15C652.65 176.56 654.9 172.43 657.15 168.28C659.4 164.13 661.65 159.97 663.9 156.33" fill="none" stroke="#000" stroke-width="16.65"/><path d="M678.3 143.71C680.55 143.8 682.8 144.98 685.05 147.1C687.3 149.21 689.55 152.26 691.8 155.85C694.05 159.44 696.3 163.57 698.55 167.72C700.8 171.87 703.05 176.03 705.3 179.67" fill="none" stroke="#000" stroke-width="16.65"/><path d="M719.7 192.29C721.95 192.2 724.2 191.02 726.45 188.9C728.7 186.79 730.95 183.74 733.2 180.15C735.45 176.56 737.7 172.43 739.95 168.28C742.2 164.13 744.45 159.97 746.7 156.33" fill="none" stroke="#000" stroke-width="16.65"/></mask><mask id="dw-m-a" maskUnits="userSpaceOnUse" x="0" y="0" width="1000" height="408"><rect width="1000" height="408" fill="#fff"/><path d="M630 147.24C632.23 149.38 634.47 152.43 636.7 156.01C638.93 159.59 641.17 163.7 643.4 167.82C645.63 171.93 647.87 176.06 650.1 179.67" fill="none" stroke="#000" stroke-width="16.65"/><path d="M664.5 192.29C666.75 192.2 669 191.02 671.25 188.9C673.5 186.79 675.75 183.74 678 180.15C680.25 176.56 682.5 172.43 684.75 168.28C687 164.13 689.25 159.97 691.5 156.33" fill="none" stroke="#000" stroke-width="16.65"/><path d="M705.9 143.71C708.15 143.8 710.4 144.98 712.65 147.1C714.9 149.21 717.15 152.26 719.4 155.85C721.65 159.44 723.9 163.57 726.15 167.72C728.4 171.87 730.65 176.03 732.9 179.67" fill="none" stroke="#000" stroke-width="16.65"/></mask><mask id="dw-m-c" maskUnits="userSpaceOnUse" x="0" y="0" width="1000" height="408"><rect width="1000" height="408" fill="#fff"/><path d="M650.7 143.71C652.95 143.8 655.2 144.98 657.45 147.1C659.7 149.21 661.95 152.26 664.2 155.85C666.45 159.44 668.7 163.57 670.95 167.72C673.2 171.87 675.45 176.03 677.7 179.67" fill="none" stroke="#000" stroke-width="16.65"/><path d="M692.1 192.29C694.35 192.2 696.6 191.02 698.85 188.9C701.1 186.79 703.35 183.74 705.6 180.15C707.85 176.56 710.1 172.43 712.35 168.28C714.6 164.13 716.85 159.97 719.1 156.33" fill="none" stroke="#000" stroke-width="16.65"/><path d="M733.5 143.71C735.23 143.78 736.95 144.48 738.67 145.77C740.4 147.05 742.12 148.91 743.85 151.21C745.58 153.51 747.3 156.25 749.02 159.21C750.75 162.18 752.48 165.37 754.2 168.55" fill="none" stroke="#000" stroke-width="16.65"/></mask></defs><rect class="post" x="596" y="88.72" width="8" height="44" rx="4"/><rect class="post" x="596" y="203.28" width="8" height="44" rx="4"/><text class="lb hi" text-anchor="middle" font-size="13.5"><tspan x="600" y="74.72">land · one short step, taken in turn</tspan></text><path class="strand st-a" d="M250 168C368.33 168 486.67 168 605 168C620 168 632.35 160.63 640.35 150.43C643.8 146.04 647.25 143.56 650.7 143.71C654.15 143.85 657.6 146.61 661.05 151.21C664.5 155.81 667.95 162.19 671.4 168.55C674.85 174.91 678.3 181.17 681.75 185.57C685.2 189.96 688.65 192.44 692.1 192.29C695.55 192.15 699 189.39 702.45 184.79C705.9 180.19 709.35 173.81 712.8 167.45C716.25 161.09 719.7 154.83 723.15 150.43C726.6 146.04 730.05 143.56 733.5 143.71C736.95 143.85 740.4 146.61 743.85 151.21C747.3 155.81 750.75 162.19 754.2 168.55" stroke-width="8.55" mask="url(#dw-m-a)"/><path class="strand st-b" d="M250 80C323.33 80 396.67 80 470 80C555 80 535 146 570 146C580 146 590 146 600 146C610 146 620 137.66 630 147.24C633.45 150.54 636.9 156.07 640.35 162.25C643.8 168.43 647.25 175.19 650.7 180.63C654.15 186.06 657.6 190.1 661.05 191.61C664.5 193.12 667.95 192.07 671.4 188.76C674.85 185.46 678.3 179.93 681.75 173.75C685.2 167.57 688.65 160.81 692.1 155.37C695.55 149.94 699 145.9 702.45 144.39C705.9 142.88 709.35 143.93 712.8 147.24C716.25 150.54 719.7 156.07 723.15 162.25C726.6 168.43 730.05 175.19 733.5 180.63C736.95 186.06 740.4 190.1 743.85 191.61C747.3 193.12 750.75 192.07 754.2 188.76" stroke-width="8.55" mask="url(#dw-m-b)"/><path class="strand st-c" d="M250 256C323.33 256 396.67 256 470 256C560 256 540 190 570 190C580 190 590 190 600 190C610 190 620 180.46 630 189.32C633.45 192.37 636.9 193.11 640.35 191.32C643.8 189.54 647.25 185.25 650.7 179.67C654.15 174.09 657.6 167.28 661.05 161.18C664.5 155.07 667.95 149.74 671.4 146.68C674.85 143.63 678.3 142.89 681.75 144.68C685.2 146.46 688.65 150.75 692.1 156.33C695.55 161.91 699 168.72 702.45 174.82C705.9 180.93 709.35 186.26 712.8 189.32C716.25 192.37 719.7 193.11 723.15 191.32C726.6 189.54 730.05 185.25 733.5 179.67C736.95 174.09 740.4 167.28 743.85 161.18C747.3 155.07 750.75 149.74 754.2 146.68" stroke-width="8.55" mask="url(#dw-m-c)"/><text class="lb mono t-b" font-size="13"><tspan x="284" y="106">rebased</tspan></text><text class="lb mono t-a" font-size="13"><tspan x="290" y="154">fast-forward</tspan></text><path class="knot" d="M334 256 C352.2 256 371.7 252.1 371.7 237.8 C371.7 223.5 350.9 223.5 350.9 237.8 C350.9 252.1 369.1 256 386 256"/><text class="lb t-x" font-size="13"><tspan x="290" y="222">conflict · exit 2 · main did not move</tspan></text><path class="loop" d="M334 266C316 308 264 312 260 272"/><path class="ar ar-c" d="M260 267 L264.36 273.71 L256.87 274.36 Z"/><text class="lb mono t-c" font-size="13"><tspan x="274" y="332">update · fix · commit</tspan></text><text class="lb mono t-c" text-anchor="end" font-size="13"><tspan x="588" y="282">fast-forward</tspan></text><text class="lb mono hi" text-anchor="middle" font-size="15"><tspan x="692.1" y="124">main</tspan></text><path class="flow" d="M766.2 168 L789.2 168"/><path class="ar" d="M795.2 168 L788.14 171.76 L788.14 164.24 Z"/><rect class="box" x="798.2" y="137" width="197.8" height="62" rx="12"/><text class="lb mono hi" font-size="15"><tspan x="814.2" y="163">git sync</tspan></text><text class="lb dim" font-size="13.5"><tspan x="814.2" y="184">any git remote</tspan></text><text class="lb dim" font-size="13.5"><tspan x="800.2" y="222">fast-forward, with a lease</tspan></text><rect class="ghost" x="798.2" y="268" width="197.8" height="58" rx="12"/><text class="lb muted" font-size="13.5"><tspan x="814.2" y="292">planned:</tspan></text><text class="lb muted" font-size="13.5"><tspan x="814.2" y="312">daemon · caches</tspan></text></svg> |
added scripts/demos/diagram.py +109 −0
| @@ -0,0 +1,109 @@ | ||
| 1 | +#!/usr/bin/env python3 | |
| 2 | +# SPDX-License-Identifier: Apache-2.0 | |
| 3 | +# Copyright (c) 2026 UtopiaIA | |
| 4 | +"""Exports the site's wide "How it works" diagram for the README, in | |
| 5 | +English, as standalone SVGs, dark and light. | |
| 6 | + | |
| 7 | +usage: diagram.py <site/index.html> <site/site.css> <out dir> | |
| 8 | + | |
| 9 | +The site's tall diagram, for narrow screens, stays on the site: for a | |
| 10 | +reader who has chosen a theme, GitHub rewrites the colour-scheme media | |
| 11 | +queries of a README's <picture>, and a source that also tests the screen's | |
| 12 | +width then shows on wide screens too. | |
| 13 | + | |
| 14 | +The site's diagram tells the scene of crates/cli/tests/three_agents.rs, where | |
| 15 | +c lands as a fast-forward, a is rebased with 1 path merged, and b conflicts. | |
| 16 | +The README tells the scene of docs/assets/demo-agents.gif and of its quick | |
| 17 | +start, where a lands as a fast-forward, b is rebased onto it without | |
| 18 | +merging any path, and c conflicts. So the letters move round, a to b, b to | |
| 19 | +c and c to a, each with its colour, and the rebase is only "rebased". Every | |
| 20 | +other label is the site's. | |
| 21 | + | |
| 22 | +The colours are site.css's tokens for each theme, written into a <style>, | |
| 23 | +and the ground is left transparent for GitHub's own page. No scripts and no | |
| 24 | +external fonts: GitHub shows these files through <img>. | |
| 25 | +""" | |
| 26 | +import os | |
| 27 | +import re | |
| 28 | +import sys | |
| 29 | + | |
| 30 | +SITE, CSS, OUT = sys.argv[1:4] | |
| 31 | +ROUND = {"a": "b", "b": "c", "c": "a"} | |
| 32 | +WIDTH, HEIGHT = 1000, 408 | |
| 33 | +TITLE = ("How braid works: workspaces commit in parallel over one shared store, " | |
| 34 | + "land on main in turn, and git sync sends main to any git remote") | |
| 35 | + | |
| 36 | + | |
| 37 | +def tokens(css): | |
| 38 | + """site.css's custom properties: the dark ones of :root, and the light | |
| 39 | + ones that its prefers-color-scheme block puts over them.""" | |
| 40 | + dark_block = re.search(r"^:root \{(.*?)^\}", css, re.S | re.M).group(1) | |
| 41 | + light_block = re.search(r"@media \(prefers-color-scheme: light\) \{\s*:root \{(.*?)\}", css, re.S).group(1) | |
| 42 | + | |
| 43 | + def props(block): | |
| 44 | + block = re.sub(r"/\*.*?\*/", "", block, flags=re.S) | |
| 45 | + return dict(re.findall(r"--([\w-]+):\s*([^;]+);", block)) | |
| 46 | + | |
| 47 | + dark = props(dark_block) | |
| 48 | + return {"dark": dark, "light": {**dark, **props(light_block)}} | |
| 49 | + | |
| 50 | + | |
| 51 | +def rules(css, values, used): | |
| 52 | + """The diagram's rules of site.css, `.dgm .x { ... }`, for the classes | |
| 53 | + the SVG uses, with every var() resolved.""" | |
| 54 | + out = [] | |
| 55 | + for cls, body in re.findall(r"^\.dgm \.([\w-]+) \{([^}]*)\}", css, re.M): | |
| 56 | + # The loop back and its arrow belong to the agent that conflicts: | |
| 57 | + # b's teal on the site, c's indigo here. | |
| 58 | + if cls in ("loop", "ar-b"): | |
| 59 | + body = body.replace("var(--g-teal)", "var(--g-indigo)") | |
| 60 | + cls = "ar-c" if cls == "ar-b" else cls | |
| 61 | + if cls in used: | |
| 62 | + body = re.sub(r"var\(--([\w-]+)\)", lambda m: values[m[1]].strip(), body.strip()) | |
| 63 | + out.append(f".{cls} {{ {body} }}") | |
| 64 | + return "\n".join(out) | |
| 65 | + | |
| 66 | + | |
| 67 | +def english(svg): | |
| 68 | + svg = re.sub(r'<tspan data-l="es" lang="es"[^>]*>[^<]*</tspan>', "", svg) | |
| 69 | + return svg.replace(' data-l="en" lang="en"', "") | |
| 70 | + | |
| 71 | + | |
| 72 | +def relabel(svg): | |
| 73 | + """The README's scene: the letters move round, colours and all.""" | |
| 74 | + svg, n = re.subn(r"\b(acc|t|st|ar|dw-m|dt-m)-([abc])\b", lambda m: f"{m[1]}-{ROUND[m[2]]}", svg) | |
| 75 | + assert n >= 12, n | |
| 76 | + svg, n = re.subn(r"(>workspace(?: |</tspan><tspan [^>]*>))([abc])<", | |
| 77 | + lambda m: f"{m[1]}{ROUND[m[2]]}<", svg) | |
| 78 | + assert n == 3, n | |
| 79 | + svg, n = re.subn(r">rebased · 1 path merged<", ">rebased<", svg) | |
| 80 | + assert n == 1, n | |
| 81 | + return svg | |
| 82 | + | |
| 83 | + | |
| 84 | +def main(): | |
| 85 | + html = open(SITE, encoding="utf-8").read() | |
| 86 | + css = open(CSS, encoding="utf-8").read() | |
| 87 | + svg = re.search(r'<svg class="dgm dgm-wide".*?</svg>', html, re.S).group(0) | |
| 88 | + svg = relabel(english(svg)) | |
| 89 | + svg, n = re.subn(r"^<svg [^>]*>", "", svg) | |
| 90 | + assert n == 1 | |
| 91 | + used = set(re.findall(r'class="([^"]+)"', svg)) | |
| 92 | + used = {c for group in used for c in group.split()} | |
| 93 | + for theme, values in tokens(css).items(): | |
| 94 | + out = ( | |
| 95 | + "<!-- SPDX-License-Identifier: Apache-2.0\n Copyright (c) 2026 UtopiaIA\n" | |
| 96 | + " Made by scripts/demos/diagram.py from the site's diagram: edit that, not this. -->\n" | |
| 97 | + f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {WIDTH} {HEIGHT}" ' | |
| 98 | + f'width="{WIDTH}" height="{HEIGHT}" role="img" aria-labelledby="dgm-title">\n' | |
| 99 | + f'<title id="dgm-title">{TITLE}</title>\n' | |
| 100 | + f"<style>\n{rules(css, values, used)}\n</style>\n" | |
| 101 | + f"{svg}\n" | |
| 102 | + ) | |
| 103 | + name = os.path.join(OUT, f"how-it-works-{theme}.svg") | |
| 104 | + with open(name, "w", encoding="utf-8") as f: | |
| 105 | + f.write(out) | |
| 106 | + print(name, len(out.encode()), "bytes") | |
| 107 | + | |
| 108 | + | |
| 109 | +main() |
added scripts/demos/hero.py +217 −0
| @@ -0,0 +1,217 @@ | ||
| 1 | +#!/usr/bin/env python3 | |
| 2 | +# SPDX-License-Identifier: Apache-2.0 | |
| 3 | +# Copyright (c) 2026 UtopiaIA | |
| 4 | +"""Builds the README's banner: the logo's strands, the tagline, and a | |
| 5 | +terminal with the landings of the agents recording, so that the banner and | |
| 6 | +docs/assets/demo-agents.gif show the same run, ids and all. | |
| 7 | + | |
| 8 | +usage: hero.py <site/index.html> <agents.cast | transcript.txt> <out dir> | |
| 9 | + | |
| 10 | +From a recording (asciicast v2, as record.py writes it) it takes the lines | |
| 11 | +from the note "# landing on main ..." to the end; a .txt file gives those | |
| 12 | +lines as they are. The lines about the working copy and what to run next | |
| 13 | +are left out to keep the banner short: the GIF has them all. A recording | |
| 14 | +whose story changed stops it, rather than giving a banner that no longer | |
| 15 | +matches. | |
| 16 | + | |
| 17 | +It writes hero-dark.svg and hero-light.svg, 1280 wide, each a final frame | |
| 18 | +that CSS animates in once where the reader allows motion. There is no | |
| 19 | +narrow variant: for a reader who has chosen a theme, GitHub rewrites the | |
| 20 | +colour-scheme media queries of a README's <picture>, and a source that | |
| 21 | +also tests the screen's width then shows on wide screens too. | |
| 22 | + | |
| 23 | +The terminal stays dark in both themes, as on the site. No scripts, no | |
| 24 | +external fonts or images: GitHub shows these files through <img>. | |
| 25 | +""" | |
| 26 | +import html | |
| 27 | +import json | |
| 28 | +import os | |
| 29 | +import re | |
| 30 | +import sys | |
| 31 | + | |
| 32 | +SITE, SOURCE, OUT = sys.argv[1:4] | |
| 33 | + | |
| 34 | +SERIF = "'Iowan Old Style', Georgia, 'Palatino Linotype', Palatino, serif" | |
| 35 | +MONO = "ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace" | |
| 36 | + | |
| 37 | +# site.css's tokens, and og/og.svg's glows: (colour, opacity, cx, cy, r). | |
| 38 | +THEMES = { | |
| 39 | + "dark": { | |
| 40 | + "ground": "#090a11", | |
| 41 | + "glows": [("#54dcc6", .2, .12, .02, .62), ("#8272ff", .24, .9, .02, .66), | |
| 42 | + ("#c8a06a", .12, .3, 1.05, .7)], | |
| 43 | + "edge": "rgba(150,146,184,.22)", | |
| 44 | + "tagline": "#eae8f2", | |
| 45 | + "url": "#7f7ca0", | |
| 46 | + "strands": ("#c8a06a", "#54dcc6", "#8272ff"), | |
| 47 | + "term_edge": "rgba(150,146,184,.28)", | |
| 48 | + }, | |
| 49 | + "light": { | |
| 50 | + "ground": "#f6f4ee", | |
| 51 | + "glows": [("#13917f", .1, .12, .02, .62), ("#5b4ae6", .09, .9, .02, .66), | |
| 52 | + ("#a77a3a", .08, .3, 1.05, .7)], | |
| 53 | + "edge": "rgba(21,20,31,.12)", | |
| 54 | + "tagline": "#15141f", | |
| 55 | + "url": "#5f5b7d", | |
| 56 | + "strands": ("#a77a3a", "#13917f", "#5b4ae6"), | |
| 57 | + "term_edge": "rgba(21,20,31,.22)", | |
| 58 | + }, | |
| 59 | +} | |
| 60 | +# The terminal's palette, the same in both themes: the recordings' own. | |
| 61 | +TERM = {"bg": "#0e0f18", "text": "#eae8f2", "dim": "#b3afce", "muted": "#7f7ca0", | |
| 62 | + "exit": "#e779cf", "agent-a": "#c8a06a", "agent-b": "#54dcc6", "agent-c": "#8272ff"} | |
| 63 | + | |
| 64 | +# The canvas and its side margin, the logo's scale and top, the font size | |
| 65 | +# and baseline of the URL and of the tagline, and the terminal's top, font | |
| 66 | +# size and line height. | |
| 67 | +WIDTH, MARGIN = 1280, 48 | |
| 68 | +LOGO_SCALE, LOGO_TOP = .75, 24 | |
| 69 | +URL_SIZE, URL_BASE = 22, 70 | |
| 70 | +TAG_SIZE, TAG_BASE = 50, 158 | |
| 71 | +TERM_TOP, SIZE, STEP = 194, 24, 35 | |
| 72 | +TAGLINE = "Many agents. One main. No retry loop." | |
| 73 | + | |
| 74 | + | |
| 75 | +def transcript(path): | |
| 76 | + text = open(path, encoding="utf-8").read() | |
| 77 | + if path.endswith(".cast"): | |
| 78 | + events = [json.loads(line) for line in text.splitlines()[1:] if line.strip()] | |
| 79 | + text = "".join(event[2] for event in events if event[1] == "o") | |
| 80 | + text = re.sub(r"\x1b\[[0-9;?]*[A-Za-z]", "", text) | |
| 81 | + text = text.replace("\r\n", "\n").replace("\r", "") | |
| 82 | + lines = [line.rstrip() for line in text.splitlines()] | |
| 83 | + starts = [i for i, line in enumerate(lines) if line.startswith("# landing on main")] | |
| 84 | + if len(starts) != 1: | |
| 85 | + sys.exit(f"{path}: no single '# landing on main' note") | |
| 86 | + lines = lines[starts[0]:] | |
| 87 | + while lines and not lines[-1]: | |
| 88 | + lines.pop() | |
| 89 | + lines = [line for line in lines if line and not line.startswith(("Updated ", "Run `"))] | |
| 90 | + # The story the banner tells, in order; anything else means the | |
| 91 | + # recording changed, and the banner and the README with it. | |
| 92 | + story = [r"# landing on main", r"\[agent-a\] \$ braid land$", | |
| 93 | + r"Landed \w{12} on main \(fast-forward\)$", r"\[agent-b\] \$ braid land$", | |
| 94 | + r"Landed on main as \w{12}, rebased onto \w{12}$", r"\[agent-c\] \$ braid land$", | |
| 95 | + r"\w{12} conflicts with main at \w{12}; main did not move:$", | |
| 96 | + r" CONTENT +shipping\.toml +\(1 region\)$", r"exit status 2$"] | |
| 97 | + if len(lines) != len(story) or not all(re.match(s, l) for s, l in zip(story, lines)): | |
| 98 | + sys.exit(f"{path}: the landings are not the story the banner tells:\n" + "\n".join(lines)) | |
| 99 | + return lines | |
| 100 | + | |
| 101 | + | |
| 102 | +def colours(line): | |
| 103 | + """The coloured runs of one line: a prompt, a note, the exit status or | |
| 104 | + braid's output.""" | |
| 105 | + if line.startswith("# "): | |
| 106 | + return [(line, "muted")] | |
| 107 | + prompt = re.match(r"\[(agent-[abc])\] \$ (.*)$", line) | |
| 108 | + if prompt: | |
| 109 | + return [(f"[{prompt[1]}]", prompt[1]), (" $ ", "muted"), (prompt[2], "text")] | |
| 110 | + if re.match(r"exit status \d+$", line): | |
| 111 | + return [(line, "exit")] | |
| 112 | + return [(line, "dim")] | |
| 113 | + | |
| 114 | + | |
| 115 | +def logo_parts(): | |
| 116 | + page = open(SITE, encoding="utf-8").read() | |
| 117 | + svg = re.search(r'<div class="hero-logo">(<svg.*?</svg>)</div>', page, re.S).group(1) | |
| 118 | + defs = re.search(r"<defs>.*?</defs>", svg, re.S).group(0).replace("hl-cut", "hero-cut") | |
| 119 | + strands = re.findall(r'<path d="([^"]+)"[^>]*class="(s[abc])"[^>]*mask="url\(#hl-cut(\d)\)"', svg) | |
| 120 | + assert len(strands) == 3, strands | |
| 121 | + paths = "\n".join( | |
| 122 | + f'<path class="s {cls}" d="{d}" mask="url(#hero-cut{n})" pathLength="1"/>' | |
| 123 | + for d, cls, n in strands) | |
| 124 | + return defs, paths | |
| 125 | + | |
| 126 | + | |
| 127 | +def build(theme, lines, defs, paths): | |
| 128 | + t = THEMES[theme] | |
| 129 | + first = TERM_TOP + 44 | |
| 130 | + term_h = 44 + STEP * (len(lines) - 1) + 24 | |
| 131 | + height = TERM_TOP + term_h + 40 | |
| 132 | + term_x, term_w = MARGIN, WIDTH - 2 * MARGIN | |
| 133 | + text_x = term_x + 34 | |
| 134 | + | |
| 135 | + out = [] | |
| 136 | + w = out.append | |
| 137 | + w("<!-- SPDX-License-Identifier: Apache-2.0\n Copyright (c) 2026 UtopiaIA\n" | |
| 138 | + " Made by scripts/demos/hero.py from the agents recording: edit that, not this. -->") | |
| 139 | + w(f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {WIDTH} {height}" ' | |
| 140 | + f'width="{WIDTH}" height="{height}" role="img" aria-labelledby="hero-title hero-desc">') | |
| 141 | + w("<title id=\"hero-title\">Elffuss Braid: Many agents. One main. No retry loop.</title>") | |
| 142 | + w("<desc id=\"hero-desc\">Three agents land on main in turn: agent-a as a fast-forward, " | |
| 143 | + "agent-b rebased onto it, and agent-c with a conflict, so main did not move and braid " | |
| 144 | + "exits with status 2.</desc>") | |
| 145 | + sa, sb, sc = t["strands"] | |
| 146 | + w("<style>") | |
| 147 | + w(f".s {{ fill: none; stroke-width: 9.5; stroke-linecap: round; stroke-linejoin: round; " | |
| 148 | + f"stroke-dasharray: 1 2; stroke-dashoffset: 0; }}") | |
| 149 | + w(f".sa {{ stroke: {sa}; }} .sb {{ stroke: {sb}; }} .sc {{ stroke: {sc}; }}") | |
| 150 | + w(f".tag {{ font-family: {SERIF}; font-size: {TAG_SIZE}px; font-weight: 600; " | |
| 151 | + f"letter-spacing: -0.3px; fill: {t['tagline']}; }}") | |
| 152 | + w(f".url {{ font-family: {MONO}; font-size: {URL_SIZE}px; letter-spacing: 1px; fill: {t['url']}; }}") | |
| 153 | + w(f".ln {{ font-family: {MONO}; font-size: {SIZE}px; white-space: pre; }}") | |
| 154 | + w("/* plays once, then holds: the last frame is the file as written */") | |
| 155 | + w("@media (prefers-reduced-motion: no-preference) {") | |
| 156 | + w(" .s { animation: draw 1.5s cubic-bezier(.22, .61, .36, 1) both; }") | |
| 157 | + w(" .sb { animation-delay: .15s; } .sc { animation-delay: .3s; }") | |
| 158 | + w(" .tag { animation: show .8s ease-out .45s both; }") | |
| 159 | + w(" .url { animation: show .8s ease-out .8s both; }") | |
| 160 | + w(" .term { animation: show .5s ease-out 1s both; }") | |
| 161 | + w(" .ln { animation: show .3s ease-out both; }") | |
| 162 | + w("}") | |
| 163 | + w("@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }") | |
| 164 | + w("@keyframes show { from { opacity: 0; } to { opacity: 1; } }") | |
| 165 | + w("</style>") | |
| 166 | + | |
| 167 | + w("<defs>") | |
| 168 | + w(f'<clipPath id="hero-card"><rect width="{WIDTH}" height="{height}" rx="24"/></clipPath>') | |
| 169 | + for i, (colour, opacity, cx, cy, r) in enumerate(t["glows"]): | |
| 170 | + w(f'<radialGradient id="hero-glow{i}" cx="{cx}" cy="{cy}" r="{r}">' | |
| 171 | + f'<stop offset="0" stop-color="{colour}" stop-opacity="{opacity}"/>' | |
| 172 | + f'<stop offset="1" stop-color="{colour}" stop-opacity="0"/></radialGradient>') | |
| 173 | + w("</defs>") | |
| 174 | + w('<g clip-path="url(#hero-card)">') | |
| 175 | + w(f'<rect width="{WIDTH}" height="{height}" fill="{t["ground"]}"/>') | |
| 176 | + for i in range(len(t["glows"])): | |
| 177 | + w(f'<rect width="{WIDTH}" height="{height}" fill="url(#hero-glow{i})"/>') | |
| 178 | + w("</g>") | |
| 179 | + w(f'<rect x=".5" y=".5" width="{WIDTH - 1}" height="{height - 1}" rx="23.5" fill="none" ' | |
| 180 | + f'stroke="{t["edge"]}"/>') | |
| 181 | + | |
| 182 | + # The logo's strands start 17 units in, counting their round caps. | |
| 183 | + w(f'<g transform="translate({MARGIN - 17 * LOGO_SCALE:.2f} {LOGO_TOP}) scale({LOGO_SCALE})">') | |
| 184 | + w(defs) | |
| 185 | + w(paths) | |
| 186 | + w("</g>") | |
| 187 | + w(f'<text class="url" x="{WIDTH - MARGIN}" y="{URL_BASE}" text-anchor="end">braid.elffuss.com</text>') | |
| 188 | + w(f'<text class="tag" x="{MARGIN}" y="{TAG_BASE}">{html.escape(TAGLINE)}</text>') | |
| 189 | + | |
| 190 | + w('<g class="term">') | |
| 191 | + w(f'<rect x="{term_x}" y="{TERM_TOP}" width="{term_w}" height="{term_h}" rx="16" ' | |
| 192 | + f'fill="{TERM["bg"]}" stroke="{t["term_edge"]}"/>') | |
| 193 | + for i, colour in enumerate((TERM["agent-a"], TERM["agent-b"], TERM["agent-c"])): | |
| 194 | + w(f'<rect x="{term_x + 1 + 3 * i}" y="{TERM_TOP + 22}" width="3" height="{term_h - 44}" ' | |
| 195 | + f'fill="{colour}"/>') | |
| 196 | + w("</g>") | |
| 197 | + for i, line in enumerate(lines): | |
| 198 | + runs = "".join(f'<tspan fill="{TERM[c]}">{html.escape(s, quote=False)}</tspan>' | |
| 199 | + for s, c in colours(line)) | |
| 200 | + w(f'<text class="ln" x="{text_x}" y="{first + i * STEP}" xml:space="preserve" ' | |
| 201 | + f'style="animation-delay: {1.1 + .22 * i:.2f}s">{runs}</text>') | |
| 202 | + w("</svg>") | |
| 203 | + return "\n".join(out) + "\n" | |
| 204 | + | |
| 205 | + | |
| 206 | +def main(): | |
| 207 | + lines = transcript(SOURCE) | |
| 208 | + defs, paths = logo_parts() | |
| 209 | + for theme in THEMES: | |
| 210 | + name = os.path.join(OUT, f"hero-{theme}.svg") | |
| 211 | + svg = build(theme, lines, defs, paths) | |
| 212 | + with open(name, "w", encoding="utf-8") as f: | |
| 213 | + f.write(svg) | |
| 214 | + print(name, len(svg.encode()), "bytes") | |
| 215 | + | |
| 216 | + | |
| 217 | +main() |
modified scripts/demos/render.sh +7 −3
| @@ -2,9 +2,11 @@ | ||
| 2 | 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | 3 | # Copyright (c) 2026 UtopiaIA |
| 4 | 4 | # |
| 5 | -# Rebuilds the README's animated logo and terminal recordings in docs/assets. | |
| 6 | -# The recordings run the real CLI, built from this checkout, in a throwaway | |
| 7 | -# directory; agg (https://github.com/asciinema/agg) turns them into GIFs. | |
| 5 | +# Rebuilds the README's images in docs/assets: the animated logo, the | |
| 6 | +# diagram, the terminal recordings and the banner. The recordings run the | |
| 7 | +# real CLI, built from this checkout, in a throwaway directory; agg | |
| 8 | +# (https://github.com/asciinema/agg) turns them into GIFs, and the banner | |
| 9 | +# shows the landings of the same agents recording, ids and all. | |
| 8 | 10 | # Needs cargo, python3, git, jq and agg. |
| 9 | 11 | set -euo pipefail |
| 10 | 12 | cd "$(dirname "$0")/../.." |
| @@ -15,7 +17,9 @@ | ||
| 15 | 17 | trap 'rm -rf "$work"' EXIT |
| 16 | 18 | |
| 17 | 19 | python3 scripts/demos/logo.py site/index.html docs/assets/braid-animated.svg |
| 20 | +python3 scripts/demos/diagram.py site/index.html site/site.css docs/assets | |
| 18 | 21 | python3 scripts/demos/record.py "$braid" "$work/run" "$work/casts" |
| 22 | +python3 scripts/demos/hero.py site/index.html "$work/casts/agents.cast" docs/assets | |
| 19 | 23 | |
| 20 | 24 | # The site's terminal palette: background, foreground, then the 16 ANSI colors. |
| 21 | 25 | theme=0e0f18,eae8f2,1a1b29,e779cf,54dcc6,c8a06a,8272ff,e779cf,54dcc6,eae8f2,7f7ca0,f0a0e0,7fe8d6,dcc08e,a497ff,f0a0e0,7fe8d6,ffffff |