> 原文链接:Memory Providers
sidebar_position: 4 title: "Memory Providers" description: "External memory provider plugins — Honcho, OpenViking, Mem0, Hindsight, Holographic, RetainDB, ByteRover, Supermemory"
Memory Providers(记忆 Provider)
Hermes Agent 内置 8 个外部记忆 Provider 插件,为 Agent 提供超越内置 MEMORY.md 和 USER.md 的持久跨会话知识。同一时间只能激活一个外部 Provider——内置记忆始终与其并行工作。
快速开始
hermes memory setup # 交互式选择器 + 配置
hermes memory status # 检查当前激活的 Provider
hermes memory off # 禁用外部 Provider
你也可以通过 hermes plugins → Provider Plugins → Memory Provider 选择活跃的记忆 Provider。
或者手动在 ~/.hermes/config.yaml 中设置:
memory:
provider: openviking # 或 honcho, mem0, hindsight, holographic, retaindb, byterover, supermemory
工作原理
当记忆 Provider 激活时,Hermes 会自动:
- 注入 Provider 上下文到系统提示词(Provider 所知的内容)
- 预取相关记忆在每轮之前(后台、非阻塞)
- 同步对话轮次到 Provider(每次响应后)
- 在会话结束时提取记忆(对于支持的 Provider)
- 将内置记忆写入镜像到外部 Provider
- 添加 Provider 特定工具,让 Agent 可以搜索、存储和管理记忆
内置记忆(MEMORY.md / USER.md)继续像以前一样工作。外部 Provider 是增量的。
可用 Provider
Honcho
AI 原生的跨会话用户建模,具有辩证推理、会话级上下文注入、语义搜索和持久结论。基础上下文现在包含会话摘要,以及用户表示和对等卡片,让 Agent 了解已讨论过的内容。
| 最适合 | 具有跨会话上下文的多 Agent 系统、用户-Agent 对齐 |
| 需要 | pip install honcho-ai + API 密钥 或自托管实例 |
| 数据存储 | Honcho Cloud 或自托管 |
| 费用 | Honcho 定价(云)/ 免费(自托管) |
工具 (5 个): honcho_profile(读/更新对等卡片)、honcho_search(语义搜索)、honcho_context(会话上下文——摘要、表示、卡片、消息)、honcho_reasoning(LLM 合成)、honcho_conclude(创建/删除结论)
架构: 两层上下文注入——基础层(会话摘要 + 表示 + 对等卡片,按 contextCadence 刷新)加上辩证补充层(LLM 推理,按 dialecticCadence 刷新)。辩证层根据是否存在基础上下文自动选择冷启动提示(一般用户事实)或热启动提示(会话级上下文)。
三个正交配置旋钮独立控制成本和深度:
contextCadence— 基础层刷新频率(API 调用频率)dialecticCadence— 辩证 LLM 触发频率(LLM 调用频率)dialecticDepth— 每次辩证调用执行多少次.chat()(1-3,推理深度)
设置向导:
hermes honcho setup # (旧命令)
# 或
hermes memory setup # 选择 "honcho"
配置: $HERMES_HOME/honcho.json(配置文件级别)或 ~/.honcho/config.json(全局)。解析顺序:$HERMES_HOME/honcho.json > ~/.hermes/honcho.json > ~/.honcho/config.json。参见配置参考和 Honcho 集成指南。
完整配置参考
| 键 | 默认值 | 描述 |
|---|---|---|
apiKey | -- | 来自 app.honcho.dev 的 API 密钥 |
baseUrl | -- | 自托管 Honcho 的基础 URL |
peerName | -- | 用户对等身份 |
aiPeer | 主机键 | AI 对等身份(每个配置一个) |
workspace | 主机键 | 共享工作区 ID |
contextTokens | null(无上限) | 每轮自动注入上下文的 Token 预算。在词边界处截断 |
contextCadence | 1 | context() API 调用之间的最小轮次(基础层刷新) |
dialecticCadence | 3 | peer.chat() LLM 调用之间的最小轮次。仅适用于 hybrid/context 模式 |
dialecticDepth | 1 | 每次辩证调用的 .chat() 次数。限制在 1-3。第 0 次:冷/热提示,第 1 次:自审计,第 2 次:协调 |
dialecticDepthLevels | null | 可选数组,每次通过的推理级别,如 ["minimal", "low", "medium"]。覆盖按比例的默认值 |
dialecticReasoningLevel | 'low' | 基础推理级别:minimal、low、medium、high、max |
dialecticDynamic | true | 当 true 时,模型可通过工具参数覆盖每次调用的推理级别 |
dialecticMaxChars | 600 | 注入到系统提示词的辩证结果最大字符数 |
recallMode | 'hybrid' | hybrid(自动注入 + 工具)、context(仅注入)、tools(仅工具) |
writeFrequency | 'async' | 何时刷新消息:async(后台线程)、turn(同步)、session(结束时批量)或整数 N |
saveMessages | true | 是否将消息持久化到 Honcho API |
observationMode | 'directional' | directional(全部开启)或 unified(共享池)。用 observation 对象覆盖 |
messageMaxChars | 25000 | 每条消息的最大字符数(超出时分块) |
dialecticMaxInputChars | 10000 | peer.chat() 辩证查询输入的最大字符数 |
sessionStrategy | 'per-directory' | per-directory、per-repo、per-session、global |
最小 honcho.json(云)
{
"apiKey": "your-k....dev",
"hosts": {
"hermes": {
"enabled": true,
"aiPeer": "hermes",
"peerName": "your-name",
"workspace": "hermes"
}
}
}
最小 honcho.json(自托管)
{
"baseUrl": "http://localhost:8000",
"hosts": {
"hermes": {
"enabled": true,
"aiPeer": "hermes",
"peerName": "your-name",
"workspace": "hermes"
}
}
}
:::tip 从 hermes honcho 迁移
如果你之前使用过 hermes honcho setup,你的配置和所有服务端数据都完好无损。只需通过设置向导重新启用,或手动设置 memory.provider: honcho 即可通过新系统重新激活。
:::
多 Agent / 配置文件:
每个 Hermes 配置文件都有自己的 Honcho AI 对等身份,同时共享同一个工作区——所有配置文件看到相同的用户表示,但每个 Agent 构建自己的身份和观察。
hermes profile create coder --clone # 创建 honcho 对等 "coder",从默认继承配置
--clone 的作用:在 honcho.json 中创建一个 hermes.coder 主机块,设置 aiPeer: "coder",共享 workspace,继承 peerName、recallMode、writeFrequency、observation 等。对等身份在 Honcho 中被急切创建,因此在第一条消息之前就已存在。
对于在 Honcho 设置之前创建的配置文件:
hermes honcho sync # 扫描所有配置文件,为缺失的创建主机块
这从默认的 hermes 主机块继承设置,并为每个配置文件创建新的 AI 对等身份。幂等操作——跳过已有主机块的配置文件。
完整 honcho.json 示例(多配置文件)
{
"apiKey": "***",
"workspace": "hermes",
"peerName": "eri",
"hosts": {
"hermes": {
"enabled": true,
"aiPeer": "hermes",
"workspace": "hermes",
"peerName": "eri",
"recallMode": "hybrid",
"writeFrequency": "async",
"sessionStrategy": "per-directory",
"observation": {
"user": { "observeMe": true, "observeOthers": true },
"ai": { "observeMe": true, "observeOthers": true }
},
"dialecticReasoningLevel": "low",
"dialecticDynamic": true,
"dialecticCadence": 3,
"dialecticDepth": 1,
"dialecticMaxChars": 600,
"contextCadence": 1,
"messageMaxChars": 25000,
"saveMessages": true
},
"hermes.coder": {
"enabled": true,
"aiPeer": "coder",
"workspace": "hermes",
"peerName": "eri",
"recallMode": "tools",
"observation": {
"user": { "observeMe": true, "observeOthers": false },
"ai": { "observeMe": true, "observeOthers": true }
}
},
"hermes.writer": {
"enabled": true,
"aiPeer": "writer",
"workspace": "hermes",
"peerName": "eri"
}
},
"sessions": {
"/home/user/myproject": "myproject-main"
}
}
参见配置参考和 Honcho 集成指南。
OpenViking
由火山引擎(字节跳动)提供的上下文数据库,具有文件系统式知识层次结构、分层检索和自动记忆提取(6 个类别)。
| 最适合 | 具有结构化浏览的自托管知识管理 |
| 需要 | pip install openviking + 运行中的服务器 |
| 数据存储 | 自托管(本地或云) |
| 费用 | 免费(开源,AGPL-3.0) |
工具: viking_search(语义搜索)、viking_read(分层:摘要/概述/全文)、viking_browse(文件系统导航)、viking_remember(存储事实)、viking_add_resource(摄入 URL/文档)
设置:
# 先启动 OpenViking 服务器
pip install openviking
openviking-server
# 然后配置 Hermes
hermes memory setup # 选择 "openviking"
# 或手动:
hermes config set memory.provider openviking
echo "OPENVIKING_ENDPOINT=http://localhost:1933" >> ~/.hermes/.env
关键特性:
- 分层上下文加载:L0(约 100 Token)→ L1(约 2k)→ L2(全文)
- 会话提交时自动记忆提取(个人资料、偏好、实体、事件、案例、模式)
viking://URI 方案用于层次化知识浏览
Mem0
服务端 LLM 事实提取,具有语义搜索、重排序和自动去重。
| 最适合 | 无需干预的记忆管理——Mem0 自动处理提取 |
| 需要 | pip install mem0ai + API 密钥 |
| 数据存储 | Mem0 Cloud |
| 费用 | Mem0 定价 |
工具: mem0_profile(所有存储的记忆)、mem0_search(语义搜索 + 重排序)、mem0_conclude(存储原文事实)
设置:
hermes memory setup # 选择 "mem0"
# 或手动:
hermes config set memory.provider mem0
echo "MEM0_API_KEY=*** >> ~/.hermes/.env
配置: $HERMES_HOME/mem0.json
| 键 | 默认值 | 描述 |
|---|---|---|
user_id | hermes-user | 用户标识符 |
agent_id | hermes | Agent 标识符 |
Hindsight
具有知识图谱、实体解析和多策略检索的长期记忆。hindsight_reflect 工具提供其他 Provider 没有的跨记忆综合。自动保留完整对话轮次(包括工具调用),具有会话级文档追踪。
| 最适合 | 基于知识图谱的回忆,具有实体关系 |
| 需要 | 云:来自 ui.hindsight.vectorize.io 的 API 密钥。本地:LLM API 密钥(OpenAI、Groq、OpenRouter 等) |
| 数据存储 | Hindsight Cloud 或本地嵌入式 PostgreSQL |
| 费用 | Hindsight 定价(云)或免费(本地) |
工具: hindsight_retain(带实体提取存储)、hindsight_recall(多策略搜索)、hindsight_reflect(跨记忆综合)
设置:
hermes memory setup # 选择 "hindsight"
# 或手动:
hermes config set memory.provider hindsight
echo "HINDSIGHT_API_KEY=*** >> ~/.hermes/.env
设置向导会自动安装依赖,并且只安装所选模式所需的(hindsight-client 用于云,hindsight-all 用于本地)。需要 hindsight-client >= 0.4.22(如果版本过旧会在会话开始时自动升级)。
本地模式 UI: hindsight-embed -p hermes ui start
配置: $HERMES_HOME/hindsight/config.json
| 键 | 默认值 | 描述 |
|---|---|---|
mode | cloud | cloud 或 local |
bank_id | hermes | 记忆库标识符 |
recall_budget | mid | 回忆详尽程度:low / mid / high |
memory_mode | hybrid | hybrid(上下文 + 工具)、context(仅自动注入)、tools(仅工具) |
auto_retain | true | 自动保留对话轮次 |
auto_recall | true | 每轮前自动回忆记忆 |
retain_async | true | 在服务器上异步处理保留 |
tags | — | 存储记忆时应用的标签 |
recall_tags | — | 回忆时过滤的标签 |
完整配置参考请参见插件 README。
Holographic
本地 SQLite 事实存储,具有 FTS5 全文搜索、信任评分和 HRR(Holographic Reduced Representations,全息降维表示)用于组合代数查询。
| 最适合 | 具有高级检索的本地记忆,无需外部依赖 |
| 需要 | 无(SQLite 始终可用)。NumPy 可选用于 HRR 代数。 |
| 数据存储 | 本地 SQLite |
| 费用 | 免费 |
工具: fact_store(9 种操作:add、search、probe、related、reason、contradict、update、remove、list)、fact_feedback(有帮助/无帮助评分,训练信任分数)
设置:
hermes memory setup # 选择 "holographic"
# 或手动:
hermes config set memory.provider holographic
配置: config.yaml 中的 plugins.hermes-memory-store
| 键 | 默认值 | 描述 |
|---|---|---|
db_path | $HERMES_HOME/memory_store.db | SQLite 数据库路径 |
auto_extract | false | 会话结束时自动提取事实 |
default_trust | 0.5 | 默认信任分数(0.0-1.0) |
独特能力:
probe— 实体特定的代数回忆(关于某人/某物的所有事实)reason— 跨多个实体的组合 AND 查询contradict— 自动检测矛盾事实- 带有不对称反馈的信任评分(+0.05 有帮助 / -0.10 无帮助)
RetainDB
具有混合搜索(向量 + BM25 + 重排序)、7 种记忆类型和增量压缩的云记忆 API。
| 最适合 | 已在使用 RetainDB 基础设施的团队 |
| 需要 | RetainDB 账户 + API 密钥 |
| 数据存储 | RetainDB Cloud |
| 费用 | $20/月 |
工具: retaindb_profile(用户配置)、retaindb_search(语义搜索)、retaindb_context(任务相关上下文)、retaindb_remember(带类型 + 重要性存储)、retaindb_forget(删除记忆)
设置:
hermes memory setup # 选择 "retaindb"
# 或手动:
hermes config set memory.provider retaindb
echo "RETAINDB_API_KEY=*** >> ~/.hermes/.env
ByteRover
通过 brv CLI 实现的持久记忆——层次化知识树,具有分层检索(模糊文本 → LLM 驱动搜索)。本地优先,可选云同步。
| 最适合 | 想要可移植、本地优先记忆并有 CLI 的开发者 |
| 需要 | ByteRover CLI(npm install -g byterover-cli 或安装脚本) |
| 数据存储 | 本地(默认)或 ByteRover Cloud(可选同步) |
| 费用 | 免费(本地)或 ByteRover 定价(云) |
工具: brv_query(搜索知识树)、brv_curate(存储事实/决策/模式)、brv_status(CLI 版本 + 树统计)
设置:
# 先安装 CLI
curl -fsSL https://byterover.dev/install.sh | sh
# 然后配置 Hermes
hermes memory setup # 选择 "byterover"
# 或手动:
hermes config set memory.provider byterover
关键特性:
- 压缩前自动提取(在上下文压缩丢弃之前保存洞察)
- 知识树存储在
$HERMES_HOME/byterover/(按配置文件隔离) - SOC2 Type II 认证的云同步(可选)
Supermemory
具有配置文件回忆、语义搜索、显式记忆工具和会话结束对话摄入(通过 Supermemory 图谱 API)的语义长期记忆。
| 最适合 | 具有用户画像和会话级图谱构建的语义回忆 |
| 需要 | pip install supermemory + API 密钥 |
| 数据存储 | Supermemory Cloud |
| 费用 | Supermemory 定价 |
工具: supermemory_store(保存显式记忆)、supermemory_search(语义相似性搜索)、supermemory_forget(按 ID 或最佳匹配查询遗忘)、supermemory_profile(持久配置 + 近期上下文)
设置:
hermes memory setup # 选择 "supermemory"
# 或手动:
hermes config set memory.provider supermemory
echo 'SUPERMEMORY_API_KEY=*** >> ~/.hermes/.env
配置: $HERMES_HOME/supermemory.json
| 键 | 默认值 | 描述 |
|---|---|---|
container_tag | hermes | 用于搜索和写入的容器标签。支持 {identity} 模板用于按配置文件隔离的标签。 |
auto_recall | true | 在轮次前注入相关记忆上下文 |
auto_capture | true | 每次响应后存储清理后的用户-助手轮次 |
max_recall_results | 10 | 格式化为上下文的最大回忆条目数 |
profile_frequency | 50 | 在首轮和每 N 轮时包含配置文件事实 |
capture_mode | all | 默认跳过过小或琐碎的轮次 |
search_mode | hybrid | 搜索模式:hybrid、memories 或 documents |
api_timeout | 5.0 | SDK 和摄入请求的超时时间 |
环境变量: SUPERMEMORY_API_KEY(必需)、SUPERMEMORY_CONTAINER_TAG(覆盖配置)。
关键特性:
- 自动上下文隔离——从捕获的轮次中剥离回忆的记忆,防止递归记忆污染
- 会话结束对话摄入,用于更丰富的图谱级知识构建
- 配置文件事实在首轮和可配置间隔注入
- 琐碎消息过滤(跳过 "ok"、"thanks" 等)
- 按配置文件隔离的容器 — 在
container_tag中使用{identity}(如hermes-{identity}→hermes-coder)来隔离每个 Hermes 配置文件的记忆 - 多容器模式 — 启用
enable_custom_container_tags并配合custom_containers列表,让 Agent 可以跨命名容器读写。自动操作(同步、预取)仍使用主容器。
多容器示例
{
"container_tag": "hermes",
"enable_custom_container_tags": true,
"custom_containers": ["project-alpha", "shared-knowledge"],
"custom_container_instructions": "Use project-alpha for coding context."
}
支持: Discord · support@supermemory.com
Provider 对比
| Provider | 存储 | 费用 | 工具数 | 依赖 | 独特功能 |
|---|---|---|---|---|---|
| Honcho | 云 | 付费 | 5 | honcho-ai | 辩证用户建模 + 会话级上下文 |
| OpenViking | 自托管 | 免费 | 5 | openviking + 服务器 | 文件系统层次结构 + 分层加载 |
| Mem0 | 云 | 付费 | 3 | mem0ai | 服务端 LLM 提取 |
| Hindsight | 云/本地 | 免费/付费 | 3 | hindsight-client | 知识图谱 + 反思综合 |
| Holographic | 本地 | 免费 | 2 | 无 | HRR 代数 + 信任评分 |
| RetainDB | 云 | $20/月 | 5 | requests | 增量压缩 |
| ByteRover | 本地/云 | 免费/付费 | 3 | brv CLI | 压缩前提取 |
| Supermemory | 云 | 付费 | 4 | supermemory | 上下文隔离 + 会话图谱摄入 + 多容器 |
配置文件隔离
每个 Provider 的数据按配置文件隔离:
- 本地存储 Provider(Holographic、ByteRover)使用
$HERMES_HOME/路径,每个配置文件不同 - 配置文件 Provider(Honcho、Mem0、Hindsight、Supermemory)将配置存储在
$HERMES_HOME/,每个配置文件有自己的凭据 - 云 Provider(RetainDB)自动派生按配置文件的项目名称
- 环境变量 Provider(OpenViking)通过每个配置文件的
.env文件配置