Skip to main content

Crate dejadb_store

Crate dejadb_store 

Source
Expand description

dejadb-store — the embedded Turso-backed store for DejaDB.

Implements the store schema: dictionary-encoded 2½-permutation triple indexes (SPO + POS mandatory, OSP selective for entity-valued relations), entity_latest materialization, op-log + HLC + tombstones, thread index, and the vaais operation profile (add / recall / batch / supersede / forget) plus bounded graph ops and two-axis entity_at.

Sync facade over the async turso crate: DejaDB owns a current-thread runtime; point ops measured at µs-class through this path in M0.

Modules§

memory_tool
LR-13 — Anthropic memory-tool backend adapter.
migrate
Migration importers — read another memory system’s export and write it into a DejaDB file with original timestamps, provenance, and (where the source has one) the full edit history preserved as supersession chains.

Structs§

BundleStats
Result of bundle_since — the git-shaped incremental backup (§5.10).
CommandEmbed
EmbedBackend that shells out to a host-supplied command per call: the text goes to the child’s stdin, stdout must be a JSON array of numbers. This is the dependency-free way to give every surface (CLI --embed-cmd, MCP serve, bindings) a real vector leg — the host owns the model, the engine still ships none. One process spawn per embed: fine for turn-level recall and imports, not for the voice per-frame path.
DejaDB
The embedded DejaDB store handle — one file per memory.
DejaDbOptions
Open options.
EnglishExpander
Built-in English query expander: synonym substitution + naive suffix stemming, capped to a handful of variants. Deterministic and allocation- light. English-only by design (see QueryExpander).
FactDraft
One extracted fact from a remember() extraction callback.
ForkGroup
An open fork: a (namespace, subject, relation) that has more than one live head, because two writers superseded the same value concurrently (e.g. edits synced from two edges). The tips coexist — nothing is lost — until an explicit merge closes the fork. heads[0] is the deterministic provisional head every node agrees on.
HistoryEntry
One version in a supersession chain (DejaDB::history, newest first).
ImportStats
Result of import_bundle.
OpRecord
One op-log record, the change-feed unit.
RecallTuning
Post-fusion recall refinements. All default off — a bare recall_hybrid behaves exactly as before. Applied inside the recall deadline; each stage degrades to plain fusion order when its backend or data is unavailable (fail-open, never an error).
RememberResult
Result of DejaDB::remember.
StoreStats
Store statistics (DejaDB::stats).
VerifyReport
Integrity report (DejaDB::verify).

Enums§

Axis
Temporal axis for entity_at.
Direction
Traversal direction for related. In uses the selective OSP index, so it only sees entity-valued relations.

Constants§

OP_ADD
Op-log operation kinds.
OP_FORGET
OP_SUPERSEDE
RRF_K0
RRF fusion constant used by recall_hybrid (the standard k0 = 60). Exported so observability surfaces can report the effective value.

Traits§

AddableDyn
Object-safe serialization adapter so add_batch can take mixed grain types.
EmbedBackend
Pluggable embedding backend. The host owns the model; multilingual recall quality comes from choosing a multilingual model (e.g. bge-m3 / multilingual-e5) — text reaches the backend as NFC-normalized UTF-8, script untouched (Arabic/Mandarin/English alike).
QueryExpander
Pluggable rule-based query expander (Tier-1 retrieval). No LLM, no network. Given a query it returns additional query variants; the caller runs one extra BM25 leg per variant and fuses them via RRF, bridging vocabulary gaps (“cell” ↔ “mobile” ↔ “phone”) — the poor-man’s semantic bridge for the edge/BM25-only profile where no embedder is installed. The built-in EnglishExpander is English-only; multilingual deployments install their own or leave expansion off (it is opt-in per query).
RerankBackend
Pluggable cross-encoder reranker (Tier-2 retrieval). Like EmbedBackend, the host owns the model: inject a local candle/ONNX cross-encoder (or any scorer) — the engine ships no model and takes no ML dependency. Off by default; with no reranker installed recall behaves exactly as before. Reranking is a turn-level refinement (tens of ms), never on the voice per-frame path; recall_hybrid_tuned only invokes it inside the deadline and falls back to fusion order otherwise.