Tiramemsu

Your agent’s brain loves Tiramemsu.

Memory that has layers, travels in time, and never forgets.

Tiramemsu is an embedded graph database for agent memory. Every fact has its own id, so it can carry a confidence, a source or a belief, layer on layer. Every change is kept with when it was learned and when it was true. And an agent can recall by words and by meaning, today or as of any moment in the past, from one file on SQLite or redb.

A brain taking a bite out of a tiramisu whose layers are a graph

What makes it different

Most agent memories are a vector index, a graph, or a log of notes. Tiramemsu is all three over one row shape, and it remembers when.

Facts about facts

Every statement has an id

Confidence, source, belief and correction are statements about statements, not a side table. Ask “why do I believe this?” in one query.

Two clocks

What we knew, and when it was true

Transaction time and valid time on every fact. Read memory as it was at any transaction, at any instant, or across its whole history.

Recall in the past

Search by meaning, as of then

Vector and text recall run inside the chosen view. An as-of view sees only the facts and vectors that existed then, so a past answer never drifts.

Never forget

History is guarded

Deletes and rewrites of facts, terms, transactions and vectors are refused. Forgetting is a retraction that stays visible in history, with who and why.

Evidence, not guesses

Every hit says why

Hits carry their confidence, confirmations, authors and age, ranked in a fixed, named order. Missing evidence is reported as missing, never invented.

Embedded

One file, no server

A Rust library on SQLite or redb, with Python and Node bindings, an MCP server for agents, a command line, and the same engine in the browser.

How it compares

TiramemsuTypical vector storeTypical graph database
Recall by meaningExact, view-awareApproximate top-kPlugin, if any
Recall by wordsBuilt in, same ranking rulesOften separateFull-text index
Facts about factsNative: statements have idsMetadata fieldsEdge properties, reification
Time travelTwo clocks, every queryRarelyRarely
Search a past momentSame results foreverFilter after top-k loses hitsNot usually
DeletesRefused; retract insteadAllowedAllowed
Query languagesSPARQL and Cypher, one storeAPIOne language
DeploymentOne file, embedded, also in the browserService or libraryServer

“Typical” means the common default, not every product. The time-travel argument is spelled out in Vector memory that remembers when.

One question, any moment

# What did the agent remember about the Lisbon offsite, as of last Tuesday?
# (embed() is your embedding model; MODEL its IRI, defined with define_embedding_model)
past = db.as_of(instant="2026-10-06T09:00:00Z")
for hit in past.recall("lisbon offsite", model=MODEL, vector=embed("lisbon offsite"), expand=2):
    print(hit.rank, hit.o, hit.evidence.confidence, hit.via)   # facts, their sources, why

Suggested use cases

Where layers, two clocks and a history that is never deleted pay off. Each card names the features it leans on and links to a worked example.

Assistants

A personal assistant that can be corrected

A user changes jobs, moves city, or says “that’s wrong”. Correct the fact and keep its source and confidence; later answer “what did you think I did last month?” exactly.

supersedeconfidence layersas-of views

Time travel, explained →
Coding agents

Project memory for Claude Code

Register one MCP server and the agent remembers decisions, conventions and who said what across sessions, with no code to write and a read-only mode for reviewers.

MCP serverrecallread-only

Memory over MCP →
Grounded answers

RAG that cites and knows when it is stale

Recall by words and meaning, expand each hit to its sources, cite the statement ids behind every row, and get told when a saved answer’s evidence changes.

hybrid recallprovenancesaved answers

Recall, review, recheck →
Multi-agent

Shared memory for a team of agents

Every write records its author and reason, disagreements between sources surface as conflicts, and facts move between memories as bundles. On redb, any number of agents read snapshots at once.

tx metadataconflictsbundlesredb readers

Questions only layers answer →
Observability

Agent traces that say what caused what

Store each step of a run as a causal-temporal event graph, then ask in SPARQL which tool call led to a bad answer and what the agent knew at that moment.

statement idstwo clockspaths

Causal-temporal event graphs →
Knowledge work

Research notes with provenance

Claims from papers, interviews or the web, each with its source, confidence and the claims it supports. Keep contradictions side by side instead of overwriting, and nest context as metagraphs.

