灵枢 AutoBrain
Plugin+skill hybrid pack for OpenClaw: memory, anti-hallucination, self-evolution, workflow orchestration, daily maintenance, auto-scan, version check. Exclusive plugin slot + compat layer.
Audits
PassInstall
openclaw plugins install clawhub:crusheart-autobrain-turbo
🦞 灵枢 AutoBrain
Give your OpenClaw agent a brain — long-term memory, anti-hallucination, self-evolution, and workflow orchestration, out of the box.
✨ What It Does
灵枢 AutoBrain is a plugin + skill hybrid pack that upgrades any OpenClaw agent from a stateless chatbot to a persistent, self-improving AI companion. It hooks into the agent lifecycle and deploys 30+ Python engines across 8 groups — no manual setup required.
| Capability | What You Get |
|---|---|
| 🧠 Long-term Memory | 5-layer memory (session → short-term → dream consolidation → archive → vector retrieval). Remembers who you are between sessions. |
| 🛡️ Anti-Hallucination | Authority domain whitelist, knowledge assertion validation, multi-source cross-verification (16 engines). |
| 🔄 Self-Evolution | LLM-as-Judge self-scoring + Reflexion reflection (failure pattern, root cause, fix strategy). |
| 🎯 Dual-Mode + R-CCAM | Fast path for simple Q&A, deep reasoning for complex tasks. R-CCAM classifier for query complexity routing. |
| 🔮 MASA Prediction-Alignment | Pre-task difficulty/time/confidence estimation + post-task deviation analysis + feedback to self-evolution & parameter auto-tuning |
| ✅ 8 Iron Rules | Prevents "I thought so" mistakes — fact-check before answering, verify before acting. |
| 🩺 Health Check | Daily cron (00:00) — engine status, disk space, gateway health, anomaly detection. |
| 🔌 Failover | Auto-switch to backup model when primary fails. Circuit breaker prevents cascade failures. |
| 🔀 Workflow Orchestration | Multi-skill coordination, conflict detection, task routing, rule engine. |
| 📋 Context Capsule (DAG) | DAG-based context management with incremental summarization. SQLite-backed, retains message dependencies. |
| 🧠 Memory Consolidation | CLS complementarity learning + offline replay + interference merging + predictive conflict detection. |
| 🔍 Enhanced Retrieval | Query rewriting + RRF fusion + retrieval confidence evaluation for higher recall accuracy. |
🚀 Quick Start
Prerequisites
- OpenClaw ≥ 2026.5.0
- Node.js ≥ 18
- Python ≥ 3.10
Install
# Download the tarball, then:
# ⚠️ This package is a plugin-primary + skill metadata hybrid pack, exclusively occupying the OpenClaw plugin slot.
# Only one crusheart-* family plugin can be active at a time.
openclaw plugins install --dangerously-force-unsafe-install ./crusheart-pack/
# Restart gateway
supervisorctl restart openclaw-gateway
# or: openclaw gateway restart
Why
--dangerously-force-unsafe-install? The plugin'sindex.jscallschild_processto execute Python engines during bootstrap. This is a false positive — the code is local, not remote. We'll migrate to pure SDK hooks in a future release.
Plugin Slot (Exclusive)
Exclusive slot locking implemented via .crusheart-slot.json. Only one crusheart-family plugin can be active at a time. To switch versions, uninstall the old plugin first, then install the new plugin.
Compat Layer
Built-in core/engines/compat/ compatibility engine group (3 modules: compat_engine, compat_registry, compat_scaffold) supporting third-party engine hot-swapping and registration integration.
One-time Run Items on First Install (Non-cron Tasks)
- Memory Auto-Scan:
scan_memory.py— Scans memory/ directory on first install, automatically ingests extracted memories into the memory system - Skill Classification Index:
scan_skills.py— Scans skills/ directory on first install to build classification index - Self-Correction Initialization:
init_correction_data.py— Establishes JudgeEngine data pipeline - Version Check:
version_check.py— Checks for new versions on clawhub.ai and notifies when updates are available (once only)
Verify
# Check plugin is loaded
openclaw plugins list | grep crusheart
# Watch the bootstrap log — you should see:
# ✅ 31 engines initialized
# ✅ Pipeline: 10 stages ready
# ✅ Daily maintenance cron registered
🏗️ Architecture
openclaw-gateway
│
├── crusheart-autobrain-turbo (plugin)
│ ├── index.js ← Node.js bridge to Python engines
│ ├── bundle/crusheart-core.tar.gz ← 30+ Python engines (deployed at bootstrap)
│ └── skill/ ← OpenClaw skill metadata
│
├── core/engines/ ← Deployed to workspace
│ ├── init/ (11) — Auto-loader, config validator, session bootstrap
│ ├── memory/ (6) — 5-layer memory, vector index, user portrait
│ ├── quality/ (10) — Anti-hallucination, judge engine, circuit breaker
│ ├── operations/ (7) — Health check, decision core, background scheduler
│ ├── workflow/ (7) — Orchestrator, rule engine, serial lanes
│ ├── tools/ (12) — Failover, DB, template library, plugin SDK
│ ├── hooks/ (4) — Dual-mode classifier, self-evolution
│ └── compat/ (3) — Third-party engine hot-plug
│
└── core/pipeline/ ← 10-stage message pipeline
├── stage 0: Engine status probe
├── stage 1: Dual-mode classification
├── stage 2: Skill matching
├── stage 3: Anti-hallucination check
├── stage 4: Engine routing
├── stage 5: Session state (hot RAM layer)
├── stage 6: Memory alignment
├── stage 7: Evolution context injection
├── stage 8: Self-reflection
└── stage 9: Outbound anti-hallucination
🧠 Memory System Deep Dive
The memory system is the crown jewel. Five layers, one unified API:
Session (L1) ──► Short-term (L2) ──► Dream (L3) ──► Archive (L4) ──► Vector (L5)
│ │ │ │
▼ ▼ ▼ ▼
Ephemeral 7-day TTL Read-only, Permanent,
(current consolidated consolidated never deleted
conversation) by sleep cron weekly
Key features:
- Inverted index for keyword search
- TF-IDF + cosine similarity for semantic reranking
- Cold/hot storage — frequently accessed memories stay hot, old ones decay gracefully
- Scene grouping — memories tagged by context (work, chat, health, etc.)
- Anti-forget engine — periodic review prevents important memories from decaying
- Global mutex with heartbeat — prevents duplicate cron execution
📦 What's Included
| Artifact | Path | Purpose |
|---|---|---|
| Plugin entry | index.js | Bridges Python engines into OpenClaw lifecycle hooks |
| Plugin manifest | openclaw.plugin.json | OpenClaw plugin registration |
| Engine bundle | bundle/crusheart-core.tar.gz | 30+ Python engines + 10-stage pipeline |
| Skill metadata | skill/_meta.json | Skill marketplace registration |
| Skill doc | skill/SKILL.md | Skill documentation |
| Architecture doc | bundle/ARCHITECTURE.md | Full system architecture reference |
| Auto-deployed scripts | bundle/daily_maintenance.py, bundle/version_check.py, bundle/scan_memory.py, bundle/scan_skills.py, bundle/read_config.py, bundle/init_correction_data.py, bundle/register_crons.sh | Plugin auto-deploys to workspace scripts/ at bootstrap |
| Cron tasks | (auto-configured via hook) | Daily maintenance (01:00), engine init (05:00) |
🔧 Configuration
Environment Variables (optional,requires you to configure your own API key)
| Variable | Purpose | Default |
|---|---|---|
EMBEDDING_API_URL | Remote embedding service URL | (local TF-IDF fallback) |
EMBEDDING_API_KEY | Bearer token for embedding API | (none) |
Without these, the system falls back to local TF-IDF vector search — slightly less accurate but fully functional.
Cron Jobs (auto-registered)
| Time | Name | Description |
|---|---|---|
0 1 * * * | Daily Task Summary & System Cleanup | Unified task: health inspection + garbage cleanup + self-correction maintenance + memory maintenance + Dream scan + Replay distillation + execution review |
0 5 * * * | Engine Init + Version Check | Reload engine modules; check for new versions on clawhub.ai on install (first install only) |
Memory scan archival, skill classification scan, and self-correction chain initialization run once on first install only, not as scheduled tasks.
🤝 Contributing
This is an early-stage open-source project. Contributions welcome!
- Issues: Bug reports, feature requests
- PRs: Engine improvements, new pipeline stages, documentation
- Discussions: Architecture questions, use cases
Development
# After cloning, manually deploy to workspace:
tar xzf bundle/crusheart-core.tar.gz -C /path/to/workspace
# Edit Python engines in core/engines/
# Edit plugin bridge in index.js
# Repack:
tar czf bundle/crusheart-core.tar.gz -C /tmp/repack .
📄 License
MIT0 — see LICENSE.
The current version is under development and testing. If you have any suggestions or questions about this plugin, please send them to the email HIM603070@gmail.com
