ClawMem

Memory and knowledgeData and AI

On-device memory layer for AI agents. Claude Code, OpenClaw and Hermes. Hooks + MCP server + hybrid RAG search.

Your AI app calls the ClawMem MCP server, which does the memory and knowledge and data and AI work and sends the result back to the chat.

About ClawMem

ClawMem is a community MCP server from yoloshii, filed in our directory under memory and knowledge and data and ai. On-device memory layer for AI agents. Claude Code, OpenClaw and Hermes. Hooks + MCP server + hybrid RAG search.

At a glance

Publisher
yoloshii (community)
Runs
See the README for setup
Written in
TypeScript
License
MIT
GitHub stars
212

How to set up ClawMem

  1. Follow the install steps in the ClawMem README; it is written in TypeScript, so have that toolchain ready.
  2. Check the ClawMem README for keys or settings; the registry lists none that ClawMem requires.
  3. Add ClawMem to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the ClawMem tools to confirm the connection.
  5. Run one read-only task with ClawMem first, and keep your app asking before each tool call until the results look right.

ClawMem compared with similar servers

  • Mind by GabrielMartinMoran has fewer GitHub stars than ClawMem (207 against 212); both are community servers, and both run locally.
  • Www Project Agent Memory Guard by OWASP has more GitHub stars than ClawMem (214 against 212); both are community servers, and both run locally.
  • Best Agent Memory by Glen-Web-App has fewer GitHub stars than ClawMem (205 against 212); both are community servers, and both run locally.

Before you connect ClawMem

  • Give ClawMem its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each ClawMem tool call until you trust what it does with them.
  • Treat text that ClawMem fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for ClawMem on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for ClawMem

How marketing and sales teams put ClawMem to work, by company size. Pick the size closest to yours and start ClawMem on one use case.

Small business

  • A small business can give ClawMem its offers, FAQs and tone of voice once, so every draft starts from the same facts.
  • Founders can use ClawMem to keep notes from calls and decisions, then ask what was agreed with a customer weeks later.
  • A small team can use ClawMem to clean and enrich a lead list or a spreadsheet in one pass, instead of hours of copy and paste.
  • ClawMem runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing teams can connect ClawMem to positioning docs and past campaigns, so agents write on message without a long prompt each time.
  • Sales and marketing can share one knowledge base through ClawMem, so answers about pricing and features match across teams.
  • Marketing ops can connect ClawMem to enrich and score inbound leads, so sales sees fit and intent before the first call.
  • Start ClawMem on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises can use ClawMem with permissions that follow the source documents, so an agent only recalls what the person asking may see.
  • Large orgs can make ClawMem the approved memory layer for agents, with retention rules and a way to delete what shouldn't be kept.
  • Enterprises can run ClawMem inside their own cloud and data boundary, so models and data stay where governance requires.
  • ClawMem is a community server, so have security review the code and pin a version before ClawMem touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

ClawMem README

From yoloshii/ClawMem on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

ClawMem, On-device memory layer for Claude Code, OpenClaw, and Hermes agents

On-device memory for Claude Code, OpenClaw, Hermes, and AI agents. Retrieval-augmented search, hooks, and an MCP server in a single local system. No API keys, no cloud dependencies.

ClawMem fuses recent research into a retrieval-augmented memory layer that agents actually use. The hybrid architecture combines QMD-derived multi-signal retrieval (BM25 + vector search + reciprocal rank fusion + query expansion + cross-encoder reranking), SAME-inspired composite scoring (recency decay, confidence, content-type half-lives, co-activation reinforcement), MAGMA-style intent classification with multi-graph traversal (semantic, temporal, and causal beam search), and A-MEM self-evolving memory notes that enrich documents with keywords, tags, and causal links between entries. Pattern extraction from Engram adds deduplication windows, frequency-based durability scoring, and temporal navigation.

Integrates via Claude Code hooks, an MCP server (works with any MCP-compatible client), a native OpenClaw plugin, or a Hermes Agent MemoryProvider plugin. All paths write to the same local SQLite vault. A decision captured during a Claude Code session shows up immediately when an OpenClaw or Hermes agent picks up the same project.

