前扣带回记忆:AI 智能体错误追踪 - Openclaw Skills
作者:互联网
2026-03-26
什么是 前扣带回记忆?
前扣带回记忆(Anterior Cingulate Memory)技能是专为 AI Brain 系列设计的精密错误坚控模块。它模拟人类大脑的前扣带皮层,通过检测冲突和跨会话追踪持久的错误模式。通过在 Openclaw Skills 生态系统中使用此技能,开发者可以确保其智能体在历史上曾失败过的语境中变得更具自我意识和谨慎。
该技能通过分析用户与助手的交流,识别沟通误解、事实错误和语气失配。它不仅记录错误,还将其分类为不同的严重级别,并提供可操作的缓解措施,允许智能体根据在会话重启后依然存在的持久状态文件动态调整其行为。
下载入口:https://github.com/openclaw/skills/tree/main/skills/impkind/acc-error-memory
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install acc-error-memory
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 acc-error-memory。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
前扣带回记忆 应用场景
- 检测技术文档或编码建议中重复出现的事实错误。
- 在敏感的用户交互过程中坚控并纠正语气失配。
- 防止在长时间对话中重复出现上下文丢失的错误。
- 升级需要立即缓解或人工干预的关键故障模式。
- 随着错误模式进入已解决状态,追踪智能体性能的提升。
- 系统使用预处理管道从会话记录中提取用户和助手的交流内容。
- 筛选 LLM 分析这些交流,以识别直接或隐含的纠正以及用户沮丧的迹象。
- 检测到的错误被记录到中央状态文件中,并分类为特定的错误模式。
- 根据发生频率,模式会自动从普通升级为警告或严重级别。
- 智能体在每次会话开始时查阅当前错误状态,以调整其行为准则。
- 超过 30 天未重复出现的模式将自动转为已解决状态。
前扣带回记忆 配置指南
要将此组件集成到您的 Openclaw Skills 工作区,请运行以下命令:
cd ~/.openclaw/workspace/skills/anterior-cingulate-memory
./install.sh --with-cron
通过在 shell 配置中设置环境变量来配置您首选的分析用 LLM:
export ACC_MODELS="claude --model haiku -p,claude --model sonnet -p"
通过检查活动模式的当前状态来验证安装:
./scripts/load-state.sh
前扣带回记忆 数据架构与分类体系
该技能维护一个结构化的 JSON 状态文件,并为会话上下文生成易于理解的摘要。
| 文件 | 描述 |
|---|---|
acc-state.json |
包含活动模式、严重级别和解决时间戳的主数据存储。 |
ACC_STATE.md |
供智能体系统提示词使用的当前错误 Markdown 摘要。 |
brain-events.jsonl |
用于大脑分析和遥测的追加式分析事件日志。 |
pending-errors.json |
等待 LLM 分析的提取交流内容的临时缓冲区。 |
name: acc-error-memory
description: "Error pattern tracking for AI agents. Detects corrections, escalates recurring mistakes, learns mitigations. The 'something's off' detector from the AI Brain series."
metadata:
openclaw:
emoji: "?"
version: "1.0.0"
author: "ImpKind"
repo: "https://github.com/ImpKind/acc-error-memory"
requires:
os: ["darwin", "linux"]
bins: ["python3", "jq"]
tags: ["memory", "monitoring", "ai-brain", "error-detection"]
Anterior Cingulate Memory ?
Conflict detection and error monitoring for AI agents. Part of the AI Brain series.
The anterior cingulate cortex (ACC) monitors for errors and conflicts. This skill gives your AI agent the ability to learn from mistakes — tracking error patterns over time and becoming more careful in contexts where it historically fails.
The Problem
AI agents make mistakes:
- Misunderstand user intent
- Give wrong information
- Use the wrong tone
- Miss context from earlier in conversation
Without tracking, the same mistakes repeat. The ACC detects and logs these errors, building awareness that persists across sessions.
The Solution
Track error patterns with:
- Pattern detection — recurring error types get escalated
- Severity levels — normal (1x), warning (2x), critical (3+)
- Resolution tracking — patterns clear after 30+ days
- Watermark system — incremental processing, no re-analysis
Configuration
ACC_MODELS (Model Agnostic)
The LLM screening and calibration scripts are model-agnostic. Set ACC_MODELS to use any CLI-accessible model:
# Default (Anthropic Claude via CLI)
export ACC_MODELS="claude --model haiku -p,claude --model sonnet -p"
# Ollama (local)
export ACC_MODELS="ollama run llama3,ollama run mistral"
# OpenAI
export ACC_MODELS="openai ch@t -m gpt-4o-mini,openai ch@t -m gpt-4o"
# Single model (no fallback)
export ACC_MODELS="claude --model haiku -p"
Format: Comma-separated CLI commands. Each command is invoked with the prompt appended as the final argument. Models are tried in order — if the first fails/times out (45s), the next is used as fallback.
Scripts that use ACC_MODELS:
haiku-screen.sh— LLM confirmation of regex-filtered error candidatescalibrate-patterns.sh— Pattern calibration via LLM classification
Quick Start
1. Install
cd ~/.openclaw/workspace/skills/anterior-cingulate-memory
./install.sh --with-cron
This will:
- Create
memory/acc-state.jsonwith empty patterns - Generate
ACC_STATE.mdfor session context - Set up cron for analysis 3x daily (4 AM, 12 PM, 8 PM)
2. Check current state
./scripts/load-state.sh
# ? ACC State Loaded:
# Active patterns: 2
# - tone_mismatch: 2x (warning)
# - missed_context: 1x (normal)
3. Manual error logging
./scripts/log-error.sh r
--pattern "factual_error" r
--context "Stated Python 3.9 was latest when it's 3.12" r
--mitigation "Always web search for version numbers"
4. Check for resolved patterns
./scripts/resolve-check.sh
# Checks patterns not seen in 30+ days
Scripts
| Script | Purpose |
|---|---|
preprocess-errors.sh |
Extract user+assistant exchanges since watermark |
encode-pipeline.sh |
Run full preprocessing pipeline |
log-error.sh |
Log an error with pattern, context, mitigation |
load-state.sh |
Human-readable state for session context |
resolve-check.sh |
Check for patterns ready to resolve (30+ days) |
update-watermark.sh |
Update processing watermark |
sync-state.sh |
Generate ACC_STATE.md from acc-state.json |
log-event.sh |
Log events for brain analytics |
How It Works
1. Preprocessing Pipeline
The encode-pipeline.sh extracts exchanges from session transcripts:
./scripts/encode-pipeline.sh --no-spawn
# ? ACC Encode Pipeline
# Step 1: Extracting exchanges...
# Found 47 exchanges to analyze
Output: pending-errors.json with user+assistant pairs:
[
{
"assistant_text": "The latest Python version is 3.9",
"user_text": "Actually it's 3.12 now",
"timestamp": "2026-02-11T10:00:00Z"
}
]
2. Error Analysis (via Cron Agent)
An LLM (configured via ACC_MODELS) analyzes each exchange for:
- Direct corrections ("no", "wrong", "that's not right")
- Implicit corrections ("actually...", "I meant...")
- Frustration signals ("you're not understanding")
- User confusion caused by the agent
3. Pattern Tracking
Errors are logged with pattern names:
./scripts/log-error.sh --pattern "factual_error" --context "..." --mitigation "..."
Patterns escalate with repetition:
- 1x → normal (noted)
- 2x → warning (watch for this)
- 3+ → critical (actively avoid!)
4. Resolution
Patterns not seen for 30+ days move to resolved:
./scripts/resolve-check.sh
# ? Resolved: version_numbers (32 days clear)
Cron Schedule
Default: 3x daily for faster feedback loop
# Add to cron
openclaw cron add --name acc-analysis r
--cron "0 4,12,20 * * *" r
--session isolated r
--agent-turn "Run ACC analysis pipeline..."
State File Format
{
"version": "2.0",
"lastUpdated": "2026-02-11T12:00:00Z",
"activePatterns": {
"factual_error": {
"count": 3,
"severity": "critical",
"firstSeen": "2026-02-01T10:00:00Z",
"lastSeen": "2026-02-10T15:00:00Z",
"context": "Stated outdated version numbers",
"mitigation": "Always verify versions with web search"
}
},
"resolved": {
"tone_mismatch": {
"count": 2,
"resolvedAt": "2026-02-11T04:00:00Z",
"daysClear": 32
}
},
"stats": {
"totalErrorsLogged": 15
}
}
Event Logging
Track ACC activity over time:
./scripts/log-event.sh analysis errors_found=2 patterns_active=3 patterns_resolved=1
Events append to ~/.openclaw/workspace/memory/brain-events.jsonl:
{"ts":"2026-02-11T12:00:00Z","type":"acc","event":"analysis","errors_found":2,"patterns_active":3}
Integration with OpenClaw
Add to session startup (AGENTS.md)
## Every Session
1. Load hippocampus: `./scripts/load-core.sh`
2. Load emotional state: `./scripts/load-emotion.sh`
3. **Load error patterns:** `~/.openclaw/workspace/skills/anterior-cingulate-memory/scripts/load-state.sh`
Behavior Guidelines
When you see patterns in ACC state:
- ?? Critical (3+) — actively verify before responding in this area
- ?? Warning (2x) — be extra careful
- ? Resolved — lesson learned, don't repeat
Future: Amygdala Integration
Planned: Connect ACC to amygdala so errors affect emotional state:
- Errors → lower valence, higher alertness
- Clean runs → maintain positive state
- Pattern resolution → sense of accomplishment
AI Brain Series
| Part | Function | Status |
|---|---|---|
| hippocampus | Memory formation, decay, reinforcement | ? Live |
| amygdala-memory | Emotional processing | ? Live |
| vta-memory | Reward and motivation | ? Live |
| anterior-cingulate-memory | Conflict detection, error monitoring | ? Live |
| basal-ganglia-memory | Habit formation | ?? Development |
| insula-memory | Internal state awareness | ?? Development |
Philosophy
The ACC in the human brain creates that "something's off" feeling — the pre-conscious awareness that you've made an error. This skill gives AI agents a similar capability: persistent awareness of mistake patterns that influences future behavior.
Mistakes aren't failures. They're data. The ACC turns that data into learning.
Built with ? by the OpenClaw community
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
会话成本追踪器:优化 Token 投资回报率 - Openclaw Skills
Memoria: AI 智能体结构化记忆系统 - Openclaw Skills
Deno 运行时专家:安全 TypeScript 开发 - Openclaw Skills
为 AI 代理部署 Spark Bitcoin L2 代理 - Openclaw Skills
加密货币价格技能:实时市场数据集成 - Openclaw Skills
Happenstance:专业人脉搜索与研究 - Openclaw Skills
飞书日历技能:通过 Openclaw Skills 自动化日程安排
顾问委员会:多人格 AI 加密货币分析 - Openclaw Skills
CRIF:面向 AI Agent 的加密深度研究框架 - Openclaw Skills
个人社交:社交生活与生日助手 - Openclaw Skills
AI精选
