ReMe/docs/zh/auto_memory.md
jinliyl ab66f2bb56
docs: refresh ReMe guides, diagrams, and Studio documentation (#447)
* docs: update ReMe documentation URL

* docs: localize ReMe Studio social image

* docs(AGENTS): update agent guidelines and repository documentation structure

- Clarify coding agent guidance for keeping changes small and consistent
- Revise project principle descriptions for clarity and modern terminology
- Expand repository map with detailed component and folder explanations
- Add configuration and CLI usage instructions, including syntax and merging rules
- Elaborate on component, step registration, and application lifecycle processes
- Define jobs, steps, and state handling conventions for stateless design
- Specify workspace and file safety policies, including path restrictions and locking
- Update validation commands and testing environment recommendations
- Clarify coding and test conventions, including style and dependency policies
- Distinguish documentation boundaries and update website content contribution notes
- Reinforce change guardrails to avoid breaking backward compatibility and data loss
- Improve svg diagram formatting and textual details in auto dream and proactive flow image

* style(docs): fix font-family syntax in SVG style definitions

- Correct quotation marks around font-family names in memory-as-file.svg
- Standardize font-family formatting by removing unnecessary quotes in reme-blog-architecture.svg
- Ensure consistent CSS style formatting within SVG files for better rendering fidelity

* docs: add ReMe blog to news

* style(docs): inline svg styles and improve text formatting

- Convert multiline SVG style tags into single-line for compactness in multiple figures
- Remove redundant line breaks in subtitle text elements for consistency
- Shorten descriptive texts in SVG figures for clarity and conciseness
- Adjust font sizes and text for better readability in SVG elements
- Correct whitespace issues in Chinese markdown document for improved formatting
- Remove unused style blocks from framework structure SVG for cleaner code
2026-08-12 10:59:03 +08:00

4.2 KiB
Raw Blame History

Auto Memory

Auto Memory 是 ReMe 的对话记忆入口:在目标日期内,它用 session_id 定位或更新最多一张 daily 记忆卡片,文件名由 Agent 根据内容生成简洁的主题或事件名,再由当天的 YYYY-MM-DD.md 统一索引。它负责把“聊过”变成“记住”,并保留可追溯的对话记录。

ReMe Auto Memory 与 Auto Resource 写入 daily 记忆卡片的流程

关于 daily/session/、frontmatter 和 wikilink 的通用文件语义,见 Memory as File

Conversation
  ├─ step 1: daily/YYYY-MM-DD/<generated_name>.md # 每个 session 一张主题卡片
  ├─ step 2: daily/YYYY-MM-DD.md                  # 当天索引再串起来
  └─ source: session/dialog/<session_id>.jsonl    # 对话来源记录

它记录什么

它不记录聊天流水账,只记录以后可能还会用到的内容:

  • 用户偏好:喜欢什么风格、习惯怎么协作、长期要求是什么。
  • 关键事实:项目背景、重要数字、明确结论、限制条件。
  • 过程决定:发生了什么,为什么这么选,哪些方案被放弃。
  • 当前状态:做到哪一步,卡在哪里,下一步是什么。
  • 可复用经验:命令、流程、排查方法、解决方案。

写入位置

Auto Memory 会把整理后的记忆放进 daily/。当天发生的对话会先被整理成一张张小卡片:

示例目录:

workspace/
  daily/
    2026-06-20.md
    2026-06-20/
      login-refactor-decision.md
      retrieval-regression.md

日期目录下的两个文件是不同对话整理出的主题卡片,daily/2026-06-20.md 是当天索引页。资源文件也会进入 同一个 daily 记忆层,见 Auto Resource

当调用时带上 session_idAuto Memory 会通过 frontmatter 用它定位卡片Agent 则通过 name 决定可读文件名:

name: login-refactor-decision
session_id: session-a
source_conversation: "[[session/dialog/session-a.jsonl]]"

这样既能分开不同对话,又不必把不透明的 ID 当文件名。更新时会按 session_idsource_conversation 找到旧卡片;如果 Agent 提供了更好的 frontmatter name,系统可重命名并重定向入链。查看某天内容时从 YYYY-MM-DD.md 开始。

同时保存原始信息

整理后的 daily note 负责“好读”,过滤后的对话来源记录负责“可信”。

Auto Memory 在生成记忆卡片的同时,也会保存对话来源消息:

session/
  dialog/
    session-a.jsonl
    session-b.jsonl

daily note 会指向对应的对话记录。持久化时会排除 tool-result block 和 base64 data block避免召回记忆或二进制负载在后续流程中被误当成 用户提供的证据。

消息时间

Auto Memory 会在 prompt 和对话来源 JSONL 中保留每条已保留消息的 created_at。导入历史对话或 benchmark 数据时,建议为每条 message 提供真实发生时间,避免模型把事件时间误解为运行时间:

reme auto_memory \
  session_id=locomo-session \
  messages='[
    {"role":"user","content":"Jon lost his job today.","created_at":"2023-01-19T08:00:00"},
    {"role":"assistant","content":"I am sorry to hear that.","created_at":"2023-01-19T08:01:00"}
  ]'

为了兼容常见数据集字段,auto_memory 也会在缺少 created_at 时读取 time_createdtimestampcreatedAttimeCreatedcreated_time。这些字段可以放在 message 顶层,也可以放在 metadata 中。

当调用没有显式传入 dateAuto Memory 会使用消息中最晚的有效 created_at 日期作为 daily note 日期;如果消息没有有效时间, 则回退到当前日期。历史导入也可以显式指定目标日期:

reme auto_memory \
  session_id=locomo-session \
  date=2023-01-19 \
  messages='[{"role":"user","content":"Jon lost his job today."}]'

后续流向

Auto Memory 只生成 daily 层记忆。要把这些材料进一步沉淀为长期 digest/ 节点,使用 Auto Dream;要搜索 daily 和 digest使用 Memory Search