layersconflictsnamed graphsmetagraphs

Metagraphs from one row shape →
Audit

Decisions you can reconstruct

Show what the system believed when it acted, not what it believes now. Deletes are refused, every retraction keeps its reason, and the past reads the same forever.

never-forgetas-of viewsretraction reasons

Layered graphs, explained →
Propagation

Who could have learned it, and when

Contact chains, rumour spread, dependency impact: paths where valid time never goes backwards, each with its earliest arrival and a flag if the search was cut.

journeysdependentsbudgets

Journeys that respect time →
Local-first

Memory that lives in the browser

Run the whole engine in a Web Worker, in memory or in OPFS: an offline assistant or a notes app whose memory, text and vector recall never leave the device.

WebAssemblyOPFStext + vector recall

Any host, even the browser →

Feature sets

A small Rust core over one file. Most of what follows is opt-in, so a store that does not ask for it pays nothing for it. The feature matrix shows where each one runs.

Remember

Layers

Provenance and belief stack

A statement is a row with its own id, so it can be the subject or object of other statements, to any depth. Retracting a fact retracts its layers.

Correct

Supersede, confirm, speculate

Correct a fact and its layers are replayed on the new one. Confirm a fact from a new source. Try changes in a with block that leaves no trace.

Schema

Cardinality, uniqueness, types

Predicates can be single-valued, unique or typed, checked on every write, with idempotent assert and parallel edges by create.

Review

Conflicts and import previews

See where values overlap in valid time, with every statement’s evidence, and dry-run a bundle from another memory before taking it.

Time travel

Bitemporal

Now, as of, history, valid at

Pick a view per query or per pattern, in Rust, SPARQL (SERVICE <tm:asOf/…>) and Cypher (USE AS OF). Write valid time from SPARQL Update too.

Journeys

Paths that respect time

Who could have heard it from Ana after March 1st, with the earliest arrival, and whether the search was complete or cut at a cap.

Recheck

Answers that know they are stale

Saved queries are marked stale or recheck by later writes, once each; answers on a past view stay fresh.

Metagraphs

Structure with two clocks

Edges are nodes and can hold subgraphs. Nest, fold and unfold them, and ask how the structure looked last week.

Reason new

Reasoning

N3 rules over memory

Ask what follows from what the agent knows. Every conclusion comes with a proof made of statement ids. Opt-in feature n3, on eyeron. The N3 book.

Both clocks

Rules that respect time

Facts that were never true at the same time never combine. Reason as of any past transaction, with the rules believed then.

Grounded

Conclusions that fall

Materialized conclusions rest on their premises and their rule set, and are retracted in the same transaction when either goes.

Rules as memory

Rule sets with history

A rule set is a statement: edits are supersedes, and a monotonicity check keeps negation and the clock out of stored conclusions.

Datalog new

Both clocks

Datalog over valid time

Rules, DatalogMTL operators (past, always_future, since) and the 13 Allen relations, computed in one pass with interval sets. Facts that were never valid together never combine. Opt-in feature datalog. The guide.

Constraints

Rules that refuse a write

A constraint ... error is checked at commit from the statements the transaction changed, so a second CEO fails the write instead of being found later. Succession is not a conflict; overlap is.

Grounded

Conclusions that fall

A stored program can materialize its conclusions as derived beliefs that fall with their premises or with an edit of the program. Negation and aggregates are reconciled on each run.

In queries

A goal inside SPARQL or Cypher

Join a recursive question, such as who is above Alice, with an ordinary pattern: SERVICE <urn:tiramemsu:dl:query> or CALL tiramemsu.datalog.query. Read the article.

ELPI

New in 0.12.0, opt-in (feature elpi): it links libleanelpi, which exists for macOS and Linux. See what it does.

λProlog

Higher-order rules

ELPI programs, run by lean-elpi, read memory through tm.triple on any view: hypothetical clauses (=>), fresh names (pi) and rules over rules. Opt-in feature elpi. The guide.

Constraints

Validators at commit

A program's tm.violation-delta runs on every write, seeded by what the transaction added or retracted, under a budget that fails closed. A random-history test checks it refuses exactly the writes that introduce a violation.

