π The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
ADR-058: Self-Contained Ruflo RVF Appliance β Linux Kernel + Claude Code + ruvLLM
| Field | Value |
|---|---|
| Status | Proposed |
| Date | 2026-02-28 |
| Authors | Claude Flow Team |
| Supersedes | β |
| Related | ADR-057 (RVF Native Storage), ADR-054 (RVF Plugin Marketplace), ADR-056 (agentic-flow v3 Integration), ADR-017 (RuVector Integration) |
1. Context
The Problem
Ruflo v3.5 requires the user to have Node.js 20+, npm, Claude Code CLI, API keys, and a properly configured OS environment. This means:
- 10+ setup steps before a user can run their first agent swarm
- Network dependency at runtime for API calls, npm installs, MCP server downloads
- Environment drift between dev, CI, staging, and production
- No offline capability β the system is unusable without internet
- Reproducibility gaps β "works on my machine" across OS, Node, and npm versions
The Vision
A single ruflo.rvf file that contains everything needed to run the full Ruflo platform:
ruflo.rvf (self-contained appliance)
βββ Linux microkernel (Alpine-based, ~5MB)
βββ Node.js 22 runtime (~30MB stripped)
βββ Claude Code CLI
βββ Ruflo v3.5+ (all packages)
βββ ruvLLM local inference OR API key vault
βββ AgentDB with HNSW indexes
βββ Pre-trained SONA patterns
βββ 60+ agent definitions
βββ MCP server (pre-configured)
βββ Capability verification suite
One file. No install. No dependencies. Works offline with ruvLLM, or connects to cloud APIs.
Why RVF as the Container Format
The RVF (RuVector Format) binary format from ADR-057 already provides:
| RVF Feature | Appliance Use |
|---|---|
Magic bytes (RVF\0, RVEC, RVFL, RVLS) |
Section identification within appliance |
| Header + payload binary layout | Metadata + compressed filesystem layers |
| Atomic write (tmp + rename) | Safe appliance updates |
| CRC32/SHA256 integrity | Appliance verification |
| Streaming reads | Boot without full decompression |
Extending RVF to RVFA (RuVector Format Appliance) creates a unified format that Ruflo already understands natively.
2. Decision
2.1 Appliance Format: RVFA (RuVector Format Appliance)
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Magic: RVFA (4 bytes) β
β Version: u32 (4 bytes) β
β Header Length: u32 (4 bytes) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Header (JSON): β
β name, version, created, arch, platform β
β sections: [{ id, type, offset, size, sha256 }]β
β boot: { entrypoint, args, env } β
β models: { provider, engine, config } β
β capabilities: [list of verified caps] β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Section 0: KERNEL (compressed rootfs) β
β Alpine Linux 3.23 minimal + busybox β
β /sbin/init β ruflo-init (PID 1) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Section 1: RUNTIME (compressed) β
β Node.js 22 (stripped, no npm) β
β Claude Code CLI binary β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Section 2: RUFLO (compressed) β
β @claude-flow/cli + shared + guidance β
β All 26 commands, 140+ subcommands β
β 60+ agent definitions β
β 17 hooks + 12 workers β
β MCP server (pre-configured, stdio + SSE) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Section 3: MODELS (compressed, optional) β
β ruvLLM engine (GGUF quantized models) β
β OR: encrypted API key vault (.env.enc) β
β OR: hybrid (local small + cloud large) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Section 4: DATA (RVF native) β
β AgentDB with pre-built HNSW indexes β
β Pre-trained SONA patterns β
β Plugin registry snapshot β
β Capability verification checksums β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Section 5: VERIFY (plaintext) β
β Built-in capability test suite β
β Expected results manifest β
β Self-test entrypoint β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Footer: SHA256 of all sections (32 bytes) β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
2.2 Model Strategy: ruvLLM + API Key Vault
Three model configurations, selected at build time:
| Profile | Models Included | Size | Offline | Use Case |
|---|---|---|---|---|
offline |
ruvLLM + Qwen2.5-Coder-3B-Q4 + Phi-3-mini-Q4 | ~4GB | Full | Air-gapped, edge, demos |
hybrid |
ruvLLM + Phi-3-mini-Q4 + API vault | ~2GB | Partial | Local routing + cloud for complex tasks |
cloud |
API key vault only (no local models) | ~80MB | No | Minimal size, full cloud |
ruvLLM is the local language model inference engine from the RuVector ecosystem. It extends the existing @ruvector packages (core, router, sona, attention) with on-device LLM inference:
ruvLLM Architecture (extends @ruvector):
βββ @ruvector/core β vector database, Q-learning router, AST analysis
βββ @ruvector/router β ML-based intelligent task routing (~80% accuracy)
βββ @ruvector/sona β Self-Optimizing Neural Architecture (<0.05ms)
βββ @ruvector/attention β Flash Attention (2.49x-7.47x speedup)
βββ @ruvector/micro-hnsw-wasm β HNSW vector search (WASM)
βββ ruvLLM (new):
βββ GGUF model loader (llama.cpp compatible)
βββ KV-cache with RVF persistence
βββ Token streaming over stdio/SSE
βββ Automatic model selection by task complexity
β βββ Tier 1: Agent Booster (WASM, <1ms) β simple transforms
β βββ Tier 2: Phi-3-mini-Q4 (local, ~200ms) β routing, classification
β βββ Tier 3: Qwen2.5-Coder-3B-Q4 (local, ~2s) β code generation
βββ Fallback to cloud API if local confidence < threshold
ruvLLM bridges the gap between RuVector's vector intelligence (search, routing, learning) and full language model inference, keeping everything in the same ecosystem.
API Key Vault (for cloud profiles):
.env.enc (AES-256-GCM encrypted)
βββ ANTHROPIC_API_KEY β Claude Sonnet/Opus
βββ OPENAI_API_KEY β GPT-4/Codex (dual-mode)
βββ GOOGLE_API_KEY β Gemini (fallback)
βββ Decryption: passphrase at boot OR hardware key
2.3 Boot Sequence
1. ruflo-appliance load ruflo.rvf
2. Verify RVFA magic bytes + footer SHA256
3. Extract KERNEL section β mount as rootfs
4. Extract RUNTIME section β /usr/local/bin/
5. Extract RUFLO section β /opt/ruflo/
6. Mount DATA section (read-write overlay)
7. Load MODELS section:
- If ruvLLM: start inference server on unix socket
- If API vault: decrypt keys, set env vars
- If hybrid: start local + configure cloud fallback
8. Run VERIFY section β self-test all capabilities
9. Start MCP server (stdio or SSE based on config)
10. Ready for agent orchestration
2.4 Execution Modes
| Mode | Command | Description |
|---|---|---|
| Run | ruflo-appliance run ruflo.rvf |
Boot and enter interactive CLI |
| MCP | ruflo-appliance mcp ruflo.rvf |
Boot as MCP server (stdio) |
| Verify | ruflo-appliance verify ruflo.rvf |
Run full capability test suite |
| Extract | ruflo-appliance extract ruflo.rvf ./out/ |
Unpack all sections |
| Build | ruflo-appliance build --profile offline |
Create new appliance |
| Update | ruflo-appliance update ruflo.rvf --section RUFLO |
Hot-patch one section |
| Inspect | ruflo-appliance inspect ruflo.rvf |
Show header + section manifest |
2.5 Runtime Isolation
The appliance runs in one of three isolation levels:
| Level | Technology | Overhead | Security |
|---|---|---|---|
| Container | OCI/Docker (default) | ~50MB RAM | Namespace + cgroup isolation |
| MicroVM | Firecracker/Cloud Hypervisor | ~128MB RAM | Full VM isolation |
| Native | Direct execution (dev only) | ~30MB RAM | Process-level only |
Container mode (default):
# The .rvf file IS the container image
ruflo-appliance run ruflo.rvf
# Equivalent to:
# docker run --rm -it ruflo:self-contained
3. Capability Verification Suite
The appliance includes a built-in verification suite that tests every capability of Ruflo + Claude Flow. This runs automatically at boot (Section 5: VERIFY) and can be triggered manually.
3.1 Test Categories (25 Categories, 80+ Checks)
| # | Category | Critical Checks | What It Proves |
|---|---|---|---|
| 1 | CLI Core | --version, --help, version match |
Binary integrity |
| 2 | Doctor | 14 health checks, --fix |
System diagnostics |
| 3 | Init System | settings.json, helpers, agent teams config | Project scaffolding |
| 4 | Memory Operations | store, list, search, retrieve, delete, TTL | AgentDB + RVF backend |
| 5 | Config Management | show, get, set, list | Configuration system |
| 6 | Session Management | start, status, end, list | Session persistence |
| 7 | Agent System | list, spawn, status, pool | Agent lifecycle |
| 8 | Swarm Coordination | init, status, topologies | Multi-agent orchestration |
| 9 | Task System | create, list, assign | Task management |
| 10 | Hooks System | list, route, pre-task, workers, statusline | Self-learning pipeline |
| 11 | Security | scan, audit, validate | Input validation, CVE checks |
| 12 | Performance | metrics, benchmark | Profiling |
| 13 | Neural/Intelligence | status, patterns | SONA + MoE |
| 14 | Embeddings | embed, search | Vector generation |
| 15 | Workflow System | list, templates | Workflow engine |
| 16 | Daemon | status, start | Background workers |
| 17 | Claims Authorization | list, check | RBAC |
| 18 | Migration | status | V2βV3 migration |
| 19 | Plugins | list | Plugin registry |
| 20 | MCP Server | help, list, stdio transport | MCP protocol |
| 21 | Completions | bash, zsh | Shell integration |
| 22 | Status | system status | Health monitoring |
| 23 | Hive-Mind | status | Byzantine consensus |
| 24 | Process Management | list | Background processes |
| 25 | Cross-Feature Integration | storeβsearchβretrieveβdelete cycle | End-to-end data flow |
3.2 Appliance-Specific Tests (Additional)
| # | Category | Checks | What It Proves |
|---|---|---|---|
| 26 | RVF Format | magic bytes, header parse, section integrity | Binary format correctness |
| 27 | ruvLLM Inference | model load, tokenize, generate, stream | Local LLM works offline |
| 28 | API Vault | decrypt, key validation, provider connectivity | Cloud API access |
| 29 | Boot Integrity | SHA256 verification, section checksums | Tamper detection |
| 30 | Isolation | namespace check, cgroup limits, filesystem | Security boundaries |
| 31 | Agent Swarm E2E | spawn 4 agents β coordinate β produce output | Full orchestration |
| 32 | MCP E2E | JSON-RPC init β tool call β response | Protocol compliance |
| 33 | Persistence | write data β reboot β verify data survives | RVF durability |
| 34 | Offline Mode | disconnect network β run full workflow | Air-gap capability |
| 35 | Hot Update | patch RUFLO section β verify new version | Live update |
3.3 Test Output Format
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Ruflo Appliance v3.5.2 β Full Capability Verification β
β Format: RVFA v1 | Profile: offline | Arch: x86_64 β
β Kernel: Alpine 3.23 | Node: 22.22.0 | ruvLLM: 0.1.0 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββ 1. CLI Core βββ
β ruflo --version
β ruflo --help
β version is 3.5.2
βββ 2. Doctor βββ
β doctor runs (14/14 checks)
...
βββ 26. RVF Format βββ
β RVFA magic bytes valid
β header JSON parses correctly
β all 6 sections present
β section SHA256 checksums match
β footer hash matches computed hash
βββ 27. ruvLLM Inference βββ
β model loaded (Phi-3-mini-Q4, 2.3GB)
β tokenizer functional (32000 vocab)
β generation produces valid output
β streaming tokens arrive in <100ms
β KV-cache persists across calls
ββββββββββββββββββββββββββββββββββββββββββββββββββ
RESULTS: 95/95 passed, 0 failed, 3 warnings
β
APPLIANCE FULLY VERIFIED
ββββββββββββββββββββββββββββββββββββββββββββββββββ
4. Build Pipeline
4.1 Build Command
# Build offline appliance (includes local models)
ruflo-appliance build \
--profile offline \
--arch x86_64 \
--models "phi-3-mini-q4,qwen2.5-coder-3b-q4" \
--output ruflo-offline.rvf
# Build cloud appliance (API keys only)
ruflo-appliance build \
--profile cloud \
--api-keys .env \
--output ruflo-cloud.rvf
# Build hybrid appliance
ruflo-appliance build \
--profile hybrid \
--models "phi-3-mini-q4" \
--api-keys .env \
--output ruflo-hybrid.rvf
4.2 Build Stages
Stage 1: KERNEL
βββ Pull alpine:3.23 rootfs
βββ Install busybox, dumb-init
βββ Strip to <5MB
βββ Compress with zstd -19
Stage 2: RUNTIME
βββ Download Node.js 22 (linux-x64-musl)
βββ Strip debug symbols, remove npm/corepack
βββ Include Claude Code CLI binary
βββ Compress (~30MB β ~12MB)
Stage 3: RUFLO
βββ npm pack ruflo@latest --omit=optional
βββ Include all CLI commands + agent defs
βββ Pre-configure MCP server
βββ Compress (~9MB β ~3MB)
Stage 4: MODELS (profile-dependent)
βββ offline: Download GGUF models, build ruvLLM
βββ hybrid: Download small model + encrypt keys
βββ cloud: Encrypt API keys only
Stage 5: DATA
βββ Initialize AgentDB with RVF backend
βββ Build HNSW indexes for default patterns
βββ Snapshot pre-trained SONA weights
βββ Cache plugin registry
Stage 6: VERIFY
βββ Bundle test script (sh, no dependencies)
βββ Generate expected-results manifest
βββ Include checksum of all sections
Final: Assemble RVFA
βββ Write magic + version + header
βββ Append all sections with offsets
βββ Compute and append footer SHA256
βββ Output: ruflo.rvf
4.3 Size Targets
| Profile | Sections | Compressed Size |
|---|---|---|
cloud |
Kernel + Runtime + Ruflo + Data + Verify | ~60MB |
hybrid |
All + Phi-3-mini-Q4 | ~2GB |
offline |
All + Phi-3 + Qwen2.5-Coder-3B | ~4GB |
5. Architecture
5.1 Component Diagram
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ruflo.rvf (RVFA) β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β KERNEL: Alpine Linux 3.23 (~5MB) β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β RUNTIME: Node.js 22 + Claude Code CLI β β β
β β β βββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β β RUFLO v3.5+ ββ β β
β β β β βββ 26 CLI commands (140+ subcommands) ββ β β
β β β β βββ 60+ agent definitions ββ β β
β β β β βββ 17 hooks + 12 workers ββ β β
β β β β βββ MCP server (215 tools) ββ β β
β β β β βββ AgentDB + HNSW (RVF backend) ββ β β
β β β β βββ Security + Claims + Plugins ββ β β
β β β βββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β βββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β β MODELS ββ β β
β β β β βββ ruvLLM inference engine ββ β β
β β β β βββ Local: Phi-3 / Qwen2.5-Coder (GGUF) ββ β β
β β β β βββ Cloud: encrypted API key vault ββ β β
β β β βββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β ββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β DATA: AgentDB + SONA patterns + Plugin registry β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β VERIFY: 95-check capability suite + checksums β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β β
ββββββ΄βββββ ββββββ΄βββββ ββββββ΄βββββ
βContainerβ βMicroVM β β Native β
β (OCI) β β(Firecrk)β β (dev) β
βββββββββββ βββββββββββ βββββββββββ
5.2 Model Routing Flow
User Task
β
βΌ
βββββββββββββββββββ
β Complexity Check β
β (hooks route) β
ββββββββββ¬βββββββββ
β
ββββββ΄βββββββββββββββββββββββββ
β β
βΌ βΌ
Simple (<30%) Complex (>30%)
β β
βΌ βΌ
ββββββββββββ βββββββββββββββ
β Tier 1: β β ruvLLM local?β
β Agent β ββββββββ¬βββββββ
β Booster β Yes β No
β (WASM) β ββββββ΄βββββ
β <1ms, $0 β β β
ββββββββββββ βΌ βΌ
ββββββββββββ ββββββββββββ
β Tier 2: β β Tier 3: β
β Phi-3 β β Cloud APIβ
β (local) β β (Sonnet/ β
β ~200ms β β Opus) β
β $0 β β 2-5s β
ββββββββββββ ββββββββββββ
6. Security
6.1 Appliance Integrity
| Mechanism | Purpose |
|---|---|
| RVFA footer SHA256 | Tamper detection for entire appliance |
| Per-section SHA256 | Integrity of individual sections |
| Code signing (Ed25519) | Verify publisher identity |
| API key vault (AES-256-GCM) | Protect cloud credentials |
| Read-only rootfs | Prevent runtime modification of system files |
| Namespace isolation | Container/VM boundary enforcement |
| Seccomp profile | Restrict syscalls to minimum required |
6.2 Key Management
Boot:
1. User provides passphrase OR hardware key
2. Derive AES key via Argon2id (memory-hard)
3. Decrypt .env.enc β load API keys into memory
4. Keys exist only in process memory (never on disk)
5. On shutdown: zero memory, drop keys
6.3 Update Security
Hot Update Flow:
1. Download signed patch (.rvfp)
2. Verify Ed25519 signature against pinned public key
3. Verify patch targets correct appliance version
4. Apply patch to target section
5. Recompute section SHA256 + footer hash
6. Run VERIFY suite to confirm no regression
7. Atomic swap (old β .bak, new β active)
7. Implementation Plan
Phase 1: RVFA Format + Builder (Week 1-2)
| Task | Description |
|---|---|
| Define RVFA binary spec | Magic bytes, header schema, section table |
ruflo-appliance build |
Multi-stage builder with profile selection |
ruflo-appliance inspect |
Header + section manifest viewer |
ruflo-appliance extract |
Unpack all sections to directory |
| Cloud profile | Kernel + Runtime + Ruflo + encrypted keys |
Phase 2: Runtime + Verification (Week 3-4)
| Task | Description |
|---|---|
ruflo-appliance run |
Boot sequence with container isolation |
ruflo-appliance verify |
95-check capability suite |
ruflo-appliance mcp |
MCP server mode (stdio + SSE) |
| DATA section | Pre-built AgentDB + HNSW + SONA |
| CI integration | Build appliance on every release |
Phase 3: ruvLLM Integration (Week 5-8)
| Task | Description |
|---|---|
| ruvLLM engine | GGUF model loader + KV-cache + streaming |
| Model routing | 3-tier routing (Booster β local β cloud) |
| Hybrid profile | Small local model + cloud fallback |
| Offline profile | Full local inference, no network |
| Offline verification | All 95 checks pass without network |
Phase 4: Distribution + Updates (Week 9-10)
| Task | Description |
|---|---|
ruflo-appliance update |
Hot-patch individual sections |
| Ed25519 signing | Code signing for appliance + patches |
| IPFS distribution | Publish appliances to decentralized storage |
| MicroVM support | Firecracker/Cloud Hypervisor isolation |
| Documentation | User guide, API reference, examples |
8. Consequences
Positive
- Zero-install deployment: One file, no Node.js/npm/Claude Code prerequisites
- Offline-capable: Full agent orchestration without internet (offline profile)
- Reproducible: Same binary = same behavior everywhere
- Secure: Encrypted keys, signed updates, container isolation
- Fast boot: <5s from cold start (vs 35s for
npx ruflo@latest) - Verifiable: Built-in 95-check suite proves every capability works
- Updatable: Hot-patch sections without rebuilding entire appliance
Negative
- Larger artifact: 60MB-4GB depending on profile (vs ~9MB npm package)
- Build complexity: Multi-stage builder with cross-compilation
- Model storage: Local models consume significant disk (2-4GB per model)
- Update latency: Section-level patches still require verification pass
Mitigations
- Cloud profile keeps size at ~60MB (comparable to a Docker image)
- Builder is automated and reproducible via CI
- Model quantization (Q4_K_M) reduces size while maintaining quality
- Verification suite runs in parallel (~10s for full 95-check pass)
9. Alternatives Considered
| Alternative | Reason Rejected |
|---|---|
| Docker image only | Requires Docker installed; no offline model support; not a single file |
| Flatpak/Snap | Linux-only packaging; no custom binary format; no model bundling |
| AppImage | Linux-only; no Windows/macOS; limited isolation |
| WebAssembly bundle | No filesystem access; can't run Claude Code CLI; no local models |
| Nix derivation | Requires Nix; steep learning curve; no model bundling |
| VM image (qcow2) | Too large; requires hypervisor; not portable |
RVFA provides the best balance of portability, size, isolation, and integration with the existing RVF ecosystem.
10. References
- ADR-057: RVF Native Storage Backend
- ADR-054: RVF-Powered Plugin Marketplace
- ADR-056: agentic-flow v3 Integration
- llama.cpp GGUF format
- Firecracker MicroVM
- OCI Image Spec