Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Provides persistent, searchable memory for Claude Code using local SQLite, semantic embeddings, and full-text search, enabling Claude to recall and retrieve context across sessions and projects without external services.

README.md

<p align="center"> <img src="assets/banner.svg" alt="claude-memory" width="680"> </p>

claude-memory

Persistent, searchable memory for Claude Code — backed by SQLite, semantic embeddings, and full-text search. Connected via MCP.

Everything runs locally. No API keys. No cloud services. Your data never leaves your machine.

---

Claude remembers. Across sessions. Across projects. Forever.

You: "What do you remember about my auth setup?"

Claude: *searches 847 memories semantically*
        *finds 3 relevant entries across 2 projects*
        *ranks by importance, recency, and relevance*

"Based on my memory: you use JWT with refresh token rotation,
 the auth middleware lives in src/middleware/auth.ts, and you
 switched from Passport to a custom solution last month because..."

Why this exists

Claude Code ships with MEMORY.md — a per-project markdown file, capped at ~200 lines, loaded in full every message. It works for small notes. It doesn't scale.

| | MEMORY.md | claude-memory | |---|---|---| | Scope | Single project | Global — all projects, all sessions | | Search | None (full file loaded every turn) | Semantic + full-text hybrid search | | Capacity | ~200 lines before truncation | Unlimited (SQLite) | | Structure | Flat markdown | Categories, tags, relations, importance | | Duplicates | Manual | Automatic 85% similarity detection | | Relevance | All or nothing | Importance scoring with time decay | | Connections | None | Typed relationship graph |

Quick start

Requires Node.js 18+

git clone https://github.com/Tim-Fischer-zh/claude-memory.git
cd claude-memory
./install.sh

Restart Claude Code. The embedding model (~23MB) downloads on first use — subsequent starts are instant.

To uninstall:

./uninstall.sh          # backs up your database
./uninstall.sh --force  # deletes everything, no backup

