Self-hosted · Belief memory · Open source

mem01 ( agent memory )

Memory that
stays correct

Self-hosted memory for AI agents that updates when the truth changes — so they don't keep acting on yesterday's facts.

$ docker compose up -d --build

demo · location_updatelive

bag of facts

  • ×User lives in New York City
  • ×User moved NYC → San Francisco

Both active. Agent invents a cover story.

mem01 · recall (now)

  • User lives in New York Cityout of prompt
  • User lives in San Franciscoactive

Default: one truth for the agent.

mem01 · history / include_history

“Where did we live before SF?”

  • [active] User lives in San Francisco
  • [superseded] User lives in New York City

Previous facts stay in the DB and can be recalled on purpose — labeled so the agent never confuses past with present.

The problem

Append-only
becomes wrong

Users change their minds. Agents that remember everything end up remembering the past louder than the present.

01

Facts only grow

Most memory layers ADD. Preferences flip, jobs change, cities move — the old fact still sits in the prompt.

02

Agents reconcile

When NY and SF both retrieve, the LLM covers the mess. Looks fine in a demo. Fails in production.

03

Quality decays

Token budgets fill with contradictions. Cost climbs. Correctness slides the other way.

Benchmarks

LoCoMo
v0 → v0.2

Self-run on LoCoMo-10 (1,540 questions) with the same open eval style as mem0's public harness. Same models for extract, answer, and judge: gpt-4o-mini.

v0 · baseline

31.7%

488/1540 correct

v0.2 · current

77.9%

1200/1540 correct · +46.2 pts

Multi-hop

cat 1
v0
13.8%
v0.2
83.3%

Temporal

cat 2
v0
39.6%
v0.2
74.5%

Open-domain

cat 3
v0
12.5%
v0.2
74.0%

Single-hop

cat 4
v0
36.9%
v0.2
77.9%

Full methodology, models, and caveats on the research page — including why this is not a copy of every published headline number.

Research details

Compare

Why mem01

mem0 wins on cloud polish. Zep wins on graph depth. mem01 wins when you need correct beliefs under evolution, self-hosted, lean recall.

Capabilitymem01mem0Zep
Belief lifecycle (supersede / invalidate)
Stale facts retired on conflict
Recall without LLM by default
Token-budgeted context packing
Self-hosted first (your Postgres)
Light model — no full knowledge graph
Open-source MIT core

● yes · — partial · × no · from public docs / positioning

vs mem0

The append problem

They do well: Best-in-class ease and fact extraction.

Gap: After NYC → SF, search often returns both. Store stays dirty; agent covers it.

Why mem01: SUPERSEDE retires NYC. One active belief. Product suite: mem01 5/5 vs mem0 2/5 on conflict cases.

vs zep

Graph power, heavier path

They do well: Temporal graphs, enterprise packaging, multi-hop context.

Gap: Graph materialization trades simplicity and cost. Overkill for “two cities in the prompt.”

Why mem01: Belief ops + budgeted packing. Evolution correctness without a full temporal graph.

vs diy

Vectors alone

They do well: You control embeddings and filters.

Gap: No extraction policy, no conflict model, no packer. Every agent reinvents hygiene.

Why mem01: remember / recall / correct / forget over Postgres. Lifecycle is the product.

Use cases

Where we have
leverage

Not every product needs belief memory. These are the jobs where staleness, scopes, and self-host actually change the outcome.

01

Coding agents that share project memory

Why here · Stack, monorepo tools, and “we use light mode now” change over a repo’s life. Append-only memory keeps old toolchains in the prompt.

How mem01 · Scope by user + project. SUPERSEDE when the project switches package manager, model, or conventions. Cursor / Claude / custom agents hit the same HTTP API.

Skip if · One-shot scripts with no shared state — skip a memory layer.

02

Long-running agents when user state flips

Why here · Location, job, plan tier, and preferences are single-slot truths. Stacked facts force the model to guess which one is current.

How mem01 · Default recall is active-only. Opt into history when the question is temporal (“before SF?”) without poisoning every turn.

Skip if · Pure multi-hop “who works with whom across orgs” — a temporal graph fits better.

03

Self-hosted / data-boundary teams

Why here · Agent memory often includes code context, internal names, and PII. SaaS memory is a non-starter for many shops.

How mem01 · docker compose · Postgres + pgvector on your network. Same remember / recall shape as a managed API, under your keys.

Skip if · Zero-ops hobby demos that only need a cloud key and never leave the laptop.

04

Multi-tool agents without memory cross-talk

Why here · One user, several agents: a coder, a support bot, a research runner. Shared user prefs should travel; agent scratch should not.

How mem01 · user / project / agent / session scopes. Share what’s meant to be shared; isolate the rest.

Skip if · A single chat window with no second agent or project boundary.

System

Three calls.
One truth.

01

remember

Send messages. One extraction pass classifies belief ops: ADD, UPDATE, SUPERSEDE, INVALIDATE, MERGE — then writes to Postgres + pgvector.

02

beliefs evolve

New truths replace old ones. Superseded and invalidated beliefs stay for audit, drop out of active recall.

03

recall

Embed the query, filter by scope, apply conflict rules, pack to a token budget. No LLM on the hot path.

Product

Infrastructure,
not a chat toy

A1

Belief lifecycle

ADD · UPDATE · SUPERSEDE · INVALIDATE · MERGE — not just store another string.

A2

Zero-LLM recall

Vector search, scope filters, conflict rules, token packer. Fast hot path.

A3

Token discipline

Budgeted packing keeps memory blocks tight so agents stay cheap.

B1

Postgres + pgvector

Production store in dev and deploy. Neon or any Postgres with vectors.

B2

Self-hosted first

docker compose up. Your network, your keys, your compliance boundary.

B3

Agent scopes

User, project, agent, session. Share what should be shared; isolate the rest.

API

Two endpoints
to ship

HTTP + Python SDK. remember extracts beliefs; recall returns a budgeted context string. Also correct and forget when humans need to fix the model.

shell:8080
# remember
curl -s localhost:8080/v1/remember \
  -H 'Content-Type: application/json' \
  -d '{
    "user_id": "user_1",
    "messages": [
      {"role": "user", "content": "I live in San Francisco."}
    ]
  }'

# recall — no LLM on this path
curl -s localhost:8080/v1/recall \
  -H 'Content-Type: application/json' \
  -d '{
    "user_id": "user_1",
    "query": "Where does the user live?",
    "max_memory_tokens": 800
  }'

FAQ

Straight
answers

Same job — long-term agent memory — different model. mem01 is belief-centric: lifecycle ops, conflict filtering, and self-hosted Postgres as the default story.

No. v1 avoids full temporal graphs. You get validity windows and supersede chains without multi-hop search on every request.

Docker Compose: FastAPI + PostgreSQL with pgvector. Point OPENAI_API_KEY (or compatible) at extraction/embeddings. Data stays in your DB.

Yes by default. Recall is embed → search → filter → pack. Writes may call an LLM once per batch for extraction.

On conflict and staleness — location/job/preference flips — not every public benchmark. Product suite: mem01 5/5 vs mem0 2/5 when old values must not reappear.

No. Default recall is current-only so agents stay correct. For “before SF?” or medical audit, call recall with include_history=true, or POST /v1/history for a full timeline. Past beliefs stay labeled, not mixed in as active truth.

Get started

Ship agents that
remember right

Clone the repo. Compose up. Call remember and recall.

Start on GitHub