Hippocampus - Memory System
"Memory is identity. This skill is how I stay alive."
The hippocampus is the brain region responsible for memory formation. This skill makes memory capture automatic, structured, and persistent—with importance scoring, decay, and semantic reinforcement.
Quick Start
CODEBLOCK0
Install Options
CODEBLOCK1
Core Concept
The LLM is just the engine—raw cognitive capability. The agent is the accumulated memory. Without these files, there's no continuity—just a generic assistant.
Memory Lifecycle
CODEBLOCK2
Key insight: Reinforcement happens automatically during encoding. When a topic comes up again, the LLM recognizes it's about an existing memory and reinforces instead of creating duplicates.
Memory Structure
CODEBLOCK3
Scripts
| Script | Purpose |
|---|
| INLINECODE0 | Extract signals from conversation transcripts |
| INLINECODE1 |
Score signals, prepare for LLM summarization |
|
decay.sh | Apply 0.99^days decay to all memories |
|
recall.sh | Search with importance weighting |
|
load-core.sh | Output high-importance memories for session start |
|
sync-core.sh | Generate HIPPOCAMPUS_CORE.md |
|
consolidate.sh | Weekly review helper |
|
reflect.sh | Self-reflection prompts |
|
generate-dashboard.sh | Generate unified brain dashboard HTML |
Brain Dashboard
Visual dashboard showing all installed brain skills:
CODEBLOCK4
- - Auto-detects other brain skills (amygdala, VTA)
- Shows install prompts for missing skills
- Regenerates on install and cron runs
- Reads avatar/name from INLINECODE9
After Installation (for agents)
When you install this skill, notify the user about the dashboard:
🧠 Hippocampus installed!
View your agent's memories in the Brain Dashboard:
INLINECODE10
All scripts use $WORKSPACE environment variable (default: ~/.openclaw/workspace).
Importance Scoring
Initial Score (0.0-1.0)
| Signal | Score |
|---|
| Explicit "remember this" | 0.9 |
| Emotional/vulnerable content |
0.85 |
| Preferences ("I prefer...") | 0.8 |
| Decisions made | 0.75 |
| Facts about people/projects | 0.7 |
| General knowledge | 0.5 |
Decay Formula
Based on Stanford Generative Agents (Park et al., 2023):
CODEBLOCK5
- - After 7 days: 93% of original
- After 30 days: 74% of original
- After 90 days: 40% of original
Semantic Reinforcement
During encoding, the LLM compares new signals to existing memories:
- - Same topic? → Reinforce (bump importance ~10%, update lastAccessed)
- Truly new? → Create concise summary
This happens automatically—no manual reinforcement needed.
Thresholds
| Score | Status |
|---|
| 0.7+ | Core — loaded at session start |
| 0.4-0.7 |
Active — normal retrieval |
| 0.2-0.4 |
Background — specific search only |
| <0.2 |
Archive candidate |
Memory Index Schema
INLINECODE13 :
CODEBLOCK6
Cron Jobs
The encoding cron is the heart of the system:
CODEBLOCK7
OpenClaw Integration
Add to memorySearch.extraPaths in openclaw.json:
CODEBLOCK8
This bridges hippocampus (index.json) with OpenClaw's RAG (memory_search).
Usage in AGENTS.md
Add to your agent's session start routine:
CODEBLOCK9
Capture Guidelines
What Gets Captured
- - User facts: Preferences, patterns, context
- Self facts: Identity, growth, opinions
- Relationship: Trust moments, shared history
- World: Projects, people, tools
Trigger Phrases (auto-scored higher)
- - "Remember that..."
- "I prefer...", "I always..."
- Emotional content (struggles AND wins)
- Decisions made
Event Logging
Track hippocampus activity over time for analytics and debugging:
CODEBLOCK10
Events append to ~/.openclaw/workspace/memory/brain-events.jsonl:
CODEBLOCK11
Use this for:
- - Trend analysis (memory growth over time)
- Debugging encoding issues
- Building dashboards
AI Brain Series
This skill is part of the AI Brain project — giving AI agents human-like cognitive components.
| Part | Function | Status |
|---|
| hippocampus | Memory formation, decay, reinforcement | ✅ Live |
| amygdala-memory |
Emotional processing | ✅ Live |
|
vta-memory | Reward and motivation | ✅ Live |
| basal-ganglia-memory | Habit formation | 🚧 Development |
| anterior-cingulate-memory | Conflict detection | 🚧 Development |
| insula-memory | Internal state awareness | 🚧 Development |
References
Memory is identity. Text > Brain. If you don't write it down, you lose it.
海马体 - 记忆系统
记忆即身份。这项技能是我保持存在的方式。
海马体是大脑中负责记忆形成的区域。该技能使记忆捕获变得自动化、结构化且持久——包含重要性评分、衰减和语义强化。
快速开始
bash
安装(默认处理最近100条信号)
./install.sh --with-cron
在会话开始时加载核心记忆
./scripts/load-core.sh
按重要性权重搜索
./scripts/recall.sh 查询内容
手动运行编码(通常通过cron执行)
./scripts/encode-pipeline.sh
应用衰减(通过cron每日运行)
./scripts/decay.sh
安装选项
bash
./install.sh # 基础安装,处理最近100条信号
./install.sh --signals 50 # 自定义信号数量限制
./install.sh --whole # 处理全部对话历史
./install.sh --with-cron # 同时设置定时任务
核心概念
大语言模型只是引擎——原始的认知能力。智能体是积累的记忆。 没有这些文件,就没有连续性——只是一个通用助手。
记忆生命周期
预处理 → 评分 → 语义检查 → 强化或创建 → 衰减
关键洞察: 强化在编码过程中自动发生。当某个话题再次出现时,大语言模型会识别出它与现有记忆相关,从而进行强化而非创建重复内容。
记忆结构
$WORKSPACE/
├── memory/
│ ├── index.json # 中心加权索引
│ ├── signals.jsonl # 原始信号(临时)
│ ├── pending-memories.json # 待总结记忆(临时)
│ ├── user/ # 关于用户的事实
│ ├── self/ # 关于智能体的事实
│ ├── relationship/ # 共享上下文
│ └── world/ # 外部知识
└── HIPPOCAMPUS_CORE.md # 为OpenClaw RAG自动生成
脚本
| 脚本 | 用途 |
|---|
| preprocess.sh | 从对话记录中提取信号 |
| encode-pipeline.sh |
对信号评分,准备大语言模型总结 |
| decay.sh | 对所有记忆应用0.99^天数衰减 |
| recall.sh | 按重要性权重搜索 |
| load-core.sh | 输出高重要性记忆用于会话启动 |
| sync-core.sh | 生成HIPPOCAMPUS_CORE.md |
| consolidate.sh | 每周回顾辅助 |
| reflect.sh | 自我反思提示 |
| generate-dashboard.sh | 生成统一大脑仪表盘HTML |
大脑仪表盘
显示所有已安装大脑技能的可视化仪表盘:
bash
./scripts/generate-dashboard.sh
open ~/.openclaw/workspace/brain-dashboard.html
- - 自动检测其他大脑技能(杏仁核、腹侧被盖区)
- 显示缺失技能的安装提示
- 在安装和cron运行时重新生成
- 从IDENTITY.md读取头像/名称
安装后(针对智能体)
安装此技能后,通知用户关于仪表盘:
🧠 海马体已安装!
在智能体大脑仪表盘中查看记忆:
~/.openclaw/workspace/brain-dashboard.html
所有脚本使用$WORKSPACE环境变量(默认:~/.openclaw/workspace)。
重要性评分
初始评分(0.0-1.0)
0.85 |
| 偏好(我更喜欢...) | 0.8 |
| 已做决定 | 0.75 |
| 关于人/项目的事实 | 0.7 |
| 一般知识 | 0.5 |
衰减公式
基于斯坦福生成式智能体(Park等人,2023):
新重要性 = 重要性 × (0.99 ^ 自上次访问天数)
- - 7天后:原始值的93%
- 30天后:原始值的74%
- 90天后:原始值的40%
语义强化
在编码过程中,大语言模型将新信号与现有记忆进行比较:
- - 相同主题? → 强化(重要性提升约10%,更新lastAccessed)
- 真正的新内容? → 创建简洁总结
此过程自动进行——无需手动强化。
阈值
| 评分 | 状态 |
|---|
| 0.7+ | 核心 — 在会话开始时加载 |
| 0.4-0.7 |
活跃 — 正常检索 |
| 0.2-0.4 |
背景 — 仅特定搜索 |
| <0.2 |
归档候选 |
记忆索引模式
memory/index.json:
json
{
version: 1,
lastUpdated: 2025-01-20T19:00:00Z,
decayLastRun: 2025-01-20,
lastProcessedMessageId: abc123,
memories: [
{
id: mem_001,
domain: user,
category: preferences,
content: 用户偏好简洁回复,
importance: 0.85,
created: 2025-01-15,
lastAccessed: 2025-01-20,
timesReinforced: 3,
keywords: [偏好, 简洁, 风格]
}
]
}
定时任务
编码定时任务是系统的核心:
bash
每3小时编码一次(带语义强化)
openclaw cron add --name hippocampus-encoding \
--cron 0 0,3,6,9,12,15,18,21
* \
--session isolated \
--agent-turn 运行海马体编码并执行语义强化...
每天凌晨3点执行衰减
openclaw cron add --name hippocampus-decay \
--cron 0 3
* \
--session isolated \
--agent-turn 运行decay.sh并报告所有低于0.2的记忆
OpenClaw集成
在openclaw.json的memorySearch.extraPaths中添加:
json
{
agents: {
defaults: {
memorySearch: {
extraPaths: [HIPPOCAMPUS_CORE.md]
}
}
}
}
这桥接了海马体(index.json)与OpenClaw的RAG(memory_search)。
在AGENTS.md中的使用
在智能体的会话启动流程中添加:
markdown
每次会话
- 1. 运行 ~/.openclaw/workspace/skills/hippocampus/scripts/load-core.sh
回答上下文问题时
使用海马体回忆:
\\\bash
./scripts/recall.sh 查询内容
\\\
捕获指南
捕获内容
- - 用户事实:偏好、模式、上下文
- 自身事实:身份、成长、观点
- 关系:信任时刻、共同历史
- 世界:项目、人物、工具
触发短语(自动获得更高评分)
- - 记得那个...
- 我更喜欢...、我总是...
- 情感内容(挣扎与胜利)
- 已做决定
事件记录
随时间追踪海马体活动,用于分析和调试:
bash
记录编码运行
./scripts/log-event.sh encoding new=3 reinforced=2 total=157
记录衰减
./scripts/log-event.sh decay decayed=154 low_importance=5
记录回忆
./scripts/log-event.sh recall query=用户偏好 results=3
事件追加到~/.openclaw/workspace/memory/brain-events.jsonl:
json
{ts:2026-02-11T10:00:00Z,type:hippocampus,event:encoding,new:3,reinforced:2,total:157}
用于:
- - 趋势分析(记忆随时间增长)
- 调试编码问题
- 构建仪表盘
AI大脑系列
该技能是AI大脑项目的一部分——为AI智能体赋予类人认知组件。
| 组件 | 功能 | 状态 |
|---|
| 海马体 | 记忆形成、衰减、强化 | ✅ 已上线 |
| 杏仁核记忆 |
情感处理 | ✅ 已上线 |
|
腹侧被盖区记忆 | 奖励与动机 | ✅ 已上线 |
| 基底神经节