Vector × Graph × Document
Three paths, one embedded AI database.
TriviumDB is a single-file engine for AI applications, built to weave agent context, multimodal memory, and structured metadata on one machine.
One embedded file, one node ID space, three coordinated representations.
02 · Problem
Three stores create one fragile memory.
A metadata store, vector index, and graph database can each be correct — while the agent's memory is still inconsistent.
03 · Trinity Model
One ID space binds the planes.
A Trivium node is the shared address for semantic position, payload state, and graph relations.
node_id = vector ⊕ payload ⊕ edges - VECTOR: f32[]
- PAYLOAD: JSON
- GRAPH: edges[]
04 · Search Pipeline
A query becomes ranked memory.
Search recalls top-k vector anchors, optionally expands through weighted graph edges, then returns ranked hits with payload attached.
05 · QuIVer
ANN candidates, original-vector rerank.
QuIVer keeps BQ2 signatures and a Vamana-pruned ANN graph on the hot path, then scores candidates against original f32 vectors.
portable knowledge stores and smaller databases
large vector pools with zero-copy cold start
06 · Storage
Portable when small. Mmap-backed when large.
Rom mode keeps a compact `.tdb` file easy to copy. Mmap mode separates vector pools into `.vec` while the `.tdb` file remains the source of metadata, graph structure, and durable state.
07 · Reliability
Crash recovery is part of the write path.
TriviumDB treats embedded durability as an engine primitive: dry-run validation, WAL frames with CRCs, fsync boundaries, atomic rename, and deterministic replay keep the three planes moving together.
- 01
Validate as a dry run
Mutations are shaped before commit so vector, payload, and edge updates can be rejected without partially changing the node.
- 02
Append WAL records
The write-ahead log captures intent first, giving replay a precise source of truth after process or host interruption.
- 03
Guard each frame with CRC
Checksummed log frames make torn or corrupted records detectable before they can be applied to the embedded store.
- 04
Flush, rename, replay
fsync and atomic rename make durable checkpoints explicit; startup replay completes committed records and ignores unsafe tails.
08 · Developer Experience
Embedded memory without a service graph.
Start from Python, Node, or Rust and keep vectors, JSON, and edges in one local database file. The API is designed for agent memory loops where every result can point back to a durable node.
pip install triviumdb npm install triviumdb cargo add triviumdb import triviumdb
with triviumdb.TriviumDB("agent-memory.tdb", dim=3) as db:
alice = db.insert([0.12, -0.45, 0.78], {
"type": "memory",
"text": "Alice works on embedded databases",
})
cafe = db.insert([0.08, -0.52, 0.81], {
"type": "place",
"name": "Blue Bottle",
})
db.link(alice, cafe, label="visited", weight=0.8)
context = db.search([0.10, -0.48, 0.80], top_k=5, expand_depth=2)
print(context) 09 · Build
Give your agent one durable memory substrate.
Explore the core concepts, then open the TriviumDB repository to inspect the embedded engine behind WAL recovery, CRC-protected frames, and the shared vector/graph/payload node model.