[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-94785":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":15,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":16,"rankGlobal":10,"rankLanguage":10,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":20,"hasPages":18,"topics":21,"createdAt":10,"pushedAt":10,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":15,"starSnapshotCount":15,"syncStatus":35,"lastSyncTime":36,"discoverSource":37},94785,"MasterAgent","OpenSparX\u002FMasterAgent","OpenSparX","Build AI agents that run 100% on-device. Sub-100ms latency on Qualcomm NPU. Zero cloud dependency.","https:\u002F\u002Fwww.opensparx.ai",null,"C++",344,17,1,0,43.77,"Other",false,"main",true,[22,23,24,25,26,27,28,29,30,31],"agent-framework","ai-agent","automotive","edge-ai","embedded","iot","llm","npu","on-device","qualcomm","2026-08-24 04:01:22","\u003Cdiv align=\"center\">\n\n\u003Cimg src=\"docs\u002Fimages\u002FOAK.png\" alt=\"OAK\" width=\"120\" \u002F>\n\n# 🌳 OAK — Open Agent Kernel\n\n**The Linux kernel for AI agents.**\u003Cbr>\nBuild agents that run 100% on-device. No cloud. No latency. No data leaks.\n\n构建 100% 端侧运行的 AI Agent。无云端依赖，无网络延迟，无数据泄露。\n\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache%202.0-blue.svg)](LICENSE)\n[![CI](https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent\u002Fworkflows\u002FCI\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent\u002Factions)\n[![Platform](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fplatform-CPU%20%7C%20Qualcomm%20NPU-green.svg)](#-supported-hardware)\n[![Version](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fversion-2.1.18-orange.svg)](https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent\u002Freleases)\n\n```bash\nnpm install -g @sparx\u002Fcli && sparx demo automotive\n```\n\n[Quick Start](#-quick-start) · [Why OAK?](#-why-oak) · [Docs](#-documentation) · [中文文档](#中文)\n\n\u003C\u002Fdiv>\n\n---\n\n## ⚡ 30-Second Demo\n\n```bash\n$ sparx demo automotive\n\n🚗 Automotive Voice Assistant\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\nYou: \"Turn on AC, set to 22°C, interior mode\"\n\n⚙️  Processing...\n├─ Intent: climate_control              ✓  0.02ms (deterministic)\n├─ Skills: ac.power, ac.temp, ac.mode   ✓\n├─ MCP: vehicle.climate                 ✓  87ms\n└─ Result: Climate control updated      ✓\n\n⚡ Total: 87ms | Route: deterministic | Model: not invoked\n```\n\nNo model was loaded. No GPU required. Pattern matching handled it in **0.02ms**.\n\n---\n\n## 🧠 Why OAK?\n\n\u003Ctable>\n\u003Ctr>\n\u003Ctd width=\"33%\">\n\n### ⚡ Sub-100ms\nNo network round-trip. 80% of requests resolve via pattern matching in **microseconds**. The other 20% run local LLM inference.\n\n\u003C\u002Ftd>\n\u003Ctd width=\"33%\">\n\n### 🔒 Private by Default\nData never leaves the device. No telemetry. No cloud calls. Encrypted-at-rest storage with device-bound keys.\n\n\u003C\u002Ftd>\n\u003Ctd width=\"33%\">\n\n### 🔋 NPU-Optimized\nDevelop on CPU anywhere. Deploy to Qualcomm NPU for **14× speedup** at **3.5× less power**. Same code, different backend.\n\n\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n### How OAK compares\n\n| | OAK | LangChain | AutoGPT | Apple Intelligence |\n|:---|:---:|:---:|:---:|:---:|\n| Runs 100% on-device | ✅ | ❌ | ❌ | ✅ |\n| Open source | ✅ | ✅ | ✅ | ❌ |\n| Crash recovery (WAL) | ✅ | ❌ | ❌ | ❌ |\n| Formal verification | ✅ | ❌ | ❌ | ❌ |\n| Multi-device mesh | ✅ | ❌ | ❌ | ❌ |\n| Speculative execution | ✅ | ❌ | ❌ | ❌ |\n| On-device learning | ✅ | ❌ | ❌ | ❌ |\n| NPU acceleration | ✅ | ❌ | ❌ | ✅ |\n| Latency (typical) | **87ms** | 2-5s | 3-10s | ~200ms |\n\n---\n\n## 🚀 Quick Start\n\n### Install\n\n```bash\n# npm (recommended)\nnpm install -g @sparx\u002Fcli\n\n# Homebrew (macOS)\nbrew install OpenSparX\u002Fmasteragent\u002Fsparx\n\n# curl (macOS \u002F Linux)\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002FOpenSparX\u002FMasterAgent\u002Fmain\u002Fscripts\u002Finstall.sh | sh\n```\n\n### Your First Agent in 60 Seconds\n\n```bash\n# Initialize\nsparx init my-agent && cd my-agent\n\n# Download a small model (530 MB)\nsparx pull qwen2.5-0.5b-instruct\n\n# Run\nsparx run\n```\n\nThat's it. Type a message:\n\n```\n> hello\n✓ route=deterministic  skill=hello  0.02ms\n\n> what's the weather like?\n✓ route=inference  ttft=142ms  total=1830ms  tokens=28\n  I don't have access to real-time weather data...\n```\n\n> **💡** `sparx run` works without a model — deterministic skills still respond. Only open-ended questions need one.\n\n---\n\n## 🏗️ Architecture\n\n```\n┌─────────────────────────────────────────────────────────────────┐\n│                         User Input                               │\n└──────────────────────────────┬──────────────────────────────────┘\n                               ▼\n┌──────────────────────────────────────────────────────────────────┐\n│  Preprocessing: UTF-8 normalize → parameter extract → memory     │\n└──────────────────────────────┬───────────────────────────────────┘\n                               ▼\n                    ┌─────────────────────┐\n                    │  Route Decision     │\n                    │  (80% deterministic │\n                    │   20% inference)    │\n                    └────┬──────────┬─────┘\n                         │          │\n              ┌──────────▼──┐  ┌───▼────────────┐\n              │ Skill Engine │  │ LLM Inference  │\n              │ (0.02ms)     │  │ (87ms NPU \u002F    │\n              │              │  │  1200ms CPU)   │\n              └──────────┬───┘  └───┬────────────┘\n                         │          │\n                         ▼          ▼\n              ┌────────────────────────────────────┐\n              │  Task Orchestrator (DAG execution)  │\n              │  + WAL Recovery + MCP Services      │\n              └────────────────────────────────────┘\n                               ▼\n              ┌────────────────────────────────────┐\n              │  Response (sub-100ms typical)       │\n              └────────────────────────────────────┘\n```\n\n\u003C!-- PLACEHOLDER_ARCHITECTURE_CONTINUED -->\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>📊 Full architecture diagram\u003C\u002Fb>\u003C\u002Fsummary>\n\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fimages\u002Fsparx-architecture.png\" alt=\"Architecture\" width=\"100%\" \u002F>\n\u003C\u002Fp>\n\u003C\u002Fdetails>\n\n**Design principles:**\n- **Deterministic first** — pattern matching handles 80% of requests at sub-ms latency\n- **Crash-safe** — WAL (Write-Ahead Log) with three terminal states: `COMMITTED`, `FAILED`, `UNKNOWN`\n- **Hardware-agnostic** — same code runs on CPU (dev) and NPU (production)\n- **Speculate ahead** — predict user's next intent and pre-compute during idle time\n\n---\n\n## 💎 Key Features\n\n### 🔮 Speculative Execution\n\nOAK predicts what you'll ask next and pre-computes the answer during idle NPU time.\n\n```\nYou: \"navigate to office\"     ← observed\n                               ↓ predictor: P(\"play music\") = 0.83\n                               ↓ pre-computes playlist response during idle\nYou: \"play my commute mix\"   ← cache HIT, 0.11μs response\n```\n\n| Metric | Value |\n|:---|---:|\n| Prediction (top-3) | 0.27 μs |\n| Cache hit (exact) | 0.11 μs |\n| Embedding similarity | 8.79 μs |\n| Cold-start threshold | 10 interactions |\n\n### 🛡️ Formal Plan Verification\n\nPlans are verified for safety **before** execution using CTL* model checking:\n\n```bash\n$ sparx plan verify plans\u002Fpayment-flow.yaml\n\nPlan Verification Report\n═══════════════════════════\n  ✓ PASS  auth-before-destructive          (12μs)\n  ✓ PASS  no-resource-deadlock             (8μs)\n  ✓ PASS  all-nodes-terminate              (15μs)\n  ✓ PASS  data-flow-integrity              (11μs)\n  ✗ FAIL  no-conflicting-destructive       (23μs)\n         → Node \"charge\" and \"refund\" conflict on resource \"wallet\"\n\n✗ Plan should NOT be executed. Fix conflicts first.\n```\n\n- CTL* temporal logic (AG, AF, AX, AU, EF, EX)\n- Partial-order reduction: **60% state-space reduction** on typical plans\n- Counterexample traces pinpoint the exact violation path\n- Runtime monitor for online verification during execution\n\n### 🌐 Agent Mesh Protocol\n\nZero-config multi-device collaboration. Your phone, laptop, and car share agent memory and route work to the most capable device:\n\n```bash\n$ sparx mesh status\n\nMesh: oak-home (3 peers, healthy)\n┌────────────────┬──────────┬───────┬────────┬─────────┐\n│ Device         │ NPU      │ RAM   │ Idle   │ Score   │\n├────────────────┼──────────┼───────┼────────┼─────────┤\n│ 🚗 Car (local) │ 45 TOPS  │ 16GB  │ yes    │ 0.92    │\n│ 📱 Phone       │ 12 TOPS  │ 8GB   │ no     │ 0.45    │\n│ 💻 Laptop      │ —        │ 32GB  │ yes    │ 0.38    │\n└────────────────┴──────────┴───────┴────────┴─────────┘\n\nCRDT sync: 142 keys, last sync 2s ago\nMerkle: roots match (no divergence)\n```\n\n- **mDNS\u002FDNS-SD** zero-config discovery (`_sparx-mesh._tcp.local.`)\n- **CRDT state sync**: GCounter, PNCounter, GSet, ORSet (add-wins), LWW-Register\n- **Merkle anti-entropy**: O(log K) divergence detection, not O(K) full scan\n- **Capability routing**: intent → best device by NPU TOPS, model, idle state\n- **Split inference**: partition large models across multiple NPU devices\n\n### 🧱 Crash Recovery (UNKNOWN State)\n\n**Industry first.** When an agent crashes mid-operation, the only honest answer is \"I don't know if it succeeded.\"\n\n```\n┌──────────┐     ┌──────────┐     ┌──────────────┐\n│ COMMITTED│     │  FAILED  │     │   UNKNOWN    │\n│ (success)│     │ (error)  │     │ (crashed     │\n│          │     │          │     │  mid-flight) │\n└──────────┘     └──────────┘     └──────────────┘\n                                         │\n                                         ▼\n                                  Manual reconciliation\n                                  required (sparx reconcile)\n```\n\nOther frameworks retry (duplicate charges) or ignore (lost money). OAK is honest.\n\n### 🧬 On-Device Continual Learning\n\nYour agent gets smarter with every correction — entirely on-device, with mathematical privacy guarantees.\n\n```bash\n$ sparx learn correct\n# Last response was wrong? Record a correction:\n# Original: \"Setting AC to 22°C\" → turned on heat\n# Correct:  \"Setting AC to 22°C\" → ac.setCooling(22)\n\n$ sparx learn status\n\nLearning Status\n═══════════════\n  Adapter:    v3 (merged 2 hours ago)\n  Corrections: 47 recorded, 38 trained\n  Privacy:    ε = 2.1 \u002F budget 8.0 (73% remaining)\n  Quality:    perplexity 12.3 → 11.1 (↓9.7%)\n  Next train: idle + charging + cool (estimated 3:00 AM)\n\n$ sparx learn train\n# ⚙️  QLoRA fine-tuning with DP-SGD...\n# ├─ Batch: 38 corrections\n# ├─ Privacy: Rényi DP, ε = 0.4 this round\n# ├─ Validation: perplexity 12.3 → 11.1 ✓ (improved)\n# └─ Adapter merged: v3 → v4\n```\n\n**Why this matters:**\n- **No cloud training** — corrections never leave the device\n- **Differential privacy** — DP-SGD with configurable ε budget, mathematically bounded information leakage\n- **Quality guard** — perplexity validation before\u002Fafter; auto-rollback on degradation\n- **Idle scheduling** — trains only when NPU idle + charging + thermally cool\n- **Progressive merge** — weighted adapter averaging prevents catastrophic forgetting\n\nThe more you use it, the better it gets. Your data stays yours.\n\n### 📚 More Features\n\n| Feature | Description |\n|:---|:---|\n| **Constrained Decoding** | GBNF grammar forces valid JSON — zero hallucinated tool calls |\n| **DAG Orchestrator** | Multi-step plan execution with dependency resolution |\n| **Deterministic Skills** | YAML-defined pattern matching, no model needed |\n| **NPU Acceleration** | Qualcomm QNN backend, 14× faster than CPU at 3.5× less power |\n\n---\n\n## Evaluation Results\n\n| Feature | Key Metric | Value | Baseline | Improvement |\n|---------|-----------|-------|----------|-------------|\n| Speculative Execution | Cache Hit Rate | **73.2%** | 0% (no speculation) | 3.71× latency speedup |\n| Agent Mesh | Convergence Rounds | **1–2 rounds** | Full-sync every round | 88% bandwidth savings |\n| Formal Verification | Unsafe Plan Detection | **71.4%** | No verification (100% escape) | 0% false positives |\n| On-Device Learning | Personalization Accuracy | **66.8%** | 5% (static model) | +61.8pp lift |\n| Constrained Decoding | Valid Output Rate | **100%** | 16.7% (unconstrained) | 83.3pp improvement |\n\n> Run `.\u002Feval\u002Frun_all.sh` to reproduce these results.\n\n---\n\n## Technical Report\n\n- [Technical Report](docs\u002FTECHNICAL_REPORT.md) — detailed evaluation methodology, results analysis, and system design decisions\n- [Why On-Device?](docs\u002FWHY_ON_DEVICE.md) — rationale for on-device agent execution over cloud-based alternatives\n\n---\n\n## Reproducing Results\n\n```bash\n# Build evaluation suite\ncd build && cmake .. -DBUILD_EVAL=ON && make -j$(nproc)\n# Run all evaluations\n.\u002Feval\u002Frun_all.sh\n# Results appear in eval\u002Fresults\u002F\n```\n\n---\n\n## 📦 Examples\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent.git\ncd MasterAgent\n```\n\n| Example | Path | Description |\n|:---|:---|:---|\n| 🚗 **Automotive** | `examples\u002Fautomotive_assistant\u002F` | Voice commands → vehicle control |\n| 🏠 **Smart Home** | `examples\u002Fsmart_home\u002F` | Multi-room device orchestration |\n| 📡 **IoT Edge** | `examples\u002Fiot_edge\u002F` | Battery-optimized sensor agent |\n\n```bash\ncd examples\u002Fautomotive_assistant && sparx run\n\n# \"Turn on AC, set to 22°C\"      → 87ms\n# \"Navigate to nearest charger\"   → 1.2s (inference)\n# \"What's my tire pressure?\"      → 0.03ms (deterministic)\n```\n\n---\n\n## 🔌 Supported Hardware\n\nDevelop on **any machine** (CPU). Deploy to NPU for production:\n\n| Platform | Backend | Latency | Power | Status |\n|:---|:---|---:|---:|:---:|\n| Mac \u002F Linux \u002F Windows | llama.cpp (CPU) | ~1,200ms | 8.1W | ✅ |\n| SA8155P \u002F SA8295P | Qualcomm QNN (NPU) | **87ms** | **2.3W** | ✅ |\n| SA8650P \u002F SA8775P | Qualcomm QNN (NPU) | ~70ms | ~2.0W | ✅ |\n| Snapdragon 8 Gen 3+ | Qualcomm QNN (NPU) | TBD | TBD | 🔄 Q4 2026 |\n\n---\n\n## 📐 Project Structure\n\n```\nMasterAgent\u002F\n├── cli\u002F                    # Sparx CLI (commands + strategic features)\n│   ├── include\u002F            # Public headers\n│   │   ├── sparx_speculative.h      # Speculative execution\n│   │   ├── sparx_formal_verify.h    # CTL* model checker\n│   │   ├── sparx_mesh.h             # Agent mesh protocol\n│   │   ├── sparx_learning.h         # Continual learning\n│   │   └── sparx_constrained_decode.h\n│   └── src\u002F                # Implementations (~5,500 LOC strategic features)\n├── include\u002Fmaster_agent\u002F   # Core kernel API\n│   ├── orchestrator\u002F       # DAG task execution\n│   ├── inference\u002F          # Model runtime abstraction\n│   ├── atomic_service\u002F     # MCP tool integration + WAL\n│   ├── intent\u002F             # Intent recognition engine\n│   ├── skill\u002F              # Deterministic skill engine\n│   ├── memory\u002F             # Short-term context\n│   └── transport\u002Fipc\u002F      # Inter-process communication\n├── src\u002F                    # Core kernel implementation (~40,000 LOC)\n├── tests\u002F                  # 19 test suites + 5 strategic feature tests\n├── examples\u002F               # Ready-to-run example agents\n├── docs\u002F                   # Architecture docs + ROADMAP\n└── .github\u002Fworkflows\u002F      # CI\u002FCD (8-platform release)\n```\n\n---\n\n## 🗺️ Roadmap\n\nSee [docs\u002FROADMAP_v3.md](docs\u002FROADMAP_v3.md) for the full plan.\n\n| Version | Target | Key Features |\n|:---|:---|:---|\n| ~~v2.0~~ | ~~2025~~ | ✅ Core kernel, WAL, MCP, NPU |\n| ~~v2.1~~ | ~~Aug 2026~~ | ✅ Speculation, Verification, Mesh, Learning |\n| **v3.0** | Q4 2026 | Neural predictor (LSTM), CEGAR, BLE mesh |\n| **v3.1** | Q1 2027 | Intent-aware speculation, causal broadcast |\n| **v3.2** | Q2 2027 | mTLS mesh, adaptive Merkle, observability |\n| **v3.3** | Q3 2027 | WAN relay, federated learning, heterogeneous compute |\n\n---\n\n## 📚 Documentation\n\n| Doc | Description |\n|:---|:---|\n| [System Overview](docs\u002FSYSTEM_OVERVIEW.md) | Architecture deep-dive |\n| [Build & Test](docs\u002FBUILD_AND_TEST.md) | Compilation from source |\n| [WAL Recovery](docs\u002FWAL_RECOVERY.md) | Crash recovery mechanism |\n| [MCP Services](docs\u002FMCP_SERVICES.md) | Adding custom tool capabilities |\n| [Qualcomm NPU](docs\u002FQUALCOMM_NPU.md) | QNN SDK integration |\n| [v3.x Roadmap](docs\u002FROADMAP_v3.md) | Future direction |\n\n---\n\n## 🤝 Contributing\n\nWe welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n```bash\n# Clone and build\ngit clone https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent.git\ncd MasterAgent\ncmake -B build -DCMAKE_BUILD_TYPE=Release\ncmake --build build -j$(nproc)\n\n# Run tests\nctest --test-dir build --output-on-failure\n```\n\n**Good first issues:** [GitHub Issues](https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent\u002Flabels\u002Fgood%20first%20issue)\n\n---\n\n## ❓ FAQ\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Do I need Qualcomm hardware?\u003C\u002Fb>\u003C\u002Fsummary>\nNo. Develop with CPU inference (llama.cpp) on any machine. NPU is optional for production.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>What models work?\u003C\u002Fb>\u003C\u002Fsummary>\nAny GGUF model: Qwen2\u002F3, Llama 3, Mistral, Phi, etc. For NPU: models need QNN conversion.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Is this production-ready?\u003C\u002Fb>\u003C\u002Fsummary>\nYes. 19 test suites, WAL crash recovery, formal verification. Deployed on SA8295P vehicles.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>How is this different from LangChain?\u003C\u002Fb>\u003C\u002Fsummary>\nLangChain orchestrates cloud API calls. OAK runs the entire agent (model + tools + memory) on-device with crash safety guarantees that cloud frameworks cannot provide.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cb>Can I use it for non-automotive apps?\u003C\u002Fb>\u003C\u002Fsummary>\nYes — smart home, robotics, IoT, medical devices, industrial automation. The automotive demo is just the showcase.\n\u003C\u002Fdetails>\n\n---\n\n## 📄 License\n\nApache 2.0 — see [LICENSE](LICENSE)\n\n---\n\n## 💬 Community\n\n- [GitHub Discussions](https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent\u002Fdiscussions)\n- [GitHub Issues](https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent\u002Fissues)\n- Email: dev@opensparc.com\n\n---\n\n\u003Cdiv align=\"center\">\n\n**Ready to build?**\n\n```bash\nnpm install -g @sparx\u002Fcli && sparx init my-agent\n```\n\n[⭐ Star this repo](https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent) · [📖 Read the docs](docs\u002F) · [💬 Join the discussion](https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent\u002Fdiscussions)\n\n\u003C\u002Fdiv>\n\n---\n---\n\n\u003Ca name=\"中文\">\u003C\u002Fa>\n\n\u003Cdiv align=\"center\">\n\n# 🌳 OAK — 开放智能体内核\n\n**AI Agent 的 Linux 内核。**\u003Cbr>\n构建 100% 端侧运行的智能体。无云端，无延迟，无数据泄露。\n\n```bash\nnpm install -g @sparx\u002Fcli && sparx demo automotive\n```\n\n[快速开始](#-快速开始-1) · [为什么选 OAK](#-为什么选-oak) · [English](#-quick-start)\n\n\u003C\u002Fdiv>\n\n---\n\n## 🧠 为什么选 OAK？\n\n| | OAK | LangChain | AutoGPT |\n|:---|:---:|:---:|:---:|\n| 100% 端侧运行 | ✅ | ❌ | ❌ |\n| 崩溃恢复 (WAL) | ✅ | ❌ | ❌ |\n| 形式化验证 | ✅ | ❌ | ❌ |\n| 多设备 Mesh | ✅ | ❌ | ❌ |\n| 投机执行 | ✅ | ❌ | ❌ |\n| 端侧自学习 | ✅ | ❌ | ❌ |\n| 典型延迟 | **87ms** | 2-5s | 3-10s |\n\n**核心理念：** OAK 之于 Agent OS，如同 Linux 内核之于 Android\u002FUbuntu。我们不做完整操作系统 — 我们提供开源内核层，车企、手机厂商、机器人公司基于 OAK 自研专属 Agent OS。\n\n---\n\n## ⚡ 快速开始\n\n```bash\n# 安装\nnpm install -g @sparx\u002Fcli\n\n# 初始化项目\nsparx init my-agent && cd my-agent\n\n# 下载模型（530MB，1-2 分钟）\nsparx pull qwen2.5-0.5b-instruct\n\n# 运行\nsparx run\n```\n\n```\n> 你好\n✓ route=deterministic  skill=hello  0.02ms  (未调用模型)\n\n> 法国的首都是哪里？\n✓ route=inference  ttft=142ms  total=1830ms  tokens=28\n  法国的首都是巴黎。\n```\n\n> **💡** 不装模型也能用 — 确定性技能照常工作，只有开放问题需要模型。\n\n---\n\n## 💎 核心特性\n\n### 🔮 投机执行 — 预测你的下一步\n\n预测用户意图，NPU 空闲时预计算结果。命中缓存时 **0.11 μs** 响应。\n\n### 🛡️ 形式化验证 — 执行前证明安全\n\nCTL* 模型检查 + 偏序归约，在执行前验证计划不会死锁、不会越权、不会超时。\n\n### 🌐 Agent Mesh — 零配置多设备协作\n\nmDNS 发现 + CRDT 状态同步 + Merkle 反熵。你的手机、车机、电脑自动组网，将任务路由到最强设备。\n\n### 🧱 UNKNOWN 终态 — 业界首创\n\nAgent 崩溃时不盲目重试（重复扣费），不静默忽略（钱丢了）。进入 UNKNOWN 状态，要求显式对账。\n\n### 🧬 端侧自学习 — 越用越聪明\n\n每次纠正都让 Agent 变强，完全在设备上完成，数学保证隐私：\n\n- **QLoRA 微调** — 纠正 → 训练 → adapter 合并，全流程端侧\n- **差分隐私** — DP-SGD + Rényi 隐私预算，信息泄露有数学上界\n- **质量守门** — 训练前后验证困惑度，退步自动回滚\n- **空闲调度** — 仅在 NPU 空闲 + 充电 + 温控正常时训练\n- **渐进合并** — 加权平均防止灾难性遗忘\n\n你的数据永远不离开设备。用得越多，越懂你。\n\n### 📚 更多特性\n\n| 特性 | 说明 |\n|:---|:---|\n| 约束解码 | GBNF 语法强制有效 JSON，零幻觉工具调用 |\n| DAG 编排 | 多步计划执行，带依赖解析 |\n| 确定性路由 | 80% 请求不过模型，微秒级响应 |\n\n---\n\n## 🔌 支持平台\n\n| 平台 | 后端 | 延迟 | 功耗 | 状态 |\n|:---|:---|---:|---:|:---:|\n| Mac \u002F Linux \u002F Windows | llama.cpp (CPU) | ~1,200ms | 8.1W | ✅ |\n| SA8155P \u002F SA8295P \u002F SA8650P | Qualcomm QNN | **87ms** | **2.3W** | ✅ |\n| Snapdragon 8 Gen 3+ | Qualcomm QNN | 待测 | 待测 | 🔄 2026 Q4 |\n\n---\n\n## 📦 示例\n\n| 示例 | 路径 | 说明 |\n|:---|:---|:---|\n| 🚗 车载助手 | `examples\u002Fautomotive_assistant\u002F` | 语音 → 车控 |\n| 🏠 智能家居 | `examples\u002Fsmart_home\u002F` | 多房间设备编排 |\n| 📡 IoT 边缘 | `examples\u002Fiot_edge\u002F` | 电池优化传感器 Agent |\n\n---\n\n## 🗺️ 路线图\n\n| 版本 | 时间 | 关键特性 |\n|:---|:---|:---|\n| ~~v2.0~~ | ~~2025~~ | ✅ 内核、WAL、MCP、NPU |\n| ~~v2.1~~ | ~~2026.8~~ | ✅ 投机执行、验证、Mesh、学习 |\n| **v3.0** | 2026 Q4 | 神经预测器、CEGAR、BLE Mesh |\n| **v3.1** | 2027 Q1 | 意图感知投机、因果广播 |\n| **v3.2** | 2027 Q2 | mTLS Mesh、自适应 Merkle |\n| **v3.3** | 2027 Q3 | WAN 中继、联邦学习 |\n\n详见 [docs\u002FROADMAP_v3.md](docs\u002FROADMAP_v3.md)\n\n---\n\n## 📚 文档\n\n- [系统概述](docs\u002F01_系统概述.md)\n- [构建和测试](docs\u002F10_构建运行与测试.md)\n- [WAL 恢复机制](docs\u002FWAL_RECOVERY_zh-CN.md)\n- [MCP 服务开发](docs\u002FMCP_SERVICES_zh-CN.md)\n- [Qualcomm NPU 集成](docs\u002FQUALCOMM_NPU_zh-CN.md)\n\n---\n\n## 🤝 贡献\n\n欢迎贡献！详见 [CONTRIBUTING_zh-CN.md](CONTRIBUTING_zh-CN.md)\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002FOpenSparX\u002FMasterAgent.git\ncd MasterAgent\ncmake -B build -DCMAKE_BUILD_TYPE=Release\ncmake --build build -j$(nproc)\nctest --test-dir build --output-on-failure\n```\n\n---\n\n## 📄 许可证\n\nApache 2.0 — 见 [LICENSE](LICENSE)\n\n---\n\n\u003Cdiv align=\"center\">\n\n**立即开始 ↓**\n\n```bash\nnpm install -g @sparx\u002Fcli && sparx init my-agent\n```\n\n\u003C\u002Fdiv>\n","OAK（Open Agent Kernel）是一个专为端侧AI智能体设计的轻量级运行时框架，支持100%本地化执行，无需云端依赖。其核心特性包括：基于模式匹配与本地小模型协同的亚100ms低延迟响应（典型87ms），针对高通NPU深度优化（14×加速、3.5×能效提升），内置形式化验证、WAL崩溃恢复与多设备Mesh组网能力。适用于车载语音助手、工业IoT控制、隐私敏感型边缘交互等对实时性、安全性与离线可靠性要求严苛的嵌入式场景。",2,"2026-08-16 02:30:03","CREATED_QUERY"]