Research

HumemDB

A study of an embedded database for agent memory: one SQLite file with SQL and Cypher, keyword and vector search, and DuckDB for analytics later.

Illustration of a grid of squares joined by one line to a small diamond-shaped graph with one rose node, standing for graph queries over a table.

Question

One embedded database for an agent's memory.

HumemDB is an embedded database for agent memory. One file, two languages (SQL and Cypher), and two engines: SQLite runs transactions, DuckDB runs analytics, and HumemDB routes each query to the right one. Keyword and vector search are built in.

That is the aim, and the research asks whether each part of it holds. Can Cypher, the common language for graph questions such as who knows whom through two steps, compile to SQLite's SQL, give the answers Neo4j gives, and run about as fast as SQL written by hand? Can DuckDB answer analytical queries over the same data without putting the file's transactions at risk, and can each query go to the right engine without the user choosing one?

This is research. Nothing can be installed yet, and new evidence can change every decision below.

Plan

The plan decided so far.

HumemDB is a database of its own. It ships its own SQLite (3.54.1, with FTS5 for keyword search and vec1 for vector search; vec1 is not in the build yet) and always uses it. An application opens a file through HumemDB and runs SQL and Cypher on HumemDB's connection, in the same transactions. There is no option to hand in a SQLite connection of the application's own.

A HumemDB file is a normal SQLite file. An existing SQLite database can be opened with HumemDB and its tables queried with SQL and Cypher, and other programs can still read the file. Opening the same file in the same process with a second SQLite library, such as Python's sqlite3, is not supported: in a test, that lost acknowledged commits.

Users write one SQL dialect, SQLite's, plus Cypher, and never choose an engine. Everyday reads and writes run on SQLite as written. A query sent to DuckDB is translated so that it keeps SQLite's meaning, and a query whose meaning cannot be kept runs on SQLite, slower but with the same answer.

The first release runs everything on SQLite, with keyword and vector search. DuckDB, the routing between the two engines, and tiervec as a vector index come after it. DuckDB will read a copy kept up to date from a log of changes, and never the SQLite file itself.

The Cypher part, humemdb-cypher, compiles standard openCypher, with no extensions of its own, to SQL over ordinary tables, and Neo4j's answers are the reference for what a query should return. The tables become a graph through a declared mapping that HumemDB proposes from the tables and their keys, and that a written mapping can override. Keyword and vector search come in as procedures that use Neo4j's names for the same operations.

Text in Chinese, Japanese, and Korean is in the first release: FTS5 trigram, with a LIKE fallback for words shorter than three characters. A bounded path query is capped at 6 steps by default. A statement that HumemDB cannot run is refused, and the refusal names the fix: the table, mapping entry, or option that would make it work.

Cypher writes and generic graph tables for names that the schema does not have wait until three schemas or users from outside the project want the Cypher path. So do the DuckDB copy, the routing, and the durability classes.

These decisions date from 2026-11-30. That day HumemDB also changed from a Cypher library on the application's own SQLite connection to a database of its own. Nothing of the database is built, so new evidence can reverse any of them.

Measured

The Cypher compiler, checked against Neo4j and by hand.

humemdb-cypher compiles the reads of its first Cypher subset to SQLite's SQL. Three checks measure it so far.

What the compiler does on each check. The first two judge answers; the third times the compiled SQL against SQL written by hand for the same question.

CheckResult
303 conformance cases, against the answers of Neo4j 2026.10.2 on the same graphs252 same answer, 13 same error, 38 refused with a named fix, 0 wrong
1,382 scenarios of the openCypher test suite (TCK) that tables can hold812 passed, 570 refused with a named fix, 0 failed
16 pairs of queries on TPC-H and LDBC shaped tables, larger size1.06 times the time of the hand-written SQL (geometric mean)

The conformance cases are the agent memory statements that the first subset runs, the cases of the engines A/B below, search, and schema commands (the tests). The openCypher suite has 3,878 scenarios, and 1,687 of them test the first subset. Of those, 305 have a graph that a table per label set cannot hold, and the other 1,382 are judged against the suite's own expected results.

The speed rule of the first release allows 1.10 as the geometric mean and 1.25 for any one pair. 2 of the 105 pairs checked are over 1.25: the same TPC-H query (tpch.by_region, 1.31) at two sizes. Compiling a statement takes under 1 ms. These times come from GitHub's shared runners, and the timed study on the benchmark host has not run (overhead note).

Findings

What the research found.

DuckDB for analytics, provisional. On a copy of the data in DuckDB, 22 analytical statements (TPC-H queries, agent memory aggregates, and graph analytics) ran 37.7 times faster than on SQLite (geometric mean), and 8 lookups ran 51 times slower. All 30 answers were equal. DuckDB reading the SQLite file itself, from a separate process, was 8.8 times slower than the copy. A hint from the caller picked the right engine for 29 of the 30 statements. The runs were on GitHub's shared runners, and every recommendation of the note is provisional (DuckDB integration).

What agents send. A corpus holds 468 Cypher statements: 417 that 9 agent memory and RAG frameworks send to Neo4j at pinned releases, 10 from prompts and tutorials, and 41 written the way a coding agent would. The first version runs 131 of the 417 framework statements as they are sent. 143 of the 417 contain a write, so until writes are built those frameworks can read through it but not store (agent Cypher corpus).

Others already offer most of it. Several projects offer SQL, graph queries, and vectors in one embedded store, in whole or in part, and LadybugDB's SQLite extension has graph pattern matching over SQLite tables in its source and tests. No user asking for Cypher over their own SQLite tables was found, which is weak evidence either way (landscape).

Three ways to store a graph in one SQLite file. They were tried with hand-written SQL on an agent memory. A mapping over the user's own tables keeps those tables, but in 13 of the 20 steps (10 writes and 3 reads) a person had to change the schema first. Generic node and edge tables needed nobody, but have no types. Typed tables that the graph creates refused 6 of 7 names that a model made up (graph storage designs).

Existing tools, run side by side. Existing tools were installed and run on the same agent memory statements, with Neo4j as the reference. Every one of them answered some cases differently from Neo4j without an error: on 46 awkward cases, cypher-to-sql differed in 1, GraphQLite in 4, and LadybugDB over typed tables in 14. Each figure holds for the version that ran (engines A/B).

What people want from a multi-model database. They ask for pieces, not for "multi-model": one file and no server, keyword and vector search together with filters, JSON next to tables, and text search that works in their language. Time series and geospatial data are rare in agent memory: in 11 agent memory projects, 24 of 13,942 issues mention time series and 6 mention geospatial topics. SQLite already has most of the pieces (multi-model demand).

Status

The Cypher compiler exists; the database does not yet.

humemdb-cypher compiles the reads of the first subset, and the checks above run on its changes. The database itself, which is the first release, is not built, and nothing can be installed. Both are written in Rust, in one repository.

A check of how far the sources behind the newest notes can be trusted is done (the credibility check). Much of what the notes lean on is young or small, often a project with one main author or under a year old. The notes are strongest where they measured on SQLite, DuckDB, and PostgreSQL themselves.

The software page has no install step yet. It fills in with the first release that can be installed.