CoolFace
Modelpublic

ielfeqi-rgb/omni_engine

sourceHugging Faceapache-2.0updated 14h agoView on Hugging Face
1likes
Model Card

Omni Engine v2.0: Sovereign Autonomous Agent Runtime & Causal-DAG KV-Cache Pruning

![Rust 1.75+](https://www.rust-lang.org) ![License: CC BY 4.0 / Apache 2.0](https://creativecommons.org/licenses/by/4.0/) ![Edge AI Ready](#) ![Zero External Dependencies](#) ![GitHub Repository](https://github.com/ielfeqi-rgb/omni_engine)

"Why should autonomous agency be the exclusive monopoly of multi-megawatt corporate data centers?" Omni Engine v2.0.0 is an independent, single-binary, zero-dependency autonomous AI execution engine written in pure Rust. It transforms compact open-weights language models (1.5B–3B parameters) into self-healing, deterministic execution agents operating on ordinary consumer laptops without cloud dependencies, API subscriptions, or external environment setup.

1. The Core Philosophy: Replacing Brute Force with Systems Intelligence

Modern frontier AI labs address agentic execution failures through brute force: inflating parameter counts from 70B to 405B+, chaining thousands of API calls, and maintaining ever-growing, unbounded conversation context windows.

When a small model (1.5B–3B) attempts complex multi-step reasoning, standard inference runtimes (such as vLLM or standard llama-server) fail catastrophically:

  1. 1.Attention Dilution: As unrelated execution steps accumulate, the softmax mass allocated to the true root causes approaches zero.
  2. 2.Inertial Token Lock-in (Attractor Traps): Once a model generates a failing action, preserving that failed sequence in the KV cache creates a high-probability attractor basin, trapping the model in identical, repetitive failures.
  3. 3.Execution Insecurity & Host Pollution: Standard runtimes require Python interpreters, pip dependencies, or uncontained shell access that can easily alter or destroy the user's host filesystem.

Omni Engine re-engineers this foundation from first principles in pure Rust:

  • Zero Host Prerequisites: In-binary embedded Lua 5.4 sandbox (mlua 0.9 vendored) with zero pip/npm/go installations needed on the host.
  • In-Memory RAM Virtual Disk (`MemoryVfs`): All file manipulations, spreadsheets, and intermediate documents are created strictly in volatile memory. A single byte never touches the host disk without an interactive user confirmation gate (y/N).
  • Causal-DAG KV-Cache Rollback: An exact mathematical graph maps dependencies between steps. When an execution fails, the engine physically cuts the failed tokens out of the tensor KV cache (O(1) rollback), eliminates irrelevant historical noise, and reactively hydrates necessary prerequisites in sub-100 microseconds.

2. Complete Architecture & Decision Topology

                          ┌──────────────────────────────────────────────┐
                          │               OMNI AGENT CORE                │
                          │        (Grounded System Persona & CLI)       │
                          └──────────────────────┬───────────────────────┘
                                                 │
                                       [Mode Triage Router]
                                                 │
                         ┌───────────────────────┴───────────────────────┐
                         ▼                                               ▼
              [Fast Interactive Mode]                         [Deep Autonomous Mode]
               (Sub-50ms Single-Pass)                        (Multi-Stage Reasoning)
                         │                                               │
                         │                                   [Internal Supervisor Probe]
                         │                                    - Speculative Branching
                         │                                    - Causal Rollback & Pruning
                         │                                    - Distilled Causal Lessons
                         │                                               │
                         └───────────────────────┬───────────────────────┘
                                                 │
                                                 ▼
                                  ┌─────────────────────────────┐
                                  │    EXECUTIVE HANDS & VFS    │
                                  ├─────────────────────────────┤
                                  │  Embedded Lua 5.4 Sandbox   │
                                  │  - Pure In-Memory VFS (RAM) │
                                  │  - Native Rust HTTP (Fetch) │
                                  │  - Browser Terminal Lens    │
                                  │  - Interactive Commit Gate  │
                                  └──────────────┬──────────────┘
                                                 │ User Confirmation (y/N)
                                                 ▼
                                        [Host File System]

3. Deep Mathematical Formalism: Causal DAG & The Attractor Escape Proof

3.1 The Monotonic Failure Model

Let context length $L = N + t - 1$. Under standard Grouped-Query Attention (GQA):

$$ \alpha{t, i}^{(h)} = \frac{\exp\left(\frac{\mathbf{q}t^{(h)} (\mathbf{k}i^{(h)})^T}{\sqrt{dk}}\right)}{\sum{j=1}^L \exp\left(\frac{\mathbf{q}t^{(h)} (\mathbf{k}j^{(h)})^T}{\sqrt{dk}}\right)} $$

In standard append-only caching:

$$ L{\text{standard}}(m) = L0 + \sum{k=1}^m \left( |\mathbf{y}k| + |\mathbf{o}_k| \right) $$

where $|\mathbf{y}k|$ is the step output and $|\mathbf{o}k|$ is error feedback.

Theorem 1 (Attention Dilution in Monotonic Caching): Partition the cache indices into causally relevant root-cause tokens $\mathcal{R}$ and accumulated intermediate exploratory noise $\mathcal{N}$ ($L = |\mathcal{R}| + |\mathcal{N}|$, $\mathcal{R} \cap \mathcal{N} = \emptyset$, $|\mathcal{N}| \gg |\mathcal{R}|$):

$$ \lim{|\mathcal{N}| \to \infty} \sum{i \in \mathcal{R}} \alpha{t, i} = \lim{|\mathcal{N}| \to \infty} \frac{\sum{i \in \mathcal{R}} \exp(ui)}{\sum{i \in \mathcal{R}} \exp(ui) + \sum{j \in \mathcal{N}} \exp(uj)} = 0 $$

Proof: As intermediate exploration continues, the denominator diverges to $+\infty$, mathematically forcing attention on the original root-cause state to zero.

3.2 The Causal Directed Acyclic Graph (DAG)

We define agent execution history as a dynamic graph $\mathcal{G} = (\mathcal{V}, \mathcal{E})$. Each step $v_i \in \mathcal{V}$ corresponds to:

$$ vi = \langle \text{id}i, \mathcal{D}i, I(vi), O(vi), \taui, \sigma_i \rangle $$

Where:

  • $I(v_i) \subset \mathcal{U}$: Entities read/consumed by step $i$.
  • $O(v_i) \subset \mathcal{U}$: Entities written/modified by step $i$.
  • $\taui = [p{\text{start}}^{(i)}, p_{\text{end}}^{(i)}]$: Physical memory range in the tensor KV cache.
  • $\sigma_i \in \{\text{Active}, \text{Evicted}\}$: Tensor allocation status.

Dependency edges are computed via deterministic set intersection:

$$ e{i \to j} \in \mathcal{E} \iff O(vi) \cap I(v_j) \neq \emptyset $$

3.3 Mathematical Ancestral Cone Isolation

When an execution crash occurs at step $v{\text{crash}}$ referencing error target entity $E{\text{target}}$:

$$ \mathcal{C}(E{\text{target}}) = \{vk \in \mathcal{V} \mid E{\text{target}} \in O(vk) \cup I(v_k)\} $$

All intermediate operations $v{\text{noise}} \notin \mathcal{C}(E{\text{target}})$ are physically masked out:

$$ L{\text{causal}} = \sum{vk \in \mathcal{C}(E{\text{target}})} |\tauk| \ll L{\text{standard}} $$

3.4 Surgical O(1) In-Place Rollback

When step $v_i$ fails, rather than appending failure tokens to the prompt, Omni Engine triggers an in-place KV sequence truncation:

$$ \text{PruneKV}(p{\text{start}}^{(i)}, p{\text{head}}) \implies p{\text{head}} \leftarrow p{\text{start}}^{(i)} $$

This operates in physical O(1) tensor complexity, removing the failure basin from the autoregressive probability density function.

4. Empirical Benchmarks (Real Edge Telemetry)

Evaluated on compact edge hardware (4 Physical Cores, 16 GB RAM, Qwen 2.5 Coder 1.5B Instruct GGUF):

4.1 Attractor Lock-in & Recovery Benchmark

MetricStandard Stateful Caching (vLLM / llama-server)Omni Engine Causal-DAG PruningAdvantage
Turn 1 Output"VQKRHT" (Wrong)"VQKRHT" (Wrong)Identical Baseline
Cache HandlingAppends error to active KVIn-place Rollback [72, end)O(1) Truncation
Turn 2 Output"VQKRHT" (Identical Repeat)"QRKWBS" (100% Correct)Escape Attractor
Turn 3 OutputUnmatched / Infinite TrapN/A (Resolved on Turn 2)Clean Termination
Success Rate0.0% (Infinite Lock-in)100.0% (Turn 2 Recovery)Deterministic
Active Context383 tokens (Compounding)221 tokens (Strictly bounded)-42.3% Context Bloat

4.2 Cross-Turn Causal Isolation & Hydration Benchmark

DimensionStandard Monotonic Stateful CachingOmni Causal-DAG ArchitectureAdvantage
Active KV Context1,850 tokens294 tokens-84.1% Active Tokens
Active RAM Footprint358.4 MB42.6 MB-88.1% Memory Savings
Noise Contamination72.8% (Unrelated operations retained)0.0% (Ancestral cone isolated)Zero Attention Dilution
Hydration LatencyN/A (Retains all bloat)0.00 ms (< 100 µs)Instantaneous Swapping
Time-To-First-TokenMonotonically decayingFlat, constant latency16.3x Speedup

5. The 5 Integrated System Pillars

Pillar 1: Embedded In-Binary Lua Sandbox (mlua 0.9 / Lua 5.4)

  • Zero host prerequisites (no Python virtualenv, no Node.js, no Go binaries).
  • POSIX os.execute and raw file io.open are stripped from the environment.
  • Accessible primitives are strictly native Rust bindings:
  • vfs.write(path, content)
  • vfs.read(path)
  • web.fetch(url): Bounded HTTP/HTTPS fetching with user-agent and timeouts.
  • print(msg): Real-time telemetry streaming into the engine.

Pillar 2: Pure In-Memory Virtual File System (MemoryVfs)

  • Stored entirely in volatile RAM: Arc<RwLock<HashMap<PathBuf, Vec<u8>>>>.
  • Zero host disk writes during agent generation, testing, or intermediate iterations.
  • Interactive Commit Gate: Unified git-style diffs are displayed in the terminal. The runtime pauses and prompts the user with an explicit authorization gate (y/N) before any file touches permanent storage.

Pillar 3: Terminal Browser Lens (BrowserTerminalLens)

  • Replaces heavy Chromium/Playwright browsers with an ultra-compact ASCII projection matrix.
  • Compresses live DOM trees into numbered interactive coordinate elements [#1 Input], [#2 Link].
  • Bounded to a strict terminal dimension (80 columns × 24 rows), saving up to 92% of vision/multimodal token overhead.

Pillar 4: Autonomous Mode Router

  • Fast Interactive Mode: For direct questions and conversational queries, bypassing speculative trees for sub-50ms latency.
  • Deep Autonomous Mode: For multi-step engineering tasks, activating speculative hypothesis branching, causal supervisor logging, and causal rollback.

Pillar 5: Internal Supervisor Probe & Causal Distillation

  • Telemetry stream tracking branch status (ActiveEvaluating, TrappedAndPruned, ValidatedSuccess).
  • Generates distilled causal lessons (DistilledCausalLesson) injected as strict negative constraints into subsequent branches without context bloat.

6. Quick Start & Execution Guide

6.1 Build from Source

bash
# Clone the repository
git clone https://github.com/ielfeqi-rgb/omni_engine.git
cd omni_engine

# Compile standalone release binary
cargo build --release

# The zero-dependency binary is located at target/release/omni_engine

6.2 Interactive Agent Terminal (TUI)

bash
# Launch interactive agentic session
./target/release/omni_engine chat

# Execute one-shot autonomous task
./target/release/omni_engine ask "Generate a technology sales spreadsheet and save to sales_q3.csv"

6.3 Local Inference Daemon & CLI Controller

bash
# Inspect physical hardware specs and thread topology
./omni_engine status

# List available local GGUF models
./omni_engine models

# Start background local inference daemon
./omni_engine start qwen2.5-coder-1.5b-instruct-q4_k_m.gguf --port 8081 --ctx 2048

# Create secure Bearer API tokens
./omni_engine keys new "Production-Key"

# Start Web UI Dashboard and OpenAI-compatible REST server (/v1/chat/completions)
./omni_engine serve --port 8090

7. Research Paper & Formal Citation

The complete academic paper with formal theorems, mathematical proofs, set-theoretic formulations, and benchmark tables is included in this repository:

BibTeX Citation

bibtex
@article{elfeqi2026causaldag,
  title   = {Causal-DAG KV-Cache Pruning and Reactive Hydration: Eliminating Attention Dilution and Memory Bloat in Autonomous LLM Reasoning Loops},
  author  = {Elfeqi, Ibrahim},
  journal = {Omni Engine Open-Source Research Specifications},
  year    = {2026},
  url     = {https://github.com/ielfeqi-rgb/omni_engine},
  contact = {ielfeqi@gmail.com}
}

8. Open-Source Terms & Commercial Freedom

This project is licensed under the Dual Open-Source License: Creative Commons Attribution 4.0 International (CC BY 4.0) & Apache License 2.0.

  • Total Freedom: Anyone is fully permitted to inspect, study, fork, deploy, modify, and build commercial or non-commercial applications upon this framework for profit without paying royalties.
  • Strict Attribution Requirement: Any derivative work, distribution, research publication, or commercial deployment utilizing this methodology MUST explicitly credit the original authorship of Ibrahim Elfeqi (ielfeqi@gmail.com) and reference the upstream project repository at https://github.com/ielfeqi-rgb/omni_engine.