Skip to content

About

A two-track benchmark for agent memory systems: source discovery kept apart from answer sufficiency, in Spanish and English.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

100 Commits

Folders and files

Repository files navigation

memory-bench

A two-track benchmark for agent memory systems, in Spanish and English.

Most memory benchmarks collapse the two tracks. A system can surface the right document and still answer badly, or answer well from the wrong source and score as correct. Separating them makes it possible to say which half is failing.

Track R — source discovery. Which conversation a system finds for a question. This is not memory quality: a system can return the right conversation and the superseded version of the fact.

Track A — answer sufficiency. Whether the evidence a system returns, under a token budget identical for every system, lets one fixed reader answer the question. Implemented in a later plan.

What no published benchmark does today, and what this one is for: a non-English corpus, the two tracks kept apart, and operability scored with evidence. Operability scoring is not implemented either: the capability matrix and its evidence come with a later plan, as Track A does.

What this release is

Track R and a lexical baseline over a six-conversation fixture. It is not yet a validated comparative standard: no rival system has been measured, Track A and operability are unimplemented, and the scoring thresholds do not exist — the design requires deriving them from a baseline pilot and committing them before any scored run, precisely so they cannot be chosen once the results are known. Beating this floor establishes that a system is better than untuned lexical retrieval, and nothing more.

docs/superpowers/ holds the design record and the build plan that produced this. They are published so the reasoning behind every choice can be attacked, and they are historical: neither was revised as the code corrected it, and each carries a banner saying where it diverges. The normative rules a result cites are in docs/spec/revision-1.md, and every manifest records the revision it was produced under as spec_revision.

Specification: docs/spec/revision-1.md. Design record: docs/superpowers/specs/2026-09-17-memory-bench-design.md. Known limitations: TODO.md.

Run the baseline over the fixture corpus

uv run membench run \
  --adapter baseline_fts5 \
  --corpus corpora/fixture/corpus.jsonl \
  --questions corpora/fixture/questions.jsonl \
  --out results/fixture-baseline

The floor is the point: SQLite FTS5 with no model, no embedding and no extraction. Every sophisticated system is measured by how far above it lands.

This fixture is six conversations, and it is a smoke test, not a result. It prints recall_any_at_5 and recall_any_at_10 of 1.0000, and those two columns are saturated, not perfect: recall@k only discriminates while k is far smaller than the corpus, and a lexical query that ORs its tokens matches almost everything in six documents. Only recall_any_at_1 and the reciprocal rank separate anything here. Every fixture question carries one labelled conversation, so the recall_all_* columns repeat the recall_any_* ones exactly, and the abstention line reports that the set holds no unanswerable question rather than a rate it did not observe. A corpus this benchmark reports recall@10 on has to be large enough for the number to mean something, and a saturated column is reported as saturated rather than as a tie.

Each metric line ends with the number of questions its mean was taken over, because the seven means are not taken over the same ones. A recall_all_* is undefined for every question carrying more distinct labels than that depth can hold, so on a set of mostly multi-label questions its mean can rest on a handful of rows while the recall_any_* beside it rests on all of them. Both numbers are honest; printed side by side without their populations they invite the reading that they are comparable, and a mean whose denominator is stated only in a docstring is not a mean this benchmark publishes. The population is the questions that were answerable and whose run was scorable, which is decided by the question set and the run before any system is asked - so no system can change a count by changing what it returns.

Writing an adapter

The contract is membench/memory_adapter.py, and it is the whole of what a system under test has to satisfy: setup, ingest, query, teardown, plus the construction rules in ADAPTER_CONTRACT_VERSION above them. Read it before writing code; the docstrings there are normative in a way this section is not.

Registration is unbuilt. There is no plugin mechanism today: the harness constructs adapters from ADAPTERS, a hard-coded dict in membench/build_adapter.py, so a foreign adapter reaches the harness by adding an entry to that dict in a fork or a patch. That is the honest state, not a recommendation — what the mechanism should be is a design decision worth making with two real adapters in hand rather than one. TODO.md records it.