<details> <summary>What the installer does</summary> <br>

  1. Copies source to ~/.claude/memory-server/
  2. Runs npm install and compiles TypeScript
  3. Registers the MCP server in ~/.claude.json (merges safely — won't overwrite your other servers)
  4. Installs Claude rules to ~/.claude/rules/ (won't overwrite custom rules)
// Added to ~/.claude.json
{
  "mcpServers": {
    "memory": {
      "command": "node",
      "args": ["~/.claude/memory-server/dist/index.js"]
    }
  }
}

</details>

---

Tools

11 MCP tools, organized by function.

Store & retrieve

| Tool | What it does | |:-----|:------------| | remember | Store knowledge with category, tags, and source tracking. Checks for duplicates — warns if >85% similar memory exists. | | recall | Hybrid search: semantic similarity + full-text matching + importance scoring. Finds "JWT middleware" when you search "auth setup". | | update_memory | Modify content, category, tags, or importance. Auto re-embeds on content change. | | forget | Delete a memory and cascade to its embedding and relationships. |

Browse

| Tool | What it does | |:-----|:------------| | list_categories | Overview of categories, entry counts, and embedding model status. |

Connect

| Tool | What it does | |:-----|:------------| | relate | Link two memories: related, supersedes, caused_by, contradicts, supports, depends_on. | | find_related | Traverse the relationship graph + find semantically similar entries. |

Maintain

| Tool | What it does | |:-----|:------------| | consolidate | Scan for clusters of duplicate/similar memories. Returns groups ranked by similarity. | | merge | Combine multiple memories into one. Preserves relationships, merges tags, deletes originals. |

Explore

| Tool | What it does | |:-----|:------------| | visualize | Open the memory graph UI in the browser — force-directed graph, categories, search, stats. |

---

How it works

Semantic search

Memories are embedded locally using all-MiniLM-L6-v2 (384 dimensions) via Transformers.js. Searching "immutability preferences" finds a memory stored as "always use functional patterns, never mutate state" — no keyword overlap needed.

The model loads in the background. Until ready, search falls back to full-text only — the server is always responsive.

Hybrid ranking

Every search combines three signals:

score = semantic_similarity × 0.5
      + full_text_relevance × 0.2
      + importance_score    × 0.3

Importance blends manual priority, access frequency, and pin status with time decay:

importance = (manual_importance × 0.4 + access_frequency × 0.3 + pinned × 0.3)
           × decay

decay = pinned ? 1.0 : e^(-0.005 × days_since_last_access)

Frequently accessed, manually prioritized, or pinned memories rank higher. Unused memories fade — unless pinned.

Deduplication

When storing, the server checks cosine similarity against all existing memories. If a match exceeds 85% similarity, it returns the existing memory instead of creating a duplicate.

Relationship graph

Memories form a directed graph:

"Use JWT for auth"       ──caused_by──▶  "Security audit findings"
"Switch to bun"          ──supersedes──▶  "Use npm for all projects"
"Redis caching layer"    ──depends_on──▶  "Redis deployment config"
"Use REST not GraphQL"   ──contradicts─▶  "Evaluate GraphQL for API"

find_related traverses explicit edges and surfaces semantically similar entries — giving you both explicit and implicit connections.

Consolidation

Over time, small related memories accumulate:

"Tim uses TypeScript for all projects"     ┐
"Always use strict TypeScript"              ├── 87% similar → merge candidates
"TypeScript with strict mode is preferred"  ┘

consolidate finds these clusters. merge combines them into one clean entry, preserving all relationships.

Source tracking

Every memory can record where it came from:

  • source_project — project directory (e.g. ~/projects/my-app)
  • source_session — Claude Code session ID
  • source_file — file being worked on

Agent support

The installed rules ensure every agent and subagent:

  1. Calls recall before starting work to load relevant context
  2. Has access to memory tools for storing findings
  3. Sets source_project when remembering

This works with the Agent tool, Tasks, agent teams, swarms, and pipelines.

---

Performance

<p align="center"> <img src="assets/benchmarks.svg" alt="Benchmark results" width="800"> </p>

<details> <summary>Run the benchmark yourself</summary> <br>

node tools/benchmark.js

Seeds 1,000 test memories if your database has fewer than 50, runs all benchmarks, then cleans up. Your real data is never modified. </details>

---

Visualizer

Built-in web UI for exploring your memory database — force-directed graph, category filters, search, and live stats.

# standalone
node tools/visualize.js

# or via Claude
"show me my memory"  →  Claude runs the visualize tool

Open localhost:4200.

<details> <summary>Features</summary> <br>

  • Force graph — D3 force-directed layout, edges for typed relationships
  • Cluster mode — group nodes by category
  • Radial mode — circular layout by category
  • Sidebar — searchable, filterable card list synced with the graph
  • Tooltips — hover any node for content, tags, importance
  • Stats bar — total memories, relations, embeddings, recalls, pinned count
  • Color-coded — distinct colors per category, edge colors per relation type
  • Interactive — drag, zoom, click-to-highlight

</details>

---

Architecture

┌─────────────┐     stdio/MCP     ┌──────────────────┐     ┌──────────┐
│             │◄─────────────────►│  Memory Server   │────►│  SQLite  │
│  Claude Code │                   │                  │     │  + FTS5  │
│             │                   │  index.ts        │     │  + WAL   │
└─────────────┘                   │  db.ts           │     └──────────┘
                                  │  embeddings.ts   │────►┌──────────┐
                                  └──────────────────┘     │ MiniLM   │
                                                           │ L6-v2    │
                                                           └──────────┘

Schema

memories (
  id, content, category, tags,
  source_project, source_session, source_file,
  importance, access_count, last_accessed_at, pinned,
  created_at, updated_at
)

memory_embeddings (
  memory_id  → memories.id,
  embedding  BLOB  -- Float32Array × 384
)

memory_relations (
  source_id  → memories.id,
  target_id  → memories.id,
  relation_type  -- related | supersedes | caused_by | contradicts | supports | depends_on
)

memories_fts  -- FTS5 virtual table over content, category, tags

Project structure

src/
  index.ts          MCP server — tool definitions, request handling
  db.ts             Database — schema, queries, scoring, relations
  embeddings.ts     Embedding model — lazy loading, cosine similarity
rules/
  memory.md         Claude rule — automatic memory usage
  agents.md         Agent rule — memory-aware agent spawning
tools/
  visualize.js      Web UI — D3 force graph, category explorer
  benchmark.js      Performance benchmarks
install.sh          Safe installer (preserves existing config)
uninstall.sh        Uninstaller with database backup

Storage paths

| Path | Contents | |:-----|:---------| | ~/.claude/memory-server/dist/ | Compiled server | | ~/.claude/memory-server/memory.db | Your knowledge base | | ~/.claude/memory-server/models/ | Cached embedding model (~23MB) | | ~/.claude/rules/claude-memory.md | Installed Claude rule | | ~/.claude/rules/claude-memory-agents.md | Agent awareness rule |

The database uses WAL mode for safe concurrent access.

---

License

MIT

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Databases servers.