>_

Open Source Alternative to Mem0 for Claude Code [2026]

Robin||10 min
claude-codememoryopen-sourcekairn
Open source alternative to Mem0 for Claude Code memory - Kairn MIT licence, local SQLite FTS5 knowledge graph, MCP server, no API key, versus Mem0 cloud memory layer pricing and quotas, Claude Code auto memory built in, primeline-ai/evolving-lite

You searched for this because you saw a price. Fair enough. But the honest first answer is that you may not need either option, and no vendor is going to open with that.

Claude Code has memory built in, on by default, and it costs nothing. Whether you need more than that is a real question with a real answer, and it depends on one thing that has nothing to do with features.

$0Kairn, MIT licence, no account
$19-249Mem0 Platform, per month
1,000retrievals a month on Mem0's free tier
4rows where the free option loses

Check what you already have

Claude Code ships auto memory and it is on by default. It writes notes to itself as you work and loads them at the start of every session. Nobody selling a memory product will lead with this, and one of them says the opposite outright: Mem0's own Claude Code page opens with "Your agent forgets everything between sessions." That was true once. It is not true now.

What you actually get for free, and the limits are worth knowing precisely:

  • Memory lives at ~/.claude/projects/<project>/memory/, with a MEMORY.md index and topic files beside it.
  • The first 200 lines of MEMORY.md, or the first 25KB, whichever comes first, load at the start of every session. Content past that is not loaded at all.
  • Topic files do not load at startup. Claude reads them on demand when it needs them.
  • It is machine-local and per-repository. All worktrees of one repo share a memory directory, which matters if you run several sessions in parallel.
  • Claude does not save something every session. It decides what is worth keeping.

So the free baseline is real but narrow: local, per-repo, index-capped, and selective. If you have been running Claude Code for a month and never opened that folder, open it before you spend anything. My setup guide for built-in memory covers getting more out of it.

The question that decides this

Everything below reduces to one question: does your memory need to leave the machine? Sync across devices, a team sharing recall, a hosted dashboard - those are the things you cannot get for free, and they are the only things you cannot get for free.

What Mem0 actually gives you

Mem0 is a hosted memory layer with a real Claude Code integration, and it is worth describing accurately rather than dismissively.

The plugin installs from a marketplace in two commands and brings three things: an MCP server with nine memory tools (if the difference between a server, a skill and a hook is not obvious, that map is here), lifecycle hooks that capture at session start, user prompt, tool execution and session end, and a Mem0 SDK skill. The hooks are the part that matters. They mean capture happens without you asking for it, which is genuine work you would otherwise wire yourself.

It requires a Mem0 account and an API key beginning m0-, exported in your shell profile. Your memories live in Mem0's cloud.

Pricing from their own page:

PlanPriceAdd requestsRetrieval requestsProjects
HobbyFree10,000 / month1,000 / month1
Starter$19 / month50,000 / month5,000 / month1
Pro$249 / month500,000 / month50,000 / monthUnlimited
EnterpriseCustomUnlimitedUnlimitedUnlimited

The number to look at is retrievals, not adds. A retrieval happens when Claude pulls context, which on an active day is many times an hour. Context budget is the real constraint here either way, and I have written about what fills it. 1,000 a month on the free tier is roughly 33 a day. Mem0 also publishes an open-source edition separate from the Platform, so "Mem0" is not automatically the paid thing.

What the open-source route is

Kairn is MIT licensed and describes itself as a context-aware knowledge engine: a knowledge graph with context routing that decides what to load and how much. Storage is SQLite with FTS5, per workspace, in a local database.

The properties that matter for this comparison, from its own README:

  • No API key and no account. There is no service to sign up for.
  • Local. The database is a file in your workspace.
  • Offline. Its import commands are described as running at "$0 - no LLM calls, no network calls".
  • An MCP server. kairn serve exposes it to Claude Code the same way any MCP server connects.

I am writing this in a session with Kairn connected as an MCP server, so the tools are in front of me rather than something I read about. That is also the honest limit of my testing: one machine, one user.

This lives in primeline-ai/evolving-lite - the self-evolving Claude Code plugin. Free, MIT, no build step.

The comparison

Feature matrices are usually written by the person who wins them. This one has four rows where the free option loses, and they are the rows most likely to matter to you.

KairnMem0 Platform
Licence and priceMIT, freeFree tier, then $19 to $249 a month
Account requiredNoneMem0 account plus m0- API key
Where memories liveLocal SQLite file in your workspaceMem0's cloud
Works offlineYesNo
Monthly quotaNone1,000 retrievals free, 5,000 at $19
Sync across machinesNoYes
Team or shared memoryNoProjects, unlimited on Pro
SupportNone. Issues on GitHubEmail, Slack on higher tiers
Automatic captureYou wire the hooks yourselfLifecycle hooks included
Installpip install kairn-aiclaude plugin marketplace add then install
Claude Code integrationMCP serverMCP server, hooks and a skill

Where the free one loses

Taking the bold rows seriously, because a comparison that admits nothing is an advertisement.

No sync. Kairn's database is a file on one machine. Work on a laptop and a desktop and you have two unrelated memories. Mem0's cloud is the answer to exactly this, and there is no clever workaround that is not just "sync a SQLite file yourself and handle the conflicts".

