内存提供者
Hermes Agent 内置了 8 个外部内存提供者插件,为代理提供持久化、跨会话的知识,超越内置的 MEMORY.md 和 USER.md。同一时间只能激活一个外部提供者——内置内存始终与之同时启用。
快速入门
hermes memory setup # interactive picker + configuration
hermes memory status # check what's active
hermes memory off # disable external provider
你也可以通过 hermes plugins → 提供者插件 → 内存提供者 来选择激活的内存提供者。
或手动在 ~/.hermes/config.yaml 中设置:
memory:
provider: openviking # or honcho, mem0, hindsight, holographic, retaindb, byterover, supermemory
工作原理
当启用某个内存提供者时,Hermes 会自动执行以下操作:
- 注入提供者上下文到系统提示中(提供者所知内容)
- 在每次对话前预取相关记忆(后台、非阻塞)
- 在每次响应后将对话轮次同步到提供者
- 在会话结束时提取记忆(适用于支持该功能的提供者)
- 将内置内存的写入操作镜像到外部提供者
- 添加提供者特定工具,使代理能够搜索、存储和管理记忆
内置内存(MEMORY.md / USER.md)的工作方式与以往完全相同。外部提供者是叠加式的。
可用提供者
Honcho
基于 AI 的跨会话用户建模,支持辩证问答、语义搜索和持久化结论。
| 最适合 | 具有跨会话上下文的多代理系统,用户与代理对齐 |
| 要求 | pip install honcho-ai + API 密钥 或自托管实例 |
| 数据存储 | Honcho 云服务或自托管 |
| 成本 | Honcho 定价(云服务) / 免费(自托管) |
工具: honcho_profile(同行卡片)、honcho_search(语义搜索)、honcho_context(LLM 合成)、honcho_conclude(存储事实)
设置向导:
hermes honcho setup # (legacy command)
# or
hermes memory setup # select "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 # creates honcho peer "coder", inherits config from default
--clone 的作用:在 honcho.json 中创建一个 hermes.coder 主机块,其中 aiPeer: "coder",共享 workspace,继承 peerName、recallMode、writeFrequency、observation 等设置。同行会提前在 Honcho 中创建,确保在第一条消息前就存在。
对于在 Honcho 设置之前创建的配置文件:
hermes honcho sync # scans all profiles, creates host blocks for any missing ones
这将从默认的 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/文档)
设置:
# Start the OpenViking server first
pip install openviking
openviking-server
# Then configure Hermes
hermes memory setup # select "openviking"
# Or manually:
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 # select "mem0"
# Or manually:
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 # select "hindsight"
# Or manually:
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
本地 SQLite 事实存储,支持 FTS5 全文搜索、信任评分和 HRR(全息还原表示)以实现组合代数查询。
| 最适合 | 仅本地记忆,具备高级检索能力,无外部依赖 |
| 所需条件 | 无需额外依赖(SQLite 始终可用)。NumPy 可选,用于 HRR 代数运算。 |
| 数据存储 | 本地 SQLite |
| 成本 | 免费 |
工具: fact_store(9 个操作:添加、搜索、探测、相关、推理、矛盾、更新、删除、列出)、fact_feedback(有用/无用评分,用于训练信任分数)
设置:
hermes memory setup # select "holographic"
# Or manually:
hermes config set memory.provider holographic
配置文件: plugins.hermes-memory-store 下的 config.yaml
| 键 | 默认值 | 描述 |
|---|---|---|
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 云端 |
| 成本 | $20/月 |
工具: retaindb_profile(用户资料)、retaindb_search(语义搜索)、retaindb_context(任务相关上下文)、retaindb_remember(存储带类型 + 重要性)、retaindb_forget(删除记忆)
设置:
hermes memory setup # select "retaindb"
# Or manually:
hermes config set memory.provider retaindb
echo "RETAINDB_API_KEY=your-key" >> ~/.hermes/.env
ByteRover
通过 brv CLI 实现的持久化内存 —— 基于分层知识树的分层检索(模糊文本 → LLM 驱动搜索)。本地优先,支持可选的云同步。
| 最适合 | 希望拥有可移植、本地优先记忆系统的开发者 |
| 所需依赖 | ByteRover CLI(npm install -g byterover-cli 或 安装脚本) |
| 数据存储 | 本地(默认)或 ByteRover 云(可选同步) |
| 成本 | 免费(本地)或 ByteRover 定价(云) |
工具: brv_query(搜索知识树)、brv_curate(存储事实/决策/模式)、brv_status(CLI 版本 + 树状统计信息)
设置:
# Install the CLI first
curl -fsSL https://byterover.dev/install.sh | sh
# Then configure Hermes
hermes memory setup # select "byterover"
# Or manually:
hermes config set memory.provider byterover
核心功能:
- 自动预压缩提取(在上下文压缩丢弃信息前保存洞察)
- 知识树存储于
$HERMES_HOME/byterover/(基于配置文件的作用域) - SOC2 Type II 认证的云同步(可选)
超记忆(Supermemory)
具备用户画像记忆、语义搜索、显式记忆工具以及通过 Supermemory 图 API 在会话结束时摄入对话内容的语义长期记忆系统。
| 最适合 | 带用户画像的语义回忆与会话级图结构构建 |
| 所需依赖 | pip install supermemory + API 密钥 |
| 数据存储 | Supermemory 云 |
| 成本 | Supermemory 定价 |
工具: supermemory_store(保存显式记忆)、supermemory_search(语义相似性搜索)、supermemory_forget(通过 ID 或最佳匹配查询遗忘)、supermemory_profile(持久化用户画像 + 最近上下文)
设置:
hermes memory setup # select "supermemory"
# Or manually:
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列表,允许代理在命名容器间读写。自动操作(同步、预取)仍作用于主容器
多容器示例
{
"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 | 知识图谱 + 反思式合成 |
| 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文件进行配置
构建记忆提供者
有关如何创建自定义记忆提供者插件,请参阅 开发者指南:记忆提供者插件。