claude-mem: the persistent memory plugin for Claude Code, explained and measured on Twitter (X)

By TwitterAPI.io Team•14 min read
Diagram of the claude-mem memory loop: Claude Code hooks send tool calls to a local worker, an observer model writes notes into SQLite, and the next session starts with an index of observations
The claude-mem loop: hooks, local worker, observer, SQLite storage, and the index injected into the next session. Study figure collected in 2026.
TL;DR
  • What it is: an Apache-2.0 plugin (thedotmack/claude-mem, v15.17.0 on npm at the time of writing) that records what your agent does and feeds a short memory index into the next session.
  • Install: npx claude-mem install (picks your agents), or /plugin marketplace add thedotmack/claude-mem + /plugin install claude-mem inside Claude Code, then restart. Needs Node 20.19+ or 22.12+; Bun and uv are installed if missing.
  • Cost: the engine is free; the observer runs on your Anthropic plan, your own key, or CMEM Pro ($30/month after a 30 Day Free Trial; Heavy $70/month; CMEM Max $100/month plus overages). The installer asks for a card for the trial; --provider skips sign-in.
  • vs built-in memory: Claude Code already loads your CLAUDE.md and its own auto-memory notes every session. claude-mem adds automatic capture of tool activity, a search index and cross-agent recall.
  • On X: 600 recent posts in 29.6 days (about 20.3 a day); 85.8% of community posts were about the plugin and only 0.2% used crypto-token terms.
  • Study bill: 1,104 posts via /twitter/tweet/advanced_search and /twitter/user/last_tweets cost $0.17 at $0.15 per 1,000 tweets; the same reads on X's pay-per-usage card ($0.005 per post) would be $5.54.

Every Claude Code session starts with an empty conversation. The model re-reads the same files, asks the same questions and can walk back into a bug you already fixed together, unless something carries the lessons forward. claude-mem is the third-party plugin most people mean when they search "claude mem": it watches the session, writes notes, and hands the next session a short index of what mattered.

This page answers the head query first: what claude-mem does, how to install it in Claude Code, what the free engine and the paid CMEM Pro tiers cost, how it compares with Claude Code's own CLAUDE.md and auto memory, and where it can go wrong. Every version number, price and default below was read this session from the GitHub repo, the npm registry, cmem.ai/pricing, docs.claude-mem.ai and Claude Code's memory docs.

Then comes the part no other claude-mem guide has: a measured look at how developers talk about it on Twitter (X), from a study of recent posts we collected in 2026, and how to wire X data into the same Claude Code session so that what your agent reads on X becomes part of its memory. For Claude Code plans and limits see our Claude Code pricing guide, for the hook system claude-mem is built on see the Claude Code hooks guide, and for other agents see Claude Code alternatives; this page stays on memory.

Share of 556 recent X posts naming claude-mem that also named Codex

31.3%

01 — Section

What claude-mem is (and what it is not)

claude-mem is an open-source project at github.com/thedotmack/claude-mem, licensed Apache-2.0 and maintained by Alex Newman with outside contributors. When we checked the repository this session it had about 116,000 stars and 10,000 forks, its newest release was v15.17.0, and commits were landing the same day; npm reported 34,485 downloads of the claude-mem package in the most recent full week. Its own description: it "captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions."

Despite the name, it is not an Anthropic product and not the memory feature built into Claude Code. It started as a Claude Code plugin and now installs into Claude Code, Codex, Cursor, OpenCode, Gemini, Antigravity, OpenClaw gateways and others; the README lists Copilot CLI, Goose, Roo Code and Warp as search-only, meaning they can query memory but their sessions are not recorded.

The CMEM token is a separate thing. The README mentions a third-party crypto token called CMEM. It is not the plugin, nothing in the install or the paid tiers involves it, and this page does not cover it. The paid product that shares the letters is CMEM Pro, a regular monthly subscription described below.

