DEV Community

Cover image for Best Open-Source AI Agent Memory Tools (Ranked by What They Guarantee)
Statewave
Statewave

Posted on

Best Open-Source AI Agent Memory Tools (Ranked by What They Guarantee)

The best open-source AI agent memory tool is the one that guarantees the properties your system depends on: a self-hostable runtime, deterministic retrieval, provenance back to source events, and a permissive license. Ranked on those four, Statewave leads, ahead of Cognee, Mem0, Graphiti, and Letta.

We checked the LICENSE file and README of every project below, reading the repository rather than the landing page. That produced the finding this post is built on: two of the four alternatives most often listed as self-hostable memory servers do not ship that from the repo people link to.

This post ranks by capability, not by adoption. Adoption tells you what other teams picked last year. Capability tells you what will hold when your agent is in production.

Disclosure: we build Statewave. Every claim below about another project is quoted from or linked to that project's public repository, so you can check each one yourself.

What makes an agent memory tool "best"?

Four properties separate a memory runtime from a fact store with a vector index bolted on. Every ranking below is scored against these.

Self-hostable as the actual product. Not a client library that calls someone else's cloud. When data cannot leave your infrastructure, this is the first filter, and it eliminates more tools than teams expect.

Deterministic retrieval. The same subject, task, and token budget returns the same context. Without this, you cannot regression-test memory, and you cannot explain why two identical requests produced different answers.

Provenance. Every compiled fact traces back to the raw event that produced it. When someone asks why the agent said something about their account, that has to be a query rather than an investigation.

Permissive license. Apache-2.0 or MIT, with no source-disclosure obligation and no seat-count trap. All five here pass this one.

Which open-source memory tools are worth shortlisting?

Self-hosted product Deterministic retrieval Provenance License
Statewave Yes, single service Yes, documented contract Yes, per memory Apache-2.0
Cognee Yes Not advertised Graph lineage Apache-2.0
Mem0 Library and self-hosted server; managed platform separate Not advertised Not surfaced in public docs Apache-2.0
Graphiti Yes, library plus a REST/MCP server Not advertised Edge validity dates Apache-2.0
Letta Agent runtime, not a memory layer Not advertised Not surfaced in public docs Apache-2.0

1. Statewave

Statewave
Statewave is a memory runtime rather than a memory library. It records raw events as append-only episodes, compiles them into typed memories with confidence scores and validity windows, then assembles a ranked, token-bounded context bundle on demand. Start the server first with npx @statewavedev/statewave, then talk to it from the Python SDK (pip install statewave), which is a client rather than the runtime:

from statewave import StatewaveClient

with StatewaveClient("http://localhost:8100") as sw: sw.create_episode(subject_id="user-42", source="chat", type="message", payload={"text": "Alice asked about pricing tiers"}) sw.compile_memories("user-42") print(sw.get_context("user-42", task="answer pricing", max_tokens=1000).assembled_context)

It leads on all four criteria for one architectural reason: the expensive work happens at compile time, not query time. The same (subject_id, task, max_tokens) returns the same bytes against the same compiled state, which is what makes retrieval regression-testable. Every memory returns source_episode_ids, so provenance is a field rather than a feature request. Storage is Postgres with pgvector and nothing else, so self-hosting is one command rather than an infrastructure project: npx @statewavedev/statewave, or git clone plus docker compose up -d if you want the compose file in your own tree.

Where it costs you: compiled bundles are denser than plain fact-store lookups, so a single-hop query spends more tokens than it would against a flat key-value store. For workloads that are all single-hop and cost-sensitive, that trade is not worth it.

Best for: teams that must self-host and must be able to prove why a fact surfaced. Read the ranked retrieval and provenance model for how the audit chain works.

2. Cognee

Cognee
Cognee builds a self-hosted knowledge graph with ontology grounding, combining vector embeddings with graph reasoning. It ranks second because it genuinely self-hosts and the graph gives you real lineage between entities.

It ranks below Statewave on determinism, which is not advertised as a contract, and on retrieval shape: graph traversal answers "how is Alice connected to Acme" better than "what is the ranked context for Alice under a 1,000-token budget."

Fits domains where the relationships between entities are the product.

3. Mem0

Mem0
Mem0 offers the shortest path from zero to an assistant that remembers a user, with an add / search / update / delete surface that is four calls wide. The open-source library is Apache-2.0.

It ranks third on our criteria rather than on quality, and not because it is library-only, which it no longer is: the repository ships a self-hosted Docker server with a dashboard, per-user API keys and a request audit log alongside the pip-installable library. The split that remains is between that open-source stack and the managed platform, and the README is explicit that its published scores "reflect Mem0's managed platform, which includes proprietary optimizations not available in the open-source SDK." The load-bearing gap for our criteria is retrieval composition: the public documentation still does not break down how the vector store, graph layer and reranker compose at retrieval time. If you need to explain a specific retrieval to an auditor, you will be reading source.

Fits consumer-facing personalization where speed to first result matters more than explainability.

4. Graphiti

Graphiti
Graphiti is a temporal context graph engine that tracks when facts became valid and invalid, which is a real answer to the stale-memory problem.

The ranking note here is the one that surprised us. The repository most lists point to for this project is getzep/zep, and its own README states it is not the product: it holds example code and integrations for Zep Cloud, which is managed. Graphiti is the self-hostable open-source component, and it is more than a library: the repository ships a FastAPI REST service under server/ and an MCP server under mcp_server/, with a prebuilt zepai/graphiti image published on each graphiti-core release. A team whose requirement is "runs in our VPC" does not have to write that service. What it still writes is the retrieval contract, because what Graphiti returns is graph queries rather than a ranked, token-bounded, deterministic bundle.

Fits teams that want temporal graph semantics and are willing to build the retrieval contract themselves.

5. Letta

Letta
Letta carries the MemGPT lineage and is the most capable system here at the thing it actually does, which is running agents. It ranks last only because it is answering a different question: it is an agent runtime that owns the reasoning loop, the tool calls and the context management.

The second repository note: that README states the repo is the legacy server and active development has moved to the Letta Agent repo. Adopting Letta means replacing your orchestration, not adding memory to it.

Fits teams with no agent stack yet who want the whole thing in one decision.

Which one should you pick?

Pick by the constraint that is load-bearing for you, in this order:

  1. Data cannot leave your infrastructure. Statewave, Cognee, or Graphiti. Mem0's open-source stack qualifies; its managed platform does not.
  2. You need to explain retrievals after the fact. Statewave. Provenance and deterministic ranking are the two properties that make this answerable.
  3. Relationships between entities are the product. Cognee or Graphiti.
  4. You have no agent framework yet. Letta.
  5. You want something working this afternoon. Mem0.

One honest note on all of the above, including ours: no neutral, third-party benchmark covers all five on the same task with the same corpus. Every comparison in this category, this one included, is vendor-shaped. Run the eval on your own data before committing.

When the first two constraints are the binding ones, Statewave is Apache-2.0 and boots with one command: npx @statewavedev/statewave.

Top comments (0)