Long-term memory for AI agents

MUSTER

Read the order, don’t extract it.

MUSTER detects the structure a store already records, then matches retrieval and context assembly to it. No language model builds or grows the memory.

pip install muster-memory

Score against the time to build

paper Tables 7 and 15
01 · Results

The highest mean score across six settings.

All six settings

paper Table 7

LoCoMo, under both answer prompts

GPT-4.1-mini reader · paper Table 3

LoCoMo-Refined, three readers

official judge · paper Table 3
LoCoMo and LoCoMo-Refined as a table, with LM calls (paper Table 3)

02 · Cost

Seconds to build. A fraction of the read cost.

Memory usually costs one of two ways: an LLM extracts it when you write, or the model reads everything when you answer. MUSTER stores the text as is and fits its read to the structure.

Building one 10M-token conversation

paper Table 15 · build time as run, log scale

Reading: cost per 1,000 questions

GLM-5.3-Flash and GPT-6 Luna on MemoryAgentBench, LoCoMo-Refined and BEAM-10M · list price · paper Appendix D

03 · How it works

Detect the structure. Retrieve by it. Assemble in order.

Most stores already record their structure: logs number their lines, example banks separate their records, conversations keep their order. MUSTER measures that structure instead of paying an LLM to rebuild it, and fits the two steps that decide an answer to it: what to retrieve, and in what order to show it.

no model discriminative: one query embedding, one rerank generative: the reader, one call per query nothing is written back

What it sets

paper Figure 3A · Section 3.2
What the rule sets, by branch
SettingNumbered logserial share ≥ 0.80Record storerecord share ≥ 0.90Proseotherwise
Unitone record, its serial strippedthe benchmark’s chunk size, cut so no record is splitthe benchmark’s chunk size
Parentthe record’s slot: entity and attributeeight units, halved until at least ten parents remain
Orderthe serialnone claimed
Floorsdense, BM25, parent graph2, 0, 84, 3, 3

Checked in this order: a numbered log first, then a record store. One pass over the bytes, no model, no labels, no candidate runs.

What detection measures, the three parts' effect, write-time or read-time memory

What detection measures

paper Figure 2 · 14 MemoryAgentBench stores

All 14 stores, with the branch each took

Write-time memory or read-time memory?

paper Tables 15 and 6
04 · Quick start

One file. No language-model call to build or grow it.

  • Retrieval runs on your machine. The first search downloads BGE-M3 and its reranker once, and your app keeps its own answer model.
  • The store measures its own structure as it grows (muster.explain(store.head().plan) shows what it chose) and keeps every word.
  • Agent frameworks connect through muster.integrations, with openai_tools for the OpenAI Agents SDK, langchain_tools for LangChain and langgraph_node for LangGraph (integration docs).
  • The app guide shows where recall and remember go in an app you already run, with examples.
More

Where the lead comes from, reproduction and questions.

Retrieval and assembly lead. Matching them to the structure adds the rest.

Step explorer

MemoryAgentBench, GPT-4o-mini reader · paper Table 2
Overall

Against the other systems

MemoryAgentBench Overall · paper Tables 1 and 2
Every competency, every system this reader reads (paper Table 1)

Inspect the rule, contexts and released results.
The rule’s cuts and the library’s contexts, against the published runs
muster verify cuts --data data_root        # the rule's cuts, store by store
muster verify contexts --data data_root    # the library's contexts, question by question
The reproduction gate
CheckResultEvidence
Detection on the fourteen MemoryAgentBench storestwelve exact; the two FactConsolidation stores take the numbered-log branchstage0_derive.md
Rendered contexts, BEAM 100K, 1M and 10M and LoCoMo14 of 14 files sha256-identicalstage0_tier0.md
Every context the MemoryAgentBench board read5,439 of 5,439 per-question hashes equalstage0d_render.md
CPU retrieval replay, BEAM-100K at 20 units400 of 400 contexts byte-identicalstage1_beam100k.md
MemoryAgentBench board, re-scored from its per-cell results57.52 / 60.92 / 64.71, all 45 values equalrescore_mab.md
BEAM main table, re-scored from its judge filesevery score equalrescore_beam.md