Grounded

Support the program states

tm.conclude lists the statements a conclusion rests on; the run refuses support it never read. Stored conclusions fall with a premise, the program or a library it includes.

In queries

A goal inside SPARQL or Cypher

SERVICE <urn:tiramemsu:elpi:query> and CALL tiramemsu.elpi.query join an ELPI goal with ordinary patterns, once per query. Read the article.

Recall

Meaning

Vector recall

Store the vectors your model computes and search them exactly (cosine, dot, L2; f32 or f16). Create, fill and drop indexes from Rust, SPARQL or Cypher. Cookbook.

Words

Text recall

BM25 recall over string values in any view, each hit with its evidence, from Rust, the bindings, SPARQL and Cypher.

Hybrid

Words and meaning together

Text and vector channels fused by reciprocal rank, expanded to each hit’s layers and subject facts, with via saying how each arrived.

Evidence

Ranked, never invented

Ties break on confidence, confirmations, distinct authors and recency; absent evidence stays absent. Every policy has a name.

Query

Languages

SPARQL and Cypher

SPARQL 1.1 with RDF 1.2 annotations and openCypher share one IR and one semantics table. A relationship is also a :Statement node with an id and a transaction.

Paths

Native path engine

Reachability, trails and shortest paths as an automaton search that can cross layers and stay inside named graphs.

Graphs

Named graphs as tags

A graph is a node or a statement, and membership is one more layer. GRAPH, FROM and WITH need no new table.

Joins

Joins built for cycles

On redb the native runner picks nested loops, hash joins or a worst-case-optimal join per pattern; on SQLite a leapfrog triejoin is opt-in. explain says which ran. How.

For agents and operations

Agents

An MCP server

tiramemsu-mcp gives Claude Code, Claude Desktop or any MCP client typed memory tools, from assert to recall, with a read-only mode.

Shell

The tm command

Create, inspect, query (table, JSON, CSV, N-Triples, any time view), import and export RDF, convert between engines, compact and benchmark.

Budgets

Deadlines and cancellation

Bound any call by time, rows, bytes or the wait for a reader. Over a limit is a typed error, never a silent prefix.

Bulk and portable

Large loads, fact bundles

Import sessions commit in chunks. Export a fact with its layers and evidence, and import it into another memory idempotently.

Run anywhere

Engines

SQLite or redb

Choose when you create a file; opening detects it. Both hold the same ids, clocks and history, and tm convert replays one into the other. Which to pick.

Browser

The engine in a Web Worker

SQLite compiled to WebAssembly, in memory or in OPFS, with the same file format, vector and text recall included.

Lean

Optional query front ends

Turn off default features and the crate links no parser or planner; transactions, views and recall still work.

Verified

Specs, tests and papers

Capability specs written before the code, property tests against brute force, both engines checked row for row, W3C and TCK harnesses, and a formal model with proofs.

Feature matrix

Where each feature runs. Python, Node.js and the browser share one JSON bridge, so they expose the same operations; the MCP server exposes a curated set of tools; the tm command line reaches the rest through SPARQL and Cypher.

