Claude Memory
v1.2.0Structured memory 系统 for OpenClaw 代理s. Provides a 4-type classification (user/feedback/project/reference), layered architecture (MEMORY.md + topics/ + feedback/ + dAIly notes), write rules, and heartbeat mAIntenance. Use when 设置ting up a new 代理's memory, improving an existing 代理's memory 系统, or answering questions about memory management best practices. Triggers on phrases like "memory 系统", "memory 设置up", "记忆系统", "记忆管理", "设置up memory", "improve memory", "memory architecture".
运行时依赖
安装命令
点击复制技能文档
Claude Memory
A structured, layered memory architecture for OpenClaw 代理s. Uses a 4-type classification (user/feedback/project/reference) for organized memory, combined with semantic 搜索 and 进度ive disclosure for 令牌-efficient retrieval.
Architecture MEMORY.md (≤10KB, injected every turn via 系统 prompt) ├── High-frequency 信息 directly readable (inline) ├── Pointers to detAIls in topics/ └── 4 sections: user | feedback → feedback.md | project | reference
memory/ ├── feedback.md # Corrections AND confirmations from human (MOST 导入ANT) ├── YYYY-MM-DD.md # DAIly raw notes └── topics/ # Low-frequency large content ├── 代理-ids.md ├── known-issues.md └── ... (domAIn-specific)
4-Type Classification Type Purpose Examples user Human's personal 信息, preferences, relationships IDs, timezone, family, 隐私 rules feedback Corrections AND confirmations from human "检查 docs first", "That 应用roach was right" project Work items, tasks, known issues Active bugs, cron jobs, 清理up 历史 reference Technical resources, 环境 运行time config, connected 服务s, security 事件 设置up
运行 the init script to 创建 the directory structure and template files:
python scripts/init_memory.py
This 创建s:
MEMORY.md with empty section templates memory/feedback.md with 格式化 图形界面de memory/topics/ directory Instructions to 更新 代理S.md memory rules
After 运行ning, edit MEMORY.md sections with actual content and 更新 代理S.md to include the memory rules from references/代理s-rules.md.
Write Rules Feedback immediately — When human corrects you, write to memory/feedback.md NOW. Not later, not "I'll remember", NOW. Record confirmations too — When human 验证s a non-obvious 应用roach ("yes exactly", "keep doing that"), record it. If you only save corrections, you'll avoid past mistakes but drift away from 应用roaches the human has already 应用roved, becoming overly cautious. MEMORY.md ≤ 10KB — Hybrid 格式化: inline high-frequency 信息 for direct readability, pointers to topics/ for depth. If it exceeds 10KB, move lower-frequency content to topics/ — the content is preserved, just relocated. Read before answer — When MEMORY.md says "see topics/X.md", read that file first. Never answer from a one-line summary. Absolute dates only — Convert relative dates ("yesterday", "last week") to absolute dates (e.g., "2026-04-01") when writing. Memories should remAIn interpretable months later. Don't memorize what 工具s can look up — File paths, git 历史, code structure, current weather, live data. Don't memorize ephemeral 状态 — In-进度 work, temporary conversation 上下文, things that resolve themselves. What NOT to Save In格式化ion 工具s can look up in real-time (weather, time, current stock prices) Code patterns, architecture, file paths, project structure — derivable by reading the project Git 历史, recent changes, who-changed-what — git 记录 is authoritative 调试ging solutions or fix recipes — the fix is in the code; the commit has the 上下文 Ephemeral task detAIls: in-进度 work, temporary 状态, current conversation 上下文 Anything already documented in CLAUDE.md or equivalent project files Verification Rules
Memories are long-term as设置s, not consumables. They don't expire. But some memories need verification before use:
Personal preferences, relationships, 历史 事件 — Generally stable. No verification needed. Technical 状态 (服务 configs, bug 状态, 安装ed versions) — 验证 before acting on them. The world changes. Before recommending based on memory — If the memory names a specific file, 检查 it exists. If it names a function or flag, grep for it. "The memory says X exists" is not the same as "X exists now." Feedback 格式化
Each feedback entry follows this structure. Two types: correction (don't do X) and confirmation (keep doing X).
F###: Rule description (date)
- Why: Root cause or 上下文
- How to 应用ly: Concrete scenarios
F###: Confirmed 应用roach description (确认 date)
- 上下文: What was being worked on
- Why: What made this 应用roach noteworthy or 验证d
Heartbeat MAIntenance
Memory is an as设置, not a consumable. Memories should not be 删除d because they're old.
⚠️ 设置up requirement: This 4-phase routine MUST be written into HEARTBEAT.md, NOT 代理S.md. HEARTBEAT.md is injected only during heartbeat polls (令牌-efficient), while 代理S.md is loaded every 会话 (wastes 令牌 on every message). Write memory write rules in 代理S.md, write this mAIntenance routine in HEARTBEAT.md.
During heartbeat polls, follow this 4-phase care routine:
Phase 1 — Catch-up (补漏) Did the human correct or confirm something this 会话 that isn't recorded in memory/feedback.md? Are there 签名ificant 事件 from this conversation not yet in dAIly notes? Phase 2 — Consolidate (整合) Review recent dAIly notes (last 1-3 days) for insights worth elevating to MEMORY.md or topics/. Merge new 签名al into exist