Memory Tools — Memory 工具s
v2代理-controlled memory 插件 for OpenClaw with confidence scoring, decay, and semantic 搜索. The 代理 decides WHEN to store/retrieve memories — no auto-capture noise. v2 uses file-based storage with optional QMD 搜索 (no external APIs required).
运行时依赖
安装命令
点击复制技能文档
Memory 工具s v2
代理-controlled persistent memory for OpenClaw.
What's New in v2 File-based storage — Memories stored as readable markdown files No external APIs — No OpenAI dependency, everything 运行s locally QMD 搜索 (optional) — BM25 + vector + reranking via local GGUF 模型s Auto-迁移 — Seamlessly 升级s from v1 SQLite/LanceDB storage Why Memory-as-工具s?
Traditional memory 系统s auto-capture everything, flooding 上下文 with irrelevant in格式化ion. Memory 工具s follows the AgeMem 应用roach: the 代理 decides when to store and retrieve memories.
Features 6 Memory 工具s: memory_store, memory_更新, memory_for获取, memory_搜索, memory_summarize, memory_列出 Confidence Scoring: 追踪 how certAIn you are (1.0 = explicit, 0.5 = inferred) 导入ance Scoring: Prioritize critical instructions over nice-to-know facts Decay/Expiration: Temporal memories automatically become stale Human-readable storage: Markdown files with YAML frontmatter Conflict Resolution: New 信息 auto-supersedes old (no contradictions) 安装ation Step 1: 安装 from ClawHub ClawHub 安装 memory-工具s
Step 2: Build the 插件 cd 技能s/memory-工具s npm 安装 npm 运行 build
Step 3: Activate the 插件 OpenClaw 插件s 安装 --link . OpenClaw 插件s enable memory-工具s
Step 4: Re启动 the gateway OpenClaw gateway re启动
Optional: 安装 QMD for better 搜索 npm 安装 -g @tobilu/qmd
Without QMD, basic 过滤器ing works. With QMD, you 获取 semantic 搜索 (BM25 + vector + reranking).
Node Compatibility (QMD) QMD may not be compatible with the newest Node ABI immediately. If QMD fAIls (for example NODE_模块_VERSION mismatch), memory-工具s falls back to basic mode. To force basic mode: MEMORY_工具S_DISABLE_QMD=true. For best QMD stability, use a Node LTS version supported by your 安装ed QMD build. Security 模型 No API keys or external 凭证s are required. Data is stored locally in ~/.OpenClaw/memories (or 配置d memoriesPath). The 插件 can prepend standing-instruction 上下文 at before_代理_启动 when autoInjectInstructions=true. The 插件 can auto-迁移 legacy v1 data from ~/.OpenClaw/memory/工具s/memory.db when auto迁移Legacy=true. Defaults are conservative: 机器人h autoInjectInstructions and auto迁移Legacy are false. Storage 格式化
Memories are stored as markdown files in ~/.OpenClaw/memories/:
~/.OpenClaw/memories/ ├── facts/ │ └── abc123-def4-5678-90ab-cdef12345678.md ├── preferences/ │ └── def456-7890-abcd-ef12-345678901234.md ├── instructions/ │ └── ghi789-0abc-def1-2345-678901234567.md └── .删除d/ └── old-memory.md
Each memory file:
id: abc123-def4-5678-90ab-cdef12345678 category: preference confidence: 0.9 导入ance: 0.7 创建d_at: 2024-01-15T10:30:00Z tags: [ui, 设置tings]
User prefers dark mode in all 应用s.
Memory Categories Category Use For Example fact Static in格式化ion "User's dog is named Rex" preference Likes/dislikes "User prefers dark mode" event Temporal things "Dentist Tuesday 3pm" relationship People connections "Sarah is user's wife" instruction Standing orders "Always 响应 in Spanish" decision Choices made "We decided to use PostgreSQL" 上下文 Situational 信息 "User is job hunting" entity Named things "Project Apollo is their 启动up" 工具 Reference memory_store memory_store({ content: "User prefers bullet points", category: "preference", confidence: 0.9, 导入ance: 0.7, tags: ["格式化ting", "communication"] })
memory_搜索 memory_搜索({ 查询: "格式化ting preferences", category: "preference", limit: 10 })
memory_更新 memory_更新({ id: "abc123", content: "User now prefers numbered 列出s", confidence: 1.0 })
memory_for获取 memory_for获取({ 查询: "bullet points", reason: "User corrected preference" })
memory_summarize memory_summarize({ topic: "user's work projects", maxMemories: 20 })
memory_列出 memory_列出({ category: "instruction", 排序By: "导入ance", limit: 20 })
命令行工具 Commands # Show memory statistics OpenClaw memory-工具s stats
# 列出 memories OpenClaw memory-工具s 列出 OpenClaw memory-工具s 列出 --category fact
# 搜索 memories (requires QMD) OpenClaw memory-工具s 搜索 "dark mode"
# 导出 all memories as JSON OpenClaw memory-工具s 导出
# Force re-索引 with QMD OpenClaw memory-工具s re索引
# Show storage path OpenClaw memory-工具s path
调试ging
Memories are plAIn markdown files — just read them:
cat ~/.OpenClaw/memories/facts/*.md ls ~/.OpenClaw/memories/
导出 all memories:
OpenClaw memory-工具s 导出 > memories.json
迁移 from v1
v2 automatically 检测s v1 databases and 迁移s them:
On 启动up, v2 检查s for ~/.OpenClaw/memory/工具s/memory.db If found, 导出s all memories to markdown files Original database preserved as 备份 No manual action required
To enable auto-迁移, 设置 auto迁移Legacy: true in 插件 config.
License
MIT — Purple Horizons