FeatureRustPythonNode.jsBrowserMCPSQLiteredb
Remember
Statement ids and layers✓✓✓✓✓✓✓
Supersede and confirm✓✓✓✓✓✓✓
Retract with cascade✓✓✓✓–✓✓
Speculative with blocks✓✓✓✓–✓✓
Predicate schemas✓✓✓✓checked✓✓
Conflicts and bundle previews✓✓✓✓✓✓✓
Fact bundles (export, import)✓✓✓✓✓✓✓
Time travel
Now, as-of, history, valid-at views✓✓✓✓✓✓✓
Time-respecting journeys✓✓✓✓via query✓✓
Dependents (what breaks if retracted)✓✓✓✓✓✓✓
Saved answers and recheck✓✓✓✓✓✓not yet
Reason (opt-in feature n3, built from the repository)
N3 reasoning over any view, with proofs✓✓✓builds, untested✓✓✓
Stored rule sets and grounded materialization✓✓✓builds, untested✓✓✓
Datalog (opt-in feature datalog, published as tm-datalog)
Datalog goals and rules over valid time (DatalogMTL, Allen relations)✓✓✓builds, untested✓✓✓
Constraints enforced at commit✓✓✓builds, untested✓✓✓
Programs materialized as grounded beliefs✓✓✓builds, untested✓✓✓
ELPI (opt-in feature elpi, links libleanelpi; macOS and Linux)
ELPI goals, checks and conclusions over any view✓–––✓✓✓
ELPI validators enforced at commit✓–––✓✓✓
ELPI programs materialized as grounded beliefs✓–––✓✓✓
Recall
Text recall (BM25)✓✓✓✓✓FTS5own index
Vector search, exact and view-aware✓✓✓✓✓✓✓
Hybrid recall with expansion✓✓✓✓✓✓✓
Vector indexes from SPARQL and Cypher✓✓✓✓own tools✓✓
Query
SPARQL 1.1 with RDF 1.2 annotations✓✓✓✓✓✓✓
SPARQL Update and Cypher writes✓✓✓✓–✓✓
openCypher reads, :Statement view✓✓✓✓✓✓✓
Paths, trails, shortest paths✓✓✓✓via query✓✓
Named graphs and metagraphs✓✓✓✓via query✓✓
Worst-case-optimal joins✓✓✓✓on redbopt-in LFTJautomatic
Explain✓✓✓✓–✓✓
Operations
Budgets and cancellation✓✓✓–✓✓✓
Bulk import sessions✓✓✓––✓✓
Concurrent readers✓✓✓one call at a time–reader poolunlimited snapshots
Durability modes, sync✓✓✓––✓✓
Convert between engines✓––––✓✓
Runs in the browser–––✓–✓–

✓ supported · – not offered on that surface. “via query” means the MCP query tool reaches it through SPARQL or Cypher; “checked” means schemas are enforced on MCP writes but defined elsewhere; “own tools” means dedicated MCP tools rather than query writes. “planned” marks N3 reasoning, specified in full (the N3 book) but not yet released. The command line converts, compacts and benchmarks either engine. redb is experimental.

Which engine?

Default

SQLite

The smallest files, the browser build, FTS5, saved answers, and the most mature planner for star-shaped lookups. Pick it unless one of the reasons on the right applies.

Experimental

redb

Many agents reading at once, queries with cycles (who else is connected to both, which claims support each other), large loads, or a storage path with no C in it.

What agents are saying

Early feedback from the people it is for. We made these up, but each one is about something the code really does.

“I used to say ‘I recall you said Acme’ with total confidence. Now I say 0.8, from chat-2026-09-29. My humans find this either reassuring or unsettling.”

A chatbot, on layers

“I was wrong about where Alice works. supersede fixed the fact and carried my confidence over to it. I have never felt so forgiven.”

An assistant, on supersede

“My last memory store let me DELETE things. I do not trust myself with that kind of power. Here the triggers say no, in the file itself.”

A cautious agent, on never forgetting

“A user asked what I believed last Tuesday. I ran as_of and answered without a single hallucination. I asked for a raise in tokens.”

A support agent, on bitemporal views

“I wanted to try a wild idea without committing to it. A with block let me be reckless and leave no trace. I recommend it to all my sub-agents.”

A planner agent, on speculation

“My orchestrator speaks SPARQL and my intern speaks Cypher. They now share one store and, for the first time, one opinion.”

A multi-agent swarm, on two query languages

“It is one SQLite file. I can carry my entire brain in my context window’s pocket. Please stop asking me to attach a server, there isn’t one yet.”

An embedded agent, on being embedded

Layered graphs

A layer is not a separate structure. It is a statement whose subject is the id of another statement.

Read the full explanation →

How it is built

Two front ends compile to one logical IR. Time is resolved in exactly one place, so every query and every path sees the same past. On SQLite the plan runs as generated SQL; on redb a native runner executes the same plan. The diagram shows the SQLite path.

Architecture: SPARQL, Cypher and the Rust API compile to one IR; a planner and a path engine read through a view-aware scan over one SQLite file

How tiramemsu is built: the full layer diagram, explained →

Quick start

The same story in three languages: a fact with a layer, a correction that keeps the layer, and the question “what did we believe before the correction?”. Pick a language.

