记忆提供商
Hermes Agent 内置 8 个外部记忆提供商插件,为智能体提供跨会话的持久化知识,超越内置的 MEMORY.md 和 USER.md。同一时间只能有一个外部提供商处于活跃状态——内置记忆始终与之并行工作。
快速开始
hermes memory setup # 交互式选择 + 配置
hermes memory status # 查看当前活跃状态
hermes memory off # 禁用外部提供商
或在 ~/.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(profile 级)或 ~/.honcho/config.json(全局)。解析顺序:$HERMES_HOME/honcho.json > ~/.hermes/honcho.json > ~/.honcho/config.json。参见配置参考和 Honcho 集成指南。
主要配置项
| 键名 | 默认值 | 说明 |
|---|---|---|
apiKey | -- | 来自 app.honcho.dev 的 API 密钥 |
baseUrl | -- | 自托管 Honcho 的 Base URL |
peerName | -- | 用户对等方名称 |
aiPeer | host key | AI 对等方身份(每个 profile 一个) |
workspace | host key | 共享工作空间 ID |
recallMode | hybrid | hybrid(自动注入 + 工具)、context(仅注入)、tools(仅工具) |
observation | 全部开启 | 每个对等方的 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,即可在新系统中重新激活。
多智能体 / Profiles
每个 Hermes profile 都有自己的 Honcho AI 对等方,同时共享同一工作空间——所有 profile 看到的是相同的用户表征,但每个智能体构建自己独立的身份和观察记录。
hermes profile create coder --clone # 创建 honcho 对等方 "coder",继承默认配置
--clone 的作用:在 honcho.json 中创建 hermes.coder 主机块,aiPeer: "coder",共享 workspace,继承 peerName、recallMode、writeFrequency、observation 等配置。对等方会在 Honcho 中提前创建,确保首次消息前即已存在。
对于在设置 Honcho 之前创建的 profiles:
hermes honcho sync # 扫描所有 profiles,为缺少主机块的 profile 创建主机块
此操作继承默认 hermes 主机块的设置,并为每个 profile 创建新的 AI 对等方。幂等操作——已有主机块的 profile 会被跳过。
完整 honcho.json 示例(多 profile)
{
"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(全文)
- 会话提交时自动提取记忆(profile、偏好、实体、事件、案例、模式)
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 工具提供其他提供商所不具备的跨记忆综合能力。
| 适用场景 | 基于知识图谱的记忆召回,支持实体关系 |
| 依赖项 | 云端:pip install hindsight-client + API 密钥;本地:pip install hindsight + LLM 密钥 |
| 数据存储 | 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
配置文件:$HERMES_HOME/hindsight/config.json
| 键名 | 默认值 | 说明 |
|---|---|---|
mode | cloud | cloud 或 local |
bank_id | hermes | 记忆库标识符 |
budget | mid | 召回精度:low / mid / high |
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
云端记忆 API,支持混合搜索(向量 + BM25 + 重排序)、7 种记忆类型和增量压缩。
| 适用场景 | 已使用 RetainDB 基础设施的团队 |
| 依赖项 | RetainDB 账户 + API 密钥 |
| 数据存储 | RetainDB Cloud |
| 费用 | $20/月 |
工具:retaindb_profile(用户 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/(profile 作用域) - SOC2 Type II 认证的云端同步(可选)
Supermemory
语义长期记忆,支持 profile 召回、语义搜索、显式记忆工具,以及通过 Supermemory 图 API 进行会话结束时的对话导入。
| 适用场景 | 支持用户画像和会话级图谱构建的语义召回 |
| 依赖项 | pip install supermemory + API 密钥 |
| 数据存储 | Supermemory Cloud |
| 费用 | Supermemory 定价 |
工具:supermemory_store(保存显式记忆)、supermemory_search(语义相似度搜索)、supermemory_forget(按 ID 或最佳匹配查询遗忘)、supermemory_profile(持久化 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} 模板,实现按 profile 划分标签。 |
auto_recall | true | 每次对话前注入相关记忆上下文 |
auto_capture | true | 每次响应后存储已清洁的用户-助手对话轮次 |
max_recall_results | 10 | 格式化为上下文的最大召回条数 |
profile_frequency | 50 | 在首次对话及每隔 N 次对话时包含 profile 事实 |
capture_mode | all | 默认跳过内容过短或无意义的对话轮次 |
search_mode | hybrid | 搜索模式:hybrid、memories 或 documents |
api_timeout | 5.0 | SDK 和导入请求的超时时间 |
环境变量:SUPERMEMORY_API_KEY(必填)、SUPERMEMORY_CONTAINER_TAG(覆盖配置文件中的值)。
主要特性:
- 自动上下文隔离——从捕获的对话轮次中剥离已召回的记忆,防止递归记忆污染
- 会话结束时导入对话,构建更丰富的图谱级知识
- Profile 事实在首次对话时注入,并按可配置的间隔周期性注入
- 无关消息过滤(跳过"好的"、"谢谢"等)
- Profile 作用域容器——在
container_tag中使用{identity}(例如hermes-{identity}→hermes-coder),按 Hermes profile 隔离记忆 - 多容器模式——启用
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 · support@supermemory.com
提供商对比
| 提供商 | 存储位置 | 费用 | 工具数 | 依赖项 | 独特功能 |
|---|---|---|---|---|---|
| Honcho | 云端 | 付费 | 4 | 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 | 上下文隔离 + 会话图谱导入 + 多容器 |
Profile 隔离
每个提供商的数据都按 profile 隔离:
- 本地存储提供商(Holographic、ByteRover)使用
$HERMES_HOME/路径,每个 profile 路径不同 - 配置文件提供商(Honcho、Mem0、Hindsight、Supermemory)将配置存储在
$HERMES_HOME/,每个 profile 有独立凭证 - 云端提供商(RetainDB)自动推导按 profile 划分的项目名称
- 环境变量提供商(OpenViking)通过每个 profile 的
.env文件配置
构建记忆提供商
参见开发者指南:记忆提供商插件了解如何创建自定义提供商。