The npm trap. npm install -g claude-mem installs only the SDK/library. The README is explicit that this does not register the hooks or start the worker; use npx claude-mem install or the /plugin commands.

02 — Section

How claude-mem works: hooks, worker, observer, index

1. Hooks capture activity. For Claude Code the plugin registers the Setup, SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PostToolUseFailure, Stop, SubagentStop and SessionEnd hooks. Each hook runs one shell-free command (claude-mem hook claude-code ...) that passes the event to the worker. Because Claude Code hooks also fire for MCP tools, calls to any MCP server you connect are part of what gets recorded.

2. A local worker receives it. The worker is an HTTP service managed by Bun. By default it binds to 127.0.0.1 on a per-user port of 37700 plus your user id modulo 100 (CLAUDE_MEM_WORKER_PORT overrides it). It also serves the web viewer (memory, sessions, settings) and the My Work view.

3. An observer writes notes. A second model turns raw tool activity into short observations (typed as decisions, bug fixes, discoveries and so on) and writes a summary when the session ends. The default provider is Claude with CLAUDE_MEM_MODEL=haiku, which follows the newest Haiku; you can switch CLAUDE_MEM_PROVIDER to codex, gemini, openrouter or an openai-compatible endpoint, or use the hosted CMEM Pro observer.

4. Storage stays local. Sessions, observations and summaries live in SQLite at ~/.claude-mem/claude-mem.db with FTS5 keyword search; Chroma adds semantic search on top. Cloud sync is opt-in.

5. The next session starts with an index. At SessionStart the plugin injects a compact index of recent observations (CLAUDE_MEM_CONTEXT_OBSERVATIONS, default 50). Memory injection starts on your second session in a project; /learn-codebase front-loads a repo in about five minutes if you do not want to wait.

6. Details on demand. The agent drills down with three MCP tools: search returns an index with IDs at roughly 50 to 100 tokens per result, timeline shows what happened around a result, and get_observations fetches full details at roughly 500 to 1,000 tokens each. The README credits this filter-then-fetch pattern with about 10x token savings; that figure is the project's own claim, not something we measured.

03 — Section

Install claude-mem in Claude Code

There are two supported routes. The npx installer finds the agents on your machine and asks which ones to set up, and for Claude Code it also asks whether to disable Claude Code's native auto memory. The plugin-marketplace route installs into Claude Code only. Either way, restart Claude Code afterwards.

Requirements. Node.js 20.19 or later in the 20.x line, or 22.12 or later; a current Claude Code with plugin support. Bun (the worker runtime) and uv (for vector search) are installed automatically if missing; SQLite is bundled.

The sign-in step. The default installer finishes setup, then asks you to sign in to claude-mem in your browser with an email magic link. Choosing the claude-mem observer starts the 30 Day Free Trial on a checkout page that asks for a payment method. To skip all of that, pass an explicit --provider flag, set CLAUDE_MEM_ONLINE_OPTIN=false, or run in a non-interactive shell; the observer then runs on your Anthropic plan or your own OpenRouter or Gemini key.

Check it worked. npx claude-mem doctor checks Bun, uv, the hook launcher and the worker and tells you what to fix. Open the worker URL printed at startup to see observations stream in from your first prompt.

Telemetry. Anonymous usage analytics are on by default; npx claude-mem telemetry disable turns them off. Wrap anything you never want stored in <private> tags.

bash
# Route 1: the installer (sets up every supported agent you pick)
npx claude-mem install

# Skip the hosted sign-in and run the observer on your own plan or key
npx claude-mem install --provider claude

# Route 2: inside Claude Code, from the plugin marketplace
/plugin marketplace add thedotmack/claude-mem
/plugin install claude-mem
# then restart Claude Code

# Health check and telemetry opt-out
npx claude-mem doctor
npx claude-mem telemetry disable
04 — Section

claude-mem pricing: free engine, CMEM Pro, Heavy and CMEM Max