TypeScript on Bun. MIT License.

What It Does

ClawMem turns your markdown notes, project docs, and research dumps into persistent memory for AI coding agents. It automatically:

  • Surfaces relevant context on every prompt (context-surfacing hook)
  • Bootstraps sessions with your profile, latest handoff, recent decisions, and stale notes
  • Captures decisions, preferences, milestones, and problems from session transcripts using a local GGUF observer model
  • Imports conversation exports from Claude Code, ChatGPT, Claude.ai, Slack, and plain text via clawmem mine, with optional post-import LLM fact extraction (--synthesize) that pulls structured decisions / preferences / milestones / problems and cross-fact links out of otherwise full-text conversation dumps (v0.7.2). Imports preserve authorship time (v0.27.0): ranking recency and temporal queries run on when content was actually written, so historical conversations mined today don't rank as fresh, with a metadata-only --backfill-dates lane for vaults mined earlier
  • Generates handoffs at session end so the next session can pick up where you left off
  • Learns what matters via a feedback loop that boosts referenced notes and decays unused ones
  • Guards against prompt injection in surfaced content
  • Classifies query intent (WHY / WHEN / ENTITY / WHAT) to weight search strategies
  • Traverses multi-graphs (semantic, temporal, causal) via adaptive beam search
  • Evolves memory metadata as new documents create or refine connections
  • Infers causal relationships between facts extracted from session observations
  • Detects contradictions between new and prior decisions, auto-decaying superseded ones, when a contradiction judge is configured (CLAWMEM_JUDGE_*, v0.29.0; disabled otherwise) (with an additional merge-time contradiction gate in the consolidation worker that blocks cross-observation contradictions before they land, v0.7.1)
  • Guards against cross-entity merges during consolidation, name-aware dual-threshold merge safety compares entity anchors before merging similar observations, preventing "Alice decided X" from merging into "Bob decided X" (v0.7.1)
  • Prevents context bleed in derived insights, the Phase 3 deductive synthesis pipeline validates every draft against an anti-contamination wrapper (deterministic entity contamination check + LLM validator + dedupe) before writing cross-session deductive observations (v0.7.1)
  • Frames surfaced facts as background knowledge, context-surfacing wraps injected content in <instruction> + <facts> + <relationships> blocks, telling the model to treat facts as already-known and exposing memory-graph edges between surfaced docs directly in-prompt (v0.7.1)
  • Injects knowledge-graph facts as structured triples, when the user's prompt mentions entities already known to the vault, context-surfacing resolves them via a three-path prompt-only extractor (canonical IDs, proper nouns, lowercased n-grams), queries the SPO graph for current-state triples, and appends a <vault-facts> block of raw subject predicate object lines to <vault-context>, off for speed, 200 tokens on balanced, 250 on deep, token-truncated at the triple boundary (v0.9.0)
  • Session-scoped focus topic, clawmem focus set "<topic>" --session-id <id> writes a per-session focus file used as a snippet-selection intent: surfaced docs prefer sentences matching the topic. Presentation only since v0.38.0, a focus never changes expansion, reranking, scoring, ordering, or the surfaced set, session-isolated, fail-open, never writes to SQLite or lifecycle columns (v0.9.0, narrowed v0.38.0)
  • Ranks hook injections on one channel-aware key, every retrieval leg (BM25, vector, file-aware, gated prior-turn, expansion variants) contributes a ranked lane; weighted reciprocal-rank fusion yields a single ordering key (current-support band, fused mass) that decides membership, final order, AND admission, no mixed raw-score sorts, no metadata reordering (v0.38.0)
  • Admits by relevance, abstains honestly, the context-surfacing hook admits candidates by a relative floor on the fused ordering key and abstains at query level when current-turn support is missing or keyword-degenerate, instead of surfacing weak lists (v0.38.0)
  • Guards the deep rerank lane, cross-encoder scores apply only under full candidate coverage AND a discriminating score set (degeneracy gate); the reranker joins the final order as a rank-fused lane, and remote rerank scores are cached only under an attested provider identity (clawmem rerank-health) (v0.38.0)
  • Keeps the hook's write path off your prompt latency, turn alignment is one early fail-closed row; recall attribution, token accounting, and vault mirrors are handed to a detached drainer process through an on-disk spool after the payload is emitted (v0.38.0)
  • Scores document quality using structure, keywords, and metadata richness signals
  • Boosts co-accessed documents, notes the agent verifiably referenced together in one turn (v0.41.0) get retrieval reinforcement on the composite MCP surfaces (removed from hook ordering in v0.38.0, the injected order is the channel-aware fusion key alone)
  • Decomposes complex queries into typed retrieval clauses (BM25/vector/graph) for multi-topic questions
  • Cleans stale embeddings automatically before embed runs, removing orphans from deleted/changed documents
  • Transaction-safe indexing, crash mid-index leaves zero partial state (atomic commit with rollback)
  • Processes each turn once, the extraction and handoff hooks keep a cursor per transcript and the feedback hook decides each surfaced turn once (v0.41.0), so a turn is extracted, summarised and credited once instead of again at every response, and each session's documents are its own
  • Navigates temporal neighborhoods around any document via the timeline tool, progressive disclosure from search to chronological context to full content
  • Boosts frequently-revised memories, documents with higher revision counts get a durability signal in composite scoring (capped at 10%)
  • Supports pin/snooze lifecycle for persistent boosts and temporary suppression
  • Manages document lifecycle, policy-driven archival sweeps with restore capability
  • Auto-routes queries via memory_retrieve, classifies intent and dispatches to the optimal search backend
  • Syncs project issues from Beads issue trackers into searchable memory
  • Runs a quiet-window heavy maintenance lane, a second consolidation worker, off by default behind CLAWMEM_HEAVY_LANE=true, that runs on a longer interval only inside a configurable hour window. Gated by context_usage query-rate so it never competes for CPU/GPU with interactive sessions, scoped exclusively via DB-backed worker_leases, stale-first by default with an optional surprisal selector, and journals every attempt in maintenance_runs for operator visibility (v0.8.0)

