記憶提供者
Hermes Agent 內置了 8 個外部記憶提供者插件,為 Agent 提供持久化、跨會話的知識,超越內置的 MEMORY.md 和 USER.md。同一時間只能激活一個外部提供者——內置記憶始終與之同時啟用。
快速入門
hermes memory setup # 交互式選擇器+配置
hermes memory status # 檢查什麼是活動的
hermes memory off # 禁用外部 provider
你也可以通過 hermes plugins → 提供者插件 → 記憶提供者 來選擇激活的記憶提供者。
或手動在 ~/.hermes/config.yaml 中設置:
memory:
provider: openviking # 或 honcho、mem0、hindsight、holographic、retaindb、byterover、supermemory
工作原理
當啟用某個記憶提供者時,Hermes 會自動執行以下操作:
- 注入提供者上下文到系統提示中(提供者所知內容)
- 在每次對話前預取相關記憶(後臺、非阻塞)
- 在每次響應後將對話輪次同步到提供者
- 在會話結束時提取記憶(適用於支持該功能的提供者)
- 將內置記憶的寫入操作鏡像到外部提供者
- 添加提供者特定工具,使 Agent 能夠搜索、存儲和管理記憶
內置記憶(MEMORY.md / USER.md)的工作方式與以往完全相同。外部提供者是疊加式的。
可用提供者
Honcho
基於 AI 的跨會話用戶建模,支持辯證問答、語義搜索和持久化結論。
| 最適合 | 具有跨會話上下文的多 Agent 系統,用戶與 Agent 對齊 |
| 要求 | pip install honcho-ai + API 密鑰 或自託管實例 |
| 數據存儲 | Honcho 雲服務或自託管 |
| 成本 | Honcho 定價(雲服務) / 免費(自託管) |
工具: honcho_profile(同行卡片)、honcho_search(語義搜索)、honcho_context(LLM 合成)、honcho_conclude(存儲事實)
設置嚮導:
hermes honcho setup # (舊命令)
# 或者
hermes memory setup # 選擇“0”
配置文件: $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 即可通過新系統重新激活。
多 Agent / 配置文件:
每個 Hermes 配置文件都會擁有自己的 Honcho AI 同行,但共享同一工作區——所有配置文件看到相同的用戶表示,但每個 Agent 會構建自己的身份和觀察記錄。
hermes profile create coder --clone # 創建 honcho 對等點 "coder",繼承默認配置
--clone 的作用:在 honcho.json 中創建一個 hermes.coder 主機塊,其中 aiPeer: "coder",共享 workspace,繼承 peerName、recallMode、writeFrequency、observation 等設置。同行會提前在 Honcho 中創建,確保在第一條消息前就存在。
對於在 Honcho 設置之前創建的配置文件:
hermes honcho sync # 掃描所有 profiles,為任何丟失的創建主機塊
這將從默認的 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 # 選擇“0”
# 或者手動配置:
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 # 選擇“0”
# 或者手動配置:
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 | Agent 標識符 |
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 # 選擇“0”
# 或者手動配置:
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 # 選擇“0”
# 或者手動配置:
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 # 選擇“0”
# 或者手動配置:
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 版本 + 樹狀統計信息)
設置:
# 先安裝CLI
curl -fsSL https://byterover.dev/install.sh | sh
# 然後配置Hermes
hermes memory setup # 選擇“0”
# 或者手動配置:
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 # 選擇“0”
# 或者手動配置:
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列表,允許 Agent 在命名容器間讀寫。自動操作(同步、預取)仍作用於主容器
多容器示例
{
"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文件進行配置
構建記憶提供者
有關如何創建自定義記憶提供者插件,請參閱 開發者指南:記憶提供者插件。