Add GoodMemory adapter (LoCoMo / LongMemEval / BEAM)#18
Closed
hjqcan wants to merge 2 commits into
Closed
Conversation
GoodMemory is served over its HTTP bridge (Bun + SQLite, bearer auth). The
client duck-types Mem0Client's async interface (add/search/delete_user), so the
three runners select it via MEMORY_SYSTEM=goodmemory with no other changes.
- benchmarks/common/goodmemory_client.py: bridge client. add -> /memory/remember
with llm-assisted extraction; search -> /memory/recall-context mapped to
per-memory results with rank-descending scores so the cutoff slice measures
GoodMemory's own recall ranking.
- benchmarks/{locomo,longmemeval,beam}/run.py: MEMORY_SYSTEM switch.
- README: Option C quick-start (extractor + embedding required for
representative numbers).
… config - search() now sends strategy=hybrid so GoodMemory's semantic recall (embedding + BM25 + semantic-candidate union) activates; the bridge forces any non-hybrid strategy to rules-only, which cannot surface semantically-relevant facts. - README Option C: full reproducible config (extractor + embedding + recommended retrieval preset + in-memory storage), validated to surface query-relevant facts (4/4 cross-topic probes) end-to-end through the adapter.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add GoodMemory adapter (LoCoMo / LongMemEval / BEAM)
What this adds
A drop-in adapter so the benchmark suite can evaluate GoodMemory alongside Mem0.
GoodMemory is served over its HTTP bridge — a single-process sidecar (Bun,
bearer-token auth required by default). The new client duck-types the existing
Mem0Clientasync interface (add/search/delete_user), so the threerunners select it via an environment switch and are otherwise unchanged.
benchmarks/common/goodmemory_client.pybenchmarks/{locomo,longmemeval,beam}/run.pyMEMORY_SYSTEM=goodmemoryswitch at client init (identical 12-line block)README.mdNo new dependencies (reuses
aiohttp/aiolimiter). Runner logic, prompts,metrics, and output schema are untouched.
How to run
Start the bridge with the full recall stack, then point any benchmark at it:
The four bridge pieces all matter (see README Option C): a well-formed LLM
extractor, an embedding endpoint, the
recommendedretrieval preset(GoodMemory's semantic candidate union), and in-memory storage (its pure-JS
vector index needs no native libraries). Omitting any of them makes recall fall
back to a lexical floor and under-reports.
Design notes
add→POST /memory/rememberwithextractionStrategy: llm-assisted(the bridge defaults to a deterministic rules-only floor).
search→POST /memory/recall-contextwithstrategy: hybrid— thisactivates GoodMemory's semantic recall (embedding + BM25 + candidate union).
GoodMemory returns items already ordered by its recall ranking; the adapter
assigns rank-descending scores so the harness's
sorted(score desc)[:cutoff]slice measures GoodMemory's own ranking rather than reordering by a
memory-quality confidence (not a retrieval-relevance signal).
maxTokensissized from
top_k.delete_useris best-effort (export + per-memory forget); the runners donot call it.
x-goodmemory-*headers and a matchingscopebody object; the bearer token is the security boundary.Verification
adddrives real llm-assistedextraction,
searchround-trips mem0-shaped{memory, score, id}withnon-increasing scores,
delete_userround-trips) plus a deterministic unitcheck of the ranking/slicing map (
[1.0, 0.8, 0.6, 0.4, 0.2], honoredtop_k, distinct cutoff slices). All pass.probes surfaced the query-relevant fact at the top of recall in every case
(4/4: "what car" → the car fact, "dietary" → the allergy fact, etc.), with
routing.resolvedStrategy = hybrid.Requires a GoodMemory build whose bridge supports
GOODMEMORY_HTTP_BRIDGE_RETRIEVAL_PRESET. A full scored suite run (with theLoCoMo/LongMemEval/BEAM datasets and answer+judge model keys) is left to the
maintainers / a follow-up.
🤖 Generated with Claude Code