The engine itself is free and open source. What you pay for is the model that writes the notes, and optionally the hosted service. These are the tiers exactly as cmem.ai/pricing showed them when we checked:

TierPriceWhat it adds
claude-mem (open source)FreeLocal capture, searchable local memory, bundled skills; model usage may cost extra
CMEM Pro30 Day Free Trial, then $30/monthHosted observer, cloud sync, private MCP recall link
Heavy$70/monthSame product, more included observation usage
CMEM Max$100/monthLargest included allowance, billed overages above it (safety ceiling)
TeamBrainNot announcedPilot with design partners, price agreed on a call

How the trial ends. Billing can start when the 30 days end or when the trial's included usage is spent, whichever comes first. A credit or debit card is required and prepaid cards are not accepted. Automatic upgrade settings can move a subscription up the ladder when its allowance is used, so check the terms at checkout. If the trial ends without a subscription, the README says memory falls back to your Anthropic plan.

What the free route really costs. With the default Claude provider, every observation is a Haiku request that counts against your Claude plan or API bill; the configuration docs note that a busy session can mean many observer requests, and that the observer stops when a subscription usage window reaches its threshold. Pointing CLAUDE_MEM_PROVIDER at OpenRouter or Gemini moves that load to a key you control. For what each Claude plan allows, see our Claude Code pricing guide.

05 — Section

claude-mem vs Claude Code's built-in memory, and the trade-offs

Claude Code ships two memory systems of its own, both loaded at the start of every conversation. CLAUDE.md files are instructions you write (project, user or organization scope). Auto memory is notes Claude writes for itself in ~/.claude/projects/<project>/memory/: your preferences, corrections you gave it, project context it cannot derive from the code, and pointers to outside references. It is on by default in local sessions, toggled from /memory, and Claude deliberately skips anything it can derive from the codebase, such as architecture, file paths or debugging fixes.

AspectCLAUDE.mdClaude Code auto memoryclaude-mem
Who writes itYouClaude, when it judges a note usefulAn observer model, from every tool call
What it holdsRules, commands, conventionsPreferences, corrections, project contextDecisions, fixes, discoveries, session summaries
Loaded at startWhole file (aim for under 200 lines)First 200 lines or 25KBIndex of recent observations (default 50)
Search laterNoNoKeyword + vector search via MCP tools
Other agentsAGENTS.md for some toolsClaude Code onlyCodex, Cursor, OpenCode and more

When the built-in pair is enough. If what you keep re-explaining is conventions and preferences, a well-kept CLAUDE.md plus auto memory covers it with no extra process, no second model and nothing else listening on a local port.

When claude-mem earns its place. It is built for the other kind of forgetting: what was tried yesterday, which fix worked, why a decision was made, across long-running projects and across agents. Auto memory skips debugging fixes by design; claude-mem records them. The installer offers to switch off native auto memory so the two do not duplicate notes; keep your CLAUDE.md either way, because it is instructions, not history.

Memory starts on session two. The first session in a project only records. Use /learn-codebase if you need context on day one.

It is another moving part. A background worker, a second model and a local database are three more things that can fail or fall behind. The repo had 173 open issues when we checked and ships releases several times a day, so pin a version if stability matters and run npx claude-mem doctor after upgrades.

Observer usage is real usage. On the default Claude provider every observation is a model request on your plan. Subagent-heavy sessions multiply it; the code--chill mode records fewer observations if you want a lighter footprint.

Privacy is your call. Memory stays in ~/.claude-mem unless you turn on cloud sync, and the worker binds to loopback by default. Screenshots are kept locally by default and uploaded only with Cloud Sync on; telemetry is on until you disable it. Wrap secrets in <private> tags and review the privacy policy before enabling sync.

Two memories can disagree. If you keep Claude Code's auto memory on alongside claude-mem, the same lesson can be stored twice in different words. Pick one for history and keep CLAUDE.md for rules.

