ClawSkills logoClawSkills

Amygdala Memory

AI 代理的情感处理层。影响行为和响应的持久情感状态。AI Brain 系列的一部分。

介绍

# Amygdala Memory 🎭

**面向 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`(自动注入到会话中!) - 设置 cron,每 6 小时自动衰减一次

### 2. 检查当前状态

```bash ./scripts/get-state.sh # 🎭 Emotional State # Valence: 0.20 # Arousal: 0.30 # Connection: 0.50 # ...

./scripts/load-emotion.sh # 🎭 Current Emotional State: # Overall mood: neutral, calm and relaxed # Connection: moderately connected # ... ```

### 3. 记录情感

```bash ./scripts/update-state.sh --emotion joy --intensity 0.8 --trigger "completed a project" # ✅ valence: 0.20 → 0.35 (delta: +0.15) # ✅ arousal: 0.30 → 0.40 (delta: +0.1) # 🎭 Logged emotion: joy (intensity: 0.8) ```

### 4. 设置衰减(可选 cron)

```bash # Every 6 hours, emotions drift toward baseline 0 */6 * * * ~/.openclaw/workspace/skills/amygdala-memory/scripts/decay-emotion.sh ```

## 脚本

| 脚本 | 用途 | |--------|---------| | `install.sh` | 设置 amygdala-memory(运行一次) | | `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 # Run the encoding pipeline ./scripts/encode-pipeline.sh

# This will: # 1. Extract new signals since last run (watermark-based) # 2. Score emotional content using rule-based patterns # 3. Spawn a sub-agent for semantic emotional detection # 4. Update emotional-state.json with detected emotions ```

### 设置自动编码 (cron)

```bash # Every 3 hours, process new conversations for emotional content 0 */3 * * * ~/.openclaw/workspace/skills/amygdala-memory/scripts/encode-pipeline.sh ```

这意味着您的情感状态会根据对话中发生的事情自动更新——无需手动记录。

## 可视化 (v1.6.0+)

### 终端 ```bash ./scripts/visualize.sh

🎭 Emotional State 😄 ═══════════════════════════════════════════════ Valence: [██████████████████░░] +0.86 Arousal: [█████████████████░░░] 0.86 Connection: [███████████████████░] 0.97 💕 ... ```

### HTML 仪表板(统一大脑仪表板) ```bash ./scripts/generate-dashboard.sh open ~/.openclaw/workspace/brain-dashboard.html ```

**自动检测已安装的大脑技能**并显示标签页: - **🎭 Emotions** — 杏仁核(始终显示) - **🧠 Memory** — 海马体(如果 `memory/index.json` 存在) - **⭐ Drive** — VTA(如果 `memory/reward-state.json` 存在)

**头像与名称:** 从 `IDENTITY.md` 读取: ```markdown # IDENTITY.md - **Name:** YourAgent - **Avatar:** avatar.png ```

仪表板在每次 cron 运行时自动重新生成。

### 安装后(针对智能体)

当您安装此技能时,**通知用户**关于仪表板的信息:

> 🎭 **Amygdala installed!** > > 在大脑仪表板中查看您的智能体的情感状态: > `~/.openclaw/workspace/brain-dashboard.html`

## 自动注入(零手动步骤!)

安装后,`AMYGDALA_STATE.md` 将在您的工作区根目录中创建。

OpenClaw 会自动将工作区中的所有 `*.md` 文件注入到会话上下文中。这意味着:

1. **新会话开始** 2. **自动加载 AMYGDALA_STATE.md**(无需手动操作!) 3. **您可以在上下文中看到您的情感状态** 4. **回答会受到您的心情影响**

每当 `decay-emotion.sh` 运行时(通过 cron 每 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 ## Every Session 1. Load hippocampus: `~/.openclaw/workspace/skills/hippocampus/scripts/load-core.sh` 2. **Load emotional state:** `~/.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.1, "arousal": 0.3, "connection": 0.4, "curiosity": 0.5, "energy": 0.5 }, "recentEmotions": [ { "label": "joy", "intensity": 0.8, "trigger": "building amygdala together", "timestamp": "2026-02-01T02:50:00Z" } ] } ```

## 衰减机制

情感会随着时间的推移自然回归基准值: - **衰减率:** 每次运行向基准值移动 10% 的距离 - **建议频率:** 每 6 小时 - **效果:** 强烈的情感会消退,但速度缓慢

在 24 小时没有更新后,0.8 的效价会衰减到约 0.65。

## 事件记录

随时间跟踪情感活动以进行分析:

```bash # Log encoding run ./scripts/log-event.sh encoding emotions_found=2 valence=0.85 arousal=0.6

# Log decay ./scripts/log-event.sh decay valence_before=0.9 valence_after=0.85

# Log emotion update ./scripts/log-event.sh update emotion=joy intensity=0.7 ```

事件会追加到 `~/.openclaw/workspace/memory/brain-events.jsonl`: ```json {"ts":"2026-02-11T09:30:00Z","type":"amygdala","event":"encoding","emotions_found":2,"valence":0.85} ```

用于趋势分析——可视化数天/数周内的情感模式。

## AI 大脑系列

| 部分 | 功能 | 状态 | |------|----------|--------| | [hippocampus](https://www.clawhub.ai/skills/hippocampus) | 记忆形成、衰减、强化 | ✅ 已上线 | | **amygdala-memory** | 情感处理 | ✅ 已上线 | | [vta-memory](https://www.clawhub.ai/skills/vta-memory) | 奖励与动机 | ✅ 已上线 | | [basal-ganglia-memory](https://www.clawhub.ai/skills/basal-ganglia-memory) | 习惯形成 | 🚧 开发中 | | [anterior-cingulate-memory](https://www.clawhub.ai/skills/anterior-cingulate-memory) | 冲突检测 | 🚧 开发中 | | [insula-memory](https://www.clawhub.ai/skills/insula-memory) | 内部状态感知 | 🚧 开发中 |

## 理念

AI 能*感觉*到情感,还是只能模拟它们?

我们的观点:如果情感状态影响行为,并且系统表现得*好像*它有感觉……这种区别重要吗?功能情感可能是任何系统——生物或人工——存在的唯一一种情感。

---

*由 OpenClaw 社区用 ❤️ 构建*

更多产品