Claude Code Buddy (CCB)

Add persistent project memory and smart task routing to Claude Code. Stop repeating context every session - Claude finally remembers your architecture, decisions, and patterns forever. 100% local, 17 MCP tools.

๐ŸŒ English | ็น้ซ”ไธญๆ–‡ | ็ฎ€ไฝ“ไธญๆ–‡ | ๆ—ฅๆœฌ่ชž | ํ•œ๊ตญ์–ด | Portuguรชs | Franรงais | Deutsch | Tiแบฟng Viแป‡t | Espaรฑol | เธ เธฒเธฉเธฒเน„เธ—เธข

MeMesh LLM Memory

Local memory for Claude Code and MCP coding agents.
One SQLite file. No Docker. No cloud required.

npm MIT Node MCP


[!IMPORTANT] Actively developed project โ€” features evolve and may change between releases. If you hit a bug or have a feature request, please open an issue.

The Problem

Your coding agent forgets what happened between sessions. Every architecture decision, bug fix, failed test, and hard-won lesson has to be re-explained. Claude Code starts fresh, re-discovers old constraints, and burns context on things it should already know.

MeMesh gives coding agents persistent, searchable, evolving local memory.

This package is the local memory layer of the MeMesh product family. It is intentionally small and open-source: install it with npm, keep your memory in ~/.memesh/knowledge-graph.db, and connect it to Claude Code or any MCP-compatible client. Hosted workspace and enterprise operating-system products should stay separate from this package's README and roadmap.


Proof โ€” 95.40% R@5 on LongMemEval-S

MeMesh's retrieval engine is FTS5 alone (no LLM, no embeddings on the hot path), measured against the public LongMemEval-S benchmark (500 questions, MIT-licensed):

SystemR@5Source
MeMesh (Mode A, FTS5)95.40%benchmarks/longmemeval/RESULTS.md
MemPalace96.6%Vendor self-report
Supermemory~82%Vendor estimate
Zep63.8%LongMemEval paper
Mem049.0%LongMemEval paper

Reproduction commands, dataset SHA256, raw per-question results, and known-failure analysis are all in benchmarks/longmemeval/. Re-runnable in ~10 seconds.


Install paths at a glance

MeMesh has two install paths that coexist. Most users want both. They write to the same memory database (~/.memesh/knowledge-graph.db), so memories captured in Claude Code chat appear in your shell, and vice versa.

flowchart TB
    classDef client fill:#1f2937,stroke:#4b5563,color:#f9fafb,stroke-width:1px
    classDef pathA  fill:#1e3a8a,stroke:#3b82f6,color:#eff6ff,stroke-width:2px
    classDef pathB  fill:#14532d,stroke:#22c55e,color:#f0fdf4,stroke-width:2px
    classDef db     fill:#7c2d12,stroke:#f97316,color:#fff7ed,stroke-width:2px

    subgraph clients["Where you use memesh from"]
      direction LR
      CC["Claude Code<br/>(chat + agent)"]:::client
      TERM["Terminal / other<br/>MCP clients<br/>(Cursor, Cline...)"]:::client
    end

    subgraph paths["Two install paths"]
      direction LR
      A["<b>Path A โ€” /plugin install</b><br/>โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€<br/>Lives in <code>~/.claude/plugins/</code><br/><br/>โ€ข MCP tools in chat<br/>โ€ข Auto-capture hooks<br/>โ€ข <code>/memesh</code> skill<br/>โ€ข Session-start banner"]:::pathA
      B["<b>Path B โ€” npm install -g</b><br/>โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€<br/>Lives in <code>$(npm prefix -g)/bin/</code><br/><br/>โ€ข <code>memesh</code> shell command<br/>โ€ข <code>memesh-mcp</code>, <code>-http</code>, <code>-view</code> bins<br/>โ€ข For Cursor / Cline / other MCP"]:::pathB
    end

    DB[("Shared memory DB<br/><code>~/.memesh/knowledge-graph.db</code><br/>Same data, both paths see it")]:::db

    CC -->|uses| A
    TERM -->|uses| B
    A --> DB
    B --> DB

Which one do you need?

