Elffuss BraidHub

utopia-ia/elffuss-braid public

2da7deeea818 · 34.9 KiBSourceRawPermalink

Braid format v1

Status: frozen. Sections 1 to 5 (ids, the codec, trees, changesets and names) are implemented in crates/format and frozen: any change to hashed bytes needs a new format version. Sections 6 and 7 describe the git mapping and the on-disk storage, which are not hashed and can still change. Section 8 describes derived data, whose encodings each have a version of their own.

Every golden vector below is pinned by the Rust tests and recomputed by check_vectors.py, a second implementation written from this document alone. It needs the reference b3sum tool:

python3 docs/spec/check_vectors.py

This document covers what is hashed: ids, trees, changesets and names. How the store keeps objects on disk (records, indexes, compression, deltas, chunks) is not part of any id and has its own, separately versioned, section at the end.

1. Conventions

2. Object ids (implemented)

An object id is BLAKE3 in key-derivation mode, with one context string per kind:

KindCodeContext string
blob1elffuss-braid 2026 blob v1
tree2elffuss-braid 2026 tree v1
changeset3elffuss-braid 2026 changeset v1
chunklist4elffuss-braid 2026 chunklist v1
derived5elffuss-braid 2026 derived v1
id = BLAKE3-derive-key(context(kind), payload)        32 bytes

Golden vectors (pinned in crates/format/src/id.rs):

KindPayloadId
blobemptyff9c212a7ef64fa38f0c411b3a68d523a20fd197ee3ba03fa4a44b7c5e99c958
blobhello\n6acd5cdf880a325d2df716699943aae586ad77d54fb2ed0c5a3f53c76fa56f89
treeempty46f1ab000b3145d2e28ff69f7570eb88065d76ef86905bb268699adb9c860c08
changesetempty1be995db81f244ac5ea57f1ba45d9f9da94ad4edd6dbfa0979c16101a34d04ef
chunklistemptyf14231be43c0cc73e7c4850ec9d980e6952b56c57f7125d0c39d16874be2ab04
derivedempty6f101e23c531e6e3959878774beefb475944b2f0200e52eafb37fd80f97df172

Anyone can check them with the reference b3sum tool:

printf 'hello\n' | b3sum --derive-key "elffuss-braid 2026 blob v1"

3. Trees

A tree describes one directory. Small directories are one flat node. Large ones are split into a balanced tree of nodes whose boundaries depend only on the entry names, so the same set of entries always produces the same root id, no matter in which order it was edited.

u8   format = 1
u8   node_type            0 flat, 1 leaf, 2 internal

flat | leaf:
  uv   n
  n × entry               strictly ascending by name bytes

entry:
  bytes name
  u8    kind              0 file, 1 executable, 2 symlink, 3 tree, 4 gitlink
                          (5 is reserved for conflict entries in a later version)
  kind 0–2:  [32] blob id, uv size in bytes
  kind 3:    [32] tree id
  kind 4:    u8 algorithm (1 = SHA-1, 2 = SHA-256), raw git id (20 or 32 bytes)

internal:
  u8   level              1 for the nodes just above the leaves
  uv   n
  n × (bytes last_name, [32] child id, uv entry_count)

Splitting rule. A directory with 1,024 entries or fewer must be one flat node. A larger one must be split:

  1. Walk the sorted entries left to right, filling a leaf. After adding entry e to a leaf that now holds c entries, end the leaf if c ≥ 32 and u32le(H(0, e.name)[0..4]) < 2³² / 128, or if c = 512.
  2. Build the next level the same way over the children, using each child's last_name, with level numbers 1, 2, …, until one node remains: the root.

H(level, name) = BLAKE3-derive-key("elffuss-braid 2026 tree-split v1", u8 level ‖ name).

Boundaries depend only on names, so changing a file's content never moves them, and an edit never rewrites the leaves before it. Any way of updating a directory must produce exactly the nodes of building it from scratch.

A reader checks a split directory by collecting its entries and building them again: the root must come out identical. A flat node may hold at most 1,024 entries, a leaf or internal node at least 1 and at most 512, and an internal node's children must be one level below it.

Golden vectors:

