NIMA Core 2.3
Neural Integrated Memory Architecture — A complete memory system for AI agents with emotional intelligence.
Website: https://nima-core.ai
GitHub: https://github.com/lilubot/nima-core
🚀 Quick Start
CODEBLOCK0
🔒 Privacy & Permissions
Data Access:
- - ✅ Reads session transcripts from INLINECODE0
- ✅ Writes to local storage at
~/.nima/ (databases, affect history, embeddings)
Network Calls (conditional on embedder choice):
- - 🌐 Voyage API — Only when
NIMA_EMBEDDER=voyage (sends text for embeddings) - 🌐 OpenAI API — Only when
NIMA_EMBEDDER=openai (sends text for embeddings) - 🔒 Local embeddings — Default (
NIMA_EMBEDDER=local), no external API calls
Opt-in Controls:
CODEBLOCK1
Privacy Defaults:
- - Subagent sessions excluded
- Heartbeat/system noise filtered
- Local embeddings (no external calls)
- All data stored locally
To disable: Remove nima-memory from plugins.allow in INLINECODE7
What's New in 2.1
VADER Affect Analyzer
- - Contextual Analysis: Caps boost (1.5x), punctuation emphasis (
!!!), negation handling, degree modifiers - 30+ Idiom Recognition: Understands phrases like "not bad", "kind of", "sort of"
- Panksepp 7-Affect Mapping: Direct mapping from VADER sentiment to SEEKING, RAGE, FEAR, LUST, CARE, PANIC, PLAY
- Guardian Archetype Transformation: User anger → Agent concern/care response modulation
- Replaces previous lexicon-based emotion detection
Noise Remediation (4-Phase)
- 1. Empty Validation — Filters out null/empty messages
- Heartbeat Filters — Excludes system noise (
HEARTBEAT_OK, polling messages) - Deduplication — Removes duplicate content within sessions
- Metrics Collection — Tracks capture quality and filter effectiveness
Performance Improvements
- - LadybugDB Circular Import Fix: Resolved import issues in LadybugDB backend
- Increased Token Budget: Recall budget increased from 500 to 3000 tokens
- Connection Pooling: Improved connection management for LadybugDB backend
What's New in 2.0
LadybugDB Backend
- - 3.4x faster text search (9ms vs 31ms)
- Native vector search with HNSW (18ms)
- 44% smaller database (50MB vs 91MB)
- Graph traversal with Cypher queries
Security Hardened
- - Query sanitization (FTS5, SQL injection prevention)
- Path traversal protection
- Temp file cleanup
- Error handling throughout
Thread Safe
- - Singleton pattern with double-checked locking
- API timeouts (30s Voyage, 10s LadybugDB)
- Connection pooling ready
348 Tests
- - Full unit test coverage
- Thread safety verified
- Edge cases covered
Architecture
CODEBLOCK2
Performance
| Metric | SQLite | LadybugDB |
|---|
| Text Search | 31ms | 9ms (3.4x) |
| Vector Search |
External |
18ms (native) |
| Context Tokens | ~180 |
~30 (6x smaller) |
| Recall Token Budget | 500 |
3000 (v2.1+) |
API
CODEBLOCK3
Configuration
| Variable | Default | Description |
|---|
| INLINECODE10 | INLINECODE11 | Memory storage path |
| INLINECODE12 |
voyage |
voyage,
openai, or
local |
|
VOYAGE_API_KEY | — | Required for Voyage |
|
NIMA_LADYBUG |
0 | Set
1 for LadybugDB backend |
Hooks
nima-memory (Capture)
- - Captures input, contemplation, output on every turn
- 4-phase noise remediation (empty validation, heartbeat filters, dedup, metrics)
- Stores to SQLite or LadybugDB
- Computes and stores embeddings
nima-recall-live (Recall)
- - Injects relevant memories before agent starts
- Lazy loading — only top N results
- Deduplicates with injected context
- Token budget: 3000 (increased from 500 in v2.1)
nima-affect (Emotion)
- - VADER-based real-time affect analysis from text
- Contextual analysis (caps, punctuation, negation, degree modifiers)
- 30+ idiom recognition
- Maintains Panksepp 7-affect state
- Guardian archetype transformation (user anger → agent care)
Installation Options
SQLite (Development)
CODEBLOCK4
LadybugDB (Production)
CODEBLOCK5
Documentation
Step-by-step installation |
|
docs/DATABASE_OPTIONS.md | SQLite vs LadybugDB |
|
docs/EMBEDDING_PROVIDERS.md | Voyage, OpenAI, Local |
|
MIGRATION_GUIDE.md | Migrate from old versions |
|
CHANGELOG.md | Release history |
Security & Privacy
Data Access
This plugin accesses:
- -
~/.openclaw/agents/.../*.jsonl — Session transcripts (for memory capture) - INLINECODE22 — Local memory database (SQLite or LadybugDB)
- INLINECODE23 — Hook installation
Network Calls
Embeddings are sent to external APIs:
- - Voyage AI (
api.voyageai.com) — Default embedding provider - OpenAI (
api.openai.com) — Optional embedding provider - Local — No external calls when using sentence-transformers
Required Environment Variables
| Variable | Purpose | Required |
|---|
| INLINECODE26 | INLINECODE27 , openai, or INLINECODE29 | No (default: voyage) |
| INLINECODE30 |
Voyage AI authentication | If using Voyage |
|
OPENAI_API_KEY | OpenAI authentication | If using OpenAI |
|
NIMA_DATA_DIR | Memory storage path | No (default: ~/.nima) |
|
NIMA_LADYBUG | Use LadybugDB backend | No (default: 0) |
Installation Script
The
install.sh script:
- 1. Checks for Python 3 and Node.js
- Creates
~/.nima/ directories - Installs Python packages via pip
- Copies hooks to INLINECODE36
No external downloads. All packages come from PyPI.
Changelog
v2.1.0 — VADER Affect Analyzer (Feb 17, 2026)
- - Added: VADER-based affect analyzer replacing lexicon-based detection
- Contextual analysis: caps boost (1.5x), punctuation (!!!), negation, degree modifiers
- 30+ idiom recognition
- Panksepp 7-affect mapping (SEEKING, RAGE, FEAR, LUST, CARE, PANIC, PLAY)
- Guardian archetype transformation (user anger → agent concern/care)
- - Added: 4-phase noise remediation (empty validation, heartbeat filters, dedup, metrics)
- Fixed: LadybugDB circular import issue
- Changed: Recall token budget increased from 500 to 3000
- Improved: Connection pooling for LadybugDB backend
v2.0.3 — Security Hardening (Feb 15, 2026)
- - Security: Fixed path traversal vulnerability in affect_history.py (CRITICAL)
- Security: Fixed temp file resource leaks in 3 files (HIGH)
- Fixed: Corrected non-existent json.JSONEncodeError → TypeError/ValueError
- Improved: Exception handling - replaced 5 generic catches with specific types
- Quality: Better error visibility and debugging throughout
v2.0.1 — Thread Safety + Metadata
- - Fixed: Thread-safe singleton with double-checked locking
- Security: Clarified metadata requirements (Node.js, env vars)
- Docs: Added security disclosure for API key usage
v2.0.0 — LadybugDB + Security
- - Added: LadybugDB backend with HNSW vector search
- Added: Native graph traversal with Cypher
- Added: nima-query CLI for unified queries
- Security: SQL/FTS5 injection prevention
- Security: Path traversal protection
- Security: Temp file cleanup
- Fixed: Thread-safe singleton initialization
- Fixed: API timeouts (Voyage 30s, LadybugDB 10s)
- Tests: 348 tests passing
- Performance: 3.4x faster text search, 44% smaller DB
v1.2.1 — Consciousness Architecture
- - Added: 8 consciousness systems (Φ, Global Workspace, self-awareness)
- Added: Sparse Block VSA memory
- Added: ConsciousnessCore unified interface
v1.1.9 — Hook Efficiency Fix
- - Fixed: nima-recall hook spawning new Python process every bootstrap
- Performance: ~50-250x faster hook recall
v1.2.0 — Affective Response Engines
- - Added: 4 Layer-2 composite affect engines
- Added: Async affective processing
- Added: Voyage AI embedding support
NIMA Core 2.3
神经集成记忆架构 — 为具有情感智能的AI智能体打造的完整记忆系统。
网站: https://nima-core.ai
GitHub: https://github.com/lilubot/nima-core
🚀 快速开始
bash
安装
pip install nima-core
或使用LadybugDB(推荐用于生产环境)
pip install nima-core[vector]
设置嵌入提供者
export NIMA_EMBEDDER=voyage
export VOYAGE
APIKEY=your-key
安装钩子
./install.sh --with-ladybug
重启OpenClaw
openclaw restart
🔒 隐私与权限
数据访问:
- - ✅ 从 ~/.openclaw/agents//sessions/.jsonl 读取会话记录
- ✅ 写入本地存储 ~/.nima/(数据库、情感历史、嵌入向量)
网络调用(取决于嵌入器选择):
- - 🌐 Voyage API — 仅当 NIMAEMBEDDER=voyage 时(发送文本以获取嵌入向量)
- 🌐 OpenAI API — 仅当 NIMAEMBEDDER=openai 时(发送文本以获取嵌入向量)
- 🔒 本地嵌入 — 默认(NIMA_EMBEDDER=local),无外部API调用
可选控制:
json
// openclaw.json
{
plugins: {
entries: {
nima-memory: {
enabled: true,
skip_subagents: true, // 排除子智能体会话(默认)
skip_heartbeats: true, // 排除心跳检查(默认)
noise_filtering: {
filterheartbeatmechanics: true,
filtersystemnoise: true
}
}
}
}
}
隐私默认设置:
- - 排除子智能体会话
- 过滤心跳/系统噪声
- 本地嵌入(无外部调用)
- 所有数据本地存储
禁用方法: 从 openclaw.json 的 plugins.allow 中移除 nima-memory
2.1 版本新特性
VADER情感分析器
- - 上下文分析:大写增强(1.5倍)、标点强调(!!!)、否定处理、程度修饰词
- 30+习语识别:理解如not bad、kind of、sort of等短语
- Panksepp 7情感映射:从VADER情感直接映射到SEEKING、RAGE、FEAR、LUST、CARE、PANIC、PLAY
- 守护者原型转换:用户愤怒 → 智能体关切/关怀响应调节
- 取代了之前基于词典的情感检测
噪声修复(4阶段)
- 1. 空值验证 — 过滤空/无效消息
- 心跳过滤 — 排除系统噪声(HEARTBEAT_OK、轮询消息)
- 去重 — 移除会话内的重复内容
- 指标收集 — 跟踪捕获质量和过滤效果
性能改进
- - LadybugDB循环导入修复:解决了LadybugDB后端的导入问题
- 增加令牌预算:召回预算从500增加到3000个令牌
- 连接池:改进了LadybugDB后端的连接管理
2.0 版本新特性
LadybugDB后端
- - 文本搜索快3.4倍(9ms vs 31ms)
- 原生向量搜索,使用HNSW(18ms)
- 数据库缩小44%(50MB vs 91MB)
- 图遍历,使用Cypher查询
安全性强化
- - 查询清理(FTS5、SQL注入防护)
- 路径遍历保护
- 临时文件清理
- 全面的错误处理
线程安全
- - 双重检查锁定的单例模式
- API超时(Voyage 30s,LadybugDB 10s)
- 连接池就绪
348个测试
架构
text
OPENCLAW钩子
├── nima-memory — 三层捕获,带4阶段噪声修复
├── nima-recall-live — 惰性召回注入(beforeagentstart)
└── nima-affect — 基于VADER的实时情感分析
PYTHON核心
├── nima_core/cognition/
│ ├── dynamic_affect.py — Panksepp 7情感系统
│ ├── personality_profiles.py — JSON个性配置
│ ├── vader_affect.py — VADER情感分析器(v2.1新增)
│ └── archetypes.py — 基线情感配置文件
└── scripts/
├── nimaladybugbackend.py — LadybugDB CLI
└── ladybug_parallel.py — 并行迁移
数据库(SQLite或LadybugDB)
├── memory_nodes — 带嵌入向量的消息
├── memory_edges — 图关系
└── memory_turns — 对话轮次
性能
| 指标 | SQLite | LadybugDB |
|---|
| 文本搜索 | 31ms | 9ms(3.4倍) |
| 向量搜索 |
外部 |
18ms(原生) |
| 上下文令牌 | ~180 |
~30(小6倍) |
| 召回令牌预算 | 500 |
3000(v2.1+) |
API
python
from nimacore import DynamicAffectSystem, getaffect_system
from nimacore.cognition.vaderaffect import VaderAffectAnalyzer
获取单例实例(线程安全)
affect = get
affectsystem(identity_name=lilu)
处理输入并获取情感状态
state = affect.process_input(我对这个项目感到非常兴奋!)
print(state.current) # {SEEKING: 0.72, PLAY: 0.65, ...}
直接使用VADER分析器
analyzer = VaderAffectAnalyzer()
result = analyzer.analyze(这太棒了!!!)
print(result.affects) # {PLAY: 0.78, SEEKING: 0.71, ...}
召回记忆(通过钩子 - 自动)
或手动通过CLI:
nima-query who_search David --limit 5
nima-query text_search project --limit 5
配置
| 变量 | 默认值 | 描述 |
|---|
| NIMADATADIR | ~/.nima | 记忆存储路径 |
| NIMA_EMBEDDER |
voyage | voyage、openai或local |
| VOYAGE
APIKEY | — | 使用Voyage时需要 |
| NIMA_LADYBUG | 0 | 设置为1以使用LadybugDB后端 |
钩子
nima-memory(捕获)
- - 每轮捕获输入、思考、输出
- 4阶段噪声修复(空值验证、心跳过滤、去重、指标)
- 存储到SQLite或LadybugDB
- 计算并存储嵌入向量
nima-recall-live(召回)
- - 在智能体启动前注入相关记忆
- 惰性加载 — 仅返回前N个结果
- 与注入的上下文去重
- 令牌预算:3000(从v2.1的500增加)
nima-affect(情感)
- - 基于VADER的文本实时情感分析
- 上下文分析(大写、标点、否定、程度修饰词)
- 30+习语识别
- 维护Panksepp 7情感状态
- 守护者原型转换(用户愤怒 → 智能体关怀)
安装选项
SQLite(开发环境)
bash
pip install nima-core
./install.sh
LadybugDB(生产环境)
bash
pip install nima-core[vector]
./install.sh --with-ladybug
文档
逐步安装指南 |
|
docs/DATABASE_OPTIONS.md | SQLite vs LadybugDB |
| [docs/EMBEDDING
PROVIDERS.md](./docs/EMBEDDINGPROVIDERS.md