用途
Hippocampus 是一个「背景记忆器官(Background memory organ)」,为 AI 智能体提供记忆的自动捕获、结构化存储与持久化能力。它的核心理念是:「LLM 只是引擎——原始认知能力。智能体是累积的记忆。」没有这些记忆文件,智能体就没有连续性,只是一个通用助手。Hippocampus 独立于主智能体运行,自动完成记忆的编码、衰减和强化。
记忆生命周期
记忆遵循以下循环:
CAPTURE → SCORE → STORE → DECAY/REINFORCE → RETRIEVE(捕获 → 评分 → 存储 → 衰减/强化 → 检索),检索结果又会回流到捕获环节。
记忆结构
记忆存储在 $WORKSPACE 工作区中,目录结构如下:
$WORKSPACE/
├── memory/
│ ├── index.json # 中央加权索引
│ ├── user/ # 关于用户的事实
│ ├── self/ # 关于智能体自身的事实
│ ├── relationship/ # 共享上下文
│ └── world/ # 外部知识
└── HIPPOCAMPUS_CORE.md # 为 OpenClaw RAG 自动生成
主要能力
Hippocampus 包含以下脚本:
| 脚本 | 用途 |
|---|---|
decay.sh |
对所有记忆应用 0.99^days 衰减 |
reinforce.sh |
记忆被使用时提升重要性 |
recall.sh |
带重要性权重的搜索 |
load-core.sh |
输出高重要性记忆 |
sync-core.sh |
生成 HIPPOCAMPUS_CORE.md |
preprocess.sh |
从对话记录中提取信号 |
所有脚本使用 $WORKSPACE 环境变量(默认值:~/.openclaw/workspace)。
重要性评分
初始评分(0.0-1.0):显式说「记住这个」得 0.9;情绪化/脆弱内容得 0.85;偏好(「我更喜欢…」)得 0.8;已做出的决定得 0.75;关于人/项目的事实得 0.7;通用知识得 0.5。
衰减公式
基于 Stanford Generative Agents(Park et al., 2023):
new_importance = importance × (0.99 ^ days_since_accessed)
- 7 天后:原来的 93%
- 30 天后:原来的 74%
- 90 天后:原来的 40%
强化公式
当记忆被访问且有用时:
new_importance = old + (1 - old) × 0.15
每次使用增加约 15% 的剩余空间向 1.0 靠近。
阈值分级
| 分数 | 状态 |
|---|---|
| 0.7+ | Core — 高优先级 |
| 0.4-0.7 | Active — 正常检索 |
| 0.2-0.4 | Background — 仅特定搜索 |
| <0.2 | Archive candidate — 归档候选 |
使用方式
快速开始
# 安装
./install.sh --with-cron
# 加载核心记忆
./scripts/load-core.sh
# 带重要性权重的搜索
./scripts/recall.sh "query" --reinforce
# 应用衰减(通过 cron 每日运行)
./scripts/decay.sh
索引数据结构
memory/index.json 的结构示例:
{
"version": 1,
"lastUpdated": "2025-01-20T19:00:00Z",
"decayLastRun": "2025-01-20",
"memories": [
{
"id": "mem_001",
"domain": "user",
"category": "preferences",
"content": "User prefers concise responses",
"importance": 0.85,
"created": "2025-01-15",
"lastAccessed": "2025-01-20",
"timesReinforced": 3,
"keywords": ["preference", "concise", "style"]
}
]
}
Cron 定时任务
通过 OpenClaw cron 设置:
# 每日凌晨 3 点衰减
openclaw cron add --name hippocampus-decay \
--cron "0 3 * * *" \
--session main \
--system-event "🧠 Run: WORKSPACE=\$WORKSPACE decay.sh"
# 每周整合
openclaw cron add --name hippocampus-consolidate \
--cron "0 21 * * 6" \
--session main \
--system-event "🧠 Weekly consolidation time"
OpenClaw 集成
在 openclaw.json 的 memorySearch.extraPaths 中添加:
{
"agents": {
"defaults": {
"memorySearch": {
"extraPaths": ["HIPPOCAMPUS_CORE.md"]
}
}
}
}
这将 hippocampus(index.json)与 OpenClaw 的 RAG(memory_search)桥接起来。
在 AGENTS.md 中的用法
添加到智能体会话启动例程:
## Every Session
1. Run `~/.openclaw/workspace/skills/hippocampus/scripts/load-core.sh`
## When answering context questions
Use hippocampus recall:
\`\`\`bash
./scripts/recall.sh "query" --reinforce
\`\`\`
捕获指南
捕获内容分类:用户事实(偏好、模式、上下文);自我事实(身份、成长、观点);关系(信任时刻、共同历史);世界(项目、人物、工具)。
触发短语:听到以下内容时自动捕获:「记住…」、「我更喜欢…」、「我总是…」、情绪化内容(困境与胜利)、已做出的决定。
适用场景
适用于需要跨会话保持连续性、积累用户与项目上下文的 AI 智能体场景,尤其是与 OpenClaw 配合使用、需要长期记忆管理的助手。
限制
官方资料未提供有关收费、价格、平台等更多信息。