记忆提供商
Hermes Agent 附带8个外部记忆提供商插件,为代理提供持久化的跨会话知识,超出内置的 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 自动:
- 注入提供商上下文到系统提示词(提供商知道的内容)
- 在每轮之前预取相关记忆(后台、非阻塞)
- 在每次响应后将对话轮次同步到提供商
- 在会话结束时提取记忆(对于支持的提供商)
- 将内置记忆写入镜像到外部提供商
- 添加提供商特定工具以便代理可以搜索、存储和管理记忆
内置记忆(MEMORY.md / USER.md)继续像以前一样工作。外部提供商是附加的。
可用提供商
Honcho
具有辩证问答、语义搜索和持久化结论的 AI 原生跨会话用户建模。
| | | |
:|---|---|---|
| 适用于 | 带跨会话上下文的多代理系统、用户-代理对齐 |
| 需要 | pip install honcho-ai + API 密钥 或自托管实例 |
| 数据存储 | Honcho Cloud 或自托管 |
| 成本 | Honcho 定价(云端)/ 免费(自托管) |
工具: honcho_profile(对等体卡片)、honcho_search(语义搜索)、honcho_context(LLM 综合)、honcho_conclude(存储事实)
设置向导:
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 | host key | AI 对等体身份(每个画像一个) |
workspace | host key | 共享工作区 ID |
recallMode | hybrid | hybrid(自动注入 + 工具)、context(仅注入)、tools(仅工具) |
observation | all on | 每个对等体的 observeMe/observeOthers 布尔值 |
writeFrequency | async | async、turn、session 或整数 N |
sessionStrategy | per-directory | per-directory、per-repo、per-session、global |
dialecticReasoningLevel | low | minimal、low、medium、high、max |
dialecticDynamic | true | 按查询长度自动提升推理 |
messageMaxChars | 25000 | 每条消息的最大字符数(超过则分块) |
最小 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 即可通过新系统重新激活。
多代理/画像:
每个 Hermes 画像在自己的 Honcho AI 对等体中共享相同的工作区——所有画像看到相同的用户表示,但每个代理构建自己的身份和观察。
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": "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,
"dialecticMaxChars": 600,
"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 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 | 代理标识符 |
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(如果过时会在会话开始时自动升级)。
本地模式 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
具有 FTS5 全文搜索、信任评分和 HRR(全息简化表示)的本地 SQLite 事实存储,用于组合代数查询。
| | | | :|---|---|---| | 适用于 | 无外部依赖的本地高级检索记忆 | | 需要 | 无(SQLite 始终可用)。NumPy 可选用于 HRR 代数。 | | 数据存储 | 本地 SQLite | | 成本 | 免费 |
工具: fact_store(9个操作:添加、搜索、探测、相关、推理、矛盾、更新、删除、列表)、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=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 | 默认跳过 tiny 或琐碎的对话 |
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列表,允许代理跨命名容器读取/写入。自动操作(同步、预取)保持在主容器上。
多容器示例
{
"container_tag": "hermes",
"enable_custom_container_tags": true,
"custom_containers": ["project-alpha", "shared-knowledge"],
"custom_container_instructions": "Use project-alpha for coding context."
}
支持: Discord · [email protected]
提供商对比
| 提供商 | 存储 | 成本 | 工具 | 依赖 | 独特功能 |
|---|---|---|---|---|---|
| Honcho | 云端 | 付费 | 4 | 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 | 上下文隔离 + 会话图摄取 + 多容器 |
画像隔离
每个提供商的数据按画像隔离:
- 本地存储提供商(Holographic、ByteRover)使用按画像不同的
$HERMES_HOME/路径 - 配置文件提供商(Honcho、Mem0、Hindsight、Supermemory)在
$HERMES_HOME/中存储配置,因此每个画像有自己的凭证 - 云提供商(RetainDB)自动派生画像作用域的项目名称
- 环境变量提供商(OpenViking)通过每个画像的
.env文件配置
构建记忆提供商
请参阅开发者指南:记忆提供商插件了解如何创建你自己的提供商。