No team. If three people should share what the assistant learned, a local file cannot do it. This is the same limitation wearing a different hat, and it is the strongest reason to pay.

No support. A GitHub issue is not an SLA. If your work depends on memory being up, you are the on-call.

Capture is not automatic out of the box. This is the one people underestimate. Mem0's lifecycle hooks mean things get remembered without you thinking about it. With Kairn alone, retrieval and storage are tools Claude can call, and whether it calls them reliably is on your configuration. Closing that gap is what my own hook layer does, and it is real work: primeline-ai/evolving-lite wires capture into session lifecycle events so it happens without being asked. That combination is the honest like-for-like, not Kairn on its own.

Which one should you pick?

Four questions, in this order
Have you opened ~/.claude/projects/<project>/memory/ yet? -> do that first
v
Does memory need to leave this machine? -> pay for the hosted one
v
Does a team need to share it? -> pay for the hosted one
v
Neither? -> the free local one, and keep the money

Solo, one machine, and privacy matters: the open-source route wins outright and it is not close. Nothing leaves your machine, there is no quota to hit, and the licence is MIT.

Two machines or two people: pay. I would rather say that than pretend a local SQLite file syncs.

Regulated data, or a client contract that forbids sending source context to a third party: the local option is not merely cheaper, it may be the only one you are allowed to use. Check before you assume.

Installing the open-source one

Three commands, then register it with Claude Code:

bash
pip install kairn-ai
kairn init ~/brain
claude mcp add kairn -- kairn serve ~/brain

kairn init creates the workspace and its local database. claude mcp add is the documented way to register an MCP server, and the -- separates the server command from the flags Claude Code parses. Confirm it connected with claude mcp list.

One install instruction you will find that does not work

If you go looking for install guidance for Claude Code plugins generally, you will find pluginDirectories in settings.json recommended in several places. It does nothing. Unknown settings keys are ignored, so you get no plugin and no error. Anything that must load as a plugin belongs in ~/.claude/skills/ with a .claude-plugin/plugin.json, or behind claude --plugin-dir. My plugin build guide lists the routes that work and the two that do not.

For the hooks layer that makes capture automatic, primeline-ai/evolving-lite clones into your skills directory and loads on the next session. It is the piece that turns "memory exists" into "memory happens without asking".

Honest scope

I maintain Kairn, so treat the recommendation accordingly and weigh the matrix rather than the conclusion. Every row in it is checkable: Mem0's prices and quotas come from their pricing page and their Claude Code integration docs, both read on 2026-08-16; Kairn's licence, storage and offline claims come from its own README.

What I have not done: run Mem0. I have not tested its retrieval quality, its hooks, or whether 1,000 free retrievals a month is generous or tight in practice. This compares what each is documented to do and what each costs, not which one recalls better. If you want that comparison, nobody should write it who maintains one of them.

Prices change. The numbers here are from one reading on one day, and the free-tier quota in particular is the sort of thing vendors adjust quietly.

FAQ

Does Claude Code need a memory plugin at all?+
Often not. Auto memory is built in and on by default, writing to ~/.claude/projects/<project>/memory/. The first 200 lines of MEMORY.md, or 25KB, whichever comes first, load at session start. It is machine-local and per-repository, so the case for adding anything is usually sync or team sharing rather than memory itself.
What is the best open source alternative to Mem0 for Claude Code?+
Kairn is MIT licensed, stores memories in a local SQLite database with FTS5 search, needs no account or API key, and exposes itself to Claude Code as an MCP server. It does not sync across machines and has no team features, which is the trade you are making.
How much does Mem0 cost for Claude Code?+
Their pricing page lists a free Hobby tier with 10,000 add requests and 1,000 retrieval requests a month, Starter at $19 a month, Pro at $249, and custom Enterprise pricing. Retrievals are the limit worth watching, since 1,000 a month is roughly 33 a day.
Can I use an open source memory tool without sending code to the cloud?+
Yes. Kairn stores everything in a local SQLite file and its import commands are documented as making no network calls. If a client contract forbids sending source context to a third party, a local tool may be the only option you are permitted to use.
What does the free option give up?+
Four things: no sync across machines, no team or shared memory, no support beyond GitHub issues, and no automatic capture out of the box. The last one is the underestimated one, since hooks that capture without being asked are real work to wire yourself.
Does Mem0 have an open source version?+
Yes. Mem0 publishes an open-source edition separate from its hosted Platform, so Mem0 is not automatically the paid option. The comparison here is against the hosted Platform, which is what the Claude Code plugin connects to and what the pricing applies to.
Why does pluginDirectories in settings.json not install my plugin?+
Because nothing reads that key. Unknown settings keys are ignored, so the install fails silently with no error to search for. Put the plugin in ~/.claude/skills/ with a .claude-plugin/plugin.json manifest, or load it for one session with claude --plugin-dir.
How do I connect a local memory tool to Claude Code?+
As an MCP server. For Kairn that is pip install kairn-ai, kairn init to create the workspace, then claude mcp add kairn -- kairn serve, with the double dash separating the server command from Claude Code's own flags. Check it connected with claude mcp list.

>_ Get the free Claude Code guide

>_ No spam. Unsubscribe anytime.

>_ Related