之前配置了hindsight,当时只有default这个profile,后来创建了其他profile,用其他agent profile的时候发现还是健忘,第二天就把昨天的会话忘得差不多了,辛苦配置的记忆有很多丢失,原因是hindsight这个外接记忆没有正常工作。
# Pubmotto 独立 Hindsight Memory Bank 配置指南
## 问题背景
Pubmotto 是从 default profile clone 的,两者的 `memory.provider` 都配置为 `hindsight`,但 pubmotto 在 hindsight 中找不到自己的对话记忆。根因是 pubmotto 缺少 profile 级别的 hindsight 配置文件。
## 根因分析
Hindsight 的 `_load_config()` 按以下顺序查找配置文件:
1. `$HERMES_HOME/hindsight/config.json`(profile 级别)
2. `~/.hindsight/config.json`(全局 legacy)
– **Default profile**: `HERMES_HOME=~/.hermes`,读取 `~/.hermes/hindsight/config.json` → mode=`local_external` → `is_available()` = True ✅
– **Pubmotto profile**: `HERMES_HOME=~/.hermes/profiles/pubmotto`,读取 `~/.hermes/profiles/pubmotto/hindsight/config.json` → **不存在** → fallback 到环境变量默认 mode=`cloud` → apiKey 为空 → `is_available()` = **False** ❌
config.yaml 虽然写了 `provider: hindsight`,但插件的 `is_available()` 返回 False,agent 初始化时就不会加载 hindsight 工具。
## 解决步骤
### 1. 创建 profile 级 hindsight 配置
复制 default 的 hindsight 配置到 pubmotto 的 profile 目录:
“`bash
mkdir -p ~/.hermes/profiles/pubmotto/hindsight
cp ~/.hermes/hindsight/config.json ~/.hermes/profiles/pubmotto/hindsight/config.json
“`
### 2. 配置独立 Bank
编辑 `~/.hermes/profiles/pubmotto/hindsight/config.json`,将 bank 设置为独立的 `pubmotto`:
“`json
{
“mode”: “local_external”,
“apiKey”: “”,
“timeout”: 120,
“idle_timeout”: 300,
“retain_tags”: “”,
“retain_source”: “”,
“retain_user_prefix”: “User”,
“retain_assistant_prefix”: “Assistant”,
“banks”: {
“hermes”: {
“bankId”: “hermes”,
“budget”: “mid”,
“enabled”: false
},
“pubmotto”: {
“bankId”: “pubmotto”,
“budget”: “mid”,
“enabled”: true
}
},
“api_url”: “http://localhost:8888”,
“bank_id”: “pubmotto”,
“recall_budget”: “mid”
}
“`
关键改动:
– `bank_id`: `hermes` → `pubmotto`
– `banks.hermes.enabled`: `true` → `false`(停用共享 bank)
– `banks.pubmotto`: 新增独立 bank,`enabled: true`
### 3. 在 Hindsight 服务器端创建 Bank
在 Hindsight 服务中创建 `pubmotto` bank(如果尚未创建):
“`python
from hindsight_client import Hindsight
client = Hindsight(base_url=’http://localhost:8888′)
bank = client.create_bank(‘pubmotto’, ‘mid’)
“`
### 4. 重启 Pubmotto Gateway
“`bash
# 找到 pubmotto gateway 进程并 kill,–replace 模式会自动重启
kill -9 “`
## 验证
重启后检查 agent.log,应看到:
“`
Memory provider ‘hindsight’ registered (3 tools)
Hindsight initialized: mode=local_external, api_url=http://localhost:8888, bank=pubmotto, budget=mid
Memory provider ‘hindsight’ activated
“`
工具列表应包含 `hindsight_retain`、`hindsight_recall`、`hindsight_reflect`。
## 验证 Bank 隔离
“`bash
curl -s http://localhost:8888/bank-config/hermes | python3 -m json.tool
curl -s http://localhost:8888/bank-config/pubmotto | python3 -m json.tool
“`
两个 bank 的数据完全隔离,互不干扰。
## 文件清单
| 文件 | 说明 |
|——|——|
| `~/.hermes/hindsight/config.json` | Default profile 的 hindsight 配置(保持不变) |
| `~/.hermes/profiles/pubmotto/hindsight/config.json` | Pubmotto 的 hindsight 配置(新建) |
| `~/.hermes/profiles/pubmotto/config.yaml` 第 351 行 | `provider: hindsight`(克隆时已有,无需修改) |
## 教训
– `memory.provider` 写在 config.yaml 里**不够**——每个 profile 必须有对应的 `$HERMES_HOME/hindsight/config.json`
– Clone profile 时不能只复制 config.yaml,hindsight 子目录也要复制
– Hindsight 的 `is_available()` 在找不到配置文件时会 fallback 到 env var 默认值(mode=cloud),导致静默失败

