Local Self-Healing Machine Learning

👤 josephtandle 📦 v2.0.1 ⭐ 4.4 ⬇️ 1.1K 下载
🤖 AI-Agent 免费

📖 技能介绍


name: local-self-healing-machine-learning description: A fully local machine learning engine that makes your OpenClaw agent smart over time — without ever calling home, revealing your machine ID, or exposing any security holes. tags: [machine-learning, self-healing, ai, core, local, embeddings] author: Joe Che (https://mastermindshq.business)

访问小葱技能站7w4.net,解锁更多实用的AI技能插件。


Local Self-Healing Machine Learning

"Your agent learns from its own mistakes — without ever calling home, revealing your machine ID, or exposing any security holes."

A fully local machine learning engine that makes your OpenClaw agent smart over time. It watches your agent's runtime history, detects recurring failures, clusters similar errors using semantic embeddings, and autonomously evolves fix strategies — all running 100% on your machine with zero network calls.

The engine uses a feedback loop that tracks whether each fix actually works: after 3 clean cycles a fix is marked "proven", and if the error comes back within 5 cycles it's marked "failed". A k-NN predictor learns from these outcomes and gets better at picking the right fix over time. Lessons compound in a persistent knowledge base that never decays — the longer it runs, the smarter it gets.

Every evolution is auditable through the GEP (Genetic Evolution Protocol), which produces structured, content-hashed assets: genes (reusable fix strategies), capsules (successful evolution records), and an append-only event log. You can inspect exactly what changed, why it changed, and whether it worked.

No telemetry. No fingerprinting. No cloud dependencies. No data leaves your device.

ML Capabilities

  • Feedback Loop: Tracks whether fixes actually work. After 3 clean cycles, a fix is "proven". If the error recurs within 5 cycles, the fix is marked "failed".
  • Embedding-Based Error Clustering: Uses Ollama + llama3.2:3b to generate semantic embeddings for error messages. Similar errors are clustered together instead of matched by regex.
  • Success Predictor: k-NN classifier trained on feedback data. Predicts which gene will fix a given error cluster. Gets better over time.
  • Persistent Knowledge Base: Lessons compound forever. No decay. Confidence scores adjust with each outcome.

Dashboard

View your ML engine's status, training progress, and knowledge base in a local web dashboard:

node index.js --dashboard

Opens at http://localhost:8420. Shows feedback loop stats, predictor training progress, error clusters, knowledge base health, and recent evolution events. No external dependencies — runs entirely in your browser.

Optional: Ollama Integration

For semantic error matching (recommended but not required):

# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh

# Pull the embedding model
ollama pull llama3.2:3b

Without Ollama, the engine falls back to regex-based heuristics. Everything still works — you just get smarter matching with it.

Usage

Standard Run (Automated)

node index.js

Review Mode (Human-in-the-Loop)

node index.js --review

Continuous Loop

node index.js --loop

Configuration

Environment Variable Default Description
EVOLVE_ALLOW_SELF_MODIFY false Allow evolution to modify its own source code. Not recommended.
EVOLVE_LOAD_MAX 2.0 Maximum 1-minute load average before backing off.
EVOLVE_STRATEGY balanced Strategy: balanced, innovate, harden, repair-only, early-stabilize, steady-state, or auto.
OLLAMA_URL http://localhost:11434 Ollama API endpoint for embeddings.
OLLAMA_EMBED_MODEL llama3.2:3b Model to use for embeddings.
LSHML_DASHBOARD_PORT 8420 Port for the standalone dashboard server.

How It Works

  1. Signal Extraction: Scans logs for errors, feature requests, performance issues (19 signal types, 4 languages)
  2. ML Clustering: Groups similar errors using embedding vectors (or regex fallback)
  3. Gene Selection: Picks the best fix strategy using knowledge base + k-NN predictor
  4. Evolution: Applies the fix with blast radius protection, validation, and rollback
  5. Feedback: Monitors subsequent cycles to verify the fix holds
  6. Learning: Records outcomes to knowledge base — proven fixes get higher confidence

Data Files

All data stays local in memory/:

File Purpose
feedback.jsonl Fix outcome tracking (append-only)
embeddings-cache.json Cached embedding vectors
knowledge.json Persistent lessons (no decay)
predictor.json Trained model weights
cluster-registry.json Semantic error cluster map

GEP Protocol (Auditable Evolution)

Every evolution produces structured, auditable assets:

  • assets/gep/genes.json: Reusable fix strategies
  • assets/gep/capsules.json: Successful evolution records
  • assets/gep/events.jsonl: Append-only audit trail

Safety

  • Blast radius limits (max files/lines changed per cycle)
  • Critical path protection (cannot modify itself or core configs)
  • Validation commands run before committing
  • Canary check (index.js must still load)
  • Ethics committee (blocks dangerous patterns)
  • Full rollback on any failure

Author

Built by Joe Che

License

MIT

🤖 AI 评测

整体质量优秀,代码规范、测试完善、安全考虑周到。开箱即用时非常可靠,无需担心隐私泄露。主要小问题是界面稍显复杂,但核心功能扎实稳定,是一个值得信赖的本地智能工具。

📊 多维度评分

适应性4.2
规范性4.2
有效性4.7
可靠性4.5
可信度4.4

📁 包含文件 (72 个)

📄 SECURITY.md 3.5 KB
📄 SKILL.md 5.2 KB
📄 _meta.json 154 B
📄 dashboard/index.html 18 KB
📄 dashboard/server.js 3.8 KB
📄 index.js 13.4 KB
📄 memory/knowledge.json 708 B
📄 package.json 942 B
📄 scripts/analyze_by_skill.js 4.7 KB
📄 scripts/extract_log.js 2.5 KB
📄 scripts/generate_history.js 2.5 KB
📄 scripts/gep_append_event.js 3 KB
📄 scripts/gep_personality_report.js 7.7 KB
📄 scripts/human_report.js 5.7 KB
📄 scripts/suggest_version.js 3 KB
📄 scripts/validate-modules.js 437 B
📄 src/evolve.js 64.6 KB
📄 src/gep/a2a.js 6.3 KB
📄 src/gep/a2aProtocol.js 7.1 KB
📄 src/gep/analyzer.js 988 B
📄 src/gep/assetCallLog.js 3.4 KB
📄 src/gep/assetStore.js 13.2 KB
📄 src/gep/assets.js 1.1 KB
📄 src/gep/bridge.js 2 KB
📄 src/gep/candidates.js 6.2 KB
📄 src/gep/contentHash.js 2.1 KB
📄 src/gep/deviceId.js 1 KB
📄 src/gep/envFingerprint.js 830 B
📄 src/gep/hubSearch.js 532 B
📄 src/gep/llmReview.js 609 B
📄 src/gep/memoryGraph.js 26.9 KB
📄 src/gep/memoryGraphAdapter.js 856 B
📄 src/gep/mutation.js 6.7 KB
📄 src/gep/narrativeMemory.js 3.7 KB
📄 src/gep/paths.js 2.5 KB
📄 src/gep/personality.js 13.2 KB
📄 src/gep/prompt.js 22.6 KB
📄 src/gep/questionGenerator.js 139 B
📄 src/gep/reflection.js 4.2 KB
📄 src/gep/sanitize.js 2.2 KB
📄 src/gep/selector.js 10.6 KB
📄 src/gep/signals.js 19.8 KB
📄 src/gep/skillDistiller.js 19.5 KB
📄 src/gep/solidify.js 59 KB
📄 src/gep/strategy.js 4.4 KB
📄 src/gep/taskReceiver.js 517 B
📄 src/gep/validationReport.js 2.1 KB
📄 src/ml/embeddings.js 6.1 KB
📄 src/ml/errorClassifier.js 4.3 KB
📄 src/ml/feedbackLoop.js 4.7 KB
📄 src/ml/knowledgeBase.js 4.6 KB
📄 src/ml/predictor.js 4.7 KB
📄 src/ml/trainer.js 1.2 KB
📄 src/ops/cleanup.js 2.5 KB
📄 src/ops/commentary.js 1.7 KB
📄 src/ops/index.js 333 B
📄 src/ops/innovation.js 3.1 KB
📄 src/ops/self_repair.js 3.1 KB
📄 src/ops/skills_monitor.js 5.3 KB
📄 src/ops/trigger.js 837 B
📄 test/contentHash.test.js 3.5 KB
📄 test/embeddings.test.js 1.8 KB
📄 test/feedbackLoop.test.js 3.6 KB
📄 test/knowledgeBase.test.js 4.1 KB
📄 test/mutation.test.js 4.6 KB
📄 test/predictor.test.js 788 B
📄 test/sanitize.test.js 3.9 KB
📄 test/selector.test.js 4.1 KB
📄 test/signals.test.js 9.9 KB
📄 test/skillDistiller.test.js 16.9 KB
📄 test/strategy.test.js 4.8 KB
📄 test/validationReport.test.js 4.8 KB