TreeId
empty (01 00 00)3136b0f18562ee73b840ea348c54ae3c7e97e4cc3e547ea9dd03fa1cd8b384cf
small: README.md (file, hello\n), latest (symlink to README.md), run.sh (executable, #!/bin/sh\n), src (the empty tree), vendor (SHA-1 gitlink, twenty 11 bytes)a6c6d54bb7663d576e8f7a702e0670927e22098d6c15c10475e06b51dc3d8c1b
large: 5,000 files f00000 … f04999, each the one-byte blob x; 30 nodes2c88a412664c1fd862c3487e1313a045a20fe4f7bdeaf1bb71e08564edc7dcce

4. Changesets

A changeset is one change to the repository: its parents, the root tree it produces, and the list of files that changed relative to its first parent.

u8    format = 1
uv    parent_count
parent_count × [32] changeset id      parent[0] is the base of the change list
[32]  root tree id
u8    changes_mode                    0 inline, 1 external
  mode 0:  uv n, n × change
  mode 1:  [32] blob id of the encoded change list, uv n
author:     bytes name, bytes email, sv seconds since the Unix epoch, sv offset in minutes
committer:  same layout
bytes message                         raw bytes, no normalisation
uv    extra_count
extra_count × (bytes key, bytes value)    order and duplicates preserved
u8    git_origin                      0 none; 1 followed by [32] blob id of the raw git commit bytes

change:
  bytes path
  u8    op                            0 delete, 1 file, 2 executable, 3 symlink, 4 gitlink
  op 1–3:  [32] blob id, uv size
  op 4:    u8 algorithm, raw git id

Rules:

Golden vector: no parents; root = the empty tree; two changes, README.md set to the file hello\n (6 bytes) and src/lib.rs set to the empty file; author and committer Ada Lovelace <ada@example.org> at second 1,700,000,000 with offset +60; message Initial import\n; no extras; no git origin.

01 00 3136b0f18562ee73b840ea348c54ae3c7e97e4cc3e547ea9dd03fa1cd8b384cf
00 02 09 524541444d452e6d64 01 6acd5cdf880a325d2df716699943aae586ad77d54fb2ed0c5a3f53c76fa56f89 06
      0a 7372632f6c69622e7273 01 ff9c212a7ef64fa38f0c411b3a68d523a20fd197ee3ba03fa4a44b7c5e99c958 00
0c 416461204c6f76656c616365 0f 616461406578616d706c652e6f7267 80c49fd50c 78
0c 416461204c6f76656c616365 0f 616461406578616d706c652e6f7267 80c49fd50c 78
0f 496e697469616c20696d706f72740a
00
00

Id: 4f8d49034a95a2938d30d13bee5508100211d04e1c125ef567a0c41c27f777d1.

5. Names

The store is permissive, close to what git fsck accepts; checkouts are strict, per file system.

A name in a tree is rejected if it:

When writing a working copy, braid also refuses names that would collide on that file system (letter case, Unicode normalisation), never follows a symlink while walking or writing, and never runs anything found in repository content.

6. Git mapping

These rules decide the braid ids of imported objects, so two importers that follow them give the same ids. They are implemented in crates/git.

Trees. An entry's kind comes from the file type bits of its octal mode: 100000 is a file, executable when the owner may execute it (so 100664 is a file and 100775 an executable); 120000 a symlink, whose blob is the target; 040000 a directory; 160000 a SHA-1 gitlink. Any other type stops the import, and so does a name section 5 refuses, checked before anything the tree names is read. Of entries with the same name, the braid tree keeps the last written, which is the one a git checkout uses. Braid trees never hold an empty subdirectory (only a root can be empty), so an entry for an empty directory, or for a directory holding only empty ones, is left out; changes, being per file, never mention one.

The canonical git tree of a braid tree lists its entries in git's order with the modes 100644, 100755, 120000, 40000 and 160000, naming each subdirectory by its own canonical git tree. A git tree equal to the canonical git tree of its braid tree needs nothing more. Any other, including one that lost duplicate names or empty directories, keeps its raw bytes in a blob, recorded against its git id, since several git trees can share one braid tree; a tree that names such a tree is not canonical either. The empty tree is read as present even when git did not store it.

Commits. The changeset of a commit has: as parents, the changesets of the parent headers that follow the first header, tree, in their order; as root, the braid tree of tree; the change list against the first parent; the message, which is every byte after the first empty line; no extras; and as git origin the blob with the commit's bytes. Author and committer are the first author and committer headers, read as Name <email> seconds ±HHMM:

Annotated tags keep their raw bytes in a blob and record the object they point to. Replacement objects and grafts are ignored, and objects are read raw: no filters, no line-ending conversion, no LFS. Shallow and SHA-256 repositories are refused for now.

Commits imported from git. A changeset with a git origin is exported as those bytes, after checking that the commit names the changeset's root and its parents, in order. The tree it names must be the one the map links to the root or, where the map does not know that tree, the canonical tree of the root; each parent must be the commit the map links to the parent changeset or, where the map does not know it, the commit that changeset exports to. So a repository that received the changesets without the map that imported them, such as a server, exports them to their original commits too, except where a git tree is not canonical: only the importing repository's map holds its raw bytes, and such a commit cannot be exported elsewhere.

Commits made in braid. A changeset without a git origin is exported as tree, one parent per parent, author and committer written as Name <email> seconds ±HHMM, then one header per extra in order, a value with newlines continuing on lines that start with a space, an empty line and the message unchanged. A signature holding <, >, a newline or NUL, an offset beyond ±99 hours, or an extra that cannot be a header has no git form and is refused.

An export records what it generated in the map, in the same tables as an import: the commit of each changeset, each canonical tree and each blob. An import that meets one of those commits again, from wherever it went, takes the changeset it was exported from instead of making a new one with a git origin. The map stays one to one: a pairing whose commit or changeset (tree, blob) is already mapped is not recorded, and a braid tree keeps the canonical git tree it has. Since exports are deterministic, the pairings of any changeset can be recomputed at any time and recorded again.

Map record. The mapping is one derived record, versioned on its own:

"braid-git-map" u8 version = 1
uv n, n × ([20] commit, [32] changeset)
uv n, n × ([20] tree, [32] braid tree)
uv n, n × ([20] tree, [32] blob with its raw bytes)          trees that are not canonical
uv n, n × ([20] blob, [32] braid blob, uv size)
uv n, n × ([20] tag, [32] blob with its raw bytes, [20] target, u8 kind)
uv n, n × (bytes ref name, [20] tag)                         tag names

Each table is sorted by key without duplicates; target kinds are 1 commit, 2 tree, 3 blob and 4 tag. The reverse mappings are rebuilt on load.

7. Storage (not hashed, versioned on its own)

This is the on-disk layout of the local store as implemented in crates/store. It is not hashed: it can change without changing any id. Fixed-size integers are little-endian; uv, sv and bytes are the codec of section 1.

.braid/store/format            object-format=blake3-dk-v1, then storage=<version>
.braid/store/format.lock       empty; locked exclusively to raise the storage version
.braid/store/seg/<name>.seg    object records, append-only
.braid/store/seg/<name>.jrn    journal of a segment that is still open
.braid/store/seg/<name>.idx    sorted index of a sealed segment
.braid/store/seg/<name>.midx   merged index of several sealed segments
.braid/store/seg/merge.lock    empty; locked exclusively while indexes are merged
.braid/store/oplog/lock        empty; locked exclusively by transactions, shared by readers
.braid/store/oplog/log         operation records, append-only
.braid/store/oplog/ckpt.<seq>  every ref as of operation <seq>
.braid/store/derived/index     where the records of derived values are, by key

Segment and merged index names are 32 random lowercase hex digits. Files whose names start with tmp- are still being written, or were left by a writer that died; they are never read, and are removed once they are a minute old and unlocked.

Storage version. The format file has two lines: the object ids (object-format=blake3-dk-v1), and the storage version, what a reader must understand to use the store (storage=3). A store without the second line has storage version 1: records stored whole (codecs 0 and 1), which every version of braid reads. Version 2 adds deltas (codec 3) and chunked blobs (codec 4). Version 3 adds indexes of version 2, whose every part carries its own checksum, and merged indexes, which take the place of the segment indexes they merge, so that a sealed segment may have no index of its own. A version of braid refuses a store of a later storage version, and a format file with any line it does not know; versions from before storage versions compare the whole file with the first line, so they refuse version 2 and later too.

New stores start at the current version. A store is raised only when a writer is about to write the first record or index that needs a later version (a delta or a chunked blob needs 2, an index of version 2 needs 3), or when a handle finds records that need it already there. The writer takes an exclusive lock on format.lock, reads format again, and if it is still older publishes the new one through a temporary file and a rename: the version never goes down, and it reaches the disk before anything that needs it.

A journal entry or an index whose checksum holds but which names an object kind or a codec the reader does not know, sets a reserved field, or has a later index version, was written by a newer version of braid: it is not torn or damaged. The reader refuses the store rather than skip the entry, scan around the index, or append after them, so nothing is ever written over records it does not understand.

Sharing. A writer appends only to a segment it holds an exclusive, non-blocking lock on: an unlocked open segment if there is one, else a new one made with an exclusive create. The kernel releases the lock when the writer dies, and the next writer resumes after what the segment's journal lists. Segments are never truncated, since others may be reading them. A segment is sealed once it holds 256 MiB, or once its journal lists 8,192 records: given a sorted index through a temporary file, flushed together with the segment, and a rename, and its journal removed; it is never written again. A segment is open while it has a journal and no index of its own; a writer takes over only such a segment, and never makes a journal for a segment that has none.

Lookups. A reader keeps a map of where objects are only for the open segments, from their journals, which the record limit keeps short. It looks up sealed segments in their indexes, binary searching the fan-out bucket of the id's first byte, and reads an index as lookups need it: the head on first use, then one bucket at a time. Opening a store reads the open journals and the heads of the merged indexes, whatever the store holds. On a miss, a reader reads the directory again once. Of several copies of an object, a lookup takes the first that serves its purpose; a delta's base must be a copy stored whole, and a chunk a copy that is not chunked.

Merged indexes. Once 8 segment indexes are there, a writer merges indexes at its next sync, or at the end of its next transaction, under an exclusive, non-blocking lock on seg/merge.lock, so that one process merges at a time and the others go on. A merge takes every segment index that no merged index covers, then the merged indexes that hold at most twice as many entries as it took so far, smallest first, so that each merged index left holds more than twice what the new one does, and an entry is written again a number of times that grows with the logarithm of the store's size. It reads them whole, checking every entry (one found damaged is made again from its segments' records), and writes one copy of each object, the best ranked, as a new merged index through a temporary file, a flush and a rename, then flushes the directory. Only then does it remove what it merged: first the journals that sealers which died left next to indexes it took, flushing the directory, so that a merged segment never looks open, then the indexes, with any that an earlier merge cut short left behind. A merge cut short at any point leaves a store that reads the same: a segment covered by several indexes is served by a merged index before its own, and by the merged index that covers more segments, the newer, before one that covers fewer.