06 — Section

How people talk about claude-mem on X: 556 community posts measured

We pulled the 600 most recent posts matching "claude-mem" from X search, plus the 184 posts X ranks as Top for the same query, and the timelines of the project's account @Claude_Memory and the maintainer @thedotmack. After removing the two project accounts, 556 recent community posts remained. They span 29.6 days: about 20.3 posts a day, 63 on the busiest day, from 412 distinct accounts.

It is a plugin conversation, not a token one. 85.8% of recent community posts used plugin vocabulary (install, memory, session, hooks, MCP, the agents it runs in). Only 0.2% mixed in crypto-token terms and none were about the token alone; the remaining 14.0% were short replies such as "Claude-Mem changes everything" with no topic words. In the Top set the plugin share was 94.7%.

People see it as cross-agent memory. Claude Code appears in 55.6% of recent posts, but Codex is named in 31.3%, Cursor in 16.7%, OpenCode in 14.7% and Gemini in 10.6%. That matches the project's own pivot from a Claude Code plugin to "persistent context across sessions for every agent."

Agent named with claude-memRecent postsTop posts
Claude Code55.6%61.2%
Codex31.3%17.8%
Cursor16.7%7.9%
OpenCode14.7%13.2%
Gemini10.6%7.2%
Copilot7.9%5.9%

Discovery runs through roundup lists. 29.9% of recent posts were "N repos you should know" style lists or trending digests, and 19.1% quoted a star count. Only 10.3% showed an install command and 7.2% made an LLM token or usage-savings claim. Comparisons were rare: MCP came up in 13.3%, CLAUDE.md in 3.6%, Obsidian in 3.2%, mem0 in 2.2%, and Claude Code's built-in auto memory in just 0.4%, so the comparison in the previous section is one most posts skip.

A global audience. 45.7% of recent posts were in English, 33.3% in Chinese and 8.1% in Japanese. 48.9% linked the GitHub repo or the project site, and 40.8% carried an image or video.

Bar chart: share of X posts naming each agent next to claude-mem. Claude Code 55.6%, Codex 31.3%, Cursor 16.7%, OpenCode 14.7% of recent posts
Agents named alongside claude-mem in 556 recent and 152 Top community posts on X. Collected in 2026.
07 — Section

Reach, the project account, and the paid-tier conversation

Reach is lopsided. The median recent post got 282 views and 4 likes; the 90th percentile reached 9,171 views. Among Top posts the median was 7,603 views and the 90th percentile 144,759. A few large roundup accounts carry most of the attention: 15.1% of Top posts came from accounts with 100,000+ followers, against 4.0% of recent posts.

The project account is a support desk. @Claude_Memory had 6,517 followers and posted about 4.2 times a day across 160 posts in the sample. 41.9% of those were replies, and 18 posts announced releases or patches; the median own post drew 257 views. If you want release notes in your feed, follow that account; the maintainer's personal account posts far less (about 0.2 a day in its sample).

Few posts mention money. Only 2.2% of recent community posts mentioned CMEM Pro, the free trial or the installer's sign-in step. The ones that did were mostly heads-ups that the default install leads to a trial checkout and that a flag skips it, which is accurate per the README.

Left: themes in claude-mem posts on X, roundup lists 29.9% and star counts 19.1% of recent posts. Right: median views 282 for recent and 7,603 for Top posts
What claude-mem posts on X do, and how far they travel. 600 Latest and 184 Top results, collected in 2026.
08 — Section

Wire X data into the same Claude Code session (and into claude-mem)

claude-mem records tool calls, so whatever your agent reads during a session can become an observation, including results from an MCP server. If your project depends on what people say on X (launch feedback, competitor announcements, bug reports that show up as posts), connect an X data source to Claude Code and the findings carry into later sessions through claude-mem's index.

