记忆提供商
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(当前 Hermes 实例)或 ~/.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 设置前创建的配置文件:
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
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 云服务 |
| 成本 | 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 云服务 或 本地嵌入式 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 已更新(会话启动时自动升级)。
本地模式界面: 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 驱动搜索的分层检索。它以本地优先为设计核心,同时支持可选的云同步。
| 适用场景 | 适合希望使用可移植、本地优先记忆并偏好 CLI 工作流的开发者 |
| 所需条件 | 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(覆盖配置项)。
核心特性:
- 自动上下文屏蔽:从捕获的对话轮次中剥离已召回的记忆,防止记忆污染循环
- 会话结束时的对话摄入,用于构建更丰富的图谱级知识
- 首次对话及可配置间隔内注入用户画像事实
- 琐碎消息过滤(跳过“好的”、“谢谢”等)
- 按用户画像隔离容器:在
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文件进行配置
构建一个记忆提供商
如果你想实现自己的记忆提供商,请参阅 开发者指南:记忆提供商插件。