What the harness requires of an adapter beyond the method signatures:

  • Construction. The constructor must be bindable by inspect.signature(...).bind(workspace, **options): the workspace Path first, then every option from --adapter-options as a named parameter. The binding is checked before anything is written, and an option the constructor does not accept is a hard failure rather than an ignored setting — a manifest that lists a setting which had no effect describes a run that did not happen. Options must be JSON-representable, since they are read from a JSON file and recorded verbatim in the manifest.
  • The workspace. The adapter owns <out>/workspace/, exclusively, and creates nothing outside it. The harness creates the directory, empty, before constructing the adapter, and never writes inside it: the run's frozen artifacts land in the parent.
  • Source ids. source_ids are matched verbatim against the corpus conversation_id. Exactly one leading synthesis/ is forgiven, for systems that namespace derived records; nothing else is normalised — not case, not whitespace, not any other namespace. An id that does not match after that one removal is scored as a miss.
  • The k slot rule. k bounds ranked source conversations, not pieces of evidence: each distinct conversation id spends one slot in the order given, deduplicated across the ranking, an unsourced hit spends one too, and everything past the k-th slot is discarded before scoring. Cite the conversations that actually support a memory, best first — a shotgun citation buys nothing and can push the real answer out of the budget.
  • Teardown. It is called once however the run ends, including after a failure part-way through ingest, so it must tolerate a system that was never fully set up.

The token budget, and what a token is

Track A gives every system in a run the same text budget, and the budget is counted by membench/count_tokens.py: a token is a whitespace-separated run of characters. That is deliberately not a model's tokenizer. A budget has to mean the same thing for every system under test and for a reader checking the result years later, and no model's tokenizer is stable across versions; what this definition buys is that every system is charged identically for the same text.

What it does not buy is fairness between writing systems, and the limit is stated here rather than discovered later. The counter is only meaningful for whitespace-delimited scripts. Spanish and English, the two this benchmark measures, split identically per whitespace run. An unsegmented script does not: a whole Chinese or Japanese sentence costs one token, so a budget that binds in Spanish is effectively unbounded there. A run of punctuation is billable while carrying no content. A corpus in an unsegmented script needs a different definition, and using this one would hand that system a budget nobody else got.

Track R passes no budget at all — it scores which conversations were found, not how much text came back — so nothing on this page's numbers depends on it yet.

The result schema