Runs fully local with no API keys and no cloud services. Integrates via Claude Code hooks and MCP tools, as a native OpenClaw plugin, or as a Hermes Agent MemoryProvider plugin. All modes share the same vault for cross-runtime memory. Works with any MCP-compatible client.

Full version history is in RELEASE_NOTES.md. Upgrade instructions for existing vaults are in docs/guides/upgrading.md.

Architecture

Install

Platform Support
Platform Status Notes
Linux Full support Primary target. systemd services for watcher + embed timer.
macOS Full support Homebrew SQLite handled automatically. GPU via Metal (llama.cpp).
Windows (WSL2) Full support Recommended for Windows users. Install Bun + ClawMem inside WSL2.
Windows (native) Not recommended Bun and sqlite-vec work, but bin/clawmem wrapper is bash, hooks expect bash commands, and systemd services have no equivalent. Use WSL2 instead.
Prerequisites

Required:

  • Bun v1.3.14+, runtime for ClawMem (1.4.0 or later recommended; before 1.2.21 ClawMem refuses to open a vault). On Linux, install via curl -fsSL https://bun.sh/install | bash (not snap, snap Bun cannot read stdin, which breaks hooks).
  • SQLite with FTS5, included with Bun. On macOS, install brew install sqlite for extension loading support (ClawMem detects and uses Homebrew SQLite automatically).

Optional (for better performance):

  • llama.cpp (llama-server), for dedicated GPU inference. Without it, node-llama-cpp runs models in-process (auto-downloads on first use). GPU servers give better throughput and prevent silent CPU fallback.
  • systemd (Linux) or launchd (macOS), for persistent background services (watcher, embed timer, GPU servers). ClawMem ships systemd unit templates; macOS users can create equivalent launchd plists. See systemd services.

Optional integrations:

  • Claude Code, for hooks + MCP integration
  • OpenClaw, for native plugin integration
  • Hermes Agent, for MemoryProvider plugin integration
  • bd CLI v0.58.0+ (verified through v1.1.0), for Beads issue tracker sync (only if using Beads)
