Memory Pro (v2)
This skill provides semantic search over your memory files using a local vector database.
Architecture (v2)
- - Service: Runs as a
systemd user service (memory-pro.service). - Port:
8001 (hardcoded for stability). - Engine: FAISS + Sentence-Transformers (
all-MiniLM-L6-v2). - Data Source:
- Daily logs:
${OPENCLAW_WORKSPACE}/memory/*.md
- Core files:
MEMORY.md,
SOUL.md,
STATUS.md,
AGENTS.md,
USER.md (from workspace root).
- - Index: Stored in
${OPENCLAW_WORKSPACE}/skills/memory-pro/v2/memory.index.
Usage
1. Semantic Search (Recommended)
Use the python script to query the running service.
CODEBLOCK0
2. Manual Index Rebuild
The service automatically rebuilds the index on restart. To force an update:
CODEBLOCK1
Note: Service restart takes ~15-20 seconds to rebuild index and load models. The client script has auto-retry logic.
3. Service Management
CODEBLOCK2
Troubleshooting
"Connection failed"
- - The service might be stopped or restarting.
- Check status:
systemctl --user status memory-pro.service. - If restarting, wait 15 seconds. The client script retries automatically for up to 20s.
"Index size mismatch"
- - This means
memory.index and sentences.txt are out of sync. - Fix: Restart the service. The startup script
start.sh automatically runs build_index.py to fix this consistency issue before starting the API.
"Address already in use"
- - Port 8001 is taken by a zombie process.
- Fix:
kill $(lsof -t -i:8001) then restart service.
Memory Pro (v2)
该技能利用本地向量数据库对记忆文件进行语义搜索。
架构 (v2)
- - 服务:作为 systemd 用户服务运行(memory-pro.service)。
- 端口:8001(为稳定性硬编码)。
- 引擎:FAISS + Sentence-Transformers(all-MiniLM-L6-v2)。
- 数据源:
- 每日日志:${OPENCLAW_WORKSPACE}/memory/*.md
- 核心文件:MEMORY.md、SOUL.md、STATUS.md、AGENTS.md、USER.md(来自工作区根目录)。
- - 索引:存储在 ${OPENCLAW_WORKSPACE}/skills/memory-pro/v2/memory.index。
使用方法
1. 语义搜索(推荐)
使用 Python 脚本查询运行中的服务。
bash
基础搜索
python3 scripts/search_semantic.py 我昨天做了什么?
JSON 输出
python3 scripts/search_semantic.py 项目更新 --json
2. 手动重建索引
服务会在重启时自动重建索引。如需强制更新:
bash
systemctl --user restart memory-pro.service
注意:服务重启需要约 15-20 秒来重建索引和加载模型。客户端脚本具有自动重试逻辑。
3. 服务管理
bash
检查状态
systemctl --user status memory-pro.service
停止服务
systemctl --user stop memory-pro.service
查看日志
journalctl --user -u memory-pro.service -f
故障排除
连接失败
- - 服务可能已停止或正在重启。
- 检查状态:systemctl --user status memory-pro.service。
- 如果正在重启,请等待 15 秒。客户端脚本会自动重试最多 20 秒。
索引大小不匹配
- - 这意味着 memory.index 和 sentences.txt 不同步。
- 修复:重启服务。启动脚本 start.sh 会在启动 API 之前自动运行 build_index.py 来解决此一致性问题。
地址已被占用
- - 端口 8001 被僵尸进程占用。
- 修复:kill $(lsof -t -i:8001) 然后重启服务。