Every line of raw.jsonl is one question's Track R result, versioned by schema_version so a row can be read correctly years after the run directory around it is gone.

  • schema_version: The raw.jsonl row format this row was written under.

  • question_id: Which question this is.

  • strata: The question's tags, for descriptive breakdowns only.

  • ranked_sources: One entry per slot the system spent, best first; null marks a slot spent by evidence that carried no source conversation.

  • applicability: "scored", or "not_applicable" when the system returned evidence and none of it, on any question in the whole run, carried a source conversation - which leaves the six recalls and reciprocal_rank null. It is a property of the system, not of one answer, so every row of a run carries the same value: there is no mixed run, and a response that came back without provenance scores the misses it earned rather than leaving the denominator. The exemption is architectural, for memories that cannot name a source, so it takes evidence to earn: a system that returned nothing at all searched and failed every time, and is scored the zeros that records. depth and truncated are still reported: they describe the request and the ranking, not the score.

  • answerable: false exactly when the corpus deliberately cannot answer this question, which it states by labelling it with no answer conversation at all. It is a property of the question, identical for every system measured on the same set, so no system can move a row in or out of a denominator by changing what it returns. Every metric below is null on an unanswerable row.

  • answer_label_count: How many distinct conversations this question is labelled with, 0 when it is unanswerable. It is what makes an empty recall_all_* cell readable: that cell is null either because the run never looked that deep, or because the depth cannot hold this many distinct labels. depth settles the first and this settles the second; without both, a consumer cannot tell which happened, and a row that cannot say which of two things it means is not a row this benchmark publishes. Distinct is the operative word, and it is the count the metric itself applies: a question labelled with the same conversation six times is satisfied by one rank slot.

  • depth: The k this run requested and observed; the six recalls and reciprocal_rank are measured at that depth and mean nothing without it.

  • truncated: true when the system offered more slots than k and the ranking was cut, so a reader knows a missing later source is the harness's choice, not the system's. It means cut at k, and nothing else: an adapter that dropped hits from the end to fit a token budget also cut its ranking, and this field still reads false. Track R passes no token budget, so the two cannot be confused today; Track A will need a signal that says which cut fired.

  • recall_any_at_1: 1.0 when at least one labelled answer conversation ranked first.

  • recall_any_at_5: 1.0 when at least one appeared in the first five, null when the run never looked five deep.

  • recall_any_at_10: 1.0 when at least one appeared in the first ten, null when the run never looked ten deep.

  • recall_all_at_1: 1.0 when every labelled answer conversation ranked first, which only a question carrying one distinct label can do, and null on a question carrying more than one: a single slot cannot hold two conversations, so that depth observed nothing about whether every label was found. It is not 0.0. A perfect system returning all three labels of a three-label question in rank order and a lazy one returning only the first would score that zero alike, and the mean of those zeros is the share of single-label questions in the question set - a property of the corpus, not of the system, and not comparable across sets.

  • recall_all_at_5: 1.0 when every one appeared in the first five, null when the run never looked five deep, or the question carries more than five distinct labels and five slots could not hold them.

  • recall_all_at_10: 1.0 when every one appeared in the first ten, null when the run never looked ten deep, or the question carries more than ten distinct labels.

    Distinct in all three, because that is what the metric decides on. A question naming the same conversation six times is satisfied by one rank slot, so it behaves as a single-label question and is scored at every depth

    • apply these rules with answer_label_count, which is the distinct count, not with the length of the label list in the question file.

    A question may be answered by more than one conversation - LongMemEval labels answer_session_ids, plural, and its multi-session questions are precisely the multi-hop ones - so recall is published twice and never averaged into one number. any asks whether the system found a way in; all asks whether it found the whole answer. A system that surfaced one of the three conversations a question needs is a hit for the first and a miss for the second, and it is neither of those things alone. With a single labelled conversation the two coincide by construction, which is why widening the label moved no number this repository had already published.

  • reciprocal_rank: 1 / rank of the best-ranked labelled answer conversation within depth, 0.0 when none of them is in the observed ranking. Best-ranked is the published rule. The worst-ranked convention is a different measurement - how far a reader must go to hold the whole answer - and choosing between them silently would change every published number without a version saying it changed; if that measurement is ever wanted it arrives as a new field with its own name.

    The name is unqualified, and the depth is not: this is reciprocal rank at depth, which the CLI prints as reciprocal_rank@k=<k>. A label ranked eleventh is 0.0 at k=10 and 0.0909 at k=20, so rows from runs at different depths are different metrics under one field name. Rows are made to be concatenated across runs; group by depth before averaging this field, or the mean silently mixes the two. The six recalls carry their depth in their own names, so only this field needs the rule.

    All seven are also null for a question the corpus deliberately cannot answer, which carries no answer conversation at all. That is not the same as the others: the run may have looked as deep as it was asked to and the system may have provenance, and the metric still has no target to be right or wrong about.

    So an empty cell has four possible causes, and the row carries what separates them. The run never looked that deep: depth is below the metric's depth. The system has no provenance anywhere in the run: applicability is not_applicable. The question has no answer: answerable is false. The depth cannot hold the question's distinct labels, which only affects recall_all_*: answer_label_count exceeds the metric's depth. Read a null against all four before concluding which case it is; none of them is a miss, and none is ever averaged as a zero.

  • abstained: true when the system returned nothing at all for this question, false when it returned something, and null on an answerable row, where the question does not arise. Evidence that names no source is not abstaining: the system answered, and it answered without provenance.

  • seconds: Wall-clock duration of this single query.

  • evidence_texts: The evidence as returned, kept so a miss can be read. One entry per hit, not per slot, and not cut at k, so it is a different length from ranked_sources by construction: one hit citing three conversations spends three slots, and a hit whose slot was truncated away still has its text here. The two lists do not align positionally and must not be zipped.

