ClawMem 是 AI Skill Hub 本期精选MCP工具之一。综合评分 8.0 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
ClawMem 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
ClawMem 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/yoloshii/ClawMem
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"clawmem": {
"command": "npx",
"args": ["-y", "clawmem"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 ClawMem 执行以下任务... Claude: [自动调用 ClawMem MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"clawmem": {
"command": "npx",
"args": ["-y", "clawmem"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
<p align="center"> <img src="docs/clawmem_hero.jpg" alt="ClawMem" width="100%"> </p>
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.
Required:
curl -fsSL https://bun.sh/install | bash (not snap — snap Bun cannot read stdin, which breaks hooks).brew install sqlite for extension loading support (ClawMem detects and uses Homebrew SQLite automatically).Optional (for better performance):
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.Optional integrations:
MemoryProvider plugin integrationnpm install -g clawmem
If you use Bun as your package manager:
bun add -g clawmem
git clone https://github.com/yoloshii/clawmem.git ~/clawmem
cd ~/clawmem && bun install
ln -sf ~/clawmem/bin/clawmem ~/.bun/bin/clawmem
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 | 12GB+ VRAM → SOTA stack (zembed-1 + zerank-2). Less → QMD native combo. No GPU → cloud embedding or CPU fallback. | [GPU Services](#gpu-services) |
| **3. Download models** | Get the GGUF files for your chosen stack | wget from HuggingFace, or let node-llama-cpp auto-download the QMD native models on first use | [Embedding](#embedding), [LLM Server](#llm-server), [Reranker Server](#reranker-server) |
| **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](docs/guides/systemd-services.md), [background workers](docs/guides/systemd-services.md#background-maintenance-workers-v082) |
| **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](docs/introduction.md#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](#integration) |
| **7. Verify** | Confirm everything is working | clawmem doctor (full health check) or clawmem status (quick index stats) | [Verify Installation](#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.
./bin/clawmem doctor # Full health check
./bin/clawmem status # Quick index status
bun test # Run test suite
```bash
list_vaults()
CLAWMEM_EMBED_URL=https://api.jina.ai CLAWMEM_EMBED_API_KEY=jina_your-key-here CLAWMEM_EMBED_MODEL=jina-embeddings-v5-text-small
Or export them in your shell. **Precedence:** shell environment > `.env` file > `bin/clawmem` wrapper defaults.
| Provider | `CLAWMEM_EMBED_URL` | `CLAWMEM_EMBED_MODEL` | Dimensions | Notes |
|---|---|---|---|---|
| Jina AI | `https://api.jina.ai` | `jina-embeddings-v5-text-small` | 1024 | 32K context, task-specific LoRA adapters |
| OpenAI | `https://api.openai.com` | `text-embedding-3-small` | 1536 | 8K context, Matryoshka dimensions via `CLAWMEM_EMBED_DIMENSIONS` |
| Voyage AI | `https://api.voyageai.com` | `voyage-4-large` | 1024 | 32K context |
| Cohere | `https://api.cohere.com` | `embed-v4.0` | 1024 | 128K context |
Cloud mode auto-detects your provider from the URL and sends the right parameters (Jina `task`, Voyage/Cohere `input_type`, OpenAI `dimensions`). Batch embedding (50 fragments/request), server-side truncation, adaptive TPM-aware pacing, and retry with jitter are all handled automatically. Set `CLAWMEM_EMBED_TPM_LIMIT` to match your provider tier (default: 100000). See [docs/guides/cloud-embedding.md](docs/guides/cloud-embedding.md) for full details.
**Note:** Cloud providers handle their own context window limits — ClawMem skips client-side truncation when an API key is set. Local llama-server truncates at `CLAWMEM_EMBED_MAX_CHARS` (default: 6000 chars).
#### Verify and embed
bash
For web dashboards, non-MCP agents, cross-machine access, or programmatic use:
./bin/clawmem serve # localhost:7438, no auth
./bin/clawmem serve --port 8080 # custom port
CLAWMEM_API_TOKEN=secret ./bin/clawmem serve # with bearer token auth
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/pinned/snoozed counts |
| 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 | Full vault export as JSON |
| POST | /reindex | Trigger re-scan |
| POST | /graphs/build | Rebuild temporal + semantic graphs |
Auth: Set CLAWMEM_API_TOKEN env var to require Authorization: Bearer <token> on all requests. If unset, access is open (localhost-only by default). See .env.example.
Search example:
curl -X POST http://localhost:7438/search \
-H 'Content-Type: application/json' \
-d '{"query": "authentication decisions", "mode": "hybrid", "compact": true}'
Copy the contents of CLAUDE.md (or the relevant sections) into your project's own CLAUDE.md or AGENTS.md. Simple but requires manual updates when ClawMem changes.
Add this minimal trigger block to your global ~/.claude/CLAUDE.md. It gives the agent routing rules always loaded, and tells it how to find the full reference (SKILL.md) shipped with your installation when deeper guidance is needed:
```markdown
clawmem setup openclaw
curl $CLAWMEM_EMBED_URL/v1/embeddings \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $CLAWMEM_EMBED_API_KEY" \ -d "{\"input\":\"test\",\"model\":\"$CLAWMEM_EMBED_MODEL\"}"
clawmem init Create DB + config
clawmem bootstrap <vault> [--name N] [--skip-embed] One-command setup
clawmem collection add <path> --name <name> Add a collection
clawmem collection list List collections
clawmem collection remove <name> Remove a collection
clawmem update [--pull] [--embed] Incremental re-scan
clawmem mine <dir> [-c name] [--embed] [--synthesize] Import conversation exports (--synthesize runs post-import LLM fact extraction, v0.7.2)
clawmem embed [-f] Generate fragment embeddings
clawmem reindex [--force] Full re-index
clawmem watch File watcher daemon
clawmem search <query> [-n N] [--json] BM25 keyword search
clawmem vsearch <query> [-n N] [--json] Vector semantic search
clawmem query <query> [-n N] [--json] Full hybrid pipeline
clawmem profile Show user profile
clawmem profile rebuild Force profile rebuild
clawmem update-context Regenerate per-folder CLAUDE.md
clawmem list [-n/--limit N] [-c col] [--json] Browse recent documents
clawmem budget [--session ID] Token utilization
clawmem log [--last N] Session history
clawmem hook <name> Manual hook trigger
clawmem surface --context --stdin IO6: pre-prompt context injection
clawmem surface --bootstrap --stdin IO6: per-session bootstrap injection
clawmem reflect [N] Cross-session reflection (last N days, default 14)
clawmem consolidate [--dry-run] [N] Find and archive duplicate low-confidence docs
clawmem install-service [--enable] [--remove] Systemd watcher service
clawmem setup hooks [--remove] Install/remove Claude Code hooks
clawmem setup mcp [--remove] Register/remove MCP server
clawmem setup curator [--remove] Install/remove curator maintenance agent
clawmem mcp Start stdio MCP server
clawmem serve [--port 7438] [--host 127.0.0.1] Start HTTP REST API server
clawmem path Print database path
clawmem doctor Full health check
clawmem status Quick index status
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 (31 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.
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.
```bash
| Tool | Description |
|---|---|
beads_sync | Sync Beads issues from Dolt backend (bd CLI) into memory: creates docs, bridges all dep types to memory_relations, runs A-MEM enrichment |
Hooks installed by clawmem setup hooks:
| Hook | Event | What It Does |
|---|---|---|
context-surfacing | UserPromptSubmit | Hybrid search → FTS supplement → file-aware search (E13) → snooze filter → spreading activation (E11) → memory type diversification (E10) → tiered injection (HOT/WARM/COLD) → <vault-context> + <vault-routing> hint. Profile-driven budget/results/timeout. |
postcompact-inject | SessionStart | Re-injects authoritative context after compaction: precompact state + recent decisions + antipatterns + vault context (1200 token budget) |
curator-nudge | SessionStart | Surfaces curator report actions, nudges when report is stale (>7 days) |
precompact-extract | PreCompact | Extracts decisions, file paths, open questions before auto-compaction → writes precompact-state.md to auto-memory |
decision-extractor | Stop | GGUF observer extracts structured observations (decisions, preferences, milestones, problems, bugfixes, features, refactors, discoveries), infers causal links, detects contradictions with prior decisions |
handoff-generator | Stop | GGUF observer generates rich handoff, regex fallback |
feedback-loop | Stop | Silently boosts referenced notes, decays unused ones, records co-activation + usage relations between co-referenced docs, tracks utility signals (surfaced vs referenced ratio for lifecycle automation) |
Additional hooks available but not installed by default:
| Hook | Event | Why Not Default |
|---|---|---|
session-bootstrap | SessionStart | Injects ~2000 tokens before user types anything. context-surfacing on first prompt is more precise. |
staleness-check | SessionStart | Redundant without session-bootstrap (stale notes are part of its output). |
pretool-inject | PreToolUse | Disabled in HOOK_EVENT_MAP (cannot inject additionalContext via PreToolUse). |
Hooks handle ~90% of retrieval automatically. For agent escalation logic (when to use MCP tools vs rely on hooks), see CLAUDE.md.
User Query + optional intent hint
→ BM25 Probe → Strong Signal Check (skip expansion if top hit ≥ 0.85 with gap ≥ 0.15; disabled when intent provided)
→ Query Expansion (intent steers LLM prompt when provided)
→ BM25 + Vector Search (parallel, original query 2× weight)
→ Reciprocal Rank Fusion → slice to candidateLimit (default 30)
→ Intent-Aware Chunk Selection (intent terms at 0.5× weight alongside query terms at 1.0×)
→ Cross-Encoder Reranking (4000 char context; intent prepended; chunk dedup; batch cap=4)
→ Position-Aware Blending (α=0.75 top3, 0.60 mid, 0.40 tail)
→ SAME Composite Scoring ((search × 0.5 + recency × 0.25 + confidence × 0.25) × qualityMultiplier × lengthNorm × coActivationBoost + pinBoost)
→ MMR Diversity Filter (Jaccard bigram similarity > 0.6 → demoted)
→ Ranked Results
For agent-facing query optimization (tool selection, query string quality, intent parameter, candidateLimit), see CLAUDE.md.
Projects using Beads (v0.58.0+, Dolt backend) issue tracking are fully integrated into the MAGMA memory graph:
.beads/ directory changes → syncBeadsIssues() queries bd CLI for live Dolt data → creates markdown docs in beads collectionmemory_relations edges — blocks/conditional-blocks/waits-for/caused-by→causal, discovered-from/supersedes/duplicates→supporting, relates-to/related/parent-child→semantic. Tagged {origin: "beads"} for traceability.postIndexEnrich() — memory note construction, semantic/entity link generation, memory evolutionintent_search and find_causal_links traverse beads dependency edges alongside observation-inferred causal chainsbd binary on PATH or at ~/go/bin/bdbeads_sync MCP tool for manual sync; watcher handles routine oper
ln -s /path/to/ClawMem/src/hermes ${HERMES_HOME:-~/.hermes}/plugins/clawmem
**Configure** in your Hermes profile's `.env` or environment:bash 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)
- **`on_session_end()`** — decision extraction, handoff generation, feedback loop (parallel)
- **`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](docs/guides/hermes-plugin.md) 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`:**
yaml vaults: work: ~/.cache/clawmem/work.sqlite personal: ~/.cache/clawmem/personal.sqlite
**Or via environment variable:**
bash 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.
高质量的开源MCP工具,适用于AI代理内存管理
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,ClawMem 在MCP工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | ClawMem |
| Topics | ai-agent-memoryai-agentstypescript |
| GitHub | https://github.com/yoloshii/ClawMem |
| License | MIT |
| 语言 | TypeScript |
收录时间:2026-06-20 · 更新时间:2026-06-20 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端