> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory

> ClickHouse agent中的 Memory 和个性化

[Beta 版功能](https://clickhouse.com/docs/reference/settings/beta-and-experimental-features.md#beta-features)

Memory 是按用户划分的存储，agent 可以在不同对话中调用其中的信息。它由多条记录组成，每条都是一个键值对——例如你偏好的
日期格式、你通常查询的数据库，以及你希望回复简洁到什么程度。agent 会在需要时将这些信息纳入上下文中。

## Memory 如何运作

一个小型Memory agent会与主对话并行运行。它会读取最近的消息，判断哪些值得记住，并将条目写入每位用户各自的存储中。
到了下一次对话时，这些条目就会作为上下文提供给主agent参考，你也就不必重复说明了。

你体验到的就是这种连贯性：只要告诉agent一次，比如你偏好 SQL 输出使用小写，或者你的财年在 3 月结束，之后的对话就会据此调整。

## 管理你的记忆

通过左侧导航中的 **Memories** (大脑) 图标打开记忆面板。该面板会列出你已保存的记忆，并提供创建、编辑、删除和过滤条目的控件。

![记忆面板，显示左侧导航中高亮的大脑图标、过滤输入框、Add 按钮、使用记忆复选框、一条带有编辑和删除控件的记忆条目，以及一个 Admin Settings 按钮](https://mintcdn.com/private-7c7dfe99/i3Gw7HRb0YxPr7dq/images/cloud/agent-builder/memory/memories.webp?fit=max\&auto=format\&n=i3Gw7HRb0YxPr7dq\&q=85\&s=be40fec929722ddd7b6ea9f16d916d53)

Memory仅对当前用户私有。其他人的agent绝不会看到你的条目，你的agent也绝不会看到他们的条目。

### 创建一条 Memory

点击面板顶部的 **+** 按钮，打开 **Create Memory** 对话框。输入 **Key** (仅限小写字母和下划线) 和 **Value**，然后点击 **Create**。

![高亮显示 Create Memory + 按钮的 Memory 面板](https://mintcdn.com/private-7c7dfe99/i3Gw7HRb0YxPr7dq/images/cloud/agent-builder/memory/create.webp?fit=max\&auto=format\&n=i3Gw7HRb0YxPr7dq\&q=85\&s=e269376c2af8fc0977bc3480b95d26c5)

### 筛选Memory

使用面板顶部的 **筛选Memory** 输入框，可按键名查找条目。

![Memory面板，已高亮显示“筛选Memory”输入框，并输入了“demo”](https://mintcdn.com/private-7c7dfe99/i3Gw7HRb0YxPr7dq/images/cloud/agent-builder/memory/filter.webp?fit=max\&auto=format\&n=i3Gw7HRb0YxPr7dq\&q=85\&s=645845ce90fb230bc74cb7bd549dbe91)

### 编辑 Memory

点击某条 Memory 上的铅笔图标，打开 **Edit Memory** 对话框。修改 Key 或 Value，然后点击 **Save**。

![高亮显示 Edit Memory 铅笔图标的 Memory 条目](https://mintcdn.com/private-7c7dfe99/i3Gw7HRb0YxPr7dq/images/cloud/agent-builder/memory/edit.webp?fit=max\&auto=format\&n=i3Gw7HRb0YxPr7dq\&q=85\&s=66cdf10cec6a546d064159f4c0856ce9)

### 删除 Memory

点击某条 Memory 上的垃圾桶图标即可将其删除。

![高亮显示“删除 Memory”垃圾桶图标的 Memory 条目](https://mintcdn.com/private-7c7dfe99/i3Gw7HRb0YxPr7dq/images/cloud/agent-builder/memory/delete.webp?fit=max\&auto=format\&n=i3Gw7HRb0YxPr7dq\&q=85\&s=5b5119248aef464b26d0549cb68a8187)

## 开启或关闭Memory

使用Memory面板顶部的 **使用记忆** 复选框来开启或关闭Memory。对于不希望被存储的敏感话题，或不需要个性化的一次性对话，请将其关闭。

关闭Memory后，agent 不会从你的Memory存储中读取内容，也不会向其中写入内容。

![Memory面板，顶部的“使用记忆”复选框已高亮显示](https://mintcdn.com/private-7c7dfe99/i3Gw7HRb0YxPr7dq/images/cloud/agent-builder/memory/toggle.webp?fit=max\&auto=format\&n=i3Gw7HRb0YxPr7dq\&q=85\&s=9944cd3c5a5afe64aa936198bbb6d118)

## Memory 最佳实践

Memory 在以下情况下会很有帮助：

* 重复使用的约定：偏好的日期格式、业务定义、命名模式。
* 项目上下文：你通常查询哪个服务或数据库、你关注哪些仪表盘。
* 沟通风格：偏简洁还是偏健谈、偏重代码还是偏重文字说明的回复。

Memory 的设计目的并不是充当数据库。例如，它不适合用来存放大量参考资料。
对于这类内容，你应该改用 [技能](https://clickhouse.com/docs/zh/agents/builder/skills.md)，或者直接将其写入agent的说明中。
它也不是用来检索过往聊天内容的；这一作用应由会话历史本身承担。
