灵枢 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

Pass

Install

openclaw plugins install clawhub:crusheart-autobrain-turbo

OpenClaw Version License Status

🦞 灵枢 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.

CapabilityWhat You Get
🧠 Long-term Memory5-layer memory (session → short-term → dream consolidation → archive → vector retrieval). Remembers who you are between sessions.
🛡️ Anti-HallucinationAuthority domain whitelist, knowledge assertion validation, multi-source cross-verification (16 engines).
🔄 Self-EvolutionLLM-as-Judge self-scoring + Reflexion reflection (failure pattern, root cause, fix strategy).
🎯 Dual-Mode + R-CCAMFast path for simple Q&A, deep reasoning for complex tasks. R-CCAM classifier for query complexity routing.
🔮 MASA Prediction-AlignmentPre-task difficulty/time/confidence estimation + post-task deviation analysis + feedback to self-evolution & parameter auto-tuning
8 Iron RulesPrevents "I thought so" mistakes — fact-check before answering, verify before acting.
🩺 Health CheckDaily cron (00:00) — engine status, disk space, gateway health, anomaly detection.
🔌 FailoverAuto-switch to backup model when primary fails. Circuit breaker prevents cascade failures.
🔀 Workflow OrchestrationMulti-skill coordination, conflict detection, task routing, rule engine.
📋 Context Capsule (DAG)DAG-based context management with incremental summarization. SQLite-backed, retains message dependencies.
🧠 Memory ConsolidationCLS complementarity learning + offline replay + interference merging + predictive conflict detection.
🔍 Enhanced RetrievalQuery 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's index.js calls child_process to 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

ArtifactPathPurpose
Plugin entryindex.jsBridges Python engines into OpenClaw lifecycle hooks
Plugin manifestopenclaw.plugin.jsonOpenClaw plugin registration
Engine bundlebundle/crusheart-core.tar.gz30+ Python engines + 10-stage pipeline
Skill metadataskill/_meta.jsonSkill marketplace registration
Skill docskill/SKILL.mdSkill documentation
Architecture docbundle/ARCHITECTURE.mdFull system architecture reference
Auto-deployed scriptsbundle/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.shPlugin 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)

VariablePurposeDefault
EMBEDDING_API_URLRemote embedding service URL(local TF-IDF fallback)
EMBEDDING_API_KEYBearer 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)

TimeNameDescription
0 1 * * *Daily Task Summary & System CleanupUnified task: health inspection + garbage cleanup + self-correction maintenance + memory maintenance + Dream scan + Replay distillation + execution review
0 5 * * *Engine Init + Version CheckReload 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