Publish order. Objects are written and flushed before the op log records an operation that refers to them, so the op log never points at an object that is not durable. An index is flushed in one batch with the segment it points into, before its rename, and a file published through a rename never reaches the disk before its contents.

Flushes. A store is opened in one of two modes. ordered, the local default, may lose the last operations on power loss but never leaves a store inconsistent; full, the server default, makes what a transaction acknowledges durable before it returns. Flushes come in batches: a sync flushes every segment and journal it covers together, and a transaction flushes its objects in one batch, then appends its record and flushes the log. On Apple systems, where fsync keeps no order and F_FULLFSYNC has the drive write out its whole cache, every file of a batch but the last is moved to the drive with fsync, and the last is flushed with F_BARRIERFSYNC (ordered), a barrier: the writes issued before it reach the medium before any issued after it; or with F_FULLFSYNC (full), which covers the whole batch. Other systems have no barrier to ask for, and each file of a batch is flushed on its own: with fdatasync (ordered) or fsync (full) on Linux.

Object record, starting at a multiple of 8 bytes:

u32 sync = 0xB7A1D5E9 | u8 kind | u8 codec | u16 flags = 0
u32 stored_len | u64 raw_len | [32] id
[32] dictionary or base id, codecs 2 and 3 only
payload, stored_len bytes
u32 crc32c of everything from the sync word to the end of the payload
zero padding to a multiple of 8 bytes

