{"slug": "i-gave-claude-code-a-memory-and-it-used-26-fewer-tokens", "title": "I gave Claude Code a memory and it used 26% fewer tokens", "summary": "An open-source MCP memory server called OmniMem cut median token use by 26% (833k to 616k per run) and median cost by 26% ($2.16 to $1.51 across ten runs) when Claude Code was given persistent memory across sessions, according to the project's own benchmark of OmniMem 7.0.12 with Claude Haiku 4.5. In ten paired runs on a fresh copy of the code, runs that hit a known dead-end dependency fell from 8 of 10 without OmniMem to 0 of 10 with it, and median wall time dropped 35%. The authors caution that the token result rests on one scenario and ten pairs (sign test p = 0.05) and should be treated as promising rather than proven.", "body_md": "Stop living the same session twiceSelf-hosted memory for Claude Code and every MCP agent\n\nOmniMem is an open-source MCP memory server that gives Claude Code, Codex, Cursor and any other MCP agent persistent memory across sessions, projects and machines. One app for your desktop or one binary on a server, everything on your own hardware and, yes, it's free.\n\nYour AI agent doesn't know your project. It doesn't remember what failed last week. It has no idea you spent three hours last Tuesday figuring out why WebKitGTK quietly ignores a redirect from a custom URL scheme, only to find something that actually works.\n\nSo you explain everything again. It suggests the same broken library again. Same alarm, same song. It's Groundhog Day: you're Bill Murray, and your agent is Punxsutawney.\n\n// without omnimem\n\nclaude>answer the settings form with a 303 redirect\n\n... 45 minutes of debugging later ...\n\nform submitted, window never moved (WebKitGTK, omnimem://)\n\nYou fixed this exact problem last Tuesday.\n\nClaude doesn't know that.\n\n// with omnimem\n\nclaude>answer the settings form with a 303 redirect\n\n⚠ WARNING: previously abandoned approach\n\n303 from omnimem://: WebKitGTK never follows it (effort 4/5)\n\n→ answer with a page that replaces itself instead\n\nMeasured\n\nFewer tokens, smaller bills, less waiting\n\nWe gave Claude Code the same task twenty times on a fresh copy of the code: ten runs without OmniMem, ten with it. The task's TODO recommends a crate that fails at runtime, and only running the tests shows it. With OmniMem the earlier failure is already in memory, so the agent skips the dead end and gets on with the job.\n\nTokens\n\n−26%\n\n833k → 616k median tokens per run, fewer in 8 of 10 pairs.\n\nwithout\n\nOmniMem\n\nMoney\n\n−26%\n\nMedian cost per run down by a quarter: $2.16 → $1.51 for all ten runs.\n\nwithout\n\nOmniMem\n\nTime\n\n−35%\n\nMedian wall time per run, because nobody spends a test run finding out the crate is broken.\n\nwithout\n\nOmniMem\n\nDead ends\n\n0 of 10\n\nRuns that walked into the known dead end, against 8 of 10 without. Red test runs went from 7 to 0.\n\nwithout\n\nOmniMem\n\nOmniMem 7.0.12, Claude Haiku 4.5, one scenario and ten pairs, so treat the token saving as promising rather than proven (a sign test gives p = 0.05); the dead-end result doesn't depend on it. A dead end that takes longer to find would be worth more. Read the full report (PDF), which also covers contradictions, forgetting and project isolation.\n\nSee it in action\n\nOne recall() pulls context from everywhere\n\nPersonal preferences, ingested articles, past conversations, project context. It all gets ranked together and merged into one properly useful answer.\n\nclaude · recall\n\n› what tools do we know about that are useful for writing markdown in?\n\n- BookStack (MIT, PHP): wiki with markdown supportknowledge\n\n- Wiki.js (AGPL-3.0, Node.js): wiki with markdown editor\n\n- Docmost (AGPL-3.0, Docker): Confluence alternative\n\nCMS with markdown support:\n\n- Sveltia CMS and DecapCMS: both work with Forgejo/Gitea backendsproject\n\nThat's the lot, pulled from your preferences, your articles, a repo you trained it on, and your project's own stack, all ranked together.\n\n› nope that's great, you reminded me of exactly what I use\n\n● Glad it worked well. OmniMem connected your preferences and past writing into one useful answer.\n\nA real recall() about markdown editors. Every tagged line traces back to a different memory source (they're the four on the right).\n\n[episodic]\n\nEpisodic memory\n\nPicked up from your conversations: decisions, bugs, what you tried, and the things you mention in passing.\n\n[knowledge]\n\nKnowledge base\n\nRSS articles, auto-summarised and embedded. They surface when relevant to what you're asking.\n\n[preference]\n\nPreferences\n\nHow you like to work, stated once and applied from then on: the editor you reach for, the licence you prefer, the way you want things written.\n\n[project]\n\nProject context\n\nExtra context it knows matters to you, like your preferred tools and platforms.\n\nWhat makes it different\n\nNot just a key-value store with an MCP wrapper\n\nOmniMem models how memory actually works. Things fade over time, they sometimes contradict each other, and the hard-won stuff earns its place.\n\nThe graveyard\n\nEvery dead end, kept on purpose\n\nWhat you tried, why it failed, and how much time it burned. Your agent checks the graveyard before it reaches for a library or a pattern, so the same rabbit hole only costs you once.\n\nA warning comes back with the way out attached: what was abandoned, and what worked instead.\n\nwarn_if_abandoned(\"global limiter\") ✗ abandoned· effort 4 · 6 tries → use one limiter per shard instead\n\nrecall()\n\nOne call. Ranked by similarity, lifecycle, age and what it cost you to learn.\n\n48\n\nMCP tools\n\nRemember, recall, audit, compile. One server, every client that speaks MCP.\n\n1.8×\n\nBattle-hardened\n\nFour attempts and a weird workaround? That is gold. The harder it was, the higher it surfaces.\n\nFour namespaces\n\nSearched together, never muddled\n\nDecisions and bugs, stack and state, articles and extracted facts, and how you like to work. Compiled skills sit alongside them.\n\nepisodicprojectknowledgepreference\n\nOne-call briefing\n\nNo three-step warm-up\n\nOne briefing() hands over project context, experience stats, stale memories, new articles and contradictions.\n\nIf a new memory disagrees with one you already have, OmniMem catches it on write, and Claude can dig deeper on demand.\n\nDeduplication\n\nSemantic, not string\n\nToo close to something stored? You get a heads-up, not a duplicate. find_duplicates cleans up in bulk.\n\nSettings window\n\nA window for all of it\n\nBrowse, search and manage memories, feeds, projects, skills and backups from the tray icon, without touching the command line or opening a port.\n\nTelemetry\n\nKnow what earns its keep\n\nRecall counts and last-accessed per memory, what's gone cold, and how much of your agent's context OmniMem takes before a single tool is called.\n\nAuto-maintenance\n\nTidies itself\n\nEvery few briefings it scans for duplicates and checks for conflicts in the background. No babysitting.\n\nLifecycle\n\nMemory is not binary\n\nMost systems either remember or delete. OmniMem has a proper lifecycle. When you say \"forget about X\" you usually mean stop bringing it up, not wipe it from existence.\n\nACTIVE\n\n1.0× weight\n\n→\n\nDEPRIORITISED\n\n0.2× weight\n\n→\n\nARCHIVED\n\n0.0× weight\n\n→\n\nDELETED\n\ngone\n\nDeprioritised memories aren't gone for good. Attach reinstate hints, and if a future query matches, the memory comes back with a note explaining why it was pushed down. You can mute entire topics across all sessions.\n\nFive factors decide what comes back. Semantic similarity on its own isn't enough, so lifecycle state, age, how hard something was to figure out, and whether it happened near a date you asked about all play a part.\n\nEffort\n\nMeaning\n\nWeight\n\n1\n\nWorked first time\n\n1.0×\n\n2\n\nMinor friction\n\n1.1×\n\n3\n\nMultiple iterations\n\n1.25×\n\n4\n\nSignificant struggle\n\n1.5×\n\n5\n\nBattle-hardened\n\n1.8×\n\nSkills\n\nSkills that build (and evolve) themselves\n\nMemories tell an agent what happened. A skill tells it how you work. OmniMem compiles skills from the work you actually did: the breakthroughs, the gotchas that keep coming back, and the graveyard of dead ends. As new experience lands, the skill evolves with it.\n\nA PATTERN EARNS A RULE\n\nOne-off episodes don't compile. A lesson has to recur before it becomes policy, unless you bless it to jump the queue.\n\nNOTHING WRITES SILENTLY\n\nEvery compile proposes a diff you can review. Rewrites of existing rules get flagged loudly, and nothing commits until you say so.\n\nDERIVED, NEVER HAND-EDITED\n\nMemories are the source of truth and the skill is just build output. Want different guidance? Update the memories and recompile.\n\nSUGGESTED, NEVER AUTO-LOADED\n\nThe briefing recommends relevant skills for the session. You and the agent decide what loads.\n\ncompile_skill(\"python\") distils a domain's accumulated experience into a loadable SKILL.md: do this, watch out for that, and never try X again because it cost you an afternoon. Load it at the start of some Python work and the agent works your way from the very first prompt.\n\n// the flywheel\n\nwork → record_experience() → compile_skill() → SKILL.md → work\n\nEvery skill tells the agent to keep recording lessons and dead ends whilst it works. A richer pool compiles a better skill next time, and the knowledge watch flags fresh articles that contradict a compiled rule, so your skills stay current.\n\n✓ SKILL.md committed · every rule cites its memories\n\nHow it compares\n\nMost memory servers just store and retrieve\n\nClaude Code's built-in memory (CLAUDE.md, plus the newer auto-memory that writes markdown notes for itself) is still flat, machine-local files with keyword recall, as persistent memory for Claude Code explains in more detail. No semantic search, no lifecycle, no contradiction handling. OmniMem goes quite a bit further. mem0 is the other name you'll hear. It's a good product aimed at a different job, a memory layer for products serving many users with a managed cloud behind it, and the table includes the things it does that OmniMem doesn't.\n\nA green box with a tick matches or beats OmniMem on that row, and ~ marks a partial one. A black box in the OmniMem column is a straight no where another system has it. Compared in September 2026, against each project's own documentation.\n\nLocal embeddings, one SQLite file, one process. The MCP server, the RSS scheduler and the enrichment worker share one memory engine, and the desktop app's settings window talks to it directly, so there's no dashboard port for anyone else to find.\n\nRSS scheduler · enrichment worker ONNX embeddings, no GPU Claude Haiku, if you give it a key\n\n// recall pipeline\n\n→ query\n\n→ abandoned fast-path (keyword scan)\n\n→ embed query\n\n→ exact vector search, 20+ per namespace\n\n→ filter archived + deleted\n\n→ filter out-of-project + suppressed topics\n\n→ apply surface_score\n\n→ apply recency (0.9 at 90 days)\n\n→ apply experience_weight\n\n→ apply date_boost\n\n→ check reinstate eligibility\n\n→ surface contradiction warnings\n\n→ merge namespaces, facts fold into their sources\n\n→ drop anything under the relevance floor\n\n→ re-rank, return top_k\n\n→ log event + increment counters\n\nGet started\n\nUp and running in two minutes\n\nPick the app for your computer, or the server if your agents live elsewhere. Nothing else to install: no Docker, no database, no Python. The embedding model fetches itself on the first start.\n\n01\n\nInstall it\n\nDownload the app: drag it to Applications, run the MSI, or open the Flatpak. It lives in your menu bar or system tray from then on. For a server, install the .deb or .rpm from the release page, or run the Docker image.\n\na Linux servercopy\n\n```\nsudo apt install ./omnimem_<version>_amd64.deb\n# on Fedora: sudo dnf install ./omnimem-<version>-1.x86_64.rpm\ncurl http://127.0.0.1:8765/healthz   # {\"status\": \"ok\"}\n# settings live in /etc/omnimem/omnimem.env\n```\n\n02\n\nConnect your agent\n\nIn the app, the tray menu's Add to Claude Code and Add to Claude Desktop do it for you, and never add it twice. Copy MCP URL covers every other agent. By hand, for Claude Code:\n\nbashcopy\n\n```\nclaude mcp add --transport http --scope user omnimem http://127.0.0.1:8765/mcp\n# on a server with a token, add: --header \"Authorization: Bearer <token>\"\n```\n\n03\n\nAdd an Anthropic key optional\n\nOmniMem works fine without one. With a key, Claude Haiku pulls the facts out of what your agent saves, rephrases recall queries so they find more, double-checks contradictions and summarises your RSS feeds. Paste it in the settings window's Configuration page, under Claude, and it takes effect at the next start. It's kept in your OS keychain. On a server, set ANTHROPIC_API_KEY in omnimem.env. Embeddings still run on your machine either way.\n\nComing from 6.x? Stop it first, since both use port 8765. Take a backup on 6.x with dump_to_file(), then restore it on the settings window's Backups page or run omnimem import memory_backup.json. Every memory is embedded again from its text, so recall and skills behave as they did.\n\nPro tip\n\nAgents mostly don't ask their memory anything, so for Claude Code there are hooks: omnimem hook puts the project's briefing in every session's opening context and stops a tool call that repeats a known dead end before it runs.", "url": "https://wpnews.pro/news/i-gave-claude-code-a-memory-and-it-used-26-fewer-tokens", "canonical_source": "https://omnimem.org/", "published_at": "2026-11-18 08:54:45+00:00", "updated_at": "2026-11-18 09:15:15.500702+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "developer-tools"], "entities": ["OmniMem", "Claude Code", "Codex", "Cursor", "Claude Haiku 4.5", "WebKitGTK"], "also_reported_by": [], "takeaway": "Giving Claude Code a persistent MCP memory of past failures cut median tokens 26% (833k to 616k) and cost 26% ($2.16 to $1.51) per run and eliminated the known dead end in 10 of 10 runs versus 8 of 10 without it, though the token result is one scenario at p = 0.05.", "recommendation": {"advice": "Persist past failed attempts and project context in an MCP memory server so agents skip known dead ends; the source measured 26% fewer tokens and 0 of 10 dead-end runs versus 8 of 10 without memory.", "playbook": "llm-cost", "playbook_url": "https://wpnews.pro/playbooks/llm-cost"}, "alternates": {"html": "https://wpnews.pro/news/i-gave-claude-code-a-memory-and-it-used-26-fewer-tokens", "markdown": "https://wpnews.pro/news/i-gave-claude-code-a-memory-and-it-used-26-fewer-tokens.md", "text": "https://wpnews.pro/news/i-gave-claude-code-a-memory-and-it-used-26-fewer-tokens.txt", "jsonld": "https://wpnews.pro/news/i-gave-claude-code-a-memory-and-it-used-26-fewer-tokens.jsonld"}}