Current
Event sourcing and disposable projections
Benchmark first
Corpora: DocRED · WDC Products · KILT · QASC
Protocol: Measure blocking pairs completeness and reduction ratio, entity pair/cluster F1, relation micro-F1, provenance precision/recall, and multi-hop answer accuracy. Then run graph-off and graph-on retrieval with identical seeds to attribute recall gains. Every projected passage must retain its source node and path.
Canonical artifacts and append-only events remain authoritative. replay_projection builds deterministic derived state and gives each build a content identity. A backend can validate and swap that build using its own transaction boundary.
How it works
Events must have unique IDs and contiguous generations. The replay function folds them in order and hashes the complete event input. Generation gaps and duplicate events fail before a usable build is returned. Storage adapters own staging validation, pointer swaps, and rollback because those guarantees depend on the selected database.
Papers and standards
Canonical artifactsdocuments · events · reviews
deterministic fold
Staging projectionsvector · lexical · graph · Markdown
validate + swap
Current read versionrollback pointer retained
from mari_components.platform import KnowledgeEvent, replay_projection
events = [
KnowledgeEvent(
event_id="event-1",
generation=1,
kind="artifact.indexed",
payload={"artifact_id": "policy-7"},
)
]
def project(state: set[str], event: KnowledgeEvent) -> set[str]:
return state | {str(event.payload["artifact_id"])}
build = replay_projection(set(), events, projector=project)
assert build.state == {"policy-7"}
assert build.generation == 1
print(build.build_id) # stable SHA-256 identity of the replay input