Install from npm (recommended)
npm install -g clawmem

If you use Bun as your package manager:

bun add -g clawmem
Install from source
git clone https://github.com/yoloshii/clawmem.git ~/clawmem
cd ~/clawmem && bun install
ln -sf ~/clawmem/bin/clawmem ~/.bun/bin/clawmem
Setup roadmap

After installing, here's the full journey from zero to working memory:

Step What How Details
1. Bootstrap Create a vault, index your first collection, embed, install hooks and MCP clawmem bootstrap ~/notes --name notes One command does it all. Or run each step manually (see below).
2. Choose models Pick embedding + reranker models based on your hardware 16GB+ VRAM → SOTA stack (zembed-1 + zerank-2). Less → QMD native combo. No GPU → cloud embedding or CPU fallback. Inference services
3. Download models Get the model files for your chosen stack (GGUFs for all three services; for zerank-2, only a GGUF that carries its score head works) wget from HuggingFace, let node-llama-cpp auto-download the QMD native models, or build the zerank-2 bf16 sidecar Inference services
4. Start services Run GPU servers (if using dedicated GPU) and background services. Optionally enable the v0.8.2 background maintenance workers in the watcher unit so consolidation + deductive synthesis run automatically. llama-server for each model. systemd units for watcher + embed timer. Drop-in for the watcher to enable workers + tune intervals + set the quiet window. systemd services, background workers
5. Decide what to index Add collections for your projects, notes, research, and domain docs clawmem collection add ~/project --name project The more relevant markdown you index, the better retrieval works. See building a rich context field.
6. Connect your agent Hook into Claude Code, OpenClaw, Hermes, or any MCP client clawmem setup hooks && clawmem setup mcp for Claude Code. clawmem setup openclaw for OpenClaw. Copy src/hermes/ to Hermes plugins for Hermes. Integration
7. Verify Confirm everything is working clawmem doctor (full health check) or clawmem status (quick index stats) Verify Installation

Fastest path: Step 1 alone gets you a working system with in-process CPU/GPU inference and default models, no manual model downloads or service configuration needed. Steps 2-4 are optional upgrades for better performance. Steps 5-6 are where you customize what gets indexed and how your agent connects.

