How tiramemsu is built
Tiramemsu is a library, not a server. It is a stack of layers over one SQLite file. Each layer uses only the layer below it, and time is resolved in exactly one place. This page shows the whole stack in one picture and says what each layer does.
layers diagram in lat.md/architecture.md.The layers
Front ends. SPARQL and Cypher are parsed into one logical IR, so both languages mean the same thing over the same store. The Rust API (Db, View, Tx) can build IR too, and it is also the way in for writes.
Agent memory services. The 0.3 features live in the facade, beside the Rust API. They add no new storage path. The budget meter can stop any layer below it. Saved answers re-run their query and compare what it cited. Conflict review and import previews run a transaction that is never committed. Bulk import feeds the tx engine in chunks while it holds the write lease.
Logical IR. One small algebra: basic graph patterns, joins, optional joins, filters, unions, aggregates, paths and text matches. Each pattern can carry its own view, so one query can mix “now” and “as of last week”.
Physical operators. The planner turns most of the IR into SQL. Some work SQL does badly, so it goes to native operators instead: tm_path for reachability and shortest paths, tm_lftj (opt-in) for cyclic patterns such as triangles, and tm_text for text recall. All three are SQLite table functions, so SQL can call them too.
Core. The tx engine asserts, retracts and supersedes statements, and checks cardinality and uniqueness. It never deletes. The temporal view is the one place that turns “now”, “as of”, “valid at” or “history” into conditions on the rows; every operator reads through it. The core also keeps the full-text index up to date and maps terms to compact ids.
Executor and hosts. The core reaches SQLite through a small trait: prepared statements, transactions, savepoints and a stable snapshot. tm-rusqlite implements it with bundled SQLite and WAL. tm-wasm implements it on SQLite compiled to WebAssembly. A host says what else it can do, and the engine refuses to start rather than quietly do less.
One SQLite file. The graph is a term dictionary, a transaction log and one triple table with its indexes. Next to it sit derived tables: the text index and the saved answers. They are not history, and they can always be rebuilt from the graph.
Four ways in
deployment diagram in lat.md/architecture.md.- Rust. Link the
tiramemsucrate and callDb,ViewandTx. Cargo features choose how much of the query engine you link. - Node.js and Python. Native addons call the JSON bridge in the same process. See the quick start.
- Agents over MCP. An MCP client starts
tiramemsu-mcpas a child process and talks to it over stdio. The server owns the file. See Give your agent a memory over MCP. - Browser. A page talks to a Web Worker that runs the engine on SQLite in WebAssembly, in memory or in OPFS. The file can be exported and opened natively. See the engine in the browser.
More detail
The design graph in lat.md has the rest: architecture (crates, cargo features, the executor, concurrency), query (planning, paths, text recall, budgets) and storage. For what each 0.3 feature does, read what’s new in 0.3. For why every fact has an id, read layered graphs, explained, and for the two clocks, time travel and bitemporality.