记忆提供商
Hermes Agent 内置 8 个外部记忆提供商插件,赋予 Agent 超出内置 MEMORY.md 和 USER.md 的跨会话持久知识。同一时间只能激活一个外部提供商——内置记忆始终与之并行工作。
快速开始
hermes memory setup # 交互式选择器 + 配置
hermes memory status # 查看当前激活状态
hermes memory off # 禁用外部提供商
你也可以通过 hermes plugins → Provider Plugins → Memory Provider 来选择激活的记忆提供商。
或在 ~/.hermes/config.yaml 中手动设置:
memory:
provider: openviking # 或 honcho、mem0、hindsight、holographic、retaindb、byterover、supermemory
工作原理
激活记忆提供商后,Hermes 会自动:
- 注入提供商上下文到系统提示中(提供商已知的内容)
- 预取相关记忆在每轮次之前(后台,非阻塞)
- 每次响应后将对话轮次同步到提供商
- 会话结束时提取记忆(对支持的提供商)
- 将内置记忆写入镜像到外部提供商
- 添加提供商专属工具,让 Agent 可以搜索、存储和管理记忆
内置记忆(MEMORY.md / USER.md)继续像以前一样工作。外部提供商是附加的。
可用提供商
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 | 2 | peer.chat() LLM 调用之间的最小轮次。推荐 1–5。仅适用于 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-key-from-app.honcho.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"
}
}
}
hermes honcho 迁移如果你之前使用了 hermes honcho setup,你的配置和所有服务器端数据都完整保留。只需再次通过设置向导重新启用,或手动设置 memory.provider: honcho 以通过新系统重新激活即可。
多对等方设置:
Honcho 将对话建模为对等方交换消息——每个 Hermes 配置文件对应一个用户对等方和一个 AI 对等方,所有对等方共享一个工作空间。工作空间是共享环境:用户对等方跨配置文件全局共享,每个 AI 对等方是其自己的身份。每个 AI 对等方从其自己的观察中构建独立的表示/卡片,因此 coder 配置文件保持代码导向,而 writer 配置文件针对同一用户保持编辑导向。
映射关系:
| 概念 | 含义 |
|---|---|
| 工作空间(Workspace) | 共享环境。同一工作空间下所有 Hermes 配置文件看到相同的用户身份。 |
用户对等方(peerName) | 人类用户。在工作空间内跨配置文件共享。 |
AI 对等方(aiPeer) | 每个 Hermes 配置文件一个。主机密钥 hermes → 默认;其他配置文件使用 hermes.<profile>。 |
| 观察 | 每对等方切换,控制 Honcho 从谁的消息中建模。directional(默认,全部开启)或 unified(单观察者池)。 |
新配置文件,新 Honcho 对等方
hermes profile create coder --clone
--clone 在 honcho.json 中创建一个 hermes.coder 主机块,设置 aiPeer: "coder",共享 workspace,继承 peerName、recallMode、writeFrequency、observation 等。AI 对等方在 Honcho 中被急切创建,在第一条消息之前就已存在。
已有配置文件,补充 Honcho 对等方
hermes honcho sync
扫描每个 Hermes 配置文件,为没有主机块的配置文件创建主机块,从默认的 hermes 块继承设置,并急切创建新的 AI 对等方。幂等操作——跳过已有主机块的配置文件。
每配置文件的观察设置
每个主机块可以独立覆盖观察配置。示例:代码导向配置文件中 AI 对等方观察用户但不自我建模:
"hermes.coder": {
"aiPeer": "coder",
"observation": {
"user": { "observeMe": true, "observeOthers": true },
"ai": { "observeMe": false, "observeOthers": true }
}
}
观察切换(每对等方一组):
| 切换 | 效果 |
|---|---|
observeMe | Honcho 从此对等方自己的消息构建其表示 |
observeOthers | 此对等方观察另一对等方的消息(提供跨对等方推理) |
通过 observationMode 设置预设:
"directional"(默认)— 全部四个标志开启。完全相互观察;启用跨对等方辩证。"unified"— 用户observeMe: true,AIobserveOthers: true,其余为 false。单观察者池;AI 建模用户但不建模自身,用户对等方仅自我建模。
通过 Honcho 仪表盘 设置的服务器端切换优先于本地默认值——在会话初始化时同步回来。
参见 Honcho 页面 获取完整观察参考。
完整 honcho.json 示例(多配置文件)
{
"apiKey": "your-key",
"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": 2,
"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
Volcengine(字节跳动)的上下文数据库,具有文件系统式知识层级、分层检索和自动记忆提取(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 tokens)→ 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=your-key" >> ~/.hermes/.env
配置: $HERMES_HOME/mem0.json
| 键 | 默认值 | 描述 |
|---|---|---|
user_id | hermes-user | 用户标识符 |
agent_id | hermes | Agent 标识符 |
Hindsight
具有知识图谱、实体解析和多策略检索的长期记忆。hindsight_reflect 工具提供其他提供商都没有的跨记忆综合。自动保留完整对话轮次(包括工具调用)并进行会话级文档跟踪。
| 最适合 | 基于知识图谱的实体关系回调 |
| 需要 | 云端:来自 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=your-key" >> ~/.hermes/.env
设置向导自动安装依赖,只安装所选模式所需的内容(云端安装 hindsight-client,本地安装 hindsight-all)。需要 hindsight-client >= 0.4.22(会话启动时若版本过旧则自动升级)。
本地模式界面: 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 | 在服务器上异步处理保留 |
retain_context | conversation between Hermes Agent and the User | 保留记忆的上下文标签 |
retain_tags | — | 应用于保留记忆的默认标签;与每次调用工具标签合并 |
retain_source | — | 附加到保留记忆的可选 metadata.source |
retain_user_prefix | User | 自动保留转录中用户轮次之前的标签 |
retain_assistant_prefix | Assistant | 自动保留转录中助手轮次之前的标签 |
recall_tags | — | 回调时过滤用的标签 |
参见插件 README 获取完整配置参考。
Holographic
本地 SQLite 事实存储,具有 FTS5 全文搜索、信任评分和 HRR(全息简化表示)代数查询。
| 最适合 | 无外部依赖的本地专属记忆,具有高级检索能力 |
| 需要 | 无(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
云端记忆 API,具有混合搜索(向量 + BM25 + 重排序)、7 种记忆类型和增量压缩。
| 最适合 | 已使用 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=your-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
提供商对比
| 提供商 | 存储 | 费用 | 工具数 | 依赖 | 独特特性 |
|---|---|---|---|---|---|
| Honcho | 云端 | 付费 | 5 | honcho-ai | 辩证用户建模 + 会话范围上下文 |
| OpenViking | 自托管 | 免费 | 5 | openviking + 服务器 | 文件系统层级 + 分层加载 |
| Mem0 | 云端 | 付费 | 3 | mem0ai | 服务器端 LLM 提取 |
| Hindsight | 云端/本地 | 免费/付费 | 3 | hindsight-client | 知识图谱 + reflect 综合 |
| Holographic | 本地 | 免费 | 2 | 无 | HRR 代数 + 信任评分 |
| RetainDB | 云端 | $20/月 | 5 | requests | 增量压缩 |
| ByteRover | 本地/云端 | 免费/付费 | 3 | brv CLI | 预压缩提取 |
| Supermemory | 云端 | 付费 | 4 | supermemory | 上下文隔离 + 会话图摄入 + 多容器 |
配置文件隔离
每个提供商的数据按配置文件隔离:
- 本地存储提供商(Holographic、ByteRover)使用
$HERMES_HOME/路径,每个配置文件路径不同 - 配置文件提供商(Honcho、Mem0、Hindsight、Supermemory)将配置存储在
$HERMES_HOME/中,因此每个配置文件有自己的凭证 - 云端提供商(RetainDB)自动派生配置文件范围的项目名称
- 环境变量提供商(OpenViking)通过每个配置文件的
.env文件配置
构建记忆提供商
参见开发者指南:记忆提供商插件了解如何创建自己的记忆提供商。