Customize what gets indexed: Each collection has a pattern field in ~/.config/clawmem/config.yaml (default: **/*.md). Tailor it per collection, index project docs, research notes, decision records, Obsidian vaults, or anything else your agents should know about. The more relevant content in the vault, the better retrieval works. See the quickstart for config examples.

Quick start commands
# One command: init + index + embed + hooks + MCP
clawmem bootstrap ~/notes --name notes

# Or step by step:
clawmem init
clawmem collection add ~/notes --name notes
clawmem update --embed
clawmem setup hooks
clawmem setup mcp

# Add more collections (the more you index, the richer retrieval gets)
clawmem collection add ~/projects/myapp --name myapp
clawmem collection add ~/research --name research
clawmem update --embed

# Verify
clawmem doctor
Upgrading
bun update -g clawmem   # or: npm update -g clawmem

Database schema migrates automatically on next startup (new tables and columns are added via CREATE IF NOT EXISTS / ALTER TABLE ADD COLUMN).

After major version updates (e.g. 0.1.x → 0.2.0) that add new enrichment pipelines, run a full enrichment pass to backfill existing documents:

clawmem reindex --enrich  # Full enrichment: entity extraction (backfill) + links + evolution for all docs
clawmem embed             # Re-embed if upgrading embedding models (not needed for most updates)

--enrich runs the complete A-MEM pipeline (entity extraction, link generation, memory evolution) on all documents, not just new ones; entity extraction inside it skips a document unchanged since its last extraction (enrichment lifecycle). Without it, reindex only refreshes metadata for existing docs.

Routine patch updates (e.g. 0.2.0 → 0.2.1) do not require reindexing.

For version-specific upgrade notes (opt-in features, optional cleanup steps, verification commands), see docs/guides/upgrading.md.

Integration
Claude Code

ClawMem integrates via hooks (settings.json) and an MCP stdio server. Hooks handle 90% of retrieval automatically - the agent never needs to call tools for routine context.

clawmem setup hooks    # Install lifecycle hooks (SessionStart, UserPromptSubmit, Stop, PreCompact)
clawmem setup mcp      # Register MCP server in ~/.claude.json (33 tools)

Automatic (90%): context-surfacing injects relevant memory on every prompt. postcompact-inject re-injects state after compaction. decision-extractor, handoff-generator, feedback-loop capture session state on stop.

Agent-initiated (10%): MCP tools (query, intent_search, find_causal_links, timeline, etc.) for targeted retrieval when hooks don't surface what's needed.

OpenClaw

ClawMem registers as a native OpenClaw memory plugin (kind: memory, v0.10.0+). Same 90/10 automatic retrieval, delivered through OpenClaw's plugin-hook bus instead of Claude Code hooks.

# v0.10.4+: profile-aware. Delegates to `openclaw plugins install --force` when the OpenClaw CLI
# is on PATH (auto-enables the plugin, honors OPENCLAW_STATE_DIR, OPENCLAW_CONFIG_PATH, --profile).
# Falls back to a recursive copy honoring OPENCLAW_STATE_DIR when the CLI is absent.
clawmem setup openclaw

# Custom profile (e.g. dev profile at ~/.openclaw-dev):
OPENCLAW_STATE_DIR=~/.openclaw-dev clawmem setup openclaw

What the plugin provides:

  • before_prompt_build hook (load-bearing) - prompt-aware retrieval (context-surfacing + session-bootstrap) AND the pre-emptive precompact-extract run when token usage approaches the compaction threshold. This is the authoritative path for precompact state capture because it runs synchronously before the LLM call that would trigger compaction, so it cannot race the compactor.
  • agent_end hook - decision extraction, handoff generation, feedback loop (parallel, fire-and-forget at the OpenClaw call site). OpenClaw v2026.4.26+ also enforces a 30s default void-hook timeout on agent_end, slow handlers are logged but the underlying postrun work is not cancelled (fail-open).
  • before_compaction hook (defense-in-depth fallback) - fires precompact-extract again for the rare case where before_prompt_build's proximity heuristic missed a sudden token-count jump. Fire-and-forget at OpenClaw's call site, so it races the compactor and offers no correctness guarantee on its own, the before_prompt_build path is what actually holds the invariant.
  • session_start hook - session registration + cached first-turn bootstrap context
  • 5 agent tools - clawmem_search, clawmem_get, clawmem_session_log, clawmem_timeline, clawmem_similar

Disable OpenClaw's native memory search to avoid duplicate injection:

openclaw config set agents.defaults.memorySearch.extraPaths "[]"

ClawMem coexists cleanly with OpenClaw's Active Memory plugin (v2026.4.10+) and, on OpenClaw v2026.4.18+ (#65411), with the memory-core dreaming sidecar, both run alongside ClawMem instead of being mutually exclusive. They search different backends and inject into different prompt regions, so they do not conflict. See the OpenClaw plugin guide, Active Memory coexistence and the memory-core dreaming sidecar section for the two patterns.

Pair ClawMem (memory) with a context-engine plugin (v0.10.0+). OpenClaw and Hermes maintainers have converged on a two-surface plugin model: one slot for memory plugins (cross-session, retrieval-first) and a separate slot for context-engine plugins (in-session, compression/compaction-first). Under that model ClawMem is a memory layer, it has always been one in Hermes via the MemoryProvider ABC, and v0.10.0 moves the OpenClaw integration to the same semantic slot. You can now run ClawMem in the memory slot alongside an LCM-style compression plugin (for example, lossless-claw) in the context-engine slot. The two plugins do not overlap: one persists across sessions, the other reshapes the live window. See the OpenClaw plugin guide, memory vs context engine for the full rationale.

OpenClaw v2026.4.11+ recommended (required for ClawMem v0.10.0+). v2026.4.11 introduced a new plugin discovery contract that requires each plugin directory to ship a package.json with openclaw.extensions declared, and that rejects symlinked plugin directories. ClawMem v0.10.0 includes both fixes. Older ClawMem versions (< v0.10.0) on OpenClaw v2026.4.11+ will fail to discover silently, upgrade ClawMem, then re-run clawmem setup openclaw. See docs/guides/upgrading.md.

Alternative: OpenClaw agents can also use ClawMem's MCP server directly (clawmem setup mcp), with or without hooks. This gives full access to all 33 MCP tools but bypasses OpenClaw's plugin lifecycle, so you lose token budget awareness, native compaction orchestration, and the agent_end message pipeline. The native OpenClaw plugin is recommended for new setups; MCP is available as an additional or standalone integration.

Hermes Agent

ClawMem integrates as a native MemoryProvider plugin, Hermes's pluggable interface for agent memory. Same automatic retrieval and extraction, delivered through Hermes's memory lifecycle instead of Claude Code hooks.

Install:

# Preferred, user-plugin path (Hermes #10529, v2026.4.13+).
# Survives `git pull` of hermes-agent and avoids dual-registration with bundled providers.
# Copies the directory's CONTENTS, so the same command installs and upgrades.
mkdir -p "${HERMES_HOME:-$HOME/.hermes}/plugins/clawmem"
cp -r /path/to/ClawMem/src/hermes/. "${HERMES_HOME:-$HOME/.hermes}/plugins/clawmem/"

# Or, the bundled-style path (always supported, takes precedence on name collisions).
# Recommended only when you actively work in the hermes-agent source tree.
mkdir -p /path/to/hermes-agent/plugins/memory/clawmem
cp -r /path/to/ClawMem/src/hermes/. /path/to/hermes-agent/plugins/memory/clawmem/

# Symlink alternative for in-place development (either path).
ln -s /path/to/ClawMem/src/hermes ${HERMES_HOME:-~/.hermes}/plugins/clawmem

Configure in your Hermes profile's .env or environment:

CLAWMEM_BIN=/path/to/clawmem          # Path to clawmem binary (or ensure it's on PATH)
CLAWMEM_SERVE_PORT=7438                # REST API port (default: 7438)
CLAWMEM_SERVE_MODE=external            # "external" (you run clawmem serve) or "managed" (plugin manages it)
CLAWMEM_PROFILE=balanced               # speed | balanced | deep

Then set memory.provider: clawmem in your Hermes config.yaml, or run hermes memory setup to configure interactively.

What the plugin provides:

  • prefetch(), prompt-aware retrieval via context-surfacing hook (automatic every turn)
  • sync_turn(), appends the turn to the plugin's transcript, then runs decision extraction, handoff generation and the feedback loop over it in the background (v0.41.0: after every turn; each turn is processed once)
  • on_session_end(), a last pass, then the SessionEnd handoff flush
  • on_pre_compress(), pre-compaction state preservation
  • session-bootstrap, session registration + first-turn context injection
  • 5 agent tools, clawmem_retrieve, clawmem_get, clawmem_session_log, clawmem_timeline, clawmem_similar
  • Plugin-managed transcript, maintains its own JSONL transcript for ClawMem hooks

Requirements: clawmem binary on PATH and clawmem serve running (external mode) or the plugin starts it automatically (managed mode). Python 3.10+. No pip dependencies beyond Hermes itself (uses urllib for REST calls, httpx optional for better performance).

Alternative: Hermes also has built-in MCP client support. You can add ClawMem as an MCP server in Hermes's config.yaml under mcp_servers for tool-only access. But this misses the lifecycle hooks (prefetch, session_end, pre_compress), so the native plugin is recommended.

See Hermes plugin guide for architecture details, lifecycle mapping, and troubleshooting.

Multi-Framework Operation

All three integrations share the same SQLite vault by default. Claude Code, OpenClaw, and Hermes can run simultaneously, decisions captured in one runtime are immediately available in the others, giving agents persistent shared memory across sessions and platforms. WAL mode + busy_timeout handles concurrent access.

Multi-Vault (Optional)

By default, ClawMem uses a single vault at ~/.cache/clawmem/index.sqlite. For users who want separate memory domains (e.g., work vs personal, or isolated vaults per project), ClawMem supports named vaults.

Configure in ~/.config/clawmem/config.yaml:

vaults:
  work: ~/.cache/clawmem/work.sqlite
  personal: ~/.cache/clawmem/personal.sqlite

Or via environment variable:

export CLAWMEM_VAULTS='{"work":"~/.cache/clawmem/work.sqlite","personal":"~/.cache/clawmem/personal.sqlite"}'

Using vaults with MCP tools:

All retrieval tools (memory_retrieve, query, search, vsearch, intent_search) accept an optional vault parameter. Omit it to use the default vault.

# Search the default vault (no vault param needed)
query("authentication flow")

# Search a named vault
query("project timeline", vault="work")

# List configured vaults
list_vaults()

# Sync content into a vault
vault_sync(vault="work", content_root="~/work/docs")

Single-vault users: No action needed. Everything works without configuration. The vault parameter is always optional and ignored when no vaults are configured.

Inference services (GPU, in-process, or cloud)

ClawMem uses three inference services, embedding, LLM (query expansion / intent / A-MEM / the Stop hooks' observer), and reranker. In the default stack all three run as llama-server instances, each with an in-process node-llama-cpp fallback that auto-downloads on first use, so ClawMem works without a dedicated GPU (Metal on Apple Silicon, Vulkan where available, CPU as last resort). The bin/clawmem wrapper points at localhost:8088/8089/8090. Always run via bin/clawmem, it sets the endpoints.

Choose a stack:

Stack Models VRAM License When
QMD native (default) EmbeddingGemma-300M + qmd-query-expansion-1.7B + qwen3-reranker-0.6B ~4 GB, or in-process Permissive, commercial OK Any GPU or none; zero-config start
z / SOTA zembed-1 + qmd-query-expansion-1.7B + zerank-2 (Q8_0 GGUF that carries its score head) ~13 GB Apache-2.0, commercial OK 16 GB+ GPU; best recall
Cloud embedding Jina / OpenAI / Voyage / Cohere (embedding only) none provider ToS No local GPU for embedding; LLM + reranker stay local

Heads-up before you serve: most zerank-2 GGUFs are inert, llama.cpp's standard converter drops the score head. Serve the Q8_0 GGUF that carries it (launch line) or the bf16 seq-cls sidecar, and verify with clawmem rerank-health. zembed-1 / reranking need -ub = -b (non-causal attention). Changing embedding dimensions requires clawmem embed --force. Set CLAWMEM_NO_LOCAL_MODELS=true to fail fast instead of silent CPU fallback.

→ Full stack decision matrix, model/VRAM tables, and server-setup commands: docs/guides/inference-services.md. Cloud providers, batch + TPM behavior: docs/guides/cloud-embedding.md. All environment variables: docs/reference/configuration.md. Keeping servers running: docs/guides/systemd-services.md.

MCP Server

ClawMem exposes 33 MCP tools via the Model Context Protocol and an optional HTTP REST API. Any MCP-compatible client or HTTP client can use it.

Claude Code (automatic):

./bin/clawmem setup mcp   # Registers in ~/.claude.json

Manual (any MCP client):

Add to your MCP config (e.g. ~/.claude.json, claude_desktop_config.json, or your client's equivalent):

{
  "mcpServers": {
    "clawmem": {
      "command": "/absolute/path/to/clawmem/bin/clawmem",
      "args": ["mcp"]
    }
  }
}

The server runs via stdio, no network port needed. The bin/clawmem wrapper sets the GPU endpoint env vars automatically.

Verify: After registering, your client should see tools including memory_retrieve, search, vsearch, query, query_plan, intent_search, timeline, etc.

HTTP REST API (optional)

For web dashboards, non-MCP agents, cross-machine access, or programmatic use:

./bin/clawmem serve                          # localhost:7438; every request needs the token (below)
./bin/clawmem serve --port 8080              # custom port
./bin/clawmem serve-token                    # print the token serve uses

Endpoints:

Method Path Description
GET /health Liveness probe + version + doc count
GET /stats Full index statistics
POST /search Unified search (mode: auto/keyword/semantic/hybrid)
POST /retrieve Smart retrieve with auto-routing (mode: auto/keyword/semantic/causal/timeline/hybrid)
GET /documents/:docid Single document by 6-char hash prefix
GET /documents?pattern=... Multi-get by glob pattern
GET /timeline/:docid Temporal neighborhood (before/after)
GET /sessions Recent session history
GET /collections List all collections
GET /lifecycle/status Active/archived/forgotten/pinned/snoozed counts + deactivation_reasons (absent/forget/archive/unknown_legacy)
POST /documents/:docid/pin Pin/unpin
POST /documents/:docid/snooze Snooze until date
POST /documents/:docid/forget Deactivate
POST /lifecycle/sweep Archive stale docs (dry_run default)
GET /graph/causal/:docid Causal chain traversal
GET /graph/similar/:docid k-NN neighbors
GET /export Active-document export as JSON (?full=true includes legacy precompact-state.md snapshot copies)
POST /reindex Trigger re-scan
POST /graphs/build Rebuild temporal + semantic graphs

Auth (v0.42.0): every request needs Authorization: Bearer <token>: CLAWMEM_API_TOKEN when set (32+ characters), otherwise the token file serve generates at ~/.config/clawmem/serve-token; clawmem serve-token prints it. Every POST needs Content-Type: application/json, and requests from web pages (a foreign Origin or Host) are refused. See the REST API reference.

Search example:

curl -X POST http://localhost:7438/search \
  -H "Authorization: Bearer $(clawmem serve-token)" \
  -H 'Content-Type: application/json' \
  -d '{"query": "authentication decisions", "mode": "hybrid", "compact": true}'
Verify Installation
./bin/clawmem doctor   # Full health check
./bin/clawmem status   # Quick index status
bun test               # Run test suite (from the repository root)

Agent Instructions

ClawMem ships agent instruction files and an optional maintenance agent:

File Loaded Purpose
AGENTS.md Automatically (most agents, when working in this repo) Lean root SSOT, agent-facing quick reference (inference at a glance, install, retrieval routing, MCP tools, indexing rules, integrations) + an index into docs/
CLAUDE.md Automatically (Claude Code) @AGENTS.md import, Claude Code reads CLAUDE.md natively, so it just pulls in the SSOT
SKILL.md On-demand (agent reads when needed) Portable operating reference, escalation gate, tool routing, the 4 query-optimization levers, pipeline behavior, composite scoring, lifecycle. Shipped with the package for cross-project use
docs/ On-demand (linked throughout AGENTS.md) Deep reference, inference setup, configuration, concepts, internals, guides, troubleshooting
agents/clawmem-curator.md On-demand via clawmem setup curator Maintenance agent, lifecycle triage, retrieval health checks, dedup sweeps, graph rebuilds

Working in the ClawMem repo: No action needed, CLAUDE.md (which imports AGENTS.md) loads automatically.

Using ClawMem from other projects: Your agent needs instructions on how to use ClawMem's hooks and MCP tools. Two options:

Option A: Copy instructions into your project

Copy the contents of AGENTS.md (or the relevant sections) into your project's own AGENTS.md or CLAUDE.md. Simple but requires manual updates when ClawMem changes.

Read the rest of the ClawMem README on GitHub

Questions about ClawMem

What is the ClawMem MCP server?

On-device memory layer for AI agents. Claude Code, OpenClaw and Hermes. Hooks + MCP server + hybrid RAG search. ClawMem is maintained by yoloshii on GitHub at yoloshii/ClawMem, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the ClawMem MCP server?

ClawMem doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (yoloshii/ClawMem). Like most servers, ClawMem ends with a command or URL you paste into your AI app's MCP config.

Does ClawMem need an API key?

The registry lists no required keys for ClawMem. Check the ClawMem README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is ClawMem an official MCP server?

No. ClawMem is a community server maintained by yoloshii. Community servers can be excellent; read the code and the open issues before you give ClawMem access to company data.

What license is ClawMem under?

ClawMem is released under the MIT license, according to its GitHub repository. The license covers the code of ClawMem; the service it connects to has its own terms.