ClawMemory
/install alex-clawmemory
ClawMemory Skill
Sovereign agent memory engine — self-hosted, privacy-first. All data stays local (SQLite) with optional Turso cloud sync.
Repo: https://github.com/clawinfra/clawmemory
Server port: localhost:7437
Last verified: 2026-03-28
✅ VERIFIED WORKING PATTERNS (copy-paste ready)
Start the server
cd /tmp/clawmemory && ./clawmemory serve --config config.json
# OR with defaults (SQLite at ./clawmemory.db, port 7437, Ollama at localhost:11434)
./clawmemory serve
Guard rules:
- Ollama must be running for vector search — if not, BM25-only mode activates automatically (no crash)
- Server binds
localhost:7437by default — not exposed externally - First run auto-runs migrations (safe to restart)
Store a fact manually
curl -s -X POST http://localhost:7437/facts \
-H "Content-Type: application/json" \
-d '{"text": "User prefers Python over Go for scripting", "category": "preference", "importance": 0.8}'
Search memory
# Hybrid BM25 + vector (best quality)
curl -s "http://localhost:7437/search?q=python+preference&limit=5" | python3 -m json.tool
# BM25-only (fast, no Ollama needed)
curl -s "http://localhost:7437/search?q=python+preference&limit=5&mode=bm25" | python3 -m json.tool
Extract facts from a conversation turn (auto-capture)
curl -s -X POST http://localhost:7437/extract \
-H "Content-Type: application/json" \
-d '{
"turns": [
{"role": "user", "content": "I always deploy to Hetzner, never AWS."},
{"role": "assistant", "content": "Got it, using Hetzner for deployments."}
]
}' | python3 -m json.tool
Get user profile
curl -s http://localhost:7437/profile | python3 -m json.tool
Forget a fact
curl -s -X DELETE http://localhost:7437/facts/\x3Cfact-id>
OpenClaw Plugin (TypeScript) — Auto-wire
The plugin at plugin/ auto-injects memory pre-turn and auto-captures post-turn.
cd /tmp/clawmemory/plugin && npm install && npm run build
# Copy plugin/dist/ to OpenClaw plugins dir and enable in config
Plugin config in openclaw.config.json:
{
"plugins": [
{
"id": "clawmemory",
"path": "./plugins/clawmemory/dist/index.js",
"config": {
"serverUrl": "http://localhost:7437",
"maxContextFacts": 10,
"minImportance": 0.3
}
}
]
}
What it does automatically:
- Pre-turn: searches memory for relevant facts → injects as
[Memory context]block into system prompt - Post-turn: sends conversation turn to
/extract→ stores new facts
Config Reference (config.json)
{
"server": { "host": "localhost", "port": 7437 },
"store": {
"sqlitePath": "./clawmemory.db",
"tursoUrl": "",
"tursoToken": ""
},
"extractor": {
"endpoint": "http://localhost:8080/v1",
"model": "glm-4.7",
"apiKey": "placeholder"
},
"embed": {
"ollamaUrl": "http://localhost:11434",
"model": "qwen2.5:7b"
},
"decay": {
"halfLifeDays": 30,
"minImportance": 0.1,
"intervalMinutes": 60
}
}
Key tunables:
extractor.endpoint→ point at any OpenAI-compatible endpoint (GLM-4.7, local Ollama, Anthropic proxy)embed.model→mxbai-embed-largegives better separability thanqwen2.5:7bfor security classification tasksdecay.halfLifeDays→ reduce to 7 for short-lived contexts (task sessions), increase to 90 for long-term persona facts
❌ KNOWN BROKEN / DO NOT USE
- Turso sync with empty token — set
tursoUrl: ""to disable; non-empty URL with empty token causes silent write failures - Ollama
llama3.2-visionfor embeddings — wrong dimensionality, breaks vector search index; useqwen2.5:7bormxbai-embed-large - Multi-statement SQL migrations —
go-libsqlcan't handle them; each migration must be a single statement
Build from source
git clone https://github.com/clawinfra/clawmemory /tmp/clawmemory
cd /tmp/clawmemory
go build ./... # produces ./clawmemory binary
go test ./... -timeout 120s # all tests should pass
CI status: main branch — golangci-lint v2 requires action@v7 (fixed 2026-03-28, commit 877384b)
API Reference (quick)
| Method | Path | Body / Params | Description |
|---|---|---|---|
| POST | /facts |
{text, category, importance} |
Store a fact directly |
| POST | /extract |
{turns: [{role,content}]} |
LLM-extract + store facts from conversation |
| GET | /search |
`?q=\x3Cquery>&limit=N&mode=bm25 | hybrid` |
| GET | /profile |
— | Get synthesized user profile |
| DELETE | /facts/:id |
— | Soft-delete a fact (sets importance=0) |
| POST | /forget |
{query} |
Find + soft-delete facts matching query |
Categories: person, preference, fact, skill, relationship, event, goal
Integration with OpenClaw workspace
ClawMemory replaces manual memory/YYYY-MM-DD.md writes for structured facts. Daily notes remain the primary context store for narrative/decisions; ClawMemory handles queryable structured facts (preferences, skills, relationships).
When to use ClawMemory vs daily notes:
- Daily notes: decisions, decisions-with-context, URLs shared, task state → still use these
- ClawMemory:
User prefers X,User's email is Y,Project Z uses Go→ queryable atomic facts
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install alex-clawmemory - 安装完成后,直接呼叫该 Skill 的名称或使用
/alex-clawmemory触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
ClawMemory 是什么?
Sovereign agent memory engine — self-hosted, privacy-first SQLite store with LLM-based fact extraction (GLM-4.7), hybrid BM25+vector search, contradiction re... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 104 次。
如何安装 ClawMemory?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install alex-clawmemory」即可一键安装,无需额外配置。
ClawMemory 是免费的吗?
是的,ClawMemory 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
ClawMemory 支持哪些平台?
ClawMemory 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 ClawMemory?
由 bowen31337(@bowen31337)开发并维护,当前版本 v1.0.0。