跳到主要内容

记忆提供商

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 会自动执行:

  1. 注入提供商上下文到系统提示中(提供商已知的内容)
  2. 每次对话前预取相关记忆(后台运行,非阻塞)
  3. 每次响应后将对话轮次同步到提供商
  4. 会话结束时提取记忆(适用于支持此功能的提供商)
  5. 将内置记忆写入镜像到外部提供商
  6. 添加提供商专属工具,供智能体搜索、存储和管理记忆

内置记忆(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--用户对等方名称
aiPeerhost keyAI 对等方身份(每个 profile 一个)
workspacehost key共享工作空间 ID
recallModehybridhybrid(自动注入 + 工具)、context(仅注入)、tools(仅工具)
observation全部开启每个对等方的 observeMe/observeOthers 布尔值
writeFrequencyasyncasyncturnsession 或整数 N
sessionStrategyper-directoryper-directoryper-repoper-sessionglobal
dialecticReasoningLevellowminimallowmediumhighmax
dialecticDynamictrue根据查询长度自动提升推理级别
messageMaxChars25000每条消息的最大字符数(超出则分块)

最简 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,继承 peerNamerecallModewriteFrequencyobservation 等配置。对等方会在 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_idhermes-user用户标识符
agent_idhermes智能体标识符

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

键名默认值说明
modecloudcloudlocal
bank_idhermes记忆库标识符
budgetmid召回精度: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.dbSQLite 数据库路径
auto_extractfalse会话结束时自动提取事实
default_trust0.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_taghermes用于搜索和写入的容器标签。支持 {identity} 模板,实现按 profile 划分标签。
auto_recalltrue每次对话前注入相关记忆上下文
auto_capturetrue每次响应后存储已清洁的用户-助手对话轮次
max_recall_results10格式化为上下文的最大召回条数
profile_frequency50在首次对话及每隔 N 次对话时包含 profile 事实
capture_modeall默认跳过内容过短或无意义的对话轮次
search_modehybrid搜索模式:hybridmemoriesdocuments
api_timeout5.0SDK 和导入请求的超时时间

环境变量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云端付费4honcho-ai辩证式用户建模
OpenViking自托管免费5openviking + 服务器文件系统层次 + 分层加载
Mem0云端付费3mem0ai服务端 LLM 提取
Hindsight云端/本地免费/付费3hindsight-client知识图谱 + reflect 综合
Holographic本地免费2HRR 代数 + 信任评分
RetainDB云端$20/月5requests增量压缩
ByteRover本地/云端免费/付费3brv CLI压缩前提取
Supermemory云端付费4supermemory上下文隔离 + 会话图谱导入 + 多容器

Profile 隔离

每个提供商的数据都按 profile 隔离:

  • 本地存储提供商(Holographic、ByteRover)使用 $HERMES_HOME/ 路径,每个 profile 路径不同
  • 配置文件提供商(Honcho、Mem0、Hindsight、Supermemory)将配置存储在 $HERMES_HOME/,每个 profile 有独立凭证
  • 云端提供商(RetainDB)自动推导按 profile 划分的项目名称
  • 环境变量提供商(OpenViking)通过每个 profile 的 .env 文件配置

构建记忆提供商

参见开发者指南:记忆提供商插件了解如何创建自定义提供商。