memory-reflect

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Memory Reflect

Memory Reflect

Review recent activity and consolidate valuable insights into long-term memory.
Inspired by sleep-time compute — the idea that memory formation happens best between active sessions, not during them.
回顾近期活动,将有价值的见解整合到长期记忆中。
灵感来源于“睡眠时段计算”——即记忆形成在活跃会话间隙进行效果最佳,而非会话过程中。

When to Run

运行时机

  • Cron/heartbeat: Schedule as a periodic background task (recommended: 1-2x daily)
  • On demand: User asks to reflect, consolidate, or review recent memory
  • Post-compaction: After context window compaction events
  • 定时任务/心跳触发:作为周期性后台任务调度(推荐:每日1-2次)
  • 按需触发:用户要求进行反思、整合或回顾近期记忆时
  • 压缩后触发:在上下文窗口压缩事件完成后

Process

流程

1. Gather Recent Material

1. 收集近期素材

Read the last 2-3 days of daily notes from
memory/YYYY-MM-DD.md
. Also check:
  • Recent conversation transcripts (if accessible)
  • Any files modified in
    memory/
    in the last 48 hours
  • Active tasks in
    memory/tasks/
读取
memory/YYYY-MM-DD.md
中过去2-3天的日常笔记。同时检查:
  • 近期对话记录(若可访问)
  • memory/
    目录下过去48小时内修改的所有文件
  • memory/tasks/
    中的活跃任务

2. Evaluate What Matters

2. 评估信息价值

For each piece of information, ask:
  • Is this a decision that affects future work? → Keep
  • Is this a lesson learned or mistake to avoid? → Keep
  • Is this a preference or working style insight? → Keep
  • Is this a relationship detail (who does what, contact info)? → Keep
  • Is this transient (weather checked, heartbeat ran, routine task)? → Skip
  • Is this already captured in MEMORY.md or another long-term file? → Skip
针对每条信息,思考:
  • 这是否是影响未来工作的决策?→ 保留
  • 这是否是经验教训或需避免的错误?→ 保留
  • 这是否是偏好或工作风格见解?→ 保留
  • 这是否是关系细节(职责分工、联系方式等)?→ 保留
  • 这是否是临时信息(天气查询、心跳任务运行、常规事务)?→ 跳过
  • 这是否已在MEMORY.md或其他长期文件中记录过?→ 跳过

3. Update Long-Term Memory

3. 更新长期记忆

Write consolidated insights to
MEMORY.md
following its existing structure:
  • Add new sections or update existing ones
  • Use concise, factual language
  • Include dates for temporal context
  • Remove or update outdated entries that the new information supersedes
按照MEMORY.md的现有结构,将整合后的见解写入其中:
  • 添加新章节或更新现有章节
  • 使用简洁、客观的语言
  • 包含日期以体现时间背景
  • 删除或更新被新信息取代的过时条目

4. Log the Reflection

4. 记录反思过程

Append a brief entry to today's daily note:
markdown
undefined
在今日的日常笔记中添加一条简短记录:
markdown
undefined

Reflection (HH:MM)

Reflection (HH:MM)

  • Reviewed: [list of files reviewed]
  • Added to MEMORY.md: [brief summary of what was consolidated]
  • Removed/updated: [anything cleaned up]
undefined
  • Reviewed: [list of files reviewed]
  • Added to MEMORY.md: [brief summary of what was consolidated]
  • Removed/updated: [anything cleaned up]
undefined

Guidelines

指南

  • Be selective. The goal is distillation, not duplication. MEMORY.md should be curated wisdom, not a copy of daily notes.
  • Preserve voice. If the agent has a personality/soul file, reflections should match that voice.
  • Don't delete daily notes. They're the raw record. Reflection extracts from them; it doesn't replace them.
  • Merge, don't append. If MEMORY.md already has a section about a topic, update it in place rather than adding a duplicate entry.
  • Flag uncertainty. If something seems important but you're not sure, add it with a note like "(needs confirmation)" rather than skipping it entirely.
  • Restructure over time. If MEMORY.md is a chronological dump, restructure it into topical sections during reflection. Curated knowledge > raw logs.
  • Check for filesystem issues. Look for recursive nesting (memory/memory/memory/...), orphaned files, or bloat while gathering material.
  • 有所取舍:目标是提炼,而非复制。MEMORY.md应是经过筛选的智慧集合,而非日常笔记的副本。
  • 保留风格:若Agent有性格/灵魂文件,反思内容应匹配该风格。
  • 勿删除日常笔记:它们是原始记录。反思是从中提取信息,而非替代它们。
  • 合并而非追加:若MEMORY.md已有相关主题的章节,应就地更新,而非添加重复条目。
  • 标记不确定内容:若某信息看似重要但存疑,应添加标注如“(需确认)”,而非直接跳过。
  • 随时间重构:若MEMORY.md是按时间顺序的堆砌,可在反思时将其重构为主题分类章节。经过筛选的知识优于原始日志。
  • 检查文件系统问题:收集素材时,留意递归嵌套(如memory/memory/memory/...)、孤立文件或冗余内容。