What you want to doInstall path
Use the /memesh skill inside a Claude Code conversationPath A (plugin)
Get auto-capture (sessions โ†’ lessons โ†’ recall) in Claude CodePath A (plugin)
Run memesh remember / memesh recall / memesh doctor in any terminalPath B (npm-global)
Open the local dashboard via memesh (no npx lookup delay)Path B (npm-global)
Plug memesh-mcp into Cursor, Cline, or another MCP clientPath B (npm-global)
All of the aboveInstall both โ€” they don't conflict

โš ๏ธ Installing the plugin does NOT install the CLI

This is the most common confusion. Read this once and you'll save yourself the loop:

  • /plugin install memesh@pcircle-memesh from inside Claude Code โ†’ installs Path A only. Gives you MCP tools, hooks, the /memesh skill. Does NOT put memesh on your shell PATH.
  • memesh reindex / memesh update / memesh doctor typed in a normal terminal โ†’ needs Path B (npm-global). Without it: zsh: command not found: memesh.
  • Recommended setup for Claude Code users: install both. They coexist, share the same database, never conflict.
# After /plugin install ..., also run this:
npm install -g @pcircle/memesh

If you only use memesh through Claude Code chat (never type memesh in a terminal), Path A alone is enough. Everyone else: install both.


Get Started in 60 Seconds

Option A โ€” Claude Code plugin (one-line install)

If you use Claude Code, install MeMesh as a plugin from inside the CLI:

/plugin marketplace add PCIRCLE-AI/memesh-llm-memory
/plugin install memesh@pcircle-memesh

Claude Code wires hooks, skills, and the MCP server automatically. You get in-session auto-capture, proactive recall, the /memesh skill (remember / recall / learn / forget) inside the Claude Code conversation, and remember / recall / forget / learn available as MCP tools to the agent.

The MCP server runs directly from the plugin's bundled compiled output โ€” no npx lookup, no build step needed. If the native better-sqlite3 binding is missing on first start (e.g. after a Node major upgrade), the launcher self-heals by rebuilding it in-process.

This installs the plugin only. You can run CLI commands via npx @pcircle/memesh <command> if you absolutely don't want a global install, but typing plain memesh in a terminal will report command not found. To get a real shell memesh command, also run Option B below โ€” both paths coexist and share the same memory database. The "Install paths at a glance" diagram above covers this.

Option B โ€” npm global (optional optimisation)

If you want the binary directly on your shell PATH (so plain memesh, memesh-mcp, etc. work in any terminal without the per-call npx lookup), or you want to expose memesh-mcp as a fixed-path stdio command to non-Claude-Code MCP clients (Cursor, Cline, terminal-only flows):

npm install -g @pcircle/memesh

First-install notes (one-time):

  • Native modules โ€” better-sqlite3 and sqlite-vec install via prebuilt binaries on macOS (arm64/x64), Linux (x64/arm64), and Windows x64. On uncommon platforms or when prebuilds fail, you'll need a working C/C++ toolchain.
  • Embedding model โ€” the first call that triggers a local embedding (e.g. recall with semantic mode) downloads Xenova/all-MiniLM-L6-v2 (~80 MB) into ~/.memesh/models/. Subsequent calls are instant. The default retrieval path (FTS5) does not require this download.

Step 1.5: Wire MeMesh into Claude Code (npm path only)

If you installed via Option A (/plugin install memesh@pcircle-memesh), skip this step โ€” Claude Code wires plugin hooks automatically.

If you installed via Option B (npm install -g), the CLI is on your PATH and the MCP server is registered, but the Claude Code session hooks are not auto-wired. Without them you can still use memesh remember / recall manually, but the auto-capture loop (sessions โ†’ lessons โ†’ recall on next session) is silent.

memesh install-hooks         # adds memesh's hooks to ~/.claude/settings.json
memesh doctor                # verifies "Hooks wired into Claude Code" passes

The hooks coexist with any custom hooks you already have under ~/.claude/hooks/ โ€” install-hooks writes additive entries and never overwrites yours. To remove later: memesh uninstall-hooks.

Step 2: Store a decision

The bash examples below assume memesh is on your PATH (Option B). Option A (plugin-only) users have two equivalent paths: ask in the Claude Code conversation (the /memesh skill + MCP tools cover the same flows), or replace memesh with npx @pcircle/memesh in any shell โ€” same flags, no global install needed.