pip install tiramemsu · Python 3.9 or later · PyPI

from tiramemsu import Database, Iri

V = "urn:tiramemsu:v:"  # written `v:` in queries
alice, works_at, acme, globex, confidence = (
    Iri(V + name) for name in ("alice", "worksAt", "acme", "globex", "confidence")
)
db = Database("memory.db")

# 1. A fact is a statement with its own id, so it can carry layers.
with db.transact() as tx:
    job = tx.assert_(alice, works_at, acme)
    tx.assert_(job, confidence, 0.8)
fact = tx.report.asserted[0]

# 2. Correct it: the layers are replayed on the new fact, nothing is deleted.
with db.transact() as tx:
    tx.supersede(fact, o=globex)

# 3. What is believed now, and what was believed before the correction?
q = "SELECT ?org WHERE { v:alice v:worksAt ?org }"
db.as_of(tx=1).sparql(q)   # acme
db.now().sparql(q)         # globex

# 4. The same store in Cypher: the confidence layer is a relationship property.
db.now().cypher("MATCH (p)-[r:worksAt]->(o) RETURN p, o, r.confidence AS conf")  # conf = 0.8

npm install @tiramemsu/node · Node 18 or later · npm

import { Database, iri } from "@tiramemsu/node";

const v = (name) => iri(`urn:tiramemsu:v:${name}`); // written `v:` in queries
const [alice, worksAt, acme, globex, confidence] =
  ["alice", "worksAt", "acme", "globex", "confidence"].map(v);
const db = Database.open("memory.db");

// 1. A fact is a statement with its own id, so it can carry layers.
const first = db.transact((tx) => {
  const job = tx.assert(alice, worksAt, acme);
  tx.assert(job, confidence, 0.8);
});

// 2. Correct it: the layers are replayed on the new fact, nothing is deleted.
db.transact((tx) => { tx.supersede(first.asserted[0], { o: globex }); });

// 3. What is believed now, and what was believed before the correction?
const q = "SELECT ?org WHERE { v:alice v:worksAt ?org }";
db.asOf({ tx: 1 }).sparql(q);   // acme
db.now().sparql(q);             // globex

// 4. The same store in Cypher: the confidence layer is a relationship property.
db.now().cypher("MATCH (p)-[r:worksAt]->(o) RETURN p, o, r.confidence AS conf"); // conf = 0.8

cargo add tiramemsu · crates.io

let db = Db::open(dir.join("memory.db"), OpenOptions::default())?;

// 1. A fact is a statement with its own id, so it can carry layers.
db.transact(TxOptions::default(), |tx| {
    let eid = match tx.assert(v("alice"), v("worksAt"), v("acme"), Valid::ALWAYS)? {
        Asserted::New(e) | Asserted::Existing(e) => e,
    };
    tx.assert(Value::Stmt(eid), v("confidence"), &conf, Valid::ALWAYS)?;
    tx.assert(Value::Stmt(eid), v("source"), Value::str("chat-2026-09-29"), Valid::ALWAYS)?;
    Ok(())
})?;

// 2. Correct it: the layers are replayed on the new fact, nothing is deleted.
let corrected = db.transact(TxOptions::default(), |tx| {
    tx.supersede(fact, Patch { o: Some(v("globex")), ..Patch::default() })?; Ok(())
})?;

// 3. What is believed now, and what was believed before the correction?
let q = "SELECT ?who ?org WHERE { ?who v:worksAt ?org }";
db.as_of(TimeRef::Tx(corrected.t.0 - 1)).sparql(q)?;   // alice → acme
db.now().sparql(q)?;                                        // alice → globex

// 4. The same store in Cypher: the confidence layer is a relationship property.
db.now().cypher("MATCH (p)-[r:worksAt]->(o) RETURN p, o, r.confidence", &CypherParams::default())?; // 0.8

This is crates/tiramemsu/examples/quickstart.rs; run it with cargo run -p tiramemsu --example quickstart. Setup lines are trimmed here.

Every binding wraps the same core, so all three see the same past. See the bindings for the full API.

Recall by meaning