The benchmarks’ templates, judge prompts and scorers are fetched from their own repositories at pinned commits. Released bundles have SHA-256 manifests and recorded per-question context hashes. Offline re-scoring uses the saved answers and judgments.

Questions people ask first.

Does it need a language model at all?

Not before the first query. Detection, unit cutting, embedding and BM25 are the whole write path. A query uses one reader call, like any retrieval system.

Which stores does the rule recognise?

Three kinds: numbered logs, record-delimited banks (conversations one turn per record, example banks one example per record) and prose, the branch for everything else. The rule names the branch it took, so you can see why it chose a unit. The library also recognises consecutive serials written as Step 12:, #12 or (12) on short record bodies. Library docs gives the post-paper check and its exact conditions.

What if my store already has Mem0 memories?

Keep them. Mem0’s memories, one per line in write order, read as a numbered store, and MUSTER reads them beside the conversation under the same rule: 73.1 on BEAM, against 70.8 for Mem0’s own search at the same context.

Which embedder and reranker?

BAAI/bge-m3 and BAAI/bge-reranker-v2-m3 by default, both local.

Can I run it without a GPU?

Detection, yes: it reads only bytes, and MemoryAgentBench’s 14 stores take 3 seconds. The retrieval path embeds the store once with bge-m3; a CPU-only configuration is part of the reproduction gate.

Where do the numbers on this page come from?

Every result is a cell of the paper (v219I) or is computed from one. The cells live in one data file, checked against the tex source cell by cell before the page is built; the reproduction results link to their gate files.

Abstract

An AI agent’s memory stores differ in the structure they already record. Logs number their lines, example banks separate their records, and prose does neither. RAG keeps every word and can score well after heavy tuning to a dataset, but the tuning does not generalize. Model-built memory scales to long histories but is costly to build and can drop evidence. Agents need an autonomous strategy that is cheap to build and leaves little to tune. MUSTER detects each store’s structure and builds memory from it. Two byte statistics, the shares of numbered lines and of text in records short enough to keep whole, set how a store is cut, grouped and ordered, with no model, labels, queries or candidate runs. MUSTER matches retrieval to that structure, which sets how dense, lexical and parent-graph channels split the slots. It assembles the context in stored order, keeping the newest version of each fact where an order is recorded. One rule, set on MemoryAgentBench, configures LoCoMo and BEAM unchanged. On MemoryAgentBench it is the strongest retrieval and memory system at the benchmark’s reader (57.5 against 43.6). On LoCoMo it is the strongest row under both answer prompts (86.04 and 93.46) with no generative call before the answer, where the strongest other system makes 9,398. On LoCoMo-Refined it matches that system under the official evaluation (77.57 against 75.33) and leads it by 8.5 points with a reasoning reader. On BEAM, from 100K to 10M tokens, it matches the strongest system we compare at equal context and has the highest mean with an open-weight reader at 9.7K tokens. It builds a 10M-token memory in 77 seconds, where model-built memories take hours. Read beside a model-built memory, it averages 73.1 on BEAM at 19.5K tokens, above either store alone and every system at that budget. MUSTER keeps each store as written and re-derives its configuration in seconds as the store grows.

Citation

BibTeX

Paper and code are available below.

Paper: MUSTER: Top-Ranked, Self-Configuring Agent Memory That Knows a Log from a Novel and Retrieves Each by Its Structure.

Read the paper PDF. The arXiv identifier will be linked when the paper is announced.

Code is Apache-2.0 with a NOTICE file. Benchmark content keeps its own license. The evaluation releases carry BEAM text under CC BY-SA 4.0 and LoCoMo/LoCoMo-Refined text under CC BY-NC 4.0 with attribution and scope in each bundle.