memesh remember "Use OAuth 2.0 with PKCE for the new auth"

Or use the explicit form when you want a stable name and type for later filtering:

memesh remember --name "auth-decision" --type "decision" --obs "Use OAuth 2.0 with PKCE"

Step 3: Recall it later

memesh recall "login security"
# โ†’ Finds "OAuth 2.0 with PKCE" even though you searched different words

That's it. MeMesh is now remembering and recalling across sessions.

If you want to verify the install and local wiring end to end:

memesh doctor

Open the dashboard to explore your memory:

memesh

MeMesh Search โ€” find any memory instantly

MeMesh Analytics โ€” health score, timeline, patterns, knowledge coverage

MeMesh Graph โ€” interactive knowledge graph with type filters and ego mode


Who Is This For?

If you are...MeMesh helps you...
A developer using Claude CodeAuto-recall project decisions, file-specific lessons, and past failures as you work
A coding-agent power userShare one local memory layer across MCP-compatible tools
A team experimenting with AI coding workflowsExport/import project knowledge without introducing hosted infrastructure
An agent developerAdd local memory through MCP, HTTP, CLI, or the Python SDK

Designed For Coding Agents First

Claude Code / Desktop

memesh-mcp

MCP tools + Claude Code hooks

Any HTTP Client

curl localhost:3737/v1/recall \
  -H "Content-Type: application/json" \
  -d '{"query":"auth"}'

memesh serve (REST API)

Any LLM (OpenAI format)

memesh export-schema \
  --format openai

Paste tools into any API call


Why Not OpenMemory, Cursor Memories, Mem0, Or Zep?

MeMeshOpenMemoryCursor MemoriesMem0Zep / Graphiti
Best fitLocal memory for coding agentsLocal/cross-client MCP memoryCursor-native project memoryManaged app/agent memoryTemporal knowledge graphs
Install shapenpm install -g @pcircle/memeshLocal app/server flowBuilt into CursorCloud API / SDK / MCPService/framework setup
StorageOne local SQLite fileLocal memory stackCursor-managed rules/memoriesHosted or self-hosted stackGraph database
Cloud requiredNoNo for local modeDepends on Cursor account/settingsYes for platformUsually yes/self-hosted
Claude Code hooksFirst-classMCP toolsNoMCP toolsNot Claude Code-specific
DashboardBuilt inBuilt inCursor settingsPlatform dashboardPlatform/graph tooling
TradeoffSimple local wedge, not enterprise scaleBroader local app footprintLocked to CursorStrong managed platform, less local-firstStrong graph model, heavier setup

MeMesh trades enterprise-scale managed infrastructure for instant local setup, inspectable storage, and coding-agent workflow hooks.


What Happens Automatically In Claude Code

You don't need to manually remember everything. MeMesh has 7 hooks that capture and inject knowledge while you work:

WhenWhat MeMesh does
Every session startLoads your most relevant memories + proactive warnings from past lessons
Before editing filesRecalls memories tied to the file or project before Claude writes code
Before bash commands(Opt-in) Nudges Claude to dispatch high-verifiability commands (test, build, lint, migrate, deploy, benchmark) as background agents
When you ask to rememberDetects "remember this" / "guardar en memesh" / "sauvegarder dans memesh" / "่จ˜ไธ‹ไพ†" intent (5 languages) and reminds Claude to use memesh
After every git commitRecords what you changed, with diff stats
When Claude stopsCaptures files edited, errors fixed, and auto-generates structured lessons from failures
Before context compactionSaves knowledge before it's lost to context limits

Opt out anytime: export MEMESH_AUTO_CAPTURE=false


Configuration

All configuration is via environment variables. Defaults are local-only and zero-network โ€” you don't need to set anything to get a working system.