Option 1: the hosted MCP server. TwitterAPI.io runs an MCP server at https://mcp.twitterapi.io/mcp with 12 tools for searching tweets and reading profiles, timelines, replies, followers and trends. Add it to Claude Code with one command, with your API key as a Bearer token (the command is below). No X account is needed for reads. Our Claude + Twitter (X) API guide and the MCP server explainer walk through the tools.

Option 2: a REST call from a script or skill. The study on this page is a plain loop over /twitter/tweet/advanced_search with has_next_page and next_cursor; the full runnable version is in the code section below. A Claude Code skill or hook can run it and write a short digest your agent reads.

What the X data costs. TwitterAPI.io bills per result: 15 credits per tweet returned, which is $0.15 per 1,000 tweets, with a 15-credit minimum ($0.00015) when a search returns nothing. Profiles are $0.18 per 1,000. X's official pay-per-usage rate card (docs.x.com/x-api/getting-started/pricing) charges $0.005 per post read and $0.010 per user read, which is $5 per 1,000 posts, about 33x more per 1,000 tweets.

This study's readsTwitterAPI.ioOfficial X API (pay-per-usage)
1,104 posts + 2 profiles$0.17$5.54
1,000 posts$0.15$5.00
One check every 5 minutes for a month that finds nothing$1.30not comparable (X bills per post read)

New accounts that pass the automatic bot check get up to $1 of free credits (at most 100,000 credits, no card, one per person or network, expiring after 31 days). Paid credits never expire; see the pricing page for subscriptions and rate limits.

bash
# Add TwitterAPI.io's hosted MCP server to Claude Code (user scope)
claude mcp add --transport http --scope user twitterapi-io https://mcp.twitterapi.io/mcp \
  --header "Authorization: Bearer your_key_here"

# In a session: "search X for posts about our release and note the top complaints"
# claude-mem's PostToolUse hook records the call; the summary lands in memory.
09 — Section

How we collected this

Question. When people post about claude-mem on X, what are they talking about: the plugin or the token, which agents come up with it, and how far do those posts travel?

Data. 600 Latest and 184 Top results from /twitter/tweet/advanced_search for "claude-mem" (690 unique posts), a second query for the unhyphenated "claude mem" (it returned 0 extra posts), the timelines of @Claude_Memory and @thedotmack via /twitter/user/last_tweets (160 posts each), and both profiles via /twitter/user/info. Collected in 2026; the recent window is the latest 29.6 days at collection time, not all-time.

Method. Posts from the two project accounts were removed from the community figures. Topics, agents and themes are keyword rules published in the study's analyze.py; a post can count toward several agents or themes. 59 requests, 1,104 posts returned, $0.17 of credits.

What the sample cannot show. Keyword rules miss sarcasm and posts that never write the name; Top results are X's ranking, not a random sample; view counts are as X reported them at collection time; and posts are not a measure of how many people use the plugin.

Privacy. Aggregates only. Only the project's official account and its named maintainer are identified; no private individual is profiled, and the stored sample has no post ids, text or handles.

python
"""Measure what X posts say about claude-mem (or any tool) with TwitterAPI.io.
pip install requests ; export TWITTERAPI_IO_KEY=...  Cost: $0.15 per 1,000 tweets returned."""
import os
import re
from collections import Counter

import requests

BASE = "https://api.twitterapi.io"
HEADERS = {"X-API-Key": os.environ["TWITTERAPI_IO_KEY"]}
AGENTS = {"Claude Code": r"claude[ -]?code", "Codex": r"\bcodex\b", "Cursor": r"\bcursor\b",
          "OpenCode": r"\bopencode\b", "Gemini": r"\bgemini\b"}


def search(query, query_type="Latest", max_pages=10):
    """Yield tweets from advanced_search, following next_cursor."""
    cursor = ""
    for _ in range(max_pages):
        r = requests.get(f"{BASE}/twitter/tweet/advanced_search",
                         params={"query": query, "queryType": query_type, "cursor": cursor},
                         headers=HEADERS, timeout=30)
        r.raise_for_status()
        body = r.json()
        for t in body.get("tweets", []):
            yield t
        if not body.get("has_next_page"):
            break
        cursor = body.get("next_cursor", "")


posts = list(search('"claude-mem"', max_pages=10))  # up to about 200 tweets = about $0.03
agents = Counter(name for t in posts for name, rx in AGENTS.items() if re.search(rx, t["text"], re.I))
views = sorted(t.get("viewCount") or 0 for t in posts)
langs = Counter(t.get("lang") or "und" for t in posts)

print(f"{len(posts)} posts, {posts[-1]['createdAt']} .. {posts[0]['createdAt']}" if posts else "no posts")
for name, n in agents.most_common():
    print(f"{name:12} {100 * n / len(posts):5.1f}%")
if views:
    print("median views", views[len(views) // 2], "| languages", dict(langs.most_common(3)))

Researching this?Free starter credits cover end-to-end testing — Google sign-in, no card. Get a key.

10 — Questions

Questions readers ask

What is claude-mem?

claude-mem is an open-source, Apache-2.0 plugin (github.com/thedotmack/claude-mem) that gives Claude Code and other coding agents memory across sessions. Hooks record tool activity, an observer model writes short observations into a local SQLite database, and each new session starts with an index of recent observations that the agent can search through MCP tools.

Is claude-mem free?

Yes, the engine is free and open source. The observer model that writes notes costs whatever your provider charges (your Claude plan by default, or your own OpenRouter or Gemini key). CMEM Pro, the optional hosted observer with cloud sync, has a 30 Day Free Trial and then costs $30/month; Heavy is $70/month and CMEM Max $100/month with overages, per cmem.ai/pricing.

How do I install claude-mem in Claude Code?

Run npx claude-mem install and pick Claude Code, or inside Claude Code run /plugin marketplace add thedotmack/claude-mem and then /plugin install claude-mem, and restart Claude Code. Do not use npm install -g claude-mem: that installs only the SDK and does not register the hooks or the worker.

Does claude-mem replace CLAUDE.md?

No. CLAUDE.md holds instructions you write and Claude Code loads it every session; claude-mem stores history: what was done, fixed and decided. Keep CLAUDE.md for rules. The installer can turn off Claude Code's native auto memory so it does not duplicate claude-mem's notes.

Can I skip the claude-mem sign-in and trial?

Yes. Pass an explicit --provider flag to the installer, set CLAUDE_MEM_ONLINE_OPTIN=false, or install from a non-interactive shell. The observer then runs on your Anthropic plan or your own key, and no account or card is needed.

Where does claude-mem store my data?

Locally, in ~/.claude-mem (SQLite at ~/.claude-mem/claude-mem.db, plus Chroma for semantic search). Cloud sync to cmem.ai is opt-in. Anonymous usage analytics are on by default and npx claude-mem telemetry disable turns them off.

Does claude-mem work with Codex, Cursor or OpenCode?

Yes. The installer supports Codex, Cursor, OpenCode, Gemini, Antigravity, OpenClaw gateways and more via --ide. Copilot CLI, Goose, Roo Code and Warp can search memory, but their sessions are not recorded. On X, 31.3% of recent community posts about claude-mem also named Codex.

Is the CMEM token part of claude-mem?

No. CMEM is a third-party crypto token mentioned in the README; you never need it to install or use the plugin or CMEM Pro. In our X sample, only 0.2% of recent community posts about claude-mem used crypto-token terms.

11 — Further reading

Continue

Sources & further reading
More from this series

Writing about something you built with TwitterAPI.io? Our community rewards program pays API credits for honest tutorials, build logs and videos.

Build it

Stop reading. Start building.

Starter credits cover real testing on real data. Google sign-in, no card, no application queue.

Get an API key

Already building with TwitterAPI.io? Publish an honest tutorial or build log about it and earn up to $200 a month in API credits.