raw_len is always the size of the object itself, whatever the codec, so the kind and size of any object come from its header without reading its payload. After a crash, the next writer appends at the next multiple of 8 after the end of the file, so the remains of a cut append stay in place and scans step over them.

CodecPayloadUsed for
0 rawthe object as it is (stored_len == raw_len)payloads up to 64 bytes, and larger ones zstd does not make smaller
1 zstdone zstd frame, level 3other objects stored whole
2reserved: zstd with a dictionarynot written yet
3 deltaone zstd frame against the raw payload of the base the header namesblobs under 4 MiB, trees and derived objects, given a similar object
4 chunkedthe chunk listblobs only, of 4 MiB or more

Deltas (codec 3). A writer may say which object a new one is probably close to. Braid names, for each new tree node and file, the one at the same path in the parent (for a merged file, the branch's version); for an imported commit's raw bytes, the first parent's; for the git map, the map it grew from. A blob under 4 MiB, a tree or a derived object is then compressed with zstd at level 3, with the raw payload of the base as a reference prefix (ZSTD_CCtx_refPrefix), a window that holds the base and the object together (at most 2²⁷ bytes, so that any decoder accepts it), and long-distance matching. Changesets are never deltas: against their first parent, imported histories gave none that met the cut below. The frame is kept only when it and the 32 bytes of the base id take at most a quarter of the bytes of the object stored on its own (codec 0 or 1); otherwise the object is stored on its own.

The fraction decides how often a version is stored whole again, since a delta holds every change since its base. Imports of the histories of four public repositories took, as a ratio to the same histories packed by git gc --aggressive, 2.9 to 3.7 keeping deltas up to a half, 2.6 to 3.3 up to a third, 2.5 to 3.1 up to a quarter, and 2.6 to 3.1 up to a sixth.

Depth is always one. A base is stored whole, with codec 0 or 1, and when the object named as similar is a delta, the new one is made against that delta's own base. Reading a delta reads its base and applies one delta, never a chain. A reader that knows several copies of one object, as racing writers can leave, uses a copy stored whole before a delta, and a delta before a chunked blob, so that a base always resolves to a copy stored whole when there is one.

Chunked blobs (codec 4). A blob of 4 MiB or more is cut with FastCDC, the 2020 algorithm with normalisation level 1 and the standard gear table, into chunks whose boundaries depend only on the content:

Blob sizeSmallest chunkAverageLargest
4 MiB to 256 MiB16 KiB64 KiB256 KiB
256 MiB or more256 KiB1 MiB4 MiB

The last chunk may be smaller than the smallest size. A writer that streams a blob in cuts it with the sizes for the size it expects, such as a file's length; how a blob is cut never changes its id. Each chunk is a blob of its own, whose id is the hash of its bytes, so a chunk shared by several files or versions is stored once. A chunk is stored whole: raw when its first 64 KiB do not compress below 0.9 of their size, else compressed when that is smaller. A chunk list never names a chunked blob: a chunk is written whole even when a chunked copy of the same bytes exists. The blob's own record holds its chunk list:

uv n                                 n ≥ 1
n × ([32] chunk id | uv chunk size)  in order; sizes at least 1

The sizes add up to the record's raw_len, and the chunks, in order, make up the blob. Its id is still the hash of its full content: readers fetch the chunks one at a time, each checked against its own id and size, and check the whole against the blob's id, so a blob of any size can be read and written as a stream.

What depends on what. A delta needs its base, and a chunked blob its chunks. A writer that finds a copy of an object instead of writing it again relies on it only together with what it needs, and flushes, at its next sync, the open segments of other writers that hold any of them, as it does for the copy itself. There is no garbage collection yet (braid gc is planned): no object is ever removed. Garbage collection must never drop a base while a delta needs it, nor a chunk while a chunk list names it.

Journal entry, 64 bytes at a multiple of 64, written after its record:

[32] id | u64 offset | u32 stored_len | u8 kind | u8 codec | u16 0
u64 raw_len | u32 record crc | u32 crc32c of the 60 bytes before it

Entries that fail their CRC are skipped, and a new lease holder writes after the last valid one.

Index, version 2, written once when a segment is sealed (<name>.idx, one segment) or when indexes are merged (<name>.midx, several):

[8] "braididx" | u32 version = 2 | u32 0 | u64 count | u32 segments
u32 crc32c of the 28 bytes before it
segments × ([16] segment name | u64 segment length)
256 × u32 fan-out: entry b counts the ids whose first byte is at most b
u32 crc32c of the segment table and the fan-out
count × 64-byte entries, ids strictly ascending:
    [32] id | u64 offset | u32 stored_len | u8 kind | u8 codec | u16 segment
    u64 raw_len | u32 record crc | u32 crc32c of the 60 bytes before it

An entry is a journal entry whose reserved field holds the number of its record's segment in the table: 0 in the index of one segment, and at most 65,536 segments per index. A segment name is its 32 hex digits as 16 bytes, and its length the size it had when it was sealed; no entry points past it. The head (everything up to the second checksum) and every entry carry their own checksums, so that a reader checks what it reads and nothing more. The first 32 bytes of every later index version carry their own checksum too, so that a reader can tell a later version from damage without knowing its layout. Only entries whose record checks out go in. Of several copies of an object, a copy stored whole wins over a delta, a delta over a chunked blob, and the first of equals wins; a merged index keeps one copy of each object.

Stores of storage versions 1 and 2 hold indexes of version 1, which readers of version 3 still read, whole, and merge like the others:

[8] "braididx" | u32 version = 1 | u32 0 | u64 count | u64 segment length
256 × u32 fan-out: entry b counts the ids whose first byte is at most b
count × [32] ids, strictly ascending
count × (u64 offset | u32 stored_len | u8 kind | u8 codec | u16 0
         u64 raw_len | u32 record crc | u32 0), in id order
[32] BLAKE3 hash of everything before it

A damaged index, of either version, is worked around by scanning the segments it covers; fsck reports it. A sealed segment that no readable index covers, when the head of a merged index is damaged, is scanned the same way.

Operation record:

u32 magic = 0xB7A10910 | u32 body_len | body | u32 body_len + 16
u32 crc32c of everything before it

body:   u8 version = 1 | uv seq | sv milliseconds since the Unix epoch
        bytes agent | bytes description | uv seq undone, 0 for none
        uv n | n × (bytes ref name | u8 which | [32] old | [32] new)

which has bit 0 set when old is present and bit 1 when new is; absent values take no bytes. The length at the end lets readers walk the log backwards. Sequence numbers start at 1 and have no gaps. A record cut short by a crash is skipped by readers and cut off by the next transaction, but only when no whole record follows it.

Checkpoint, written through a temporary file and a rename every checkpoint_interval operations; the newest two are kept:

[8] "braidckp" | u32 version = 1 | u32 0 | u64 seq | u64 where record seq ends
uv n | n × (bytes ref name | [32] id), names strictly ascending
[32] BLAKE3 hash of everything before it

Derived index entry, 72 bytes at a multiple of 72:

[32] key | [32] record id | u32 0 | u32 crc32c of the 68 bytes before it

The derived index is a cache of where the records of section 8 are. A writer locks the file exclusively, appends its entries at the first multiple of 72 at or after the end, and unlocks; the records the entries name are durable first. Readers take no lock, skip entries that fail their CRC, and let the last entry of a key count. The file needs no sync: losing entries only means computing values again.

Where the room goes. Imported, the histories of four public repositories take 2.5 to 3.1 times what git gc --aggressive packs them into, and 6.1 to 8.3 times without deltas. As a ratio to git's packed size:

PartShare
Blobs: file contents, and the raw bytes of imported commits1.46 to 1.74
Record headers, checksums and padding0.21 to 0.35
Journal and index entries0.18 to 0.33
Changesets0.14 to 0.35
Trees0.25 to 0.31
The git map0.13 to 0.22

Planned, not implemented yet:

8. Derived data (not frozen, versioned per function)

Values computed from changesets are stored as derived objects (kind 5), so their ids follow section 2, but their payloads are not part of format v1: each function versions its encoding, and a new encoding is a new version, so new keys. They are implemented in crates/engine.

Key of the value of function at version:

BLAKE3-derive-key("elffuss-braid 2026 derived v1",
    bytes function | uv version | uv n | n × [32] input id | bytes argument)

Record: a derived object whose payload is [32] key followed by the value. A reader uses a record only when it starts with the key and the value decodes; anything else is computed again.

graph, version 1, of a changeset (the input is its id):

uv   n, n × [32] parents, in order
uv   generation        1 without parents, else 1 + the largest of the parents'
uv   height            0 without parents, else 1 + the first parent's
[32] skip              present when height > 0: the first-parent ancestor at
                       skip_height(height)

skip_height(h) is 0 for h < 2; for an even h, h with its lowest set bit cleared; for an odd h, 1 + (h - 1 with its two lowest set bits cleared).

changed-paths, version 1, of a changeset (the input is its id):

u8   1, then [32] the first parent; or 0 without parents
uv   n                 the paths the change list names and all their parent
                       directories, each once
     filter            ceil(10 n / 8) bytes when 0 < n ≤ 1024, else nothing

The bits of an entry come from h = BLAKE3-derive-key("elffuss-braid 2026 changed-paths v1", path): with a and b its first two little-endian 64-bit words and m the number of bits of the filter, its bits are (a + i·b) mod m for i from 0 to 6, computed modulo 2⁶⁴; bit j is bit j mod 8 of byte j / 8. With n = 0 no path matches; with n > 1024 every path may.

blame, version 1, of a changeset and a path (the input is the changeset's id, the argument the path), for a changeset whose change list sets the path to a file, an executable or a symlink:

uv   k, k × [32] changesets, in the order their first lines come
uv   r, r × (uv index of the changeset, uv lines)    runs, in line order

Runs are not empty, two runs in a row never have the same changeset, and every changeset listed has lines. A line ends after \n; a last line without one is a line too.