utopia-ia/elffuss-braid public
Changesets · Branches · Tags · Compare
| Changeset | 4e69006693c7f0fd539ee99e48e04c96d6fed4cadd99155720fb6e2fb78e02fc |
|---|---|
| Author | KikoCis <KikoCis@users.noreply.github.com> · 2026-10-16 00:00 +02:00 |
| Committer | KikoCis <KikoCis@users.noreply.github.com> · 2026-10-16 00:00 +02:00 |
| Parents | 44bd6adbea21 |
2 files changed
modified README.md +31 −4
| @@ -137,6 +137,7 @@ | ||
| 137 | 137 | |
| 138 | 138 | ```bash |
| 139 | 139 | export BRAID_AUTHOR="Ada Lovelace <ada@example.org>" |
| 140 | +export BRAID_AGENT=agent-1 # recorded with everything this agent does | |
| 140 | 141 | braid workspace add agent-1 # ./agent-1, tracking main |
| 141 | 142 | cd agent-1 |
| 142 | 143 | echo 'fn main() {}' > main.rs |
| @@ -146,9 +147,34 @@ | ||
| 146 | 147 | ``` |
| 147 | 148 | |
| 148 | 149 | When two agents change the same lines, the second `land` exits with status 2, |
| 149 | -prints the conflicts as data (`--json` for agents) and leaves `main` where it | |
| 150 | -was. `braid update` then rebases the change and writes git-style conflict | |
| 151 | -markers; fix the file, `braid commit`, `braid land`. | |
| 150 | +prints the conflicts as data and leaves `main` where it was. With `--json`, | |
| 151 | +each conflict names its sides from the agent's point of view: `base`, | |
| 152 | +`branch` (what is on the branch now) and `workspace` (its own change), with | |
| 153 | +the hunks in conflict, and `next` says what to run: `braid update`, which | |
| 154 | +rebases the change and writes git-style conflict markers. Fix the file, then | |
| 155 | +`braid commit` (the change keeps its message unless `-m` gives another) and | |
| 156 | +`braid land`. | |
| 157 | + | |
| 158 | +- `land` and `update` report the same fields: where each changeset went | |
| 159 | + (`landed`, from its id to the one that holds it now), the paths merged, the | |
| 160 | + paths of the working copy they wrote or removed, and for a landing its op | |
| 161 | + log entry. | |
| 162 | +- `braid status --json` says how far the branch is ahead (`behind_by`), which | |
| 163 | + changesets have not landed, including one whose rebase is in progress, and | |
| 164 | + whether a commit would go through (`ready_to_commit`), with every reason | |
| 165 | + it would not (`blocking`), which `braid commit` refuses with too. | |
| 166 | +- Every changeset names the agent that made it, and keeps it when it is | |
| 167 | + rebased; `braid log`, `braid show` and `braid op log` show who did what, | |
| 168 | + and the op log says what each landing did. Signatures use the local time | |
| 169 | + zone. | |
| 170 | +- Revisions can be given as short ids, six hex digits or more; an ambiguous | |
| 171 | + one is an error that lists the candidates. | |
| 172 | +- `braid show` and `braid diff <from> <to>` list the files a change adds, | |
| 173 | + modifies, deletes or turns into another type (`A`, `M`, `D`, `T`), as | |
| 174 | + `git diff --name-status` does. | |
| 175 | + | |
| 176 | +`braid status --help`, `braid land --help` and `braid update --help` describe | |
| 177 | +every JSON field. | |
| 152 | 178 | |
| 153 | 179 | An agent that knows exactly what it changes needs no checkout at all, and can |
| 154 | 180 | check that nobody changed the file under it: |
| @@ -159,7 +185,8 @@ | ||
| 159 | 185 | ``` |
| 160 | 186 | |
| 161 | 187 | New files that look like secrets (`.env*`, `*.pem`, `id_*`) or are larger than |
| 162 | -1 MiB are not committed until `braid track <path>` says so. | |
| 188 | +1 MiB are not committed until `braid track <path>` says so: `braid commit` | |
| 189 | +refuses while they wait, naming them, and `--force` leaves them out. | |
| 163 | 190 | |
| 164 | 191 | ## Working with git |
| 165 | 192 |
modified docs/design.md +38 −10
| @@ -43,6 +43,16 @@ | ||
| 43 | 43 | - Large directories are split with a rule that depends only on entry names, so |
| 44 | 44 | an edit rewrites a few small nodes instead of the whole directory, and equal |
| 45 | 45 | contents always have equal ids. |
| 46 | +- A changeset may carry extra fields, ordered key and value pairs that are | |
| 47 | + part of its hash. Braid writes two: `agent`, the label of the agent that | |
| 48 | + made the changeset, and `rebased-from`, the changeset a rebased one comes | |
| 49 | + from. A rebase keeps the original's other fields, so `agent` names the | |
| 50 | + agent that made the change wherever it lands. The git bridge writes extra | |
| 51 | + fields as commit headers. | |
| 52 | +- Ids are shown as their first 12 hex digits, and any unique prefix of six | |
| 53 | + digits or more names an object; the lookup scans the store's in-memory map | |
| 54 | + of ids, and a prefix that several objects share is an error that lists | |
| 55 | + them. | |
| 46 | 56 | |
| 47 | 57 | ## Store |
| 48 | 58 | |
| @@ -60,7 +70,10 @@ | ||
| 60 | 70 | Only files that can no longer change are memory-mapped. |
| 61 | 71 | - **Op log.** Branch heads and the history of operations live in an |
| 62 | 72 | append-only log behind a short lock. Every record names the agent that wrote |
| 63 | - it, so `braid op log` shows who did what and `braid undo` can step back. | |
| 73 | + it, so `braid op log` shows who did what and `braid undo` can step back. A | |
| 74 | + record's description is written inside the transaction, once the outcome | |
| 75 | + is known: a landing says how it went, which changeset landed as which, and | |
| 76 | + how many paths it merged. | |
| 64 | 77 | - **Publish order.** Objects, then their journal entries, then a barrier, then |
| 65 | 78 | the op log record that refers to them. The op log never points at an object |
| 66 | 79 | that is not durable. |
| @@ -90,10 +103,13 @@ | ||
| 90 | 103 | runs it in order, grouping several landings into one sync. |
| 91 | 104 | |
| 92 | 105 | Conflicts are reported as data, not as markers in a file: the path, the kind, |
| 93 | -the base, ours and theirs, and the hunks. Braid is stricter than git about | |
| 94 | -structural conflicts: a file against a directory, two names that differ only in | |
| 95 | -case or Unicode normalisation, a directory removed under a new file, and the | |
| 96 | -same file renamed two ways. | |
| 106 | +what the base, the head (ours) and the change (theirs) have there, and the | |
| 107 | +hunks, with line numbers counted from 0 and the end excluded. The command line | |
| 108 | +names the sides from the caller's point of view: `base`, `branch` and | |
| 109 | +`workspace`. Braid is stricter than git about structural conflicts: a file | |
| 110 | +against a directory, two names that differ only in case or Unicode | |
| 111 | +normalisation, a directory removed under a new file, and the same file renamed | |
| 112 | +two ways. | |
| 97 | 113 | |
| 98 | 114 | **Invariants.** A branch only moves forward. A branch never contains a |
| 99 | 115 | conflict. No value is overwritten except by a change whose base already |
| @@ -113,7 +129,8 @@ | ||
| 113 | 129 | change one workspace at once; different workspaces never wait for each |
| 114 | 130 | other, except for the short transaction in which a landing moves a branch. |
| 115 | 131 | - New files that look like secrets (`.env*`, `*.pem`, `id_*`) or are larger than |
| 116 | - 1 MiB need an explicit `braid track`. | |
| 132 | + 1 MiB need an explicit `braid track`. Until then `braid commit` refuses, | |
| 133 | + naming them, and `--force` leaves them out. | |
| 117 | 134 | - Status uses a stat cache (modification time, size, inode, type, blob id), |
| 118 | 135 | with the usual guard: a file whose modification time is not strictly older |
| 119 | 136 | than the start of the scan that cached it, read from the workspace's own |
| @@ -129,18 +146,29 @@ | ||
| 129 | 146 | normalisation; names that would collide there, or that the platform cannot |
| 130 | 147 | hold, are refused before anything is written. Untracked files in the way |
| 131 | 148 | stop a checkout too. Nothing from repository content is ever run. |
| 132 | -- `braid commit` records the working copy as a changeset on the base. | |
| 133 | - `braid land` puts the workspace's changesets on its branch in one op log | |
| 149 | +- `braid commit` records the working copy as a changeset on the base. It | |
| 150 | + refuses while something blocks it, listing every reason at once: conflict | |
| 151 | + markers left in a file, a conflict that is not about content and not marked | |
| 152 | + resolved, a new file waiting for `braid track`. `braid status` lists the | |
| 153 | + same reasons as `blocking`, with `ready_to_commit`; it also counts how far | |
| 154 | + the branch's head is ahead of the workspace along first parents, stopping | |
| 155 | + after 5000 changesets, and lists the changesets that have not landed, | |
| 156 | + including those of a rebase in progress. | |
| 157 | +- `braid land` puts the workspace's changesets on its branch in one op log | |
| 134 | 158 | transaction: the engine fast-forwards or rebases them onto the head, and the |
| 135 | 159 | branch moves with a compare-and-swap. The working copy then follows, writing |
| 136 | 160 | only the difference. On conflicts the branch does not move, the conflicts |
| 137 | - come back as data, and the command exits with status 2. | |
| 161 | + come back as data, and the command exits with status 2. `land` and `update` | |
| 162 | + report the same fields: where each changeset went, from its id to the one | |
| 163 | + that holds it now, the paths merged, the paths of the working copy written | |
| 164 | + or removed, and on conflicts the command to run next. | |
| 138 | 165 | - `braid update` brings a workspace onto its branch's head, rebasing its own |
| 139 | 166 | changesets without moving the branch. On conflicts, the working copy gets |
| 140 | 167 | the head's tree with the change's clean paths and git-style markers for |
| 141 | 168 | content conflicts; a rebase is then in progress, `braid resolve` settles the |
| 142 | 169 | other conflicts, and the next `braid commit` records the resolution on the |
| 143 | - head, refusing while markers remain. | |
| 170 | + head, refusing while markers remain. The resolution keeps the rebased | |
| 171 | + changeset's author, extra fields and message, unless `-m` gives another. | |
| 144 | 172 | - A changeset can also be made without any working copy: `braid change |
| 145 | 173 | create` takes the base, the new contents and the deletions, and can require |
| 146 | 174 | what the base holds at each path first, so that an agent never overwrites |