VariableDefaultWhat it does
MEMESH_DB_PATH~/.memesh/knowledge-graph.dbOverride the SQLite database location.
MEMESH_AUTO_CAPTUREtrueDisable the auto-capture hooks (Stop, PreCompact) entirely.
MEMESH_AUTO_DETECT_LLMunsetSet to 1 to let memesh auto-detect a provider from your shell env (OPENAI_API_KEY etc.) and switch to BYOK embeddings. Default fresh-install is local ONNX (384-dim) only โ€” opt in if you want cloud embeddings. Without this flag set, an OPENAI_API_KEY lying around in your shell is ignored.
MEMESH_ENABLE_AGENTIC_ORCHESTRATIONunsetSet to 1 to enable an experimental working-model protocol (CTO / Orchestrator / Agents framing). Adds a session-start banner, a Bash command nudge, and verify_agent_work telemetry. The protocol's effectiveness is being instrumented, not yet proven โ€” opt in if you want to participate. Default is OFF: the core memory features work without this flag.
MEMESH_AUTO_UPDATEoffAuto-update policy. off (default) never auto-updates; patch allows X.Y.Z โ†’ X.Y.Z+N; minor adds X.Y.Z โ†’ X.Y+1.0; major allows any bump. When permitted, a detached npm install -g fires at session end (Stop hook) so it never blocks your work โ€” outcomes land in ~/.memesh/auto-update.log. Also settable as autoUpdate in ~/.memesh/config.json (env wins). When the installed version is deprecated by maintainers (security advisory), patch is force-allowed even on off โ€” minor / major bumps still stay manual to avoid silent behaviour drift.
OPENAI_API_KEYunsetYour OpenAI key. Only used when MEMESH_AUTO_DETECT_LLM=1 or you explicitly configure the provider.
OLLAMA_HOSThttp://localhost:11434Override the Ollama endpoint when using a local Ollama provider.

memesh doctor prints the resolved configuration so you can see what's active.

When npm flags an installed version as deprecated (typically a security advisory), the next session-start prepends a strong โš ๏ธ MeMesh <ver> is DEPRECATED banner and memesh update-status surfaces the same line until you upgrade. The check is cached at ~/.memesh/update-check.<version>.json so a transient network failure can't dim the warning.


Dashboard

8 tabs, 11 languages, zero external dependencies. Access at http://localhost:3737/dashboard when the server is running.

TabWhat you see
InsightsMemory insights โ€” weekly recaps and pattern proposals from the dreamer engine; one-click accept/reject
SearchFull-text + vector similarity search across all memories
BrowsePaginated list of all entities with archive/restore
AnalyticsMemory Health Score, 30-day timeline, PM velocity + KG connectivity metrics, work patterns, cleanup suggestions
GraphInteractive force-directed knowledge graph with type filters, search, ego mode, recency heatmap
LessonsStructured lessons from past failures (error, root cause, fix, prevention)
ManageArchive and restore entities
SettingsLLM provider config, instant language selector

Smart Features

๐Ÿง  Smart Search โ€” Search "login security" and find memories about "OAuth PKCE". MeMesh expands queries with related terms using your configured LLM.

๐Ÿ“Š Scored Ranking โ€” Results ranked by relevance (30%) + recency (25%) + frequency (15%) + confidence (15%) + recall impact (10%) + temporal validity (5%).

๐Ÿ”„ Knowledge Evolution โ€” Decisions change. forget archives old memories (never deletes). supersedes relations link old โ†’ new. Your AI always sees the latest version.

โš ๏ธ Conflict Detection โ€” If you have two memories that contradict each other, MeMesh warns you.

๐Ÿ•ธ๏ธ Knowledge Graph Connectivity โ€” memesh kg backfill-relations --all-rules links orphan entities using tag co-occurrence, project clustering, session context, and name similarity โ€” no LLM required. Reduces orphan rate from 89% to under 12% on a representative knowledge base.

๐Ÿ“ฆ Team Sharing โ€” memesh export > team-knowledge.json โ†’ share with your team โ†’ memesh import team-knowledge.json Imported bundles stay searchable, but MeMesh does not auto-inject imported memories into Claude hooks until you review or re-store them locally.


Example Usage

"MeMesh remembered that we chose PKCE over implicit flow three weeks ago. When I asked Claude about auth again, it already knew โ€” no re-explaining needed." โ€” Solo developer, building a SaaS

"We export our team's memory every Friday and import it Monday. Everyone's Claude starts the week knowing what the team learned last week." โ€” 3-person startup, shared knowledge base

"The dashboard showed me that 90% of my memories were auto-generated session logs. I started using remember deliberately for architecture decisions. Game changer." โ€” Developer who discovered the Analytics tab


