Files
nexus/wiki/concepts/记忆系统.md

64 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "记忆系统"
type: concept
tags: [memory, openclaw, context]
last_updated: 2026-04-14
---
# 记忆系统
AI Agent跨会话保留上下文和知识的能力。
## OpenClaw记忆机制
### 内置方案builtin
原始记忆存储在Markdown文件中系统维护本地索引方便检索。
### QMD方案
围绕workspace中的Markdown文件使用更强的检索/索引方式。
### 记忆流程
```
对话发生
Agent通过普通文件工具把重要信息写入memory/或MEMORY.md
下次对话开始
Agent通过memory_search/memory_get检索相关记忆
相关记忆被注入到当前对话上下文
Agent表现出"我记得你说过……"的能力
```
## 向量语义搜索
[[Semantic Memory Search]]使用memsearch
- 索引Markdown记忆文件到向量数据库
- 通过含义搜索而非关键词
- SHA-256内容哈希避免重复嵌入
## Workspace记忆文件
- [[memory/]]:按日期滚动的记忆笔记
- [[MEMORY.md]]:长期知识总表
- 与memory/目录兼容
## 关键洞察
- 对Agent来说真正算数的长期记忆是Markdown文件
- 向量索引只是派生缓存,可以随时重建
- 文件永不修改
## 使用场景
- [[第二大脑]]
- [[个人CRM]]
- [[健康症状追踪]]
## 相关工具
- [[memsearch]]:向量语义搜索工具
- [[Milvus]]:向量数据库后端