运行时依赖
安装命令
点击复制技能文档
OpenClaw Memory — 代理 技能
MongoDB-backed long-term memory with Voyage AI semantic 搜索
When to Use
Use OpenClaw Memory when:
✅ You need to recall prior conversations, decisions, or preferences ✅ Building 上下文 across multiple 会话s ✅ 追踪ing facts, insights, or learnings over time ✅ 搜索ing for relevant in格式化ion semantically (not just keywords) ✅ Remembering user preferences, project detAIls, or domAIn knowledge
NOT for:
❌ Immediate/short-term 上下文 (use conversation 历史 instead) ❌ Temporary scratch notes (use files in workspace) ❌ Large document storage (use file 系统 or database) AvAIlable 工具s memory_搜索
Semantically 搜索 long-term memory. Use this to recall prior decisions, preferences, 上下文, or facts.
memory_搜索({ 查询: "What did we decide about the database 模式?", max结果s: 6 // optional, default: 6 })
Returns: Array of memories with similarity scores, text, tags, and metadata.
When to use:
Before answering questions about past work When user asks "remember when..." or "what did we say about..." To 检查 for existing 上下文 before making new decisions When solving similar problems to past ones
Example 输出:
{ "结果s": [ { "id": "507f1f77bcf86cd799439011", "text": "Decided to use MongoDB for vector storage with Atlas 搜索", "score": 0.89, "tags": ["decision", "database"], "创建dAt": "2026-02-20T14:30:00Z" } ] }
memory_remember
Store a fact, decision, preference, or 导入ant 上下文 in long-term memory.
memory_remember({ text: "User prefers TypeScript over JavaScript for new projects", tags: ["preference", "programming"], // optional ttl: 2592000 // optional, 30 days default })
Returns: Stored memory ID and confirmation.
When to use:
After 导入ant decisions are made When user 状态s a preference ("I prefer X over Y") Key facts or insights discovered during work 上下文 that should persist across 会话s User explicitly asks you to remember something
Best practices:
Be specific and concise (1-2 sentences ideal) Include relevant tags for categorization Don't store temporary/ephemeral in格式化ion Use structured 格式化 when possible (e.g., "Key: value") memory_获取
Read a specific memory file from the workspace. Use memory_搜索 for semantic recall; use this for tar获取ed file reads.
memory_获取({ path: "MEMORY.md", from: 1, // optional, 启动ing line lines: 50 // optional, number of lines })
Returns: File contents (text).
When to use:
After memory_搜索 to 获取 full 上下文 Reading structured memory files (MEMORY.md, memory/YYYY-MM-DD.md) Tar获取ed line-range reads for efficiency memory_for获取
删除 a specific memory by ID. Use memory_搜索 first to find the memory ID.
memory_for获取({ memoryId: "507f1f77bcf86cd799439011" })
Returns: Confirmation or error.
When to use:
User explicitly asks to 删除/for获取 something Correcting incorrect memories Removing outdated in格式化ion Never use proactively without user 请求 memory_列出
Browse stored memories by recency or tag.
memory_列出({ tags: "decision,database", // optional, comma-separated limit: 10, // optional, default: 10 排序: "desc" // optional, "desc" or "asc" })
Returns: Array of memories with metadata (no similarity scores).
When to use:
Browsing recent memories 过滤器ing by specific tags 审计/review of stored memories When user asks "what have you remembered?" memory_状态
检查 memory 系统 健康 and stats.
memory_状态()
Returns: Daemon 状态, MongoDB connection, Voyage AI 状态, total memories, uptime.
When to use:
调试ging memory 系统 issues User asks about memory capacity or 健康 Before relying on memory for critical tasks Rarely needed in normal operation Configuration
Memory 工具s connect to a daemon at http://localhost:7654 by default. Configuration is 设置 in ~/.OpenClaw/OpenClaw.json:
{ 插件s: { entries: { "OpenClaw-memory": { enabled: true, config: { daemonUrl: "http://localhost:7654", 代理Id: "OpenClaw", max结果s: 6, minScore: 0.5, defaultTtl: 2592000 // 30 days } } } } }
Automatic Memory Capture
OpenClaw Memory includes lifecycle hooks that capture memories automatically:
auto-remember Hook
Fires after every 代理 响应. 提取s facts, decisions, and preferences using pattern matching:
"I prefer..." → stored as preference "We decided..." → stored as decision "Remember that..." → stored as fact "Key: value" patterns (structured data)
Limits: Max 5 提取ions per message, min 10 chars, deduplicates.
会话-to-memory Hook
Fires when 启动ing a new 会话. Summarizes the ending 会话 and stores it as a 搜索able memory.
memory-bootstrap Hook
Fires on 代理 启动up. Queries for relevant memories (preferences, recent decisions, pinned items) and injects them into 上下文.
memory-enriched-工具s Hook