Hui Yi — Forgetting-aware Cold Memory
Archive low-frequency, high-value knowledge, then resurface it only when it is both relevant now and at risk of being forgotten.
What this skill manages
Hui Yi manages the cold layer, not the whole memory stack.
Memory layers:
- - Active: current chat and current task
- Warm: recent daily files and near-term context
- Cold: durable low-frequency knowledge in INLINECODE0
- Dormant: archived items that should rarely surface unless strongly triggered
Use Hui Yi for:
- - archiving reusable lessons, background, and stable historical context
- recalling older context that would materially improve the current answer
- cooling daily notes into cold memory
- maintaining cold-memory quality, review timing, and retrieval metadata
Do not use Hui Yi for:
- - today's transient notes → INLINECODE1
- high-frequency project or personal facts → INLINECODE2
- tool paths, setup quirks, machine notes → INLINECODE3
- fresh mistakes or unvalidated lessons → INLINECODE4
Core model
The unit is a memory unit, not a raw keyword.
A memory unit can be a reusable lesson, decision, fact, troubleshooting result, or durable background note.
Do not rank memories by word frequency alone.
Use a blend of:
- - semantic relevance
- forgetting risk
- importance
- cross-session reuse
- recall feedback
Working principle:
CODEBLOCK0
Memory metadata
Cold notes remain Markdown, but Hui Yi expects metadata like:
- -
Importance: high | medium | low - INLINECODE6 : hot | warm | cold | dormant
- INLINECODE7 — last time this note appeared in a conversation or task
- INLINECODE8 — last time the note was explicitly reviewed for recall quality
- INLINECODE9 — scheduled date for the next spaced review
- INLINECODE10
-
interval_days — current review interval (starts at 1, grows with each success)
-
review_count
-
review_success
-
review_fail
- -
Confidence — reliability of the note's content (high | medium | low) - INLINECODE16 — last time the content was confirmed still accurate and current.
This is NOT updated during recall feedback; only update it when you re-verify the
underlying information against source of truth.
States:
- - hot: recently reinforced, okay to inject when useful
- warm: good prompted-recall candidate
- cold: preserved, lower urgency
- dormant: keep archived, surface only with a strong trigger
Recall rules
Prefer active recall over passive dumping.
Good pattern:
- - “You previously touched on X. Want me to pull that thread back in?”
Avoid:
- - long unsolicited note dumps
- surfacing weakly related archive material
- recalling based on one noisy keyword match
When retrieving:
- 1. Check current conversation first.
- Check warm memory /
MEMORY.md / TOOLS.md / .learnings/ when appropriate. - Use cold memory only when archival context would materially help.
- Open the fewest notes possible, ideally 1 and no more than 3.
- Summarize, do not paste raw notes unless asked.
- Log meaningful cold-memory retrievals in
memory/cold/retrieval-log.md.
Requirements
Python 3.10+ (X | Y union-type syntax used throughout the helper scripts).
First-time setup
If memory/cold/ does not exist, bootstrap it:
- 1. Create
memory/cold/ directory. - Create
memory/cold/index.md with header # Cold Memory Index. - Create
memory/cold/tags.json:
{ "_meta": { "version": 4 }, "notes": [] }
- 4. Copy
references/note-template.md → INLINECODE29
(
cold-memory-schema.md is the full schema reference; keep it separate from
_template.md).
- 5. Create
memory/cold/retrieval-log.md — just the header line:
# Retrieval Log
The
review.py feedback and
review.py session commands append rows automatically.
- 6. Optional — timed recall scheduler:
CODEBLOCK3
Storage layout
CODEBLOCK4
Script roles
- -
create.py --title "...": create a new note with Ebbinghaus defaults (interval_days: 1, next_review: tomorrow) - INLINECODE38 : check all notes against the schema; cross-validate tags.json file references
- INLINECODE39 : search cold-memory metadata by keyword/query
- INLINECODE40 : also search note file bodies (not just metadata)
- INLINECODE41 : rebuild
index.md and tags.json from note files - INLINECODE44 : decay stale notes;
--rebuild syncs tags.json in one step - INLINECODE46 : scan daily notes and update heartbeat cold-memory stats
- INLINECODE47 : list notes due for review
- INLINECODE48 : interactive batch review — presents each due note's TL;DR, collects y/n/s/q, applies Ebbinghaus intervals, handles graduation
- INLINECODE49 : rank resurfacing candidates using a short topic query
- INLINECODE50 /
--stdin: rank resurfacing candidates using richer context - INLINECODE52 : single-note feedback;
<note> accepts slug, title, or keywords - INLINECODE54 : timed-recall selector driven by schedule config with cooldown, dedupe, and quiet-hours filters
- INLINECODE55 : isolated end-to-end smoke test that bootstraps a temp cold-memory root and runs the core scripts in sequence
Scheduler setup
INLINECODE56 reads memory/cold/schedule.json. To enable it:
CODEBLOCK5
The example config runs a daily evening review at 21:00, surfaces one high-importance note, and applies quiet hours from 22:30 to 08:00.
Important:
- -
--schedule-id means “run this schedule's filters now”, not “force a candidate for preview” - INLINECODE59 is the explicit debug mode. It bypasses due, importance, allowed_states, cooldown, and relevance-required gating so you can inspect candidate ranking for that schedule
Review cadence
Default ladder for notes that merit reinforcement:
- - creation
- +1 day
- +3 days
- +7 days
- +14 days
- +30 days
After that:
- - helpful recall → extend interval
- unhelpful recall → shorten interval or cool further
- high-importance notes should degrade more slowly than low-importance notes
Archiving rules
Archive only if at least one is true:
- - it will still matter after 30 days
- it captures a reusable lesson or workflow
- it would materially improve a future answer or decision
- the user explicitly wants it preserved
Before archiving, route elsewhere if it belongs in:
- - INLINECODE60
- INLINECODE61
- INLINECODE62
- INLINECODE63
- INLINECODE64 / INLINECODE65
Never store secrets, tokens, or passwords in cold memory.
Maintenance rules
During maintenance:
- - merge overlapping notes
- sharpen summaries, triggers, and semantic context
- demote stale or noisy notes
- review
retrieval-log.md for:
- notes never recalled
- unmatched queries
- unhelpful recalls
- repeatedly useful recalls
Favor a smaller, sharper archive over a large fuzzy one.
Error handling
- - missing
memory/cold/ → bootstrap it - missing or malformed
index.md / tags.json → rebuild with INLINECODE70 - missing
retrieval-log.md → recreate standard header - missing
heartbeat-state.json → create with top-level INLINECODE73 - dangling note path in metadata → repair index / tags
- noisy resurfacing → tighten thresholds before adding more notes
- unsure where content belongs → ask the user
Development sanity check
Before shipping script changes, run:
CODEBLOCK6
This boots an isolated temporary cold-memory tree and exercises create, validate, search, resurface, feedback, decay, cool, and scheduler.
References
Read only when needed:
- -
references/cold-memory-schema.md → note/index/tags structure - INLINECODE75 → concrete note examples
- INLINECODE76 → cooling workflow
- INLINECODE77 → trigger modes, heartbeat/cron integration, scheduler boundary, preview vs normal mode
Core rule:
archive less, but archive better. recall less, but recall at the right time.
Bridge (桥接层)
INLINECODE78 是一个轻量桥接层,用于在调度 (scheduler.py) 与实际投递之间完成筛选、去重、频控等策略。默认配置位于 skills/hui-yi/bridge/config.example.json,其中已设置 statePath、outputPath 指向 bridge 目录。
关键功能
- - 统一配置:
config.example.json 包含 deliveryPolicy(maxCandidates、minScore、globalCooldownHours、perScheduleCooldownHours、maxDeliveriesPerDay、quietHours 等)。 - 投递模式:
logOnly(默认,仅记录返回 JSON),stdout(打印),file(写入 deliveries.log),message(占位,后续可接 OpenClaw 消息工具)。 - dry‑run / preview:
--dry-run 或 dryRun:true 只输出结果,不修改状态或投递。 - 状态持久化:
bridge-state.json 记录上一次运行时间、已投递记录,以实现去重与频控。
使用示例
CODEBLOCK7
如需实际向用户发送消息,请将 delivery.mode 改为 message 并在后续集成中使用 OpenClaw message API。
慧忆 — 遗忘感知的冷记忆
归档低频、高价值的知识,然后仅当这些知识既与当前相关又面临被遗忘风险时才将其重新浮现。
此技能管理的内容
慧忆管理的是冷层,而非整个记忆堆栈。
记忆层:
- - 热层:当前对话和当前任务
- 温层:近期日常文件和近期上下文
- 冷层:memory/cold/ 中持久化的低频知识
- 休眠层:已归档项目,除非被强烈触发,否则极少浮现
使用慧忆的场景:
- - 归档可复用的经验教训、背景信息和稳定的历史上下文
- 回忆能够实质性改善当前回答的较旧上下文
- 将日常笔记冷却为冷记忆
- 维护冷记忆质量、审查时机和检索元数据
不要使用慧忆的场景:
- - 今日临时笔记 → memory/YYYY-MM-DD.md
- 高频项目或个人事实 → MEMORY.md
- 工具路径、设置技巧、机器笔记 → TOOLS.md
- 新错误或未验证的经验教训 → .learnings/
核心模型
基本单位是记忆单元,而非原始关键词。
一个记忆单元可以是可复用的经验教训、决策、事实、故障排除结果或持久的背景笔记。
不要仅凭词频对记忆进行排序。
应综合使用以下因素:
工作原理:
text
优先级 ≈
0.35 * 当前相关性
+ 0.25 * 遗忘风险
+ 0.20 * 重要性
+ 0.10 * 跨会话复用
+ 0.10 * 状态偏差
记忆元数据
冷笔记仍为 Markdown 格式,但慧忆期望包含如下元数据:
- - 重要性:高 | 中 | 低
- 记忆状态:热 | 温 | 冷 | 休眠
- 最后出现 — 该笔记最后一次出现在对话或任务中的时间
- 最后审查 — 该笔记最后一次被明确审查回忆质量的时间
- 下次审查 — 计划的下一次间隔复习日期
- 审查节奏
- 间隔天数 — 当前审查间隔(从 1 开始,每次成功递增)
- 审查次数
- 审查成功
- 审查失败
- - 置信度 — 笔记内容的可靠性(高 | 中 | 低)
- 最后验证 — 内容最后一次被确认仍然准确和最新的时间。
这在回忆反馈期间不会更新;仅当您根据事实来源重新验证底层信息时才更新。
状态:
- - 热:最近被强化,在有用时可以注入
- 温:良好的提示回忆候选
- 冷:已保存,紧迫性较低
- 休眠:保持归档,仅在强触发时浮现
回忆规则
优先使用主动回忆而非被动倾倒。
良好模式:
避免:
- - 未经请求的长篇笔记倾倒
- 浮现弱相关的归档材料
- 基于单一噪声关键词匹配进行回忆
检索时:
- 1. 首先检查当前对话。
- 适当时检查温记忆 / MEMORY.md / TOOLS.md / .learnings/。
- 仅在归档上下文能实质性帮助时使用冷记忆。
- 打开尽可能少的笔记,理想情况下 1 个,最多不超过 3 个。
- 进行总结,除非被要求,否则不要粘贴原始笔记。
- 将有意义的冷记忆检索记录在 memory/cold/retrieval-log.md 中。
要求
Python 3.10+(辅助脚本中全程使用 X | Y 联合类型语法)。
首次设置
如果 memory/cold/ 不存在,请引导创建:
- 1. 创建 memory/cold/ 目录。
- 创建 memory/cold/index.md,包含标题 # Cold Memory Index。
- 创建 memory/cold/tags.json:
json
{ _meta: { version: 4 }, notes: [] }
- 4. 复制 references/note-template.md → memory/cold/_template.md
(cold-memory-schema.md 是完整模式参考;请与 _template.md 分开存放)。
- 5. 创建 memory/cold/retrieval-log.md — 仅标题行:
# Retrieval Log
review.py feedback 和 review.py session 命令会自动追加行。
- 6. 可选 — 定时回忆调度器:
bash
cp references/schedule.example.json memory/cold/schedule.json
# 然后编辑 schedule.json:时区、cron 时间、min_importance 等
存储布局
text
memory/
├── cold/
│ ├── index.md
│ ├── tags.json
│ ├── retrieval-log.md
│ ├── _template.md
│ ├── schedule.json ← 可选,从 references/schedule.example.json 复制
│ └── .md
├── heartbeat-state.json
skills/hui-yi/scripts/
├── common.py ← 共享路径 / 解析 / JSON 辅助函数
├── create.py ← 使用艾宾浩斯默认值创建新笔记
├── validate.py ← 模式验证
├── search.py
├── rebuild.py
├── decay.py
├── cool.py
├── review.py
├── scheduler.py
└── smoke_test.py
脚本角色
- - create.py --title ...:使用艾宾浩斯默认值创建新笔记(intervaldays: 1,nextreview: 明天)
- validate.py:对照模式检查所有笔记;交叉验证 tags.json 文件引用
- search.py :按关键词/查询搜索冷记忆元数据
- search.py --full-text:同时搜索笔记文件正文(不仅限于元数据)
- rebuild.py:从笔记文件重建 index.md 和 tags.json
- decay.py [--rebuild]:衰减过时笔记;--rebuild 一步同步 tags.json
- cool.py:扫描日常笔记并更新心跳冷记忆统计
- review.py due:列出到期待审查的笔记
- review.py session:交互式批量审查 — 呈现每个到期笔记的 TL;DR,收集 y/n/s/q,应用艾宾浩斯间隔,处理毕业
- review.py resurface --query ...:使用简短主题查询对重新浮现候选进行排序
- review.py resurface --context-file / --stdin:使用更丰富的上下文对重新浮现候选进行排序
- review.py feedback :单笔记反馈; 接受 slug、标题或关键词
- scheduler.py:由调度配置驱动的定时回忆选择器,包含冷却、去重和静默时段过滤器
- smoke_test.py:隔离的端到端冒烟测试,引导创建临时冷记忆根目录并按顺序运行核心脚本
调度器设置
scheduler.py 读取 memory/cold/schedule.json。要启用它:
bash
cp references/schedule.example.json memory/cold/schedule.json
然后编辑 memory/cold/schedule.json 以匹配您偏好的调度和时区
示例配置在 21:00 运行每日晚间审查,浮现一条高重要性笔记,并在 22:30 至 08:00 应用静默时段。
重要提示:
- - --schedule-id 表示立即运行此调度的过滤器,而非强制预览候选
- --preview 是明确的调试模式。它绕过到期、重要性、允许状态、冷却和相关性要求门控,以便您可以检查该调度的候选排序
审查节奏
值得强化的笔记的默认阶梯:
- - 创建
- +1 天
- +3 天
- +7 天
- +14 天
- +30 天
之后:
- - 有帮助的回忆 → 延长间隔
- 无帮助的回忆 → 缩短间隔或进一步冷却
- 高重要性笔记应比低重要性笔记衰减得更慢
归档规则
仅在满足以下至少一个条件时归档:
- - 30 天后仍然重要
- 包含可复用的经验教训或工作流程
- 能实质性改善未来的回答或决策
- 用户明确希望保留
归档前,如果内容属于以下位置,请路由到其他地方:
- - memory/YYYY-MM-DD.md
- MEMORY.md
- TOOLS.md
- .learnings/
- AGENTS.md / SOUL.md
切勿在冷记忆中存储机密、令牌或密码。
维护规则
维护期间: