Vector × Graph × Document
Three paths, one embedded AI database.
TriviumDB is an embedded engine for AI applications, built to weave agent context, vector recall, and structured metadata on one machine.
One embedded engine, 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 reranks candidates with f32 cosine scores over stored vectors.
vectors live inside the checkpoint after flush
mapped vector pages for larger pools
06 · Storage
One database, two file layouts.
Single-file mode stores vectors, payloads, edges, and BQ metadata in one `.tdb` checkpoint. Mmap mode keeps payloads and graph edges in `.tdb` while vector pages live in `.tdb.vec`. Recent writes replay from `.tdb.wal`; `.tdb.quiver` is a rebuildable ANN index cache.
07 · Reliability
Recovery is built into commits and checkpoints.
TriviumDB records recoverable changes in a CRC-protected WAL and checkpoints state with synced temp files plus atomic rename. Transaction commits validate first, write a TxBegin/TxCommit batch, then apply to memory.
- 01
Validate transaction
Transaction commits dry-run check IDs, dimensions, payload size, and graph references before applying changes.
- 02
Write WAL batch
Transactions append TxBegin, records, and TxCommit before applying to memory; standalone writes are logged for recovery.
- 03
Verify WAL frames
Each WAL record is length-delimited and CRC32-checked during recovery so torn or corrupted tails stop replay.
- 04
Replay safe prefix
Startup replays verified records, promotes complete transactions, and truncates the log to the last safe offset.
- 05
Checkpoint atomically
Checkpoint files are written to temporary paths, synced, then published with atomic rename.
08 · Developer Experience
Agent memory without a database server.
Start from Python, Node, or Rust and keep vectors, JSON payloads, and edges in a local embedded database. Search returns durable node IDs with scores and payloads, so agent loops can jump from recall back to stored state.
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)
hits = db.search([0.10, -0.48, 0.80], top_k=5, expand_depth=2, min_score=0.1)
for hit in hits:
print(hit.id, hit.score, hit.payload) 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.