What mnestic adds
mnestic is a maintained fork of CozoDB,
continued under MPL-2.0 from upstream commit 481af05 (the last upstream commit,
2024-12-04). The query language (CozoScript) and engine semantics are
unchanged unless noted here — what changed is performance, correctness, and
the primitives an agentic-memory workload actually needs.
mnestic
The pages in this section document behavior that is specific to mnestic. Pages elsewhere in these docs describe the engine inherited from CozoDB and apply to both.
Lineage
The fork point is CozoDB main HEAD — 30 commits ahead of the published
0.7.6 crate, which means adopting mnestic already gives you several unreleased
upstream fixes for free (including the stored_prefix_join correctness fix).
The version was bumped to 0.8.0 to mark the fork's identity rather than
0.7.7.
Highlights by release
0.8.3 — native 3-way fused recall & BM25 full-text
- Native 3-way fused recall —
hybrid_searchnow takes typedGraphLegs, so graph proximity fuses with the vector and keyword legs in one call. Each leg expands from seeds over a stored edge relation up tomax_hopsand ranks reached nodes by minimum hop distance. The fused call runs all three signals at ~41.55 ms p50, roughly 4× faster than hand-decomposing it into separate queries. - BM25-correct full-text search — the default
::ftsscorer is now Okapi BM25 (term-frequency saturation + document-length normalization),ORsums per-term contributions, andavgdlis an O(1) durable counter rather than a per-query scan. This lifted fused recall from 0.75 to 0.954.tfandtf_idfremain selectable for byte-identical upstream scoring.
Caution
Behavior change in 0.8.3: the default ::fts score kind moved from tf_idf
to bm25. Pass score_kind: 'tf_idf' (or 'tf') to keep upstream scoring.
→ Hybrid retrieval (RRF + MMR + graph legs)
0.8.2 — non-blocking HNSW index builds
Building an HNSW index no longer holds the base relation's write lock for the
duration of the build, so concurrent reads no longer stall for minutes. The
graph is built off-lock under a snapshot and bulk-published with RocksDB's
SstFileWriter / IngestExternalFile.
0.8.1 — one-call hybrid retrieval & faster builds
hybrid_searchruns HNSW + FTS (+ optional graph traversal), fuses with Reciprocal Rank Fusion, and optionally diversifies with MMR — in a single typed call, replacing roughly seven hand-written Datalog rules.- HNSW index builds ~3× faster (20k × 128: 135 s → 43.6 s, measured release), with a byte-identical result.
- The C++/RocksDB bridge is now a maintained fork,
mnestic-rocks, keeping the importable namecozorocks.
→ Hybrid retrieval (RRF + MMR)
0.8.0 — fixes & agentic-memory primitives
- Equality pushdown —
*rel[k, ..], k == <value>now compiles to a keyedstored_prefix_joininstead of a full scan (~28–29× faster single-row primary-key lookups at 5k rows, measured). ReciprocalRankFusion/MaximalMarginalRelevancefixed rules (aliasesRRF/MMR) — the fusion and diversity primitives behind hybrid retrieval, usable directly in Datalog.- ULID functions —
rand_ulid()andulid_timestamp()for lexicographically-sortable, time-ordered keys. - Parser fix — identifiers that begin with a keyword literal
(
nullable_column,trueValue,falsey) now parse correctly.
→ Equality pushdown · ULID identifiers
Not affiliated with CozoDB
mnestic is not the official CozoDB and is not affiliated with or endorsed by its authors. All credit for the original design belongs to Ziyang Hu and the Cozo Project Authors. See License & attribution.