BDP: a draft protocol contract for versioning, memory, and federation
The memory-beads proposal (#5877) and the versioning/history proposal (#5898) keep running into the same needs. Both need a way to name a version that doesn't depend on how the data is stored. Both need references that still work after a database is copied or synced. Both need a change feed with a clear ordering story. And the moment two stores reference each other's beads, both need a way for those references to actually resolve.
That last one is worth saying plainly: federation needs a protocol. Dolt remotes copy whole databases around. That's replication. Federation is different — it's one store asking another "what is this bead, at this version?" and getting an answer. There's no way to do that without agreeing on a wire format, and that agreement is a protocol, whether we name it or not. If we don't design it, we'll ship one anyway — it will just be "whatever the Go code happens to do over HTTP."
The version-identity problem is already biting. #5898 is right to reject commit hashes as version tokens, and the thread's own flatten experiment shows why: 41 of 43 commit-hash addresses still worked on the original machine, and 0 of 43 worked after pushing to a fresh clone.
We'd like to put a concrete draft on the table. BDP (Bead Protocol) is a draft wire contract for bead stores that we've been building and validating: https://github.com/gastownhall/bdp. We're proposing it here as input to this work, not as a done deal — the draft itself says it isn't a conformance target until it's adopted.
The wire contract is designed to solve a broader problem: uniform access to bead stores. So it also covers things like bead and link typing, update operations, and basic query support. For #5877 and #5898, those features are tangential — federation and versioning don't depend on them, and they don't need to be the focus right now.
The basic bead/link model is fundamental to the protocol. It's comparable to the traditional entity/relationship model used to build graph-based stores.
Here's what BDP already has that #5877 and #5898 need:
- Opaque version tokens. Revisions, positions, and cursors are opaque strings. You compare them for equality and nothing else. They are never commit hashes or storage details. This is #5898's rule, written as protocol law.
- Safe concurrent updates. An update can say "only apply this if the
bead is still at revision X" (
expectedRevision). That's the compare-and-swap model #5898 wants. - A clear rule for links and versions. A bead's revision covers its properties. Creating a link never changes the revision of the beads it connects. (This settles a question that #5877's citation design will hit.)
- Protection against history rewrites. Every store history has an "epoch" token. Restore a backup, flatten, or rewrite history, and the epoch changes — which cleanly invalidates every old version token instead of letting them silently point at the wrong thing. The flatten experiment above is exactly the failure this catches.
- A change feed with ordered positions and no gaps, which lines up with the journal-based feed #5898 describes.
- Careful deleted-bead behavior. Reading a deleted bead returns the
same 404 as a bead that never existed, so you can't probe a store to
learn what used to be there. This is a stricter version of the
gone/tombstone idea in the proposals, and we'd offer it to them. - Honesty about what a server supports. Every server advertises its profile and limits up front, and clients respect that. So "start small and grow" (the staging concern in #5877) is a supported protocol feature, not a compatibility hazard.
And here's what it doesn't have yet — where we want this community's help:
- Reading old versions. BDP can tell you a bead changed, but it can't yet serve "give me this bead as it was at revision R." That's #5898's core read-side need and the biggest open item. It's tracked as an open question in the draft and as gastownhall/bdp#1.
- Version-pinned references. A citation should be able to record which version of a bead it cited. This is a small extension and it's in progress now.
- Identity vs location. Today a bead's identity is its URL. Portable per-agent stores (the City Life scenario) argue identity and location should be separable. This is genuinely open (gastownhall/bdp#2), and we'd rather work it out in public than privately.
How we keep the spec honest: the repo ships a machine-checkable conformance suite, and claims are backed by committed evidence — two independent implementations run the same scenarios, and the results are sealed and verified in CI. New semantics get conformance coverage, or they don't go in.
What this is not: not a beads refactor, not a request for beads to change storage, and not a competing proposal to #5877/#5898. It's a candidate home for the parts of those proposals that need to outlive any one implementation.
Source: gastownhall/beads