用途
memory-setup 用于为 Moltbot/Clawdbot 智能体启用和配置持久化记忆搜索(memory search),以解决智能体在会话之间遗忘信息、重复提问、缺乏项目连续性的问题。其目标是让智能体从“金鱼记忆”变为“大象记忆”,能够回忆过去的对话、了解用户偏好、跟踪项目历史。
主要能力
该技能围绕以下方面提供配置与结构指引:
- 在配置文件中启用记忆搜索(memorySearch)。
- 创建工作区中的记忆结构,包括长期记忆文件 MEMORY.md 与 memory 目录(含 logs、projects、groups、system 子目录)。
- 初始化 MEMORY.md 的内容框架,用于记录用户信息、活跃项目、决策与经验、偏好。
- 提供配置项说明,包括 enabled、provider、sources、indexMode、minScore、maxResults。
- 提供嵌入提供方(provider)选项:voyage(推荐)、openai、local。
- 提供索引来源(sources)选项:memory、sessions、both(推荐)。
- 提供每日日志格式(memory/logs/YYYY-MM-DD.md)。
- 提供在 AGENTS.md 中添加记忆检索行为的指令。
- 提供故障排查与验证方法。
使用方式
1. 在配置中启用记忆搜索
将以下内容添加到 ~/.clawdbot/clawdbot.json(或 moltbot.json):
{
"memorySearch": {
"enabled": true,
"provider": "voyage",
"sources": ["memory", "sessions"],
"indexMode": "hot",
"minScore": 0.3,
"maxResults": 20
}
}
2. 创建记忆结构
在工作区中创建:
workspace/
├── MEMORY.md # 长期精选记忆
└── memory/
├── logs/ # 每日日志(YYYY-MM-DD.md)
├── projects/ # 项目专属上下文
├── groups/ # 群聊上下文
└── system/ # 偏好、设置笔记
3. 初始化 MEMORY.md
在工作区根目录创建 MEMORY.md:
# MEMORY.md — Long-Term Memory
## About [User Name]
- Key facts, preferences, context
## Active Projects
- Project summaries and status
## Decisions & Lessons
- Important choices made
- Lessons learned
## Preferences
- Communication style
- Tools and workflows
配置选项说明
| 设置 | 用途 | 推荐值 |
|---|---|---|
| enabled | 开启记忆搜索 | true |
| provider | 嵌入提供方 | "voyage" |
| sources | 索引内容 | ["memory", "sessions"] |
| indexMode | 何时索引 | "hot"(实时) |
| minScore | 相关度阈值 | 0.3(越低结果越多) |
| maxResults | 返回的最大片段数 | 20 |
提供方选项
- voyage — Voyage AI 嵌入(推荐)
- openai — OpenAI 嵌入
- local — 本地嵌入(无需 API)
来源选项
- memory — MEMORY.md + memory/*.md 文件
- sessions — 过往对话记录
- both — 完整上下文(推荐)
每日日志格式
每天创建 memory/logs/YYYY-MM-DD.md:
# YYYY-MM-DD — Daily Log
## [Time] — [Event/Task]
- What happened
- Decisions made
- Follow-ups needed
## [Time] — [Another Event]
- Details
智能体指令(AGENTS.md)
在 AGENTS.md 中添加以下内容以定义智能体行为:
## Memory Recall
Before answering questions about prior work, decisions, dates, people, preferences, or todos:
1. Run memory_search with relevant query
2. Use memory_get to pull specific lines if needed
3. If low confidence after search, say you checked
故障排查
记忆搜索不工作?
- 检查配置中 memorySearch.enabled: true
- 确认工作区根目录存在 MEMORY.md
- 重启网关:clawdbot gateway restart
结果不相关?
- 将 minScore 调低至 0.2 以获得更多结果
- 将 maxResults 增加到 30
- 检查记忆文件是否有有意义的内容
提供方错误?
- Voyage:在环境中设置 VOYAGE_API_KEY
- OpenAI:在环境中设置 OPENAI_API_KEY
- 如果没有 API 密钥,使用 local 提供方
验证
测试记忆是否工作:
- 用户:“What do you remember about [past topic]?”
- 智能体:[应搜索记忆并返回相关上下文]
如果智能体没有记忆,说明配置未生效,请重启网关。
完整配置示例
{
"memorySearch": {
"enabled": true,
"provider": "voyage",
"sources": ["memory", "sessions"],
"indexMode": "hot",
"minScore": 0.3,
"maxResults": 20
},
"workspace": "/path/to/your/workspace"
}
适用场景
- 需要智能体跨会话记住用户偏好、项目上下文与历史决策。
- 希望智能体在回答关于过往工作、决策、日期、人物、偏好或待办事项的问题前,先检索记忆。
- 希望建立长期连续的项目跟踪与用户关系。
限制
资料中未说明该技能的收费、价格、平台限制或效果保证。使用 voyage 或 openai 提供方需要相应的 API 密钥;无密钥时需使用 local 提供方。部分配置项的具体行为与完整边界未在资料中详细展开。