ADR 0013: Recent activity comes from the worlds' own change record
The pulse stops depending on what each pod happened to hear. Feeds ask the world to replay its latest changes, and the list orders by the world's write time, so every replica converges on the same list. Accepted 2026-12-03, issue #129.
Context
- The pulse was a per-pod, in-memory log of the writes that pod heard, ordered by when it heard them.
- A watch gap (a quiet MCP stream reopened without a cursor, a pod with no lendable bearer, a restart) became a resync. A resync never reaches the pulse, so two replicas listed different writes. A reload flipped the list between pods.
- A catalog backfill was rejected. It needs a borrowed bearer, and a lookup as that reader can list identity-scoped documents to other readers. It also costs a
versionsread per hit and misses archives.
Decision
- Upstream WATCH carries write time and offers a backlog (demarkus
feat/watch-backlog).- Event
at/demarkus.io/atis the document's modified time after the change, the same on every store replica. backlog: n/demarkus.io/backlogon a cursorless subscribe starts up to n positions before the head, as far as the server retains.- On MCP, a backlog request also gets a
status: okacknowledgement notification carrying the cursor, so a quiet stream can resume instead of resyncing.
- Event
- Every feed asks for
feedBacklog(64) changes, coalesced per path. The client sends it only without a cursor, so a restart refills the pulse and a resume replays its gap. Pulse.Atis the write time (heard time when the world does not stamp one). The log keeps newest-first byAt, then world, then path, so the same writes heard in any order list alike.Pulse.Heardis when this pod recorded it. The live graph'sdata-drawn/Last-Event-IDcursor uses it: µs, monotonic per pod, unlike a write time in whole seconds.
Consequences
- Replicas converge after any gap the server still retains (4096-event ring, or a bucket world's slots back to its checkpoint).
- An archive's
atis the document's last write time, because a bucket slot records no separate commit time. An archive of an old document can sort below the newest 12 and never show. A fix needs a commit time on archive slot entries upstream. - After a pod restart, a graph overlay that reconnects there re-pulses the replayed writes. This is cosmetic.
- The library needs the demarkus release before its go.mod bump. Until then the branch builds only against a local
go.work.
Amendment 2026-12-03: archives carry their own time
This amendment supersedes the archive consequence above.
- File store: an archive or unarchive event's
atis the moment of the transition. It is journaled, so it survives a server restart. - Bucket store: slot entries gain an optional
atfor archive transitions. Every replica in this release can read it. It is written only when the knowledge server config setsstampArchiveTime: true(helmserver.stampArchiveTime, default false), because replicas before this release refuse slots with unknown fields. - Rollout: deploy the release, wait until every knowledge replica runs it, then turn
stampArchiveTimeon. - Until it is on: a bucket world's archive is still dated by the document's last write.
- Tests:
- slot validation: an archive may carry
at, a write may not, and a badatis refused; - a peer replica reports the stamped time;
- with stamping off, the slot carries no
at; - the config value reaches every world's store hooks.
- slot validation: an archive may carry
- End to end: after a restart, a library instance listed the archive at its own time (15:46:16, after the writes at 15:46:13).
Revision: no flag
This revision supersedes the flag and rollout described in the amendment above.
The user dropped stampArchiveTime. The setting would become dead config once every replica runs the release, and the system is still a pilot. Bucket stores now always write the archive at.
Accepted risks:
- An archive made during the rolling deploy can stall the old pods: stale reads and refused writes until they are replaced. Avoid archiving during that rollout.
- After a stamped archive, rolling back past this release leaves the world stuck until you roll forward again.
A slot written before this release has no at, so its archive is still dated by the document.