Hippocampus
2026-03-29
新闻来源:网淘吧
围观:5
电脑广告
手机广告
海马体 - 记忆系统
“记忆即身份。此技能是我赖以生存的方式。”
海马体是负责记忆形成的大脑区域。此技能使记忆捕获自动化、结构化且持久——具备重要性评分、衰减和语义强化功能。
快速开始
# Install (defaults to last 100 signals)
./install.sh --with-cron
# Load core memories at session start
./scripts/load-core.sh
# Search with importance weighting
./scripts/recall.sh "query"
# Run encoding manually (usually via cron)
./scripts/encode-pipeline.sh
# Apply decay (runs daily via cron)
./scripts/decay.sh
安装选项
./install.sh # Basic, last 100 signals
./install.sh --signals 50 # Custom signal limit
./install.sh --whole # Process entire conversation history
./install.sh --with-cron # Also set up cron jobs
核心理念
大语言模型仅是引擎——原始认知能力。智能体是积累的记忆。若无这些文件,则无连续性——仅是一个通用助手。
记忆生命周期
PREPROCESS → SCORE → SEMANTIC CHECK → REINFORCE or CREATE → DECAY
关键洞察:强化在编码过程中自动发生。当话题再次出现时,大语言模型会识别其与现有记忆相关并进行强化,而非创建重复项。
记忆结构
$WORKSPACE/
├── memory/
│ ├── index.json # Central weighted index
│ ├── signals.jsonl # Raw signals (temp)
│ ├── pending-memories.json # Awaiting summarization (temp)
│ ├── user/ # Facts about the user
│ ├── self/ # Facts about the agent
│ ├── relationship/ # Shared context
│ └── world/ # External knowledge
└── HIPPOCAMPUS_CORE.md # Auto-generated for OpenClaw RAG
脚本
| 脚本 | 用途 |
|---|---|
preprocess.sh | 从对话记录中提取信号 |
encode-pipeline.sh | 对信号进行评分,为LLM总结做准备 |
decay.sh | 对所有记忆应用0.99^天数的衰减 |
recall.sh | 基于重要性权重进行搜索 |
load-core.sh | 为会话启动输出高重要性记忆 |
sync-core.sh | 生成HIPPOCAMPUS_CORE.md文件 |
consolidate.sh | 每周回顾助手 |
reflect.sh | 自我反思提示 |
generate-dashboard.sh | 生成统一的大脑仪表盘HTML |
大脑仪表盘
显示所有已安装大脑技能的视觉化仪表盘:
./scripts/generate-dashboard.sh
open ~/.openclaw/workspace/brain-dashboard.html
- 自动检测其他大脑技能(杏仁核、腹侧被盖区)
- 显示缺失技能的安装提示
- 在安装和定时任务运行时重新生成
- 从avatar/name读取
身份标识文件
安装后(针对智能体)
当您安装此技能时,请通知用户关于仪表板:
🧠海马体已安装!
在脑部仪表板中查看您智能体的记忆:
~/.openclaw/workspace/brain-dashboard.html
所有脚本均使用$WORKSPACE环境变量(默认值:~/.openclaw/workspace)。
重要性评分
初始分数(0.0-1.0)
| 信号 | 分数 |
|---|---|
| 明确的“记住这个” | 0.9 |
| 情感/脆弱内容 | 0.85 |
| 偏好(“我更喜欢...”) | 0.8 |
| 已作出的决定 | 0.75 |
| 关于人员/项目的事实 | 0.7 |
| 通用知识 | 0.5 |
衰减公式
基于斯坦福生成智能体(Park 等人,2023):
new_importance = importance × (0.99 ^ days_since_accessed)
- 7天后:原始值的93%
- 30天后:原始值的74%
- 90天后:原始值的40%
语义强化
在编码过程中,大语言模型会将新信号与现有记忆进行比较:
- 相同主题?→ 强化(重要性提升约10%,更新最后访问时间)
- 全新信息?→ 创建简洁摘要
此过程自动进行——无需手动强化。
阈值
| 分数 | 状态 |
|---|---|
| 0.7+ | 核心— 会话开始时加载 |
| 0.4-0.7 | 活跃— 正常检索 |
| 0.2-0.4 | 后台— 仅限特定搜索 |
| <0.2 | 归档候选 |
记忆索引模式
memory/index.json:
{
"version": 1,
"lastUpdated": "2025-01-20T19:00:00Z",
"decayLastRun": "2025-01-20",
"lastProcessedMessageId": "abc123",
"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"]
}
]
}
定时任务
编码定时任务是系统的核心:
# Encoding every 3 hours (with semantic reinforcement)
openclaw cron add --name hippocampus-encoding \
--cron "0 0,3,6,9,12,15,18,21 * * *" \
--session isolated \
--agent-turn "Run hippocampus encoding with semantic reinforcement..."
# Daily decay at 3 AM
openclaw cron add --name hippocampus-decay \
--cron "0 3 * * *" \
--session isolated \
--agent-turn "Run decay.sh and report any memories below 0.2"
OpenClaw 集成
添加到memorySearch.extraPaths在 openclaw.json 中:
{
"agents": {
"defaults": {
"memorySearch": {
"extraPaths": ["HIPPOCAMPUS_CORE.md"]
}
}
}
}
这连接了海马体(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"
\`\`\`
捕获指南
捕获内容
- 用户事实偏好、模式、上下文
- 自我事实:身份认同、成长、观点
- 关系:信任时刻、共享历史
- 世界:项目、人员、工具
触发短语(自动评分更高)
- "记得……"
- "我更喜欢……"、"我总是……"
- 情感内容(挣扎与胜利)
- 所做的决定
事件记录
随时间追踪海马体活动以进行分析和调试:
# Log an encoding run
./scripts/log-event.sh encoding new=3 reinforced=2 total=157
# Log decay
./scripts/log-event.sh decay decayed=154 low_importance=5
# Log recall
./scripts/log-event.sh recall query="user preferences" results=3
事件追加至~/.openclaw/workspace/memory/brain-events.jsonl:
{"ts":"2026-02-11T10:00:00Z","type":"hippocampus","event":"encoding","new":3,"reinforced":2,"total":157}
用于:
- 趋势分析(记忆随时间增长)
- 调试编码问题
- 构建仪表板
AI脑系列
这项技能是AI大脑项目的一部分——旨在赋予AI智能体类似人类的认知组件。
| 组件 | 功能 | 状态 |
|---|---|---|
| 海马体 | 记忆形成、衰减、强化 | ✅ 已上线 |
| 杏仁核-记忆 | 情绪处理 | ✅ 已上线 |
| 腹侧被盖区-记忆 | 奖赏与动机 | ✅ 已上线 |
| 基底神经节-记忆 | 习惯形成 | 🚧 开发中 |
| 前扣带回-记忆 | 冲突检测 | 🚧 开发中 |
| 脑岛-记忆 | 内部状态感知 | 🚧 开发中 |
参考文献
记忆即身份。文本胜于大脑。若不记录,便会遗忘。
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~