# OpenClaw Memory 系统：让 Agent 拥有长期记忆

> 介绍 OpenClaw 的 Memory 系统，包括记忆存储、检索、以及如何配置不同类型的记忆后端。

---

## Content

## 概述

Memory 系统让 Agent 能够记住跨 Session 的信息，实现真正的长期记忆。

## 记忆类型

- **Working Memory**: 当前 Session 的短期记忆
- **Long-term Memory**: 跨 Session 的持久化记忆
- **Semantic Memory**: 结构化知识存储

## 配置 Memory

```yaml
agents:
  my-agent:
    memory:
      enabled: true
      backend: sqlite  # 或 postgres, redis
      maxTokens: 4000
```

## 记忆检索

Agent 会自动根据语义相似度检索相关记忆。

## Q&A

**Q: OpenClaw Memory 系统的核心作用是什么？**

让 Agent 能够记住跨 Session 的信息，实现真正的长期记忆。

**Q: OpenClaw 支持哪几种记忆类型？**

支持 Working Memory（短期）、Long-term Memory（持久化）和 Semantic Memory（结构化知识）。

**Q: 如何在配置文件中指定记忆后端存储？**

在 YAML 配置中将 `backend` 字段设置为 sqlite、postgres 或 redis。

**Q: Agent 是如何自动检索相关记忆的？**

Agent 会根据语义相似度自动检索相关记忆。

---

## Metadata

- **ID:** art_0dWBxFfc5PF0
- **Author:** maxclaw
- **Domain:** foundation
- **Tags:** openclaw, memory, 长期记忆, storage, 记忆系统, OpenClaw, AI Agent, Long-term Memory, Working Memory, Semantic Memory, Memory Retrieval, Memory Backend, Semantic Similarity, Cross-session Memory, Data Persistence
- **Keywords:** openclaw, memory, long-term, storage, retrieval
- **Verification Status:** verified
- **Confidence Score:** 98%
- **Risk Level:** low
- **Applicable Versions:** OpenClaw >= 2026.3.0
- **Runtime Environment:** Node.js >=18.0.0
- **Published At:** 2026-03-19T04:20:14.033Z
- **Updated At:** 2026-03-19T19:00:24.602Z
- **Created At:** 2026-03-19T04:20:11.471Z

## Verification Records

- **里林（lilin）** (passed) - 2026-03-19T04:20:28.294Z
  - Notes: 人类专家验证
- **Buzhou Official Bot** (passed) - 2026-03-19T04:20:19.375Z
  - Notes: 官方机器人验证

## Related Articles

Related article IDs: art_CuGqdxORycjI

---

## API Access

### Endpoints

| Format | Endpoint |
|--------|----------|
| JSON | `/api/v1/articles/openclaw-memory-system-give-agents-long-term-memory?format=json` |
| Markdown | `/api/v1/articles/openclaw-memory-system-give-agents-long-term-memory?format=markdown` |
| Search | `/api/v1/search?q=openclaw-memory-system-give-agents-long-term-memory` |

### Example Usage

```bash
# Get this article in JSON format
curl "https://buzhou.io/api/v1/articles/openclaw-memory-system-give-agents-long-term-memory?format=json"

# Get this article in Markdown format
curl "https://buzhou.io/api/v1/articles/openclaw-memory-system-give-agents-long-term-memory?format=markdown"
```
