CozoDB, a transactional relational-graph-vector database with embedded Datalog in Rust, went dormant in December 2024. We hard-forked it as MnesticDB (not official CozoDB), under an MPL-2.0 license, to continue Ziyang Hu and the Cozo Project Authors' vision of building a "Hippocampus for AI", or agentic memory.
But agentic memory isn't a pile of current facts with a log of past decisions. It has to track change over time, and be auditable. We've recently shipped several features that make this possible.
First, we added a distinction between valid time (when a fact is true about the world) and transaction time (when the database came to believe it). This allows time travel, the ability to audit the memory at any point and see what knowledge any past decision was based on. Every write draws its transaction time from a crash-safe monotone commit clock, an atomic high-water mark persisted inside the same transaction that commits the data, so the clock can never advance without the write landing, even across a crash. Because the stamp is allocated in the commit critical section, transaction-time order equals commit order equals visibility order, which makes time travel sound.
Then we implemented the semiring provenance framework from Green et al.'s 2007 paper: the same recursive rule computes existence, cost, confidence, or supporting evidence just by swapping the combine operator, instead of a bespoke tracking system per application. In practice, an aggregate like min_cost_k returns not just an answer but the k best derivations behind it, each with the evidence chain that justifies it. And because those annotations are ordinary values, materializing a derivation into a transaction-time relation composes the two features into an annotated belief history. Every derivation carries the transaction time we came to believe it, so an as-of read tells you not just what we believed at T, but why.
Followed by some more improvements:
-
Added ::kill and :timeout to provide the ability to interrupt long-running queries.
-
Implemented a deterministic greedy join reorder to prevent naively-ordered conjunctions, the kind that an LLM may write, from spinning. 54.5x improvement with identical results.
-
Added an opt-in Yannakakis-style per-key factorized count() instead of join enumeration, with a 4-342x improvement with identical results.
It's available on crates.io and PyPI.
https://crates.io/crates/mnestic https://pypi.org/project/mnestic/
If you're building agent memory and want time-travel + provenance in the graph database rather than bolted on, I'd love to exchange notes. Special thanks to Matthias Autrata for providing valuable feedback and guidance that was critical to implementing the above improvements.
Comments URL: [https://news.ycombinator.com/item?id=48875749](https://news.ycombinator.com/item?id=48875749)
Points: 1