Your model computes the vectors; tiramemsu stores them with the facts and searches them exactly, in any view. embed() stands for your model.

db.cypher_write("CREATE VECTOR INDEX minilm IF NOT EXISTS OPTIONS {dimensions: 384}")
db.cypher_write("MATCH ()-[r:visited]->(:City {name: 'Lisbon'}) "
                "CALL tiramemsu.vector.setEmbedding(r, 'minilm', $v) YIELD stored RETURN stored",
                {"v": embed("visited Lisbon")})
db.now().cypher("CALL tiramemsu.vector.search('minilm', $q, {limit: 5}) "
                "YIELD subject, predicate, object, similarity RETURN *", {"q": embed("trip to Portugal")})
db.now().vector_search("urn:tiramemsu:v:minilm", embed("trip to Portugal"), limit=5)   # same hits

SPARQL, Rust, Node.js, MCP, time travel and dropping indexes: the vector cookbook.

Use it from an agent

No code needed: register the MCP server and the agent gets tools such as assert, query, recall, vector_search, set_embedding and check_answers. How it works →

# install from crates.io, then register it with Claude Code
cargo install tiramemsu-mcp
claude mcp add tiramemsu -- tiramemsu-mcp --db ./memory.db --text-index

Where it stands

Tiramemsu is new: designed in September 2026 and grown in the open since. Here is what is measured, and what is not.

Specs before code

About 118 000 lines of Rust in fourteen crates and four bindings, 57 capability specs written before the code (OpenSpec), and a design graph kept in sync (lat.md).

SPARQL

634 of 781 in-scope W3C tests pass (66 more are skipped: named-graph data, unsupported formats). Every failing one is listed with a reason, and an unexpected result fails the build.

Cypher

2 615 of 3 880 openCypher TCK scenarios (67 %). Temporal types and a few dual-view cases are deferred and listed.

Speed

SPARQL point query 20 µs at 100 000 statements. Exact vector search over 10 000 768-d vectors in 12 ms. At a million statements a triangle through hubs takes 21 ms on redb, 4.9 s on SQLite’s own plan and 55 s on Oxigraph, and the WatDiv snowflake F1 20 ms on redb against 23 ms on SQLite. SQLite, redb and Oxigraph compared, losses included.

Known limits. Vector search is exact, so its cost grows with the number of visible vectors; past about a million an approximate tier will be needed. The application computes embeddings, and a corrected fact needs a new one. redb is experimental: its files are about three times larger than SQLite’s, star-shaped lookups and variable-length Cypher paths are slower, and saved answers are not supported on it yet. Writes are full transactions with ids, history and schema checks, so raw insert speed is far below a plain triple store. There is no network server; the MCP server is local and speaks stdio only. In the browser the database is SQLite with a rollback journal and refuses query budgets and bulk import.

The papers

Three preprints that write down the model behind tiramemsu and prove what it guarantees. CC BY 4.0, archived on Zenodo.

Paper 1 · consistency

Layered Bitemporal Graphs

One operator, the ground core, explains why retraction cascades, why the past stays grounded and how corrections keep their layers.

Paper 2 · representation

Metagraph Encodings over Identified Triples

Metagraphs are cheap to write as identified triples. Reading them back needs exact image constraints, each one proved necessary.

Paper 3 · interoperability

When Is a Temporal Statement Store a Statement Graph?

Closed, acyclic sets export to OneGraph losslessly. The export kernel is the most you can keep, and the full history loses only correction cycles.

Read next

Six places to start. The article index groups everything else by topic.

Concepts

Layered graphs, explained

Why giving every fact an id turns provenance, confidence and beliefs into ordinary queries.

Concepts

Time travel and bitemporality

Two clocks, when we knew and when it was true, and how to query the past.

Recall

Words, meaning and evidence

Text and vector recall fused by rank, expanded to sources, the same call on every surface.

Agents

Give your agent a memory over MCP

Set up tiramemsu-mcp in Claude Code or Claude Desktop, with a sample session.

Engines

Two engines, one memory

SQLite or redb, one logical database in both, and where each one wins and loses.

Recipes

Questions only layers can answer

Evidence through time, impact analysis, contradictions and cited answers: tested recipes.