Memory 记忆
配置 OpenClaw 持久化记忆系统,实现跨对话的长期知识保留。
概述
记忆系统 允许 Agent 跨对话存储和回忆信息。这使 Agent 能够记住用户偏好、过去的交互和积累的知识。
记忆工作原理
- 短期记忆 — 会话内的对话历史
- 长期记忆 — 跨会话持久化的事实
- 共享记忆 — 跨 Agent 共享的知识
配置
{
"memory": {
"enabled": true,
"backend": "local",
"maxEntries": 1000,
"ttl": "30d"
}
}选项
| 选项 | 说明 | 默认值 |
|---|---|---|
enabled | 启用记忆系统 | true |
backend | 存储后端(local、redis) | local |
maxEntries | 最大记忆条目数 | 1000 |
ttl | 条目存活时间 | 30d |
记忆管理
# 列出存储的记忆
openclaw memory list
# 清空所有记忆
openclaw memory clear
# 导出记忆
openclaw memory export > memories.json按 Agent 的记忆
每个 Agent 可以有隔离的记忆:
{
"agents": {
"assistant": {
"memory": {
"scope": "per-sender",
"maxEntries": 500
}
}
}
}