ClawMem MCP
ClawMem gives Claude Code, OpenClaw and Hermes local memory: note search, session hooks and a 33-tool MCP server with no API keys
- 212 ★ on the repository
- Last commit
Extended access
Why this level
- Hooks see every prompt and session transcript and write their digests into a local SQLite database
- Edits `~/.claude.json` and installs Claude Code hooks
Install
- Works in
Manual install
npm install -g clawmemNeeds Bun 1.0+. Then `clawmem bootstrap ~/notes --name notes`.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- Hooks see every prompt and session transcript and write their digests into a local SQLite database
- Edits `~/.claude.json` and installs Claude Code hooks
This is third-party code. Review the repository files before installing.
What it does
ClawMem is a memory layer in TypeScript on Bun that turns markdown notes, project docs and conversation exports into persistent agent memory. Data lives in a local SQLite database. Search is hybrid: BM25, vector search and reranking. Claude Code hooks at session start bring in the profile, the latest handoff and recent decisions, and on every prompt they add relevant context. From session transcripts a local GGUF model extracts decisions, preferences, milestones and problems. `clawmem mine` imports conversations from Claude Code, ChatGPT, Claude.ai, Slack and text files, and the `--synthesize` flag adds fact extraction. Connection works through hooks, a 33-tool MCP server, a native OpenClaw plugin or a memory provider for Hermes Agent. All routes write to one database. `clawmem serve` starts a local HTTP service on port 7438 with a token on every request.
Who it is for. Developers who keep notes and decisions in markdown and want Claude Code, OpenClaw or Hermes to remember them across sessions without sending data to the cloud.
Good fit when
- A new Claude Code session should start with the profile, the latest handoff and recent decisions
- A notes folder in Obsidian or markdown has to become search for the agent
- You need to import old conversations from ChatGPT or Slack with `clawmem mine`
- Several agents such as Claude Code and OpenClaw have to share one memory
Not a fit when
- You want cloud memory with sync between machines: data stays in a local database
- You cannot install Bun and local models on the machine
- The agent built-in memory is enough and extra search is not needed
Example request
Recall which authorization decisions we made in earlier sessions and find notes on the topicMCP
- Transport
- stdio
- Authentication
- not required
Environment variables
CLAWMEM_API_TOKENsecret- Token for the local `clawmem serve` HTTP service, at least 32 characters. Without it the service creates a token file itself.
Limitations
- Bun 1.0 or newer is required. On macOS install `brew install sqlite` for SQLite extensions, and Bun from snap does not work on Linux.
- Local models for embeddings, reranking and the observer need space and compute. Some GGUF files lack the needed score head and run idle, which the README flags in a separate warning.
- The OpenClaw connection needs version 2026.4.11 or newer. Hermes needs Python 3.10 and a running `clawmem serve`.
- The local HTTP service answers only requests carrying the token from `CLAWMEM_API_TOKEN` or the file that `serve` creates.
How to disable. Remove the hooks and the MCP entry from `~/.claude.json`, stop `clawmem serve` and uninstall the package with `npm uninstall -g clawmem`. The vault with notes sits separately and is deleted by hand.
FAQ
How do I install ClawMem?
Run `npm install -g clawmem` or `bun add -g clawmem`. Then `clawmem bootstrap ~/notes --name notes` creates a vault and connects hooks and MCP. Bun 1.0 or newer is required.
Are API keys needed?
No. Embeddings, reranking and the observer model run locally with no cloud dependencies. Data is stored in SQLite.
How do I connect ClawMem to Claude Code?
Run `clawmem setup hooks` for hooks and `clawmem setup mcp`, which registers the 33-tool MCP server in `~/.claude.json`. Check with `clawmem doctor`.
What does `clawmem mine` do?
It imports conversations from Claude Code, ChatGPT, Claude.ai, Slack and plain text. With `--synthesize` it also extracts decisions and preferences.
Does ClawMem work with other agents?
Yes, any MCP-compatible client can use the MCP server. OpenClaw has a native plugin and Hermes Agent a memory provider.
Discussion
No questions or reviews yet.
Related
MCP serversMembase keeps one shared memory for AI agents that Claude Code, Cursor and Codex read through MCP, an SDK or the membase command
claude-mem-lite keeps decisions, fixes and context from Claude Code sessions in one SQLite file with full-text search
An MCP server that gives an agent memory across sessions, projects and machines: decisions, dead ends, preferences and skills
A local workbench for Claude Code, Codex, Pi and OpenCode: memory changes wait for your review, then an audit follows each turn
Local memory for an agent: hooks record facts from conversations and the MCP server brings them back in later sessions from one SQLite file
hipocampus gives an agent file-based memory: a 3,000-token topic index loads each session and shows what came up before
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| ClawMem (this card) | no | not required | 212 | |
| agentmemory | yes | not required | 30,314 | MCP memory with no session hooks, while this adds hooks and hybrid note search |
| MCP Memory Service | no | not required | 2,117 | a memory service for agents with no OpenClaw or Hermes plugins |
README in short
The README describes ClawMem as a memory layer with hybrid search, hooks and an MCP server in one local system. It goes through installation, the path from zero to working memory, connecting Claude Code, OpenClaw and Hermes, model setup, the HTTP service, agent instructions and a command reference.
README badge
Original SKILL.md
--- name: clawmem description: "ClawMem operational reference for agents at query time — the 3-rule escalation gate, MCP tool routing, the 4 query-optimization levers, pipeline behavior (query vs intent_search), composite scoring, and memory lifecycle (pin/snooze/forget). Use when tuning retrieval, troubleshooting recall quality, or any ClawMem operation beyond the routing already in your global CLAUDE.md / this repo's AGENTS.md. NOT for setup — install / inference-server config / env vars / systemd / indexing config / internals live in AGENTS.md + docs/." allowed-tools: "mcp__clawmem__*" metadata: author: yoloshii version: 2.0.0 --- # ClawMem Operational Reference **Scope: agent-time operations only** — escalation, tool routing, query tuning, pipeline reasoning, composite scoring, lifecycle. Setup, inference-server config, env vars, systemd units, indexing/collection config, graph internals, and the OpenClaw/Hermes plugins are **deliberately not here** — they live in this repo's [`AGENTS.md`](AGENTS.md) + [`docs/`](docs/) (e.g. [`docs/guides/inference-services.md`](docs/guides/inference-services.md), [`docs/reference/configuration.md`](docs/reference/configuration.md), [`docs/troubleshooting.md`](docs/troubleshooting.md), [`docs/internals/`](docs/internals/)). Kept out to avoid drift between this skill and the package. Routine memory needs neither this skill nor manual MCP calls — **hooks + the ClawMem routing already in `AGENTS.md` / your global `CLAUDE.md` handle ~90%.** Reach for this skill (and Tier-3 tools) only when that isn't enough. ## Architecture (one-liner) Two tiers: **hooks** = automatic context flow (surfacing, extraction, compaction survival); **MCP tools** = explicit recall / write / lifecycle. Substrate: QMD retrieval (BM25 + vector + RRF + cross-encoder rerank + query expansion), with SAME (composite scoring), MAGMA (intent + graph), and A-MEM (self-evolving notes) layered on top. Do not call standalone QMD tools. --- ## Tier 2 — Automatic retrieval (hooks) Hooks handle ~90% of retrieval at zero agent effort. | Hook | Trigger | Does | |------|---------|------| | `context-surfacing` | UserPromptSubmit | retrieval gate → profile-driven hybrid search → FTS supplement → file-aware search → snooze/noise filters → relevance admission on the ordering key → tiered injection → `<vault-context>` (+ optional `<vault-facts>` / `<vault-routing>`). Budget/results/vector-timeout/escalation driven by `CLAWMEM_PROFILE`. | | `postcompact-inject` | SessionStart (compact) | re-injects THIS session's pre-compaction state + recent vault decisions, framed as reference data → `<vault-postcompact>` | | `curator-nudge` | SessionStart | surfaces curator actions; nudges when the report is stale | | `precompact-extract` | PreCompact | extracts the last typed request / decisions / file paths / open questions before compaction → the vault's session-keyed `compaction_state` row | | `decision-extractor` | Stop | LLM → observations + contradiction detection + SPO triples from the turns after its cursor, each turn once (v0.41.0) → the session's own decision/antipattern docs | | `handoff-generator` | Stop | per-turn digest (no model) + throttled incremental LLM summary → the session's handoff | | `handoff-generator` | SessionEnd | render-only flush of the handoff's latest turns (v0.41.0) | | `feedback-loop` | Stop | credits each surfaced note once per turn when that turn verifiably names it → access count, utility signal, same-turn co-activations | **Default behavior:** read injected `<vault-context>` first; if sufficient, answer immediately. **Hook blind spots (by design):** hooks filter `_clawmem/` artifacts, enforce score thresholds, and cap token budget — **absence in `<vault-context>` does NOT mean absence in memory.** If expected memory wasn't surfaced, escalate to Tier 3. Note the MCP retrieval tools themselves exclude `_clawmem` by default since v0.21.0 — pass `includeInternal: true` when system-internal memory (observations/handoffs/deductions) is the target. **Profiles:** `speed` / `balanced` (default) / `deep` set the token budget, max results, vector timeout, and `factsTokens`. Only `deep` adds query expansion + reranking to the hook path. (Kept-score ratios / activation floors are consulted only by the eval-only composite control arm, `CLAWMEM_ADMISSION_POLICY=composite` — production admission is the profile-independent relevance policy, v0.38.0.) The profile comes from the `CLAWMEM_PROFILE` environment variable; the host hook `timeout` lives in `~/.claude/settings.json` — see *Operational gotchas* for timeout tuning. --- ## Tier 3 — Agent-initiated retrieval (MCP tools)