Questions the corpus cannot answer

A question set may state that a question has no answer, by labelling it with none. Those rows are a separate population and they are reported separately: every metric is null on them, and what is measured instead is whether the system abstained - returned nothing at all. The CLI prints that as its own line, outside the metric block:

abstention: 1.0000 over 12 unanswerable questions

and, when the set holds no such question, as abstention: n/a, because a rate over nothing was not observed and 0.0000 would claim the system failed to decline questions it was never asked.

The abstention rate is computed for every run, including a run Track R has found not applicable - a system whose evidence never named a source conversation anywhere. Whether a system spoke or stayed silent is observable without any provenance at all, so the number is honest and withholding it would be the dishonest choice. The consequence has to be read deliberately: a system that answers every answerable question with unsourced text and declines the unanswerable ones prints n/a on all seven metrics and 1.0000 here, and that is not a good result. It is a system this track cannot score, beside the one observation that did not need provenance. The CLI says so on the line itself. A high abstention rate earns nothing and lifts nothing; it is only meaningful next to recalls that were actually measured.

The two populations are never merged, and the reason is arithmetic rather than taste. An unanswerable question has no conversation to find, so any number recorded for it is a number recorded for returning nothing. Scored as a miss it would punish the correct behaviour; scored as a hit it would hand a perfect recall to a system that answers every question with silence. Kept apart, a system that returns nothing on every question reports 0.0000 on every recall and 1.0000 on abstention, which is exactly what it did.

Names the plans still use

The plans in docs/superpowers/plans/ are frozen build records and were not revised as fields were renamed, so they name three things this harness no longer emits under those names:

  • index_bytes is now persisted_bytes, in the manifest's ingest block. It was renamed because it never measured a derived index: it stats everything the system persists, and FTS5 keeps a verbatim copy of the corpus.
  • recall_at_1 is gone. A question is labelled with every conversation that answers it, so recall is published as the pair recall_any_at_k and recall_all_at_k, at depths 1, 5 and 10. On a question with one labelled conversation, recall_any_at_1 and recall_all_at_1 both equal what recall_at_1 measured; the pair is never averaged into one number.
  • answer_conversation_id, singular, is now answer_conversation_ids on a question. A question file may still carry the singular key - a string, or null for an unanswerable question - but not both keys on one record.

Flags

  • --adapter (required): which system under test to run, by name.
  • --corpus (required): path to the corpus JSONL. Must exist.
  • --questions (required): path to the labelled question set JSONL. Must exist.
  • --out (required): directory to write the run's artifacts into.
  • --k (default 10): ranking depth requested and scored. It bounds the ranked source conversations, not the pieces of evidence a system returns: each distinct conversation id a hit cites spends one slot, in the order given, deduplicated across the whole ranking; a hit that cites nothing spends a slot too; and everything past the k-th slot is discarded before scoring. One memory citing five conversations therefore costs five of the k, which is why a consolidated-memory system should cite the conversations that actually support the memory rather than every one it was derived from. Must be at least 1; a manifest with a smaller or unbounded k than the run it describes is the one failure this benchmark cannot tolerate, so 0 or a negative value is refused before anything is written. A depth deeper than k was never observed, so the *_at_5 and *_at_10 recalls are written as null rather than as misses when k is smaller than they are.
  • --force: overwrite an existing run directory. Without it, a run refuses to touch a directory that already holds a manifest.json, so a frozen result is never silently replaced, and refuses a non-empty workspace/ with no manifest beside it, which is what a run that failed part-way leaves behind. Under --force the harness removes workspace/ and creates it again, empty, after every other check has passed and before the adapter is constructed, so a forced re-run ingests into an empty system like any other.
  • --adapter-options: path to a JSON object of options forwarded to the adapter's constructor. An option the adapter does not accept is refused before anything is written, rather than being silently ignored.

Licence

MIT.

About

A two-track benchmark for agent memory systems: source discovery kept apart from answer sufficiency, in Spanish and English.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages