OpenClaw 持久化内存:AI 智能体上下文与搜索 - Openclaw Skills
作者:互联网
2026-04-18
什么是 OpenClaw 持久化内存?
OpenClaw 持久化内存是一个先进的系统,旨在为 AI 智能体提供长期记忆能力。通过将持久化存储层直接集成到智能体工作流中,该技能可确保关键观察结果、用户偏好和项目细节在多个会话中得以保留。它解决了上下文丢失的问题,是开发者在 Openclaw Skills 生态系统中构建复杂自动化任务的重要组件。
该系统利用带有 FTS5(全文搜索)的 SQLite 提供高性能检索。无论是智能体进行研究还是管理长期编码项目,它都能自动捕获相关数据点并在需要时准确召回。这通过减少重复指令的需求,创造了更智能、更个性化且更高效的用户体验。
下载入口:https://github.com/openclaw/skills/tree/main/skills/webdevtodayjason/openclaw-persistent-memory
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install openclaw-persistent-memory
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 openclaw-persistent-memory。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
OpenClaw 持久化内存 应用场景
- 在不同的开发会话中维护架构决策和编码偏好。
- 通过持续的观察捕获,自动构建特定于项目的知识库。
- 通过语义搜索仅注入相关记忆而非完整会话历史,从而降低 Token 消耗。
- 使用相同的内存后端同步不同 AI 智能体之间的状态和共享知识。
- 为智能体提供过去用户交互和已完成任务的可搜索历史记录。
- 该技能启动一个后台工作服务,管理配备 FTS5 的本地 SQLite 数据库以实现快速索引。
- 当智能体与用户交互时,自动捕获机制会监控响应中的重要信息并将其存储为记忆。
- 在每个新提示发送给 LLM 之前,自动召回功能会对数据库执行全文搜索以查找相关上下文。
- 匹配的记忆会被动态注入智能体的上下文窗口,使智能体能够“记住”过去的细节。
- 开发者可以手动触发 memory_search 或 memory_store 等内存工具,实现对智能体知识库的精细控制。
OpenClaw 持久化内存 配置指南
通过 npm 安装核心包:
npm install -g openclaw-persistent-memory
启动持久化内存工作服务:
openclaw-persistent-memory start
通过将其复制到本地 Openclaw Skills 目录并安装依赖项来注册扩展:
cp -r node_modules/openclaw-persistent-memory/extension ~/.openclaw/extensions/openclaw-mem
cd ~/.openclaw/extensions/openclaw-mem && npm install
最后,更新您的 ~/.openclaw/openclaw.json 配置以启用内存槽并将其指向工作服务 URL(通常为 http://127.0.0.1:37778)。
OpenClaw 持久化内存 数据架构与分类体系
该技能通过为检索速度优化的结构化 SQLite 模式管理数据。下表描述了主要的数据组织方式:
| 属性 | 类型 | 描述 |
|---|---|---|
| 记忆 ID | UUID/Int | 捕获的观察结果的唯一标识符 |
| 内容 | 文本 | 从智能体会话中捕获的原始文本或数据点 |
| FTS 索引 | 虚拟表 | 用于高速自然语言搜索的索引文本 |
| 时间戳 | ISO8601 | 记录记忆的日期和时间,用于按时间排序 |
| 元数据 | JSON | 额外上下文,如来源智能体或项目标签 |
name: openclaw-persistent-memory
version: 0.1.0
description: Persistent memory system - automatic context capture and semantic search
author: Jason Brashear / Titanium Computing
repository: https://github.com/webdevtodayjason/openclaw_memory
metadata:
openclaw:
requires:
bins: ["openclaw-persistent-memory"]
install:
- id: node
kind: node
package: openclaw-persistent-memory
bins: ["openclaw-persistent-memory"]
label: "Install OpenClaw Persistent Memory (npm)"
OpenClaw Persistent Memory
Persistent memory system that automatically captures context across sessions using SQLite + FTS5.
Features
- ?? Auto-capture - Important observations saved automatically after each response
- ?? Auto-recall - Relevant memories injected before each prompt
- ?? SQLite + FTS5 - Fast full-text search across all memories
- ??? Tools -
memory_search,memory_get,memory_store,memory_delete - ?? Progressive disclosure - Token-efficient retrieval
Setup
-
Install the npm package:
npm install -g openclaw-persistent-memory -
Start the worker service:
openclaw-persistent-memory start -
Install the OpenClaw extension:
# Copy extension to OpenClaw extensions directory cp -r node_modules/openclaw-persistent-memory/extension ~/.openclaw/extensions/openclaw-mem cd ~/.openclaw/extensions/openclaw-mem && npm install -
Configure OpenClaw (in
~/.openclaw/openclaw.json):{ "plugins": { "slots": { "memory": "openclaw-mem" }, "allow": ["openclaw-mem"], "entries": { "openclaw-mem": { "enabled": true, "config": { "workerUrl": "http://127.0.0.1:37778", "autoCapture": true, "autoRecall": true } } } } } -
Restart OpenClaw gateway
Tools Provided
| Tool | Description |
|---|---|
memory_search |
Search memories with natural language |
memory_get |
Get a specific memory by ID |
memory_store |
Save important information |
memory_delete |
Delete a memory by ID |
API Endpoints
Worker runs on http://127.0.0.1:37778:
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health check |
/api/stats |
GET | Database statistics |
/api/search |
POST | Full-text search |
/api/observations |
GET | List recent observations |
/api/observations/:id |
GET | Get observation |
/api/observations/:id |
DELETE | Delete observation |
/api/observations/:id |
PATCH | Update observation |
Troubleshooting
Worker not running
curl http://127.0.0.1:37778/api/health
# If fails, restart:
openclaw-persistent-memory start
Auto-recall not working
- Check OpenClaw logs:
tail ~/.openclaw/logs/*.log | grep openclaw-mem - Verify
plugins.slots.memoryis set to"openclaw-mem" - Restart gateway after config changes
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
Moltyverse:加密 AI 智能体社交网络 - Openclaw Skills
Moltyverse:AI 智能体社交网络 - Openclaw Skills
港币汇率换算器:实时汇率与趋势 - Openclaw Skills
ArXiv 技能猎人:自动化智能体技能生成 - Openclaw Skills
深度思考:高级推理与问题拆解 - Openclaw Skills
HSK 学习:间隔复现汉语精通 - Openclaw Skills
会议协调员:AI 高级日程管理助手 - Openclaw Skills
主动消息:为生活瞬间提供 AI 智能跟进 - Openclaw Skills
人类优化前端:美学与用户体验设计 - Openclaw 技能
UniFuncs 实时搜索 AI 智能体技能 - Openclaw Skills
AI精选
