clawmem

data-ai MCP Server

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

VerifiedInstall ReadyReviewed
data-aidata-ai
8 views184 stars27 forksv0.10.4MIT

Why This Matters

Discovered via github-seeds:mcp-hot and last synced 3mo ago.

VerifiedInstall ReadyReviewed
Source
github-seeds:mcp-hot
Stars
184
Last synced
3mo ago
Install
Instructions detected

Install

1. Install the package

npx clawmem

2. Add to claude_desktop_config.json

{
  "mcpServers": {
    "clawmem": {
      "command": "npx",
      "args": [
        "clawmem"
      ]
    }
  }
}

Config file location: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) / %APPDATA%\Claude\claude_desktop_config.json (Windows)

116
Tools
0
Resources
0
Prompts
Standard I/O
Transport

Available Tools (116)

VRAM

Purpose

LLM

8089

jina-embeddings-v5-text-small

1024

OpenAI

`https://api.openai.com`

find_similar

USE THIS for "what else relates to X", "show me similar docs". Finds k-NN vector neighbors — discovers connections beyond keyword overlap that search/query cannot find.

voyage-4-large

1024

Cohere

`https://api.cohere.com`

memory_retrieve

**Preferred entry point.** Auto-classifies query and routes to optimal backend (query, intent_search, session_log, find_similar, or query_plan). Use instead of manually choosing a search tool.

query_plan

USE THIS for complex multi-topic queries ("tell me about X and also Y", "compare A with B"). Decomposes into parallel typed clauses (bm25/vector/graph), executes each, merges via RRF. `query()` searches as one blob — this tool splits topics and routes each optimally.

memory_snooze

Temporarily hide a memory from context surfacing until a date. USE PROACTIVELY when `<vault-context>` repeatedly surfaces irrelevant content — snooze for 30 days instead of ignoring it.

1024

128K context

search

BM25 keyword search — for exact terms, config names, error codes, filenames. Composite scoring + co-activation boost + compact mode. Collection filter supports comma-separated values. Prefer `memory_retrieve` for auto-routing.

list_vaults

Show configured vault names and paths. Empty in single-vault mode.

status

Index health with content type distribution

Framework-dependent

Identical to CLAUDE.md — cross-framework compatibility (Cursor, Windsurf, Codex, etc.)

query

Full hybrid pipeline (BM25 + vector + rerank) — general-purpose when query type is unclear. WRONG for "why" questions (use `intent_search`) or cross-session queries (use `session_log`). Prefer `memory_retrieve` for auto-routing. Intent hint, strong-signal bypass, chunk dedup, candidateLimit, MMR diversity, compact mode.

multi_get

Retrieve multiple docs by glob or comma-separated list

memory_evolution_status

Show how a document's A-MEM metadata evolved over time

diary_read

Read recent diary entries. Filter by agent name.

profile

Current static + dynamic user profile

decision-extractor

Stop

deductive

∞

conversation

45 days

CLAWMEM_EMBED_API_KEY

(none)

CLAWMEM_MERGE_GUARD_DRY_RUN

`false`

diary_write

Write a diary entry. Use for recording important events, decisions, or observations in environments without hook support. Stored as searchable memories.

session_log

USE THIS for "last time", "yesterday", "what happened", "what did we do". Returns session history with handoffs and file changes. DO NOT use `query()` for cross-session questions — this tool has session-specific data that search cannot find.

precompact-extract

PreCompact

decision

∞

memory_pin

Pin a memory for +0.3 composite boost. USE PROACTIVELY when: user states a persistent constraint, makes an architecture decision, or corrects a misconception. Don't wait for curator — pin critical decisions immediately.

lifecycle_restore

Restore documents that were auto-archived by lifecycle policies. Filter by query, collection, or restore all

index_stats

Detailed stats: types, staleness, access counts, sessions

curator-nudge

SessionStart

Type

Half-life

project

handoff

CLAWMEM_CONSOLIDATION_INTERVAL

