# Leteo against other memory engines, measured Leteo is a reimplementation of Engram, and that sentence — plus the attribution in [`NOTICE`](../NOTICE) — is usually the whole of the comparison a reader sees. Engram is not the only engine an agent can be given, so this page puts the same held-out corpus and the same questions to every engine of the **deterministic tier** and scores the answers. It is deliberately narrow: it is not a claim about which product is better to use; it is what one harness measured on one day, with the versions the generated block names beside each row. The numbers and versions below are generated by [`tools/memory-bench/compare.py`](../tools/memory-bench/compare.py) from the harness's own output. They are not typed into this file, and no number is stated anywhere else: re-running the command on a machine with different engines, or after a new Leteo commit, rewrites the generated block with what it actually measured. An engine that cannot run here is listed with the reason, never as a row of zeros, and if a step cannot run the block says it was skipped rather than showing a number nobody produced. ## The corpus [`tools/memory-bench/comparison_corpus.py`](../tools/memory-bench/comparison_corpus.py) builds a deterministic corpus — a fixed seed, no network — of synthetic memories in two projects, `alpha-api` and `beta-web`, and a set of queries each of which has exactly one memory it should find. It is **held out from the ratchet**. `ratchet.py` gates search quality on [`corpus.py`](../tools/memory-bench/corpus.py), a different corpus whose paraphrases avoid the target's words and whose partial-word queries give a fragment; a benchmark that is also the tuning set cannot tell overfitting from an improvement. The queries here were written for the comparison and raise or lower no floor in `floors.json`, and `tests/repository_guards.rs` refuses a commit that edits this file together with `src/store/search*` or `src/store/semantic*`, so a ranking change cannot be tuned against the corpus that is meant to measure it. Most of the queries share a distinctive word with the memory they should find, so a plain keyword match can answer them and the relaxed stages are not the only way through. The queries are still synthetic and were written knowing how Engram and Leteo search — see [Caveats](#caveats). The memory and query counts are printed in the generated block from `comparison_corpus.py` itself, so they cannot drift from what the harness ran. ## The method Every engine is an adapter in [`tools/memory-bench/adapters.py`](../tools/memory-bench/adapters.py) behind one interface. An adapter starts its engine isolated under a throwaway `BENCH_STATE` (`HOME`, the XDG directories and every variable the engine reads to find its data are pointed there, and any such variable inherited from the caller is removed, so a run cannot reach a real store), writes each corpus memory through **the engine's own write path**, and searches through **its own search path**. Every query is asked at the same limit, which the generated block names, with the engine's defaults. An engine with no limit parameter returns what it returns and the harness keeps the first results up to the limit. The target's rank is its position in the returned hits, and the metrics are hit@1, hit@5 and mean reciprocal rank (MRR), per query kind and overall. **Which memory a hit is.** A hit maps to a corpus memory by provenance where the engine keeps something we set: Engram's and Leteo's ids, the file path basic-memory returns for the note we wrote, the entity name server-memory returns. A hit that carries no such reference is matched by content, the same rule for any engine: its normalised text (case, accents, punctuation and spacing folded) must contain the saved content, or be a stretch of it of at least forty characters, and must fit exactly one memory. A hit that maps to nothing counts as a miss and is counted per engine as **unmappable** in the generated block; it keeps its position, so it still takes a rank from the memories below it. An engine whose prerequisite is missing — its binary, its package runner, a service — is **skipped with that reason** and has no row of numbers. An engine that starts and then fails is listed the same way, with the error. Leteo, the build under test, is the one engine whose absence fails the run. The LLM tier maps hits the same way, by provenance where the engine keeps one: mem0's metadata, claude-mem's memory ids and Graphiti's source episodes. The Engram side is saved through Engram's own `engram save` CLI, so its own write path builds its index; a copy of that store is then adopted with `leteo import --from-engram`, and ids survive adoption, so one answer key serves both. The Leteo side is the binary built from the commit named in the generated block. That loading is unchanged from the Engram-only page, which is what keeps those two engines' numbers comparable with every earlier run. The page reports the version of every engine that was **actually measured**, whatever it is. Engines change their search behaviour between releases, so a run on a different version is a different measurement: the numbers belong to the version beside them and to no other. The external engines are pinned to an exact release in `adapters.py`. An engine whose answer is not the same twice is measured over several loads, each into a store of its own, and its head-to-head row reports the mean with the lowest and the highest pass, so no figure is one draw presented as reproducible; the engines table says how many passes it took and the per-kind table shows the mean alone. A run that faults before its passes are done is not measured at all, and the engines table names what stopped it. basic-memory is the one such engine here: it fills its full-text index asynchronously after `write_note` returns, and 0.23.2 exposes no completion signal to wait on, so two loads of the same corpus are not the same store. Engram's and Leteo's ranking figures are unchanged; the warm-search latency and reply-size rows are this machine's and move with it. ## The engines - **Engram** and **Leteo**: stdio MCP `mem_search`, one server per project. - **basic-memory**: markdown notes searched by its own `search_notes`, run as an external process through `uvx` and never vendored — it is AGPL-3.0. Each corpus memory is a note written with `write_note`; the project is the note's directory, and each project has its own store. It runs its default search, which includes a local embedding model, so its first run downloads that model. - **server-memory**: the reference MCP knowledge-graph server (`@modelcontextprotocol/server-memory`), run through `npx`. Each memory is an entity whose name is its title, whose type is its memory type and whose single observation is the content. Its `search_nodes` is an **unranked, case-insensitive substring match of the whole query** against names, types and observations, so a multi-word query finds a memory only when those words appear together and in that order. An empty answer to such a query is a real result of that tool, not a fault of the adapter, and the `returned nothing` column is the count of them. Its rank is simply the order in which entities are stored. The **LLM tier** is a separate, opt-in tier for engines that need a local language model, run with `compare.py --tier llm` against a local Ollama and nothing else: no paid API is called and the corpus is only ever sent to a loopback address. Its engines, each pinned to an exact release: - **mem0** 2.2.1, through its Python SDK, because OpenMemory MCP no longer exists (it was removed from the mem0 repository). Two rows. `infer=True` is not run by default (`BENCH_MEM0_INFER=1` opts in; the generated table gives the measured reason). `infer=False` stores each memory verbatim and uses the model only for embeddings; `infer=True` lets the LLM extract the facts that are stored, so a memory it extracts nothing from is not searchable, and the row says how many. The vector store is a local Qdrant under the throwaway state, and each memory carries its corpus key in its metadata, which is the provenance. - **claude-mem** 13.35.0, through the `save_memory` and `search` tools of its MCP server. `save_memory` stores the text as given, so this row calls no model at all; its own vector index is Chroma's local ONNX embedder. Its hook-driven capture, where a model would compress what an agent did, needs a live Claude Code session and is not measured. Hits are mapped through the memory ids its `save_memory` replies carry. The worker the MCP server starts is stopped when the run ends. - **Graphiti MCP** v1.1.0, not run by default (`BENCH_GRAPHITI=1` opts in; the generated table gives the measured reason), on a throwaway FalkorDB container, with Ollama behind its OpenAI-compatible API in `json_object` mode. `add_memory` returns before the episode is extracted and offers no completion signal, so each episode is named for its corpus key and the loader polls `get_episodes` for that name before anything is searched (a caller-supplied uuid cannot be used: in this release it names an episode that must already exist). Search returns extracted facts and never the saved text; a fact is mapped to a corpus memory through the episodes it lists as its source, and a fact drawn from two memories is counted as unmappable rather than guessed. - **Letta** is listed and **not measured**; the generated table says why. Because a model that extracts facts or builds a graph does not give the same store twice, every LLM-tier engine is loaded from an empty store several times (three **passes** by default, `--passes N`), and the page shows each figure as the mean with the lowest and the highest pass beside it. The pass count is a column of its own, the models are named with their digests, and the dependencies are checked first: Ollama not running, a model not pulled, Docker or a package manager absent each give a skip with that reason, never a row of zeros. The models are set with `BENCH_LLM_MODEL` (default `qwen2.5:7b`), `BENCH_EMBED_MODEL` (default `nomic-embed-text`) and `BENCH_OLLAMA_URL`. Every throwaway container is named `leteo-bench--…`, binds a random loopback port, mounts no volume, and is removed with `docker rm -f -v` when the run ends or is interrupted. ## Results *Generated by `tools/memory-bench/compare.py` on 2026-10-12.* | measured | value | |---|---| | tier | deterministic | | Leteo commit | `f75764f0d0f1e12648317e4c413f88937183c5b8` | | harness | `tools/memory-bench`, run by `compare.py` at this commit | | search limit | 20 | | corpus | 91 memories (alpha-api 47, beta-web 44) | | queries | 56 across 7 kinds (longnl 6, multiword 24, paraphrase 4, partial 4, short 10, spanish 4, typo 4) | ### Engines | engine | version | run date | status | |---|---|---|---| | Engram | 3.1.0 | 2026-10-12 | measured | | Leteo | 0.3.0 | 2026-10-12 | measured | | basic-memory | 0.23.2 | 2026-10-12 | measured, mean of 5 passes | | server-memory | 2026.8.31 | 2026-10-12 | measured | The LLM tier (engines that need a local model) is opt-in and not part of this run: its engines have no row here, which is different from a row of zeros. ### Head to head, each engine's own search, limit 20, defaults | engine | version | run date | h@1 | h@5 | MRR | returned nothing | hits returned | unmappable hits | no-answer questions answered | |---|---|---|---:|---:|---:|---:|---:|---:|---:| | Engram | 3.1.0 | 2026-10-12 | 0.64 | 0.64 | 0.643 | 20 of 56 | 37 | 0 | 0 of 16 | | Leteo | 0.3.0 | 2026-10-12 | 0.96 | 0.96 | 0.964 | 1 of 56 | 135 | 0 | 5 of 16 | | basic-memory | 0.23.2 | 2026-10-12 | 0.94 (0.93–0.95) | 0.96 (every pass) | 0.950 (0.946–0.955) | 1 (every pass) of 56 | 619 (617–622) | 0 (every pass) | 15 (every pass) of 16 | | server-memory | 2026.8.31 | 2026-10-12 | 0.23 | 0.23 | 0.232 | 43 of 56 | 14 | 0 | 0 of 16 | An engine that does not give the same store twice is measured over several passes: the head-to-head row above shows the mean with the lowest and the highest pass in parentheses, the engines table says how many passes it took, and the per-kind table below shows the mean alone. A row measured once is its own number. | query kind | n | Engram h@1 / h@5 / MRR | Leteo h@1 / h@5 / MRR | basic-memory h@1 / h@5 / MRR | server-memory h@1 / h@5 / MRR | |---|---:|---:|---:|---:|---:| | longnl | 6 | 0.00 / 0.00 / 0.000 | 1.00 / 1.00 / 1.000 | 0.90 / 1.00 / 0.950 | 0.00 / 0.00 / 0.000 | | multiword | 24 | 0.96 / 0.96 / 0.958 | 1.00 / 1.00 / 1.000 | 1.00 / 1.00 / 1.000 | 0.00 / 0.00 / 0.000 | | paraphrase | 4 | 0.00 / 0.00 / 0.000 | 1.00 / 1.00 / 1.000 | 0.75 / 1.00 / 0.875 | 0.00 / 0.00 / 0.000 | | partial | 4 | 1.00 / 1.00 / 1.000 | 1.00 / 1.00 / 1.000 | 1.00 / 1.00 / 1.000 | 1.00 / 1.00 / 1.000 | | short | 10 | 0.80 / 0.80 / 0.800 | 0.90 / 0.90 / 0.900 | 0.80 / 0.80 / 0.800 | 0.80 / 0.80 / 0.800 | | spanish | 4 | 0.25 / 0.25 / 0.250 | 0.75 / 0.75 / 0.750 | 1.00 / 1.00 / 1.000 | 0.25 / 0.25 / 0.250 | | typo | 4 | 0.00 / 0.00 / 0.000 | 1.00 / 1.00 / 1.000 | 1.00 / 1.00 / 1.000 | 0.00 / 0.00 / 0.000 | | **overall** | 56 | 0.64 / 0.64 / 0.643 | 0.96 / 0.96 / 0.964 | 0.94 / 0.96 / 0.950 | 0.23 / 0.23 / 0.232 | ### Warm-search latency and reply size | engine | warm search median | p90 | mean reply bytes | mean results | zero-result queries | 20-result replies | mean bytes at 20 | |---|---:|---:|---:|---:|---:|---:|---:| | engram | 11.2 ms | 14.0 ms | 479 | 0.7 | 20 | 0 | 0 | | leteo | 0.2 ms | 1.3 ms | 1212 | 2.4 | 1 | 0 | 0 | ### Questions the corpus cannot answer | engine | answered | with no caveat | no-answer precision | mean reply bytes | |---|---:|---:|---:|---:| | engram | 0 of 16 | 0 | 1.00 | — | | leteo | 5 of 16 | 0 | 1.00 | 2550 | ### Engram with its opt-in `match_mode: "any"` | query kind | n | Engram `any` h@1 | Engram `any` h@5 | Engram `any` MRR | Leteo h@1 | Leteo h@5 | Leteo MRR | |---|---:|---:|---:|---:|---:|---:|---:| | longnl | 6 | 0.17 | 0.17 | 0.167 | 1.00 | 1.00 | 1.000 | | multiword | 24 | 0.96 | 0.96 | 0.958 | 1.00 | 1.00 | 1.000 | | paraphrase | 4 | 0.50 | 0.50 | 0.500 | 1.00 | 1.00 | 1.000 | | partial | 4 | 1.00 | 1.00 | 1.000 | 1.00 | 1.00 | 1.000 | | short | 10 | 0.80 | 0.80 | 0.800 | 0.90 | 0.90 | 0.900 | | spanish | 4 | 0.75 | 0.75 | 0.750 | 0.75 | 0.75 | 0.750 | | typo | 4 | 0.75 | 0.75 | 0.750 | 1.00 | 1.00 | 1.000 | | **overall** | 56 | 0.79 | 0.79 | 0.786 | 0.96 | 0.96 | 0.964 | ### Who leads, per query kind | query kind | Engram MRR | Leteo MRR | basic-memory MRR | server-memory MRR | Engram `any` MRR | leader, defaults | leader, `any` | |---|---:|---:|---:|---:|---:|---|---| | longnl | 0.000 | 1.000 | 0.950 | 0.000 | 0.167 | Leteo 1.000 | Leteo 1.000 | | multiword | 0.958 | 1.000 | 1.000 | 0.000 | 0.958 | tie Leteo, basic-memory 1.000 | tie Leteo, basic-memory 1.000 | | paraphrase | 0.000 | 1.000 | 0.875 | 0.000 | 0.500 | Leteo 1.000 | Leteo 1.000 | | partial | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | tie Engram, Leteo, basic-memory, server-memory 1.000 | tie Engram, Leteo, basic-memory, server-memory 1.000 | | short | 0.800 | 0.900 | 0.800 | 0.800 | 0.800 | Leteo 0.900 | Leteo 0.900 | | spanish | 0.250 | 0.750 | 1.000 | 0.250 | 0.750 | basic-memory 1.000 | basic-memory 1.000 | | typo | 0.000 | 1.000 | 1.000 | 0.000 | 0.750 | tie Leteo, basic-memory 1.000 | tie Leteo, basic-memory 1.000 | | **overall** | 0.643 | 0.964 | 0.950 | 0.232 | 0.786 | Leteo 0.964 | Leteo 0.964 | ### Reply bytes, session-start hook latency, cold CLI search Skipped: `ENGRAM_SRC` is not set, and Engram's session-start hook is a script in its source tree rather than part of its binary. ## Results, LLM tier These engines need a language model, so they are measured only on request, with `compare.py --tier llm`, on a local Ollama and nothing else: no paid API is called and the corpus never leaves the machine. An engine that cannot run here is listed with the reason and has no row of numbers. *Generated by `tools/memory-bench/compare.py --tier llm` on 2026-10-11.* | measured | value | |---|---| | tier | llm (opt-in, local Ollama only) | | harness | `tools/memory-bench` at Leteo commit `7ac6e79fac37eea1710998d6c1d82a6f0f6ec04b` | | Ollama | 0.40.2 | | search limit | 20 | | corpus | 91 memories, the same as the table above | | queries | 56, the same as the table above | | passes requested | 3 per engine, each from an empty store | ### Engines | engine | version | models and digests | run date | passes | status | |---|---|---|---|---:|---| | mem0 (infer=False) | 2.2.1 | nomic-embed-text:latest (137M, F16, `0a109f422b47`) | 2026-10-11 | 3 | measured | | mem0 (infer=True) | — | — | 2026-10-11 | — | **not measured:** not run by default: a pass on qwen2.5:7b takes about 11 minutes, and on the 24 GB machine that produced this page it pushed swap to about 20 GB and filled the disk before three passes could finish; set BENCH_MEM0_INFER=1 to run it anyway | | claude-mem | 13.35.0 | none called | 2026-10-11 | 3 | measured | | Graphiti MCP | — | — | 2026-10-11 | — | **not measured:** not run by default: on qwen2.5:7b in json_object mode Graphiti's own validation rejected 16 of the first 18 episodes (EdgeDuplicate and Organization errors) at about 45 s per episode, so one pass of 91 memories exceeds an hour; set BENCH_GRAPHITI=1 to run it anyway | | Letta | — | — | 2026-10-11 | — | **not measured:** Letta 0.34.10 has no archival-memory server: the PyPI package and the `letta/letta:0.34.10` image are Letta Code, a terminal agent, and the V1 API server with archival passages was retired after 0.16.8, which is a different product from the version named and was not measured | **These engines may score lower here than in their vendor-default configuration.** Every model call goes to a small local model (named in the table above) in place of the hosted model each project is built and tuned around, and the extraction prompts, entity types and defaults were left as shipped. A low row says how the engine behaves on this local model, not how it behaves with its recommended one. ### Head to head, LLM tier, limit 20 Each figure is the mean over the engine's passes, with the lowest and the highest pass in parentheses. Compare with the deterministic table above: it is the same corpus, the same queries and the same limit. | engine | passes | h@1 | h@5 | MRR | returned nothing, of the answerable queries | unmappable hits | no-answer questions answered | write time per pass | |---|---:|---:|---:|---:|---:|---:|---:|---:| | mem0 (infer=False) | 3 | 0.86 (every pass) | 0.95 (every pass) | 0.902 (every pass) | 0.0 (every pass) of 56 | 0.0 (every pass) | 16.0 (every pass) of 16 | 1 (1–2) s | | claude-mem | 3 | 0.82 (every pass) | 0.95 (every pass) | 0.875 (every pass) | 0.0 (every pass) of 56 | 0.0 (every pass) | 16.0 (every pass) of 16 | 13 (13–14) s | | query kind | n | mem0 (infer=False) MRR | claude-mem MRR | |---|---:|---:|---:| | longnl | 6 | 0.690 | 0.889 | | multiword | 24 | 1.000 | 0.958 | | paraphrase | 4 | 1.000 | 0.833 | | partial | 4 | 0.438 | 0.562 | | short | 10 | 0.861 | 0.811 | | spanish | 4 | 1.000 | 1.000 | | typo | 4 | 1.000 | 0.750 | | **overall** | 56 | 0.902 | 0.875 | - **mem0 (infer=False):** stored verbatim, no model call on write; Ollama embeddings only. - **claude-mem:** measured through `save_memory` and `search`; the write path calls no model, and its index is Chroma's local ONNX embedder, not Ollama. ## Where each engine leads The generated block computes a **leader** for every query kind, under each engine's own defaults and again with Engram's opt-in relaxed mode in Engram's place. Read those rows as what they are rather than as a general verdict. A `tie` is an exact equality, not a closeness test, and names every engine that shares it. A row where one engine leads by a little is not a durable lead: the per-kind rows have few queries (see [Caveats](#caveats)), and a stage change moves them. The numbers belong to the engine versions beside them. ## Reproduce it One command, from the repository root, with the Leteo binary built from the commit under test: ```sh cargo build --release LETEO_BIN=target/release/leteo python3 tools/memory-bench/compare.py ``` The LLM tier is a second command, never run by CI, because it needs a local Ollama with the two models pulled, Docker for Graphiti, `uv`, `npm`, `node` and `bun`, and hours: ```sh ollama pull qwen2.5:7b && ollama pull nomic-embed-text python3 tools/memory-bench/compare.py --tier llm # three passes per engine python3 tools/memory-bench/compare.py --tier llm --passes 1 # a quick look python3 tools/memory-bench/compare.py --tier llm --only graphiti # one engine, with BENCH_STATE reused ``` It rewrites only the LLM section of this page and needs no Leteo binary. With `--only` and a reused `BENCH_STATE` the other engines keep their earlier rows and their own run dates. It rewrites this page's generated block and prints the harness output it came from. It needs stock `python3`, plus whatever the engines it should measure need: `engram` on `PATH` (or `ENGRAM_BIN`), `uvx` for basic-memory, `npx` for server-memory, and network access the first time for the packages and the embedding model. An engine whose prerequisite is missing is skipped and the block says why. `bench_cost.py` additionally needs `ENGRAM_SRC`, Engram's source tree, for the session-start hook script that is not part of Engram's binary; without it that step is skipped and the block says so. Set `BENCH_STATE` to reuse a scratch directory instead of a fresh temporary one. ## Caveats - **The corpus is synthetic.** It is held out from the ratchet, so the ratchet does not tune against it, but its queries were still written knowing how Engram and Leteo search. Questions real agents asked would be a stronger test. - **The engines are not the same kind of thing.** Engram and Leteo are memory stores for agents, basic-memory is a notes system with semantic search, and server-memory is a knowledge graph with a substring filter. Each is scored on retrieving the memory a question is about, which is the job of the first kind and a side use of the others; a low row says the tool is not built for this question, not that it is a bad tool. - **Write paths differ.** Each engine gets the title, content and type through the closest thing its own write path accepts, so what is indexed is not identical across engines. One pair of distractors shares a title within a project: Engram folds them into one observation, and the external engines store the second under a suffixed name rather than lose it. - **Per-kind rows have few queries.** A kind with a handful of queries moves by a whole rank on one answer; read the overall row and the kind counts together, and treat a per-kind lead of one query as noise. - **Precision is measured only on unanswerable questions.** The no-answer precision counts the replies to questions the store cannot answer that came back empty or carried a caveat; it does not measure whether the results an engine does return are the right ones. The latency, reply-size and no-answer tables cover Engram and Leteo only: the external engines' time includes process and model start-up the others do not pay. - **The LLM tier runs on a small local model.** Every figure in that section was produced with the models it names, not the hosted models these projects are built and tuned around, and the prompts, entity types and defaults were left as shipped. mem0 was installed as `pip install mem0ai` does, which leaves its optional keyword-search and language-model extras out, and it says so at start. Read those rows as the engine on a local model, not as the engine at its best. - **A pass is a draw.** The spread across passes is the variation of one configuration, with a handful of passes; it is not a confidence interval, and rows with overlapping ranges are not separated by this run. - **One machine, one day.** Timing is printed and never gated: it does not transfer between SQLite builds, and ranking does. The ranking numbers transfer better than the milliseconds. ## Related - [`tools/README.md`](../tools/README.md) — the harness, and the quality ratchet that keeps Leteo from regressing on the same corpus. - [`NOTICE`](../NOTICE) — the Engram attribution, unchanged by this page.