🧠 Memory Never Forget v4.12
A full-featured memory system for OpenClaw, integrating Active Memory retrieval, Memory Palace structured views, and a Dual-Layer Dream Verification mechanism — delivering "proactive memory + global view + verifiable consolidation."
Core Logic: Active Memory = Memory Butler, Memory Palace = Knowledge Palace, Dual-Layer Dream = Verification & Consolidation Expert
License: MIT-0 | Updated: 2026-04-15 | v4.12 adds Dual-Layer Verification
Overview (v4.12)
This skill turns your OpenClaw agent into a truly "knowing" assistant by managing memory across two orthogonal dimensions:
- 1. Temporal (Atkinson-Shiffrin 3-stage model) — what to keep vs. what to prune
- Content (4-type taxonomy from Claude Code) — where to store for fast retrieval
A Dual-Layer Dream Verification architecture ensures your agent's memories are reliable, hallucination-free, and continuously validated.
Core Components
1. Active Memory — Proactive Retrieval
Before each response, Active Memory automatically retrieves and injects relevant memories into context.
Retrieval Modes:
- -
message — current message only - INLINECODE1 — recent conversation
- INLINECODE2 — full history (recommended)
Capabilities:
- - Automatic preference learning
- Context inheritance (project background, historical conclusions)
- Real-time memory injection
2. Memory Palace — Structured Views
Provides multi-dimensional views of your agent's long-term memory:
- - Timeline — chronological view of work progress
- Projects — aggregated by project
- Technology — organized by tech domain
- Custom — user-defined dimensions
3. Dual-Layer Dream Verification (Core v4.12 Innovation)
Two independent but cross-verifying layers:
Official Dream (12:30) — Promotes short-term signals to long-term memory (MEMORY.md)
↓ outputs: DREAMS.md, memory/dreaming/deep/, etc.
↓
Refined Verify (13:00) — Reads official outputs and cross-checks with independent judgment
→ Detects conflicts, hallucinations, stale entries → writes verify/ report
→ Supplements missed promotions
Why verification matters:
- - AI memory systems suffer from hallucination (inventing facts) and drift (memory diverging from reality)
- Two independent systems checking each other = verifiable, auditable, reliable
Two Orthogonal Dimensions
| Dimension | Framework | Purpose |
|---|
| Temporal (how long) | Atkinson-Shiffrin 3-stage model | Decay management — what to keep vs. prune |
| Content (what kind) |
4-type taxonomy (Claude Code)|Classification — where to store for retrieval|
Dimension 1: Temporal Layering
| Stage | Human Equivalent | Implementation | TTL | Action |
|---|
| Sensory | ~0.25 sec perception | Current input context | Instant | Filter immediately — what deserves attention? |
| Short-term |
Recent|Model context window 10 turns|10 turns|Pass through working filters|
|Working|Recent ~7 days|memory/YYYY-MM-DD.md + Active Memory|7 days|Extract signal → promote to long-term or let decay|
|Long-term|Permanent|MEMORY.md (index) + classified files|Permanent|Periodic review, prune when stale|
Dimension 2: Content Classification (4 Types)
| Type | Directory | Content Example |
|---|
| user | memory/user/ | User profile (role, preferences, knowledge, goals) |
| feedback |
memory/feedback/|Lessons (corrections, confirmations, style)|
|project|memory/project/|Project state (work, decisions, reasoning)|
|reference|memory/reference/|External resources (links, tools, locations)|
What to Save / What NOT to Save
✅ Save
- - User's role, preferences, responsibilities, knowledge
- User corrections ("not like that", "should be this way")
- User confirmations ("yes exactly", "perfect, keep that")
- Project decisions and the reasoning (not just what, but why)
- New tools, links, resources
- External system locations and their purpose
❌ Don't Save
- - ❌ Code patterns, architecture, file paths (derivable from codebase)
- ❌ Git history (
git log is the authoritative source) - ❌ Debugging solutions (the fix is in the code)
- ❌ Anything already documented elsewhere
- ❌ Ephemeral task state (write to
todos.md instead) - ❌ Raw conversation content
MEMORY.md = Long-Term Index Only
MEMORY.md is the index of long-term memories only, never content. Format:
CODEBLOCK0
Memory File Format
Every classified memory file must have frontmatter:
CODEBLOCK1
Memory Drift Caveat
Memories can become stale. Rules:
- 1. Verify first: When referencing a file, function, or path — check it still exists
- Trust current state: If memory conflicts with current observation, trust what you see now
- Update or delete: When a memory is outdated, fix or remove it immediately
- Absolute dates: Convert relative dates ("yesterday", "last week") to absolute dates
Memory → Knowledge Sublimation
Not all mature memories should decay. Some evolve into knowledge.
When to Sublimate
| Trigger | Detection Signal | Result |
|---|
| Project complete | All tasks marked done, 3+ related project memories | Merge into INLINECODE5 |
| Feedback patterns |
3+ related feedback entries (e.g., all about reply style) | Merge into
knowledge/user-work-style-guide.md |
|
User depth | User memory accumulates role, preferences, habits over time | Expand to
knowledge/user-playbook.md |
|
Periodic review | Dream detects high density of related memories in one category | Suggest: "Found 5 related feedback entries → merge into knowledge?" |
Dual-Layer Dream Architecture
Layer 1: Official Dream (12:30)
Triggered via cron 30 12 * * * (your timezone). Produces:
| File/Directory | Contents | Read by Refined Verify? |
|---|
| INLINECODE9 | Promoted long-term entries | ✅ |
| INLINECODE10 |
Human-readable Dream diary | ✅ |
|
memory/dreaming/deep/YYYY-MM-DD.md | Deep phase report | ✅ |
|
memory/dreaming/light/YYYY-MM-DD.md | Light phase output | ✅ |
|
memory/dreaming/rem/YYYY-MM-DD.md | REM reflections | ✅ |
|
memory/.dreams/ | Internal machine data (program use only) | ❌ |
Phases:
- 1. Light — Sort and stage recent short-term material, dedupe
- Deep — Score and promote durable candidates (6 weighted signals) to MEMORY.md
- REM — Extract themes and reflection summaries
Layer 2: Refined Verify (13:00)
Triggered via cron 0 13 * * * (your timezone). Acts as the verification layer:
Verification Dimensions:
| Check | Content | On Conflict |
|---|
| Project status | Official Dream says "Project X done" but diary shows still in progress | ⚠️ Flag conflict |
| Decision conclusions |
Recorded decision has since changed in reality | ⚠️ Flag stale |
| User preferences | Does Dream's user profile match USER.md? | ⚠️ Flag for review |
| Dates | Were relative dates converted to absolute? | ✅/❌ |
| Decay decisions | Is Dream's decision to let an entry decay reasonable? | ⚠️ Flag suspicious |
Verification Report (written to memory/dreaming/verify/YYYY-MM-DD.md):
# Verification Report - YYYY-MM-DD
## Official Dream Status
- Entries promoted: X
- Top entry: X (score X)
- Disputed entries: X
## Conflict Log (⚠️)
| Entry | Official Dream | Refined Verify | Difference |
|---|---|---|---|
| ... | ... | ... | ... |
## Supplement Suggestions
- Additional promotions: X (missed by Official Dream)
- Needs user confirmation: X
## Verification Conclusion
- Consistency score: X/10
- Memory reliability: ✅ Reliable / ⚠️ Uncertain
Session Lifecycle
Session Start
CODEBLOCK3
During Conversation
CODEBLOCK4
Session End
- Summarize → write to memory/today.md (working memory)
- Identify items for long-term → update classified files
- Update MEMORY.md index
- Mark items for Dream review (decay candidates)
Workspace Structure
CODEBLOCK6
Example Interactions
User provides important info:
User: "I'm a data analyst, mostly working with Python"
→ Working: log in today's daily log
→ Long-term: save to
memory/user/user-profile.md, update MEMORY.md index
User corrects you:
User: "Don't use Markdown tables, use lists"
→ Working: log in today's daily log
→ Long-term: save to
memory/feedback/no-tables.md, update MEMORY.md index
Project decision:
Decision: approach A over B because lower cost
→ Working: log decision context
→ Long-term: save to
memory/project/decision.md with reasoning
Looking up a past date:
User: "What did we do last Tuesday?"
→ Working memory: read
memory/YYYY-MM-DD.md for that date
References
- - Atkinson-Shiffrin model (1968): Sensory → Short-term → Long-term memory stages
- Claude Code
memoryTypes.ts — 4-type taxonomy - Claude Code
extractMemories.ts — auto-extraction system - Claude Code
autoDream.ts — background consolidation system - OpenClaw
dreaming.md — Dreaming experimental documentation
OpenClaw Commands
CODEBLOCK7
Changelog
| Version | Changes |
|---|
| v4.12 | Dual-Layer Dream Verification: Official Dream (12:30) + Refined Verify (13:00) cross-checking. Verification reports in memory/dreaming/verify/. Hallucination and drift prevention. |
| v4.11 |
Full integration with OpenClaw 4.11 ecosystem, Active Memory + Memory Palace + Dream Consolidation |
| v3.2 | Memory sublimation system, 5-phase consolidation |
| v2.2 | Memory-Knowledge layering + Atkinson-Shiffrin integration |
| v1.0 | Initial release — Atkinson-Shiffrin three-stage model |
Version: v4.12 | Updated: 2026-04-15 | Dual-Layer Dream Verification prevents hallucination and memory drift
🧠 永不遗忘记忆系统 v4.12
一个为OpenClaw设计的全功能记忆系统,集成了主动记忆检索、记忆宫殿结构化视图和双层梦境验证机制——提供主动记忆 + 全局视图 + 可验证巩固。
核心逻辑:主动记忆 = 记忆管家,记忆宫殿 = 知识殿堂,双层梦境 = 验证与巩固专家
许可证:MIT-0 | 更新日期:2026-04-15 | v4.12新增双层验证
概述 (v4.12)
本技能通过管理两个正交维度的记忆,将你的OpenClaw智能体转变为真正知悉的助手:
- 1. 时间维度(Atkinson-Shiffrin三阶段模型)—— 保留什么 vs. 修剪什么
- 内容维度(来自Claude Code的4类型分类法)—— 存储在哪里以便快速检索
双层梦境验证架构确保智能体的记忆可靠、无幻觉且持续验证。
核心组件
1. 主动记忆 — 主动检索
在每次响应前,主动记忆会自动检索并将相关记忆注入上下文。
检索模式:
- - message — 仅当前消息
- recent — 最近对话
- full — 完整历史(推荐)
能力:
- - 自动偏好学习
- 上下文继承(项目背景、历史结论)
- 实时记忆注入
2. 记忆宫殿 — 结构化视图
提供智能体长期记忆的多维视图:
- - 时间线 — 工作进展的时间顺序视图
- 项目 — 按项目聚合
- 技术 — 按技术领域组织
- 自定义 — 用户定义维度
3. 双层梦境验证(v4.12核心创新)
两个独立但相互验证的层级:
正式梦境(12:30) — 将短期信号提升为长期记忆(MEMORY.md)
↓ 输出:DREAMS.md、memory/dreaming/deep/等
↓
精炼验证(13:00) — 读取正式输出并以独立判断进行交叉验证
→ 检测冲突、幻觉、过时条目 → 写入验证/报告
→ 补充遗漏的提升
为何验证重要:
- - AI记忆系统存在幻觉(编造事实)和漂移(记忆偏离现实)问题
- 两个独立系统相互检查 = 可验证、可审计、可靠
两个正交维度
| 维度 | 框架 | 目的 |
|---|
| 时间维度(保留多久) | Atkinson-Shiffrin三阶段模型 | 衰减管理 — 保留什么 vs. 修剪什么 |
| 内容维度(什么类型) |
4类型分类法(Claude Code)|分类 — 存储在哪里以便检索|
维度1:时间分层
| 阶段 | 人类类比 | 实现方式 | TTL | 操作 |
|---|
| 感觉记忆 | 约0.25秒感知 | 当前输入上下文 | 即时 | 立即过滤 — 什么值得关注? |
| 短时记忆 |
近期|模型上下文窗口10轮|10轮|通过工作过滤器|
|工作记忆|近期约7天|memory/YYYY-MM-DD.md + 主动记忆|7天|提取信号 → 提升为长期或任其衰减|
|长期记忆|永久|MEMORY.md(索引)+ 分类文件|永久|定期审查,过时则修剪|
维度2:内容分类(4种类型)
| 类型 | 目录 | 内容示例 |
|---|
| 用户 | memory/user/ | 用户画像(角色、偏好、知识、目标) |
| 反馈 |
memory/feedback/|经验教训(纠正、确认、风格)|
|项目|memory/project/|项目状态(工作、决策、推理)|
|参考|memory/reference/|外部资源(链接、工具、位置)|
保存内容 / 不保存内容
✅ 保存
- - 用户的角色、偏好、职责、知识
- 用户的纠正(不是那样、应该是这样)
- 用户的确认(是的,完全正确、完美,保持这样)
- 项目决策及其推理过程(不仅是什么,还有为什么)
- 新工具、链接、资源
- 外部系统位置及其用途
❌ 不保存
- - ❌ 代码模式、架构、文件路径(可从代码库推导)
- ❌ Git历史(git log是权威来源)
- ❌ 调试解决方案(修复已在代码中)
- ❌ 已在其他地方记录的任何内容
- ❌ 临时任务状态(改为写入todos.md)
- ❌ 原始对话内容
MEMORY.md = 仅长期索引
MEMORY.md是仅长期记忆的索引,从不包含内容。格式:
记忆文件格式
每个分类的记忆文件必须包含前置元数据:
yaml
名称:记忆名称
描述:一行描述(用于判断相关性)
类型:用户|反馈|项目|参考
创建日期:YYYY-MM-DD
规则 / 事实
(内容)
原因
(理由/动机)
如何应用
(何时以及如何使用此记忆)
记忆漂移警告
记忆可能变得过时。规则:
- 1. 先验证:引用文件、函数或路径时 — 检查其是否仍然存在
- 信任当前状态:如果记忆与当前观察冲突,相信你现在看到的
- 更新或删除:当记忆过时时,立即修复或移除
- 绝对日期:将相对日期(昨天、上周)转换为绝对日期
记忆 → 知识升华
并非所有成熟的记忆都应衰减。有些演变为知识。
何时升华
| 触发条件 | 检测信号 | 结果 |
|---|
| 项目完成 | 所有任务标记完成,3+条相关项目记忆 | 合并到knowledge/project-postmortem.md |
| 反馈模式 |
3+条相关反馈条目(例如,都关于回复风格)|合并到knowledge/user-work-style-guide.md|
|
用户深度|用户记忆随时间积累角色、偏好、习惯|扩展为knowledge/user-playbook.md|
|
定期审查|梦境检测到某一类别中高密度的相关记忆|建议:发现5条相关反馈条目 → 合并为知识?|
双层梦境架构
第1层:正式梦境(12:30)
通过cron 30 12 *(你的时区)触发。生成:
| 文件/目录 | 内容 | 精炼验证读取? |
|---|
| MEMORY.md | 提升的长期条目 | ✅ |
| DREAMS.md |
人类可读的梦境日记|✅|
|memory/dreaming/deep/YYYY-MM-DD.md|深度阶段报告|✅|
|memory/dreaming/light/YYYY-MM-DD.md|浅度阶段输出|✅|
|memory/dreaming/rem/YYYY-MM-DD.md|REM反思|✅|
|memory/.dreams/|内部机器数据(仅程序使用)|❌|
阶段:
- 1. 浅度 — 排序和暂存近期短期材料,去重
- 深度 — 评分并提升持久候选(6个加权信号)到MEMORY.md
- REM — 提取主题和反思摘要
第2层:精炼验证(13:00)
通过cron 0 13 *(你的时区)触发。作为验证层:
验证维度:
| 检查项 | 内容 | 冲突时 |
|---|
| 项目状态 | 正式梦境说项目X完成但日记显示仍在进行中 | ⚠️ 标记冲突 |
| 决策结论 |
记录的决策后来在现实中已改变|⚠️ 标记过时|
|用户偏好|梦境的用户画像是否与USER.md匹配?|⚠️ 标记待审查|
|日期|相对日期是否已转换为绝对日期?|✅/❌|
|衰减决策|梦境让某条目衰减的决定是否合理?|⚠️ 标记可疑|
验证报告(写入memory/dreaming/verify/YYYY-MM-DD.md):
markdown
验证报告 - YYYY-MM-DD
正式梦境状态
- - 提升的条目数:X
- 最高分条目:X(得分X)
- 争议条目:X
冲突日志(⚠️)
补充建议
验证结论
- - 一致性评分:X/10
- 记忆可靠性:✅ 可靠 / ⚠️ 不确定
会话生命周期
会话开始
- 1. 感觉记忆:读取当前输入
- 短时记忆:上下文窗口中的最后10轮
3.