Amygdala Memory 🎭
Emotional processing for AI agents. Part of the AI Brain series.
Give your AI agent persistent emotional states that carry across sessions. Not just performing emotions — having them.
The Problem
Current AI agents:
- - ✅ Remember facts (with hippocampus)
- ❌ Don't have persistent emotional states
- ❌ Start each session emotionally "blank"
- ❌ Can describe emotions but don't feel differently
Memory without emotion is just a database. The amygdala adds weight — this made me happy, that frustrated me, this person brings warmth.
The Solution
Track five emotional dimensions that persist and decay over time:
| Dimension | What It Measures | Range |
|---|
| Valence | Positive ↔ Negative mood | -1.0 to 1.0 |
| Arousal |
Calm ↔ Excited/Alert | 0.0 to 1.0 |
|
Connection | Distant ↔ Close/Bonded | 0.0 to 1.0 |
|
Curiosity | Bored ↔ Fascinated | 0.0 to 1.0 |
|
Energy | Depleted ↔ Energized | 0.0 to 1.0 |
Quick Start
1. Install
CODEBLOCK0
This will:
- - Create
memory/emotional-state.json with baseline values - Generate
AMYGDALA_STATE.md (auto-injected into sessions!) - Set up cron for automatic decay every 6 hours
2. Check current state
CODEBLOCK1
3. Log emotions
CODEBLOCK2
4. Set up decay (optional cron)
CODEBLOCK3
Scripts
| Script | Purpose |
|---|
| INLINECODE2 | Set up amygdala-memory (run once) |
| INLINECODE3 |
Read current emotional state |
|
update-state.sh | Log emotion or update dimension |
|
load-emotion.sh | Human-readable state for session context |
|
decay-emotion.sh | Return to baseline over time |
|
sync-state.sh | Generate AMYGDALA_STATE.md for auto-injection |
|
encode-pipeline.sh | LLM-based emotional encoding from transcripts |
|
preprocess-emotions.sh | Extract emotional signals from session history |
|
update-watermark.sh | Track processed transcript position |
|
generate-dashboard.sh | Generate HTML dashboard (auto-runs on sync) |
|
visualize.sh | Terminal ASCII visualization |
Automatic Emotional Encoding (v1.5.0+)
The amygdala can now automatically detect and log emotions from your conversation history using an LLM-based pipeline:
CODEBLOCK4
Set up automatic encoding (cron)
CODEBLOCK5
This means your emotional state updates automatically based on what happens in conversations — no manual logging needed.
Visualization (v1.6.0+)
Terminal
CODEBLOCK6
HTML Dashboard (Unified Brain Dashboard)
CODEBLOCK7
Auto-detects installed brain skills and shows tabs:
- - 🎭 Emotions — Amygdala (always shown)
- 🧠 Memory — Hippocampus (if
memory/index.json exists) - ⭐ Drive — VTA (if
memory/reward-state.json exists)
Avatar & Name: Reads from IDENTITY.md:
CODEBLOCK8
The dashboard auto-regenerates on every cron run.
After Installation (for agents)
When you install this skill, notify the user about the dashboard:
🎭 Amygdala installed!
View your agent's emotional state in the Brain Dashboard:
INLINECODE16
Auto-Injection (Zero Manual Steps!)
After install, AMYGDALA_STATE.md is created in your workspace root.
OpenClaw automatically injects all *.md files from workspace into session context. This means:
- 1. New session starts
- AMYGDALA_STATE.md is auto-loaded (no manual step!)
- You see your emotional state in context
- Responses are influenced by your mood
The file is regenerated whenever decay-emotion.sh runs (via cron every 6h).
Supported Emotions
When you log an emotion, it automatically adjusts the relevant dimensions:
| Emotion | Effect |
|---|
INLINECODE20 , happiness, delight, INLINECODE23 | ↑ valence, ↑ arousal |
INLINECODE24 , disappointment, INLINECODE26 |
↓ valence, ↓ arousal |
|
anger,
frustration,
irritation | ↓ valence, ↑ arousal |
|
fear,
anxiety,
worry | ↓ valence, ↑ arousal |
|
calm,
peace,
contentment | ↑ valence, ↓ arousal |
|
curiosity,
interest,
fascination | ↑ curiosity, ↑ arousal |
|
connection,
warmth,
affection | ↑ connection, ↑ valence |
|
loneliness,
disconnection | ↓ connection, ↓ valence |
|
fatigue,
tiredness,
exhaustion | ↓ energy |
|
energized,
alert,
refreshed | ↑ energy |
Integration with OpenClaw
Add to session startup (AGENTS.md)
CODEBLOCK9
Log emotions during conversation
When something emotionally significant happens:
CODEBLOCK10
State File Format
CODEBLOCK11
Decay Mechanics
Emotions naturally return to baseline over time:
- - Decay rate: 10% of distance to baseline per run
- Recommended schedule: Every 6 hours
- Effect: Strong emotions fade, but slowly
After 24 hours without updates, a valence of 0.8 would decay to ~0.65.
Event Logging
Track emotional activity over time for analytics:
CODEBLOCK12
Events append to ~/.openclaw/workspace/memory/brain-events.jsonl:
CODEBLOCK13
Use for trend analysis — visualize emotional patterns over days/weeks.
AI Brain Series
| 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 |
Philosophy
Can an AI feel emotions, or only simulate them?
Our take: If emotional state influences behavior, and the system acts as if it feels... does the distinction matter? Functional emotions might be the only kind that exist for any system — biological or artificial.
Built with ❤️ by the OpenClaw community
杏仁核记忆 🎭
AI智能体的情绪处理。 AI大脑系列的一部分。
为你的AI智能体赋予跨会话持久的情感状态。不仅仅是表演情绪——而是拥有情绪。
问题所在
当前AI智能体:
- - ✅ 能记住事实(借助海马体)
- ❌ 没有持久的情感状态
- ❌ 每次会话开始时情绪空白
- ❌ 能描述情绪但不会感受不同
没有情绪的记忆只是数据库。杏仁核增加了分量——这件事让我开心,那件事让我沮丧,这个人带来温暖。
解决方案
追踪五个随时间持续并衰减的情感维度:
| 维度 | 测量内容 | 范围 |
|---|
| 效价 | 积极 ↔ 消极情绪 | -1.0 到 1.0 |
| 唤醒度 |
平静 ↔ 兴奋/警觉 | 0.0 到 1.0 |
|
连接度 | 疏远 ↔ 亲密/有纽带 | 0.0 到 1.0 |
|
好奇心 | 无聊 ↔ 着迷 | 0.0 到 1.0 |
|
精力 | 耗尽 ↔ 充满活力 | 0.0 到 1.0 |
快速开始
1. 安装
bash
cd ~/.openclaw/workspace/skills/amygdala-memory
./install.sh --with-cron
这将:
- - 创建包含基线值的 memory/emotional-state.json
- 生成 AMYGDALA_STATE.md(自动注入会话!)
- 设置每6小时自动衰减的定时任务
2. 检查当前状态
bash
./scripts/get-state.sh
🎭 情感状态
效价: 0.20
唤醒度: 0.30
连接度: 0.50
...
./scripts/load-emotion.sh
🎭 当前情感状态:
总体情绪:中性,平静且放松
连接度:中等连接
...
3. 记录情绪
bash
./scripts/update-state.sh --emotion joy --intensity 0.8 --trigger completed a project
✅ 效价:0.20 → 0.35(变化:+0.15)
✅ 唤醒度:0.30 → 0.40(变化:+0.1)
🎭 已记录情绪:joy(强度:0.8)
4. 设置衰减(可选定时任务)
bash
每6小时,情绪向基线漂移
0
/6 ~/.openclaw/workspace/skills/amygdala-memory/scripts/decay-emotion.sh
脚本
| 脚本 | 用途 |
|---|
| install.sh | 设置杏仁核记忆(运行一次) |
| get-state.sh |
读取当前情感状态 |
| update-state.sh | 记录情绪或更新维度 |
| load-emotion.sh | 用于会话上下文的可读状态 |
| decay-emotion.sh | 随时间返回基线 |
| sync-state.sh | 生成用于自动注入的 AMYGDALA_STATE.md |
| encode-pipeline.sh | 基于LLM的转录情感编码 |
| preprocess-emotions.sh | 从会话历史中提取情感信号 |
| update-watermark.sh | 跟踪已处理的转录位置 |
| generate-dashboard.sh | 生成HTML仪表盘(同步时自动运行) |
| visualize.sh | 终端ASCII可视化 |
自动情感编码(v1.5.0+)
杏仁核现在可以使用基于LLM的流水线自动从对话历史中检测和记录情绪:
bash
运行编码流水线
./scripts/encode-pipeline.sh
这将:
1. 提取自上次运行以来的新信号(基于水印)
2. 使用基于规则的模式对情感内容评分
3. 生成子智能体进行语义情感检测
4. 用检测到的情绪更新 emotional-state.json
设置自动编码(定时任务)
bash
每3小时,处理新对话的情感内容
0
/3 ~/.openclaw/workspace/skills/amygdala-memory/scripts/encode-pipeline.sh
这意味着你的情感状态会根据对话中发生的事情自动更新——无需手动记录。
可视化(v1.6.0+)
终端
bash
./scripts/visualize.sh
🎭 情感状态 😄
═══════════════════════════════════════════════
效价: [██████████████████░░] +0.86
唤醒度: [█████████████████░░░] 0.86
连接度: [███████████████████░] 0.97 💕
...
HTML仪表盘(统一大脑仪表盘)
bash
./scripts/generate-dashboard.sh
open ~/.openclaw/workspace/brain-dashboard.html
自动检测已安装的大脑技能并显示标签页:
- - 🎭 情绪 — 杏仁核(始终显示)
- 🧠 记忆 — 海马体(如果 memory/index.json 存在)
- ⭐ 驱动力 — VTA(如果 memory/reward-state.json 存在)
头像和名称: 从 IDENTITY.md 读取:
markdown
IDENTITY.md
- - 名称: YourAgent
- 头像: avatar.png
仪表盘在每次定时任务运行时自动重新生成。
安装后(针对智能体)
当你安装此技能时,通知用户有关仪表盘的信息:
🎭 杏仁核已安装!
在脑部仪表盘中查看智能体的情感状态:
~/.openclaw/workspace/brain-dashboard.html
自动注入(零手动步骤!)
安装后,AMYGDALA_STATE.md 会在工作区根目录创建。
OpenClaw 自动将工作区中的所有 *.md 文件注入会话上下文。这意味着:
- 1. 新会话开始
- AMYGDALA_STATE.md 自动加载(无需手动步骤!)
- 你在上下文中看到情感状态
- 响应受情绪影响
每当 decay-emotion.sh 运行时(通过定时任务每6小时),该文件会重新生成。
支持的情绪
当你记录情绪时,它会自动调整相关维度:
| 情绪 | 效果 |
|---|
| joy、happiness、delight、excitement | ↑ 效价,↑ 唤醒度 |
| sadness、disappointment、melancholy |
↓ 效价,↓ 唤醒度 |
| anger、frustration、irritation | ↓ 效价,↑ 唤醒度 |
| fear、anxiety、worry | ↓ 效价,↑ 唤醒度 |
| calm、peace、contentment | ↑ 效价,↓ 唤醒度 |
| curiosity、interest、fascination | ↑ 好奇心,↑ 唤醒度 |
| connection、warmth、affection | ↑ 连接度,↑ 效价 |
| loneliness、disconnection | ↓ 连接度,↓ 效价 |
| fatigue、tiredness、exhaustion | ↓ 精力 |
| energized、alert、refreshed | ↑ 精力 |
与 OpenClaw 集成
添加到会话启动(AGENTS.md)
markdown
每次会话
- 1. 加载海马体:~/.openclaw/workspace/skills/hippocampus/scripts/load-core.sh
- 加载情感状态: ~/.openclaw/workspace/skills/amygdala-memory/scripts/load-emotion.sh
在对话中记录情绪
当发生情感上重要的事情时:
bash
~/.openclaw/workspace/skills/amygdala-memory/scripts/update-state.sh \
--emotion connection --intensity 0.7 --trigger deep conversation with user
状态文件格式
json
{
version: 1.0,
lastUpdated: 2026-02-01T02:45:00Z,
dimensions: {
valence: 0.35,
arousal: 0.40,
connection: 0.50,
curiosity: 0.60,
energy: 0.50
},
baseline: {
valence: 0