Claw Recall — Searchable Conversation Memory for AI Agents
Your agent just lost context mid-task. The decision you made an hour ago? Gone. What your other agent figured out yesterday? Unreachable. Claw Recall fixes this by indexing every conversation into a searchable database your agents can query anytime.
The Problem
Context compaction drops critical decisions. Cross-session knowledge vanishes. Long conversations push early context out of the window. If you run multiple agents, they can't access each other's conversations at all. MEMORY.md helps with preferences, but it can't answer "what exactly did we discuss about the API last Tuesday?"
What Claw Recall Does
- - Post-compaction recovery: Get the full transcript from before compaction wiped your context
- Cross-agent search: Any agent can search any other agent's conversations
- Unified search: Conversations, captured thoughts, Gmail, Google Drive, and Slack in one query
- Hybrid search: Keyword (FTS5) + semantic (OpenAI embeddings) with automatic detection
- Self-hosted: Your data stays on your machine. No cloud, no subscription, no vendor lock-in.
Installation
Claw Recall is an MCP server. Install the Python package, then connect it to your agent.
CODEBLOCK0
Full setup guide: https://github.com/rodbland2021/claw-recall#quick-start
Connect via MCP (OpenClaw)
Add to your OpenClaw config (~/.openclaw/openclaw.json or agent config):
CODEBLOCK1
Connect via MCP (Claude Code)
Add to ~/.claude.json:
CODEBLOCK2
Remote agents (SSE)
Start the SSE server on the Claw Recall machine, then connect from anywhere:
CODEBLOCK3
CODEBLOCK4
MCP Tools Reference
Primary Tools (use these most)
search_memory — The main search tool. Searches ALL sources in one call: conversations, captured thoughts (Gmail, Drive, Slack), and markdown files.
CODEBLOCK5
Optional params: agent (filter by agent name), days (limit to recent), force_semantic (use embeddings), force_keyword (use FTS5 only), convos_only, files_only, limit.
browse_recent — Full transcript of the last N minutes. The go-to tool for context recovery after compaction.
CODEBLOCK6
Returns the complete conversation with timestamps. Use this FIRST after any context reset.
capture_thought — Save an insight, decision, or finding so any agent can find it later.
CODEBLOCK7
Secondary Tools
| Tool | Purpose |
|---|
| INLINECODE12 | Search captured thoughts only (usually search_memory is better) |
| INLINECODE14 |
Session summaries across agents for a time period |
|
poll_sources | Trigger Gmail/Drive/Slack polling on demand |
|
memory_stats | Database statistics (indexed sessions, messages, embeddings) |
|
capture_source_status | Check external source capture health |
When to Use Each Tool
| Situation | Tool | Example |
|---|
| Just restarted / lost context | INLINECODE18 | "What was I working on?" |
| Looking for a past decision |
search_memory | "What did we decide about pricing?" |
| Need another agent's work |
search_memory with
agent= | "What did atlas find about the schema?" |
| Found something worth sharing |
capture_thought | Save a reusable insight |
| Checking if something was discussed |
search_memory with
days= | "Did we talk about X this week?" |
| External source check |
poll_sources | Trigger Gmail/Drive/Slack re-scan |
How It Works
CODEBLOCK8
All data is stored locally in a SQLite database. Keyword search uses FTS5 (zero API keys). Semantic search uses OpenAI embeddings (requires OPENAI_API_KEY in .env).
Requirements
- - Python 3.10+
- SQLite 3.35+ (bundled with Python)
- OpenAI API key (optional, only for semantic search)
Links
- - GitHub: https://github.com/rodbland2021/claw-recall
- Discord: https://discord.gg/4wGTVa9Bt6
- Full Guide: https://github.com/rodbland2021/claw-recall/blob/master/docs/guide.md
- Changelog: https://github.com/rodbland2021/claw-recall/blob/master/CHANGELOG.md
技能名称: claw-recall
详细描述:
Claw Recall — AI代理的可搜索对话记忆
你的代理在任务中途丢失了上下文。一小时前做的决定?消失了。另一个代理昨天得出的结论?无法访问。Claw Recall通过将每次对话编入可搜索数据库来解决这个问题,你的代理可以随时查询。
问题所在
上下文压缩会丢弃关键决策。跨会话知识会消失。长对话会将早期上下文挤出窗口。如果你运行多个代理,它们完全无法访问彼此的对话。MEMORY.md有助于记录偏好,但无法回答上周二我们关于API具体讨论了什么?
Claw Recall的功能
- - 压缩后恢复:获取压缩清除上下文之前的完整记录
- 跨代理搜索:任何代理都可以搜索其他代理的对话
- 统一搜索:一次查询即可搜索对话、捕获的想法、Gmail、Google Drive和Slack
- 混合搜索:关键词(FTS5)+ 语义(OpenAI嵌入)并自动检测
- 自托管:你的数据保留在你的机器上。无云、无订阅、无供应商锁定。
安装
Claw Recall是一个MCP服务器。安装Python包,然后连接到你的代理。
bash
git clone https://github.com/rodbland2021/claw-recall.git
cd claw-recall
pip install -r requirements.txt
python3 -m claw_recall.indexing.indexer --source ~/.openclaw/agents-archive/ --incremental
完整设置指南:https://github.com/rodbland2021/claw-recall#quick-start
通过MCP连接(OpenClaw)
添加到你的OpenClaw配置(~/.openclaw/openclaw.json或代理配置):
json
{
mcpServers: {
claw-recall: {
command: python3,
args: [-m, clawrecall.api.mcpstdio],
env: { PYTHONPATH: /path/to/claw-recall }
}
}
}
通过MCP连接(Claude Code)
添加到~/.claude.json:
json
{
mcpServers: {
claw-recall: {
command: python3,
args: [-m, clawrecall.api.mcpstdio],
env: { PYTHONPATH: /path/to/claw-recall }
}
}
}
远程代理(SSE)
在Claw Recall机器上启动SSE服务器,然后从任何地方连接:
bash
python3 -m clawrecall.api.mcpsse
bash
claude mcp add --transport sse -s user claw-recall http://your-server:8766/sse
MCP工具参考
主要工具(最常用)
search_memory — 主要搜索工具。一次调用搜索所有来源:对话、捕获的想法(Gmail、Drive、Slack)和markdown文件。
search_memory query=我们关于API做了什么决定 [agent=butler] [days=7]
可选参数:agent(按代理名称筛选)、days(限制为近期)、forcesemantic(使用嵌入)、forcekeyword(仅使用FTS5)、convosonly、filesonly、limit。
browse_recent — 最近N分钟的完整记录。压缩后恢复上下文的首选工具。
browse_recent [agent=kit] [minutes=30]
返回带有时间戳的完整对话。在任何上下文重置后首先使用此工具。
capture_thought — 保存见解、决定或发现,以便任何代理以后都能找到。
capture_thought content=SQLite WAL模式需要检查点才能让读取者看到写入 [agent=kit]
次要工具
| 工具 | 用途 |
|---|
| searchthoughts | 仅搜索捕获的想法(通常searchmemory更好) |
| browse_activity |
一段时间内跨代理的会话摘要 |
| poll_sources | 按需触发Gmail/Drive/Slack轮询 |
| memory_stats | 数据库统计信息(索引会话、消息、嵌入) |
| capture
sourcestatus | 检查外部源捕获状态 |
何时使用每个工具
| 情况 | 工具 | 示例 |
|---|
| 刚重启/丢失上下文 | browserecent | 我刚刚在做什么? |
| 查找过去的决定 |
searchmemory | 关于定价我们做了什么决定? |
| 需要另一个代理的工作 | 带agent=的search_memory | atlas关于模式发现了什么? |
| 发现值得分享的内容 | capture_thought | 保存可复用的见解 |
| 检查是否讨论过某话题 | 带days=的search_memory | 这周我们讨论过X吗? |
| 外部源检查 | poll_sources | 触发Gmail/Drive/Slack重新扫描 |
工作原理
会话文件(.jsonl) → 索引器 → SQLite数据库(FTS5 + 向量) → MCP工具
↑
Gmail / Drive / Slack → 源轮询器 ───┘
所有数据本地存储在SQLite数据库中。关键词搜索使用FTS5(零API密钥)。语义搜索使用OpenAI嵌入(需要在.env中设置OPENAIAPIKEY)。
要求
- - Python 3.10+
- SQLite 3.35+(与Python捆绑)
- OpenAI API密钥(可选,仅用于语义搜索)
链接
- - GitHub:https://github.com/rodbland2021/claw-recall
- Discord:https://discord.gg/4wGTVa9Bt6
- 完整指南:https://github.com/rodbland2021/claw-recall/blob/master/docs/guide.md
- 更新日志:https://github.com/rodbland2021/claw-recall/blob/master/CHANGELOG.md