300000

CLAWMEM_MERGE_SCORE_NORMAL

`0.93`

Layer

Path

Observations

`_clawmem/agent/observations/*.md`

zod

MCP schema validation

lifecycle_status

Document lifecycle statistics: active, archived, forgotten, pinned, snoozed counts and policy summary

handoff-generator

Stop

context-surfacing

UserPromptSubmit

staleness-check

SessionStart

research

90 days

CLAWMEM_ENABLE_AMEM

enabled

CLAWMEM_RERANK_URL

`http://localhost:8090`

postcompact-inject

SessionStart

Hook

Event

antipattern

∞

Default

Effect

CLAWMEM_EMBED_DIMENSIONS

(none)

Research

`research/*.md`

gray-matter

YAML frontmatter parsing

session-bootstrap

SessionStart

problem

60 days

CLAWMEM_LLM_URL

`http://localhost:8089`

Auto

∞

pretool-inject

PreToolUse

milestone

60 days

CLAWMEM_ENABLE_CONSOLIDATION

disabled

CLAWMEM_NO_LOCAL_MODELS

`false`

Rationale

ClawMem Mechanism

yaml

Config parsing

preference

hub

CLAWMEM_EMBED_MODEL

`embedding`

CLAWMEM_CONTRADICTION_POLICY

`link`

CLAWMEM_EMBED_TPM_LIMIT

`100000`

CLAWMEM_CONTRADICTION_MIN_CONFIDENCE

`0.5`

Package

Purpose

sqlite-vec

Vector similarity extension

Human

∞ (hub)

Beads

`_clawmem/agent/beads/*.md`

Antipatterns

`_clawmem/agent/antipatterns/*.md`

node-llama-cpp

GGUF model inference (reranking, query expansion, A-MEM)

Dimensions

Notes

File

Loaded

get

Retrieve single document by path or docid

kg_query

Query the SPO knowledge graph: "what does X relate to?", "what was true about X when?". Returns temporal entity-relationship triples with validity windows. Accepts entity name (resolved via `searchEntities`) or canonical ID in `vault:type:slug` form. Triples are populated by the decision-extractor hook from observer-emitted `<triples>` blocks.

handoff

30 days

CLAWMEM_EMBED_URL

`http://localhost:8088`

Reranker

8090

timeline

Show the temporal neighborhood around a document — what was created/modified before and after it. Progressive disclosure: search → timeline (context) → get (full content). Supports same-collection scoping and session correlation.

Tool

Description

intent_search

USE THIS for "why did we decide X", "what caused Y", "who worked on Z". Classifies intent (WHY/WHEN/ENTITY/WHAT), traverses causal + semantic graph edges. Returns decision chains that `query()` cannot find.

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

Platform

Status

Embedding

8088

Service

Port

1536

8K context, Matryoshka dimensions via `CLAWMEM_EMBED_DIMENSIONS`

POST

`/graphs/build`

Port

Model

Provider

`CLAWMEM_EMBED_URL`

GET

`/export`

find_causal_links

Trace decision chains: "what led to X", "how we got from A to B". Follow up `intent_search` with this tool on a top result to walk the full causal chain. Traverses causes / caused_by / both up to N hops with depth-annotated reasoning.

CLAWMEM_LLM_NO_THINK