Unlock Smart Mode (Optional)

MeMesh works offline by default โ€” recall stays strictly LLM-free (95.40% R@5 on LongMemEval-S out of the box). Add an LLM API key only if you want LLM-augmented analysis flows on top: smarter session extraction, auto-tagging of new memories, lesson generation from failures, and consolidate / dream compression:

memesh config set llm.provider anthropic
memesh config set llm.api-key sk-ant-...

Or use the dashboard Settings tab (visual setup):

memesh  # opens dashboard โ†’ Settings tab
Level 0 (default)Level 1 (Smart Mode)
SearchFTS5 + sqlite-vec, 95.40% R@5 (~18ms/query)unchanged โ€” recall is LLM-free at every level
Auto-captureRule-based patterns+ LLM extracts decisions & lessons
Auto-taggingManual tags only+ LLM generates tags for new memories
Failure analysisNot available+ LLM converts session errors into structured lessons
CompressionNot availableconsolidate + dream compress verbose memories
CostFree, no API key~$0.0001 per analysis call (Haiku)

All 9 Memory Tools

ToolWhat it does
rememberStore knowledge with observations, relations, and tags
recallFTS5 + sqlite-vec search with multi-factor scoring (relevance, recency, frequency, confidence, temporal validity) โ€” no LLM in the hot path
forgetSoft-archive (never deletes) or remove specific observations
consolidateLLM-powered compression of verbose memories
exportShare memories as JSON between projects or team members
importImport memories with merge strategies (skip / overwrite / append)
learnRecord structured lessons from mistakes (error, root cause, fix, prevention)
user_patternsAnalyze your work patterns โ€” schedule, tools, strengths, learning areas
verify_agent_workPersist a verification report for background-agent work; reality-checks claimed file changes against git diff

Architecture

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   Core Engine   โ”‚
                    โ”‚  (8 operations) โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
           โ”‚                 โ”‚                 โ”‚
     CLI (memesh)    HTTP API (serve)    MCP (memesh-mcp)
           โ”‚                 โ”‚                 โ”‚
           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                    SQLite + FTS5 + sqlite-vec
                    (~/.memesh/knowledge-graph.db)

Core is framework-agnostic. Same logic runs from terminal, HTTP, or MCP.


Upgrading

Claude Code's plugin marketplace pins versions at install time and does not auto-update. To pick up a new release:

Option A โ€” /plugin UI: uninstall memesh@pcircle-memesh, then reinstall. Claude Code fetches the latest marketplace version.

Option B โ€” one-line script (no UI clicking, idempotent):

# If your plugin install is v4.2.5 or newer, the script ships inside it:
bash ~/.claude/plugins/cache/pcircle-memesh/memesh/<current-version>/scripts/upgrade-plugin.sh

# If you installed before v4.2.5 (i.e. you're on v4.2.4 or v4.2.3),
# the script isn't in your plugin yet. Use the npm-global copy instead:
bash "$(npm prefix -g)/lib/node_modules/@pcircle/memesh/scripts/upgrade-plugin.sh"

# (That assumes you've also run `npm install -g @pcircle/memesh`. If you
# haven't, this is also a good moment to โ€” see the "Install paths at a
# glance" section above for why most users want both paths.)

The script fast-forwards the marketplace cache, stages the new version under ~/.claude/plugins/cache/, installs runtime deps, and re-points installed_plugins.json. Restart Claude Code afterwards so the MCP server reconnects.

npm-global installs (npm install -g @pcircle/memesh) can self-update via memesh update. Source checkouts: git pull && npm install && npm run build.

Session start surfaces a one-line banner (throttled to once per 24h per version) when a newer release is available, and memesh doctor reports the upgrade target with the channel-specific command.


Contributing

git clone https://github.com/PCIRCLE-AI/memesh-llm-memory
cd memesh-llm-memory && npm install && npm run build
npm test             # 630 tests
npm run test:e2e-dashboard

Dashboard: cd dashboard && npm install && npm run dev


MIT โ€” Made by PCIRCLE AI

Related Servers

NotebookLM Web Importer

Import web pages and YouTube videos to NotebookLM with one click. Trusted by 200,000+ users.

Install Chrome Extension