graphlava

Layered like baklava.
Linked like a graph.

graphlava is an embedded metagraph database in Rust, built for agent memory. Statements carry statements, hyperedges are stored once, and graphs nest inside graphs, all in one file, queried with SPARQL 1.2 and Datalog.

The graphlava logo: a diamond of baklava with pastry layers on its sides and, on top, four nodes joined to a pistachio in the centre.

Status: design. The specifications, 30 decision records and the Rust workspace with CI for Linux, macOS, Windows, iOS and Android exist. The engine does not exist yet: nothing on this site can be downloaded and run today. In the specs the project is still called by its working name, meta-core.

One piece, four layers

Read the logo from the outside in. The pastry layers are statements stacked on statements. The diamond is a graph that holds them. The pistachio is a hyperedge: one centre, many roles.

Statements about statements

Every statement has a stable 64-bit ID. Annotate it with a confidence or a source; change its object and the ID, with its annotations, stays.

Hyperedges

A meeting with an agent, a target and a topic is one record with typed roles, indexed per role; its date is a property of the record. Role triples stay virtual until you annotate one.

Nested graphs

Graphs are nodes and nest as a DAG. GRAPH :g sees g and everything under it; GRAPH! :g sees only g.

Meta-model as data

Predicates, hyperedge types, shapes and rules are statements in the system graph, read by the planner and the write path.

A taste

The statement ID is the RDF 1.2 reifier, so annotating a fact and reading the annotation back are plain scans with no join on rdf:reifies.

# a fact with a confidence on it
INSERT DATA { :alice :worksAt :acme {| :confidence 0.9 |} }

# who works at Acme, and how sure are we?
SELECT ?who ?c WHERE {
  << ?who :worksAt :acme ~ ?r >> .
  ?r :confidence ?c .
  FILTER(?c > 0.8)
}

# the same memory from Datalog: rules run on demand in v0; @materialized arrives in v1
@materialized
ancestor(?x, ?y) :- :parent(?x, ?y) .
ancestor(?x, ?z) :- ancestor(?x, ?y), :parent(?y, ?z) .
?- ancestor(:alice, ?who) .

How it stacks

One process, one file. Every query language lowers to one extended-Datalog IR; only the storage layer knows the engine.

Surfaces SPARQL 1.2, Datalog, Rust and C (v0) · Cypher subset, Swift, Kotlin (v1)
IR and planner extended Datalog · index nested-loop, Leapfrog Triejoin, merge and hash joins · plan cache
Reasoning, vectors on-demand rules: magic sets, semi-naive (v0) · materialized rules, scope-aware vector search (v1)
Data model statements · inline properties · hyperedges · nested graphs
Terms 64-bit IDs with a kind tag · inline literals · dictionary
Storage redb, one file, one owner process · sync, ordered or relaxed commits

A sibling, not a fork

graphlava and tiramemsu share the idea that every fact is a statement with an ID. They split on time.

graphlavatiramemsu
StateCurrent state only; values overwrite in placeNever forgets; every change kept with two clocks
Change a factupdate(id, o), same IDsupersede, a new statement that replays its layers
n-ary relationsNative hyperedge recordsA node with role statements, or an annotated edge
StorageredbSQLite (default) or redb
StatusDesignReleased, 0.12

More in graphlava and tiramemsu.

Read