`true`

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. ``` # 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. ### GPU Services ClawMem uses three `llama-server` (llama.cpp) instances for neural inference. All three have in-process fallbacks via `node-llama-cpp` (auto-downloads on first use), so ClawMem works without a dedicated GPU. `node-llama-cpp` auto-detects the best available backend — Metal on Apple Silicon, Vulkan where available, CPU as last resort. With GPU acceleration (Metal/Vulkan), in-process inference is fast for these small models (0.3B–1.7B); on CPU-only systems it is significantly slower. For production use, run the servers via [systemd services](docs/guides/systemd-services.md) to prevent silent fallback. **GPU with VRAM to spare (12GB+, recommended):** ZeroEntropy's distillation-paired stack delivers best retrieval quality — total ~10GB VRAM.

Method

Path

vsearch

Vector semantic search — for conceptual/fuzzy matching when exact keywords are unknown. Composite scoring + co-activation boost + compact mode. Collection filter supports comma-separated values. Prefer `memory_retrieve` for auto-routing.

build_graphs

Build temporal and/or semantic graphs from document corpus

vault_sync

Index markdown from a directory into a named vault. Restricted-path validation rejects sensitive directories.

reindex

Trigger vault re-scan

CLAWMEM_LLM_REASONING_EFFORT

(none)

Step

What

CLAWMEM_LLM_MODEL

`qwen3`

__IMPORTANT

Workflow guide: prefer `memory_retrieve` → match query type to tool → `multi_get` for full content

memory_forget

Search → deactivate closest match (with audit trail)

lifecycle_sweep

Run lifecycle policies: archive stale docs past retention threshold, optionally purge old archives. Defaults to dry_run (preview only)

feedback-loop

Stop

hub

∞

note

60 days

CLAWMEM_MERGE_SCORE_STRICT

`0.98`

Decay

ClawMem Role

Handoffs

`_clawmem/agent/handoffs/*.md`

Status

Feature

progress

note review_by: "2026-03-01" --- ``` ## Suggested Memory Filesystem This structure separates human-curated content from auto-generated memories, and within auto-generated content, separates **user memories** (persist across agents, owned by the human) from **agent memories** (operational, generated from sessions). Static knowledge lives in `resources/` with no recency decay, distinct from ephemeral session logs. The layout works with any MCP-compatible client (Claude Code, OpenClaw, custom agents). ### Workspace Collection The primary workspace where the agent operates. Path varies by client (e.g., `~/workspace/`, `~/.openclaw/workspace/`, or any directory you choose). ``` <workspace>/ ← Collection: "workspace" ├── MEMORY.md # Human-curated long-term memory ├── memory/ # Session logs (daily entries) │ ├── 2026-02-05.md │ └── 2026-02-06.md ├── resources/ # Static knowledge — use content_type: hub (∞ half-life) │ ├── runbooks/ │ │ └── deploy-checklist.md │ └── onboarding.md ├── _clawmem/ # Auto-generated — DO NOT EDIT │ ├── user/ # User memories (persist across agents/sessions) │ │ ├── profile.md # Static facts + dynamic context │ │ ├── preferences/ # Extracted preferences (update_existing merge policy) │ │ └── entities/ # Named entities (people, services, repos) │ ├── agent/ # Agent memories (operational, session-derived) │ │ ├── observations/ # Decisions + observations from transcripts │ │ ├── handoffs/ # Session summaries with next steps │ │ └── antipatterns/ # Accumulated negative patterns (∞ half-life) │ └── precompact-state.md # Pre-compaction snapshot (transient) └── ... ``` ### Project Collections Each project gets its own collection. Same structure, with optional Beads integration. ``` ~/Projects/<project>/ ← Collection: "<project>" ├── .beads/ # Beads issue tracker (Dolt backend, auto-synced) │ └── dolt/ # Dolt SQL database (source of truth) ├── MEMORY.md # Human-curated project memory ├── memory/ # Project session logs │ └── 2026-02-06.md ├── resources/ # Static project knowledge (∞ half-life) │ ├── architecture.md │ └── api-reference.md ├── research/ # Research dumps (fragment-embedded, 90-day decay) │ └── 2026-02-06-topic-slug.md ├── _clawmem/ # Auto-generated per-project │ ├── user/ │ │ └── preferences/ │ ├── agent/ │ │ ├── observations/ │ │ ├── handoffs/ │ │ ├── antipatterns/ │ │ └── beads/ # Beads issues as searchable markdown │ └── precompact-state.md ├── CLAUDE.md ├── src/ └── README.md ``` ### Design Principles