|
| 1 | +// SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | +// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 3 | += Mobile AI Orchestrator — EXPLAINME |
| 4 | +:toc: preamble |
| 5 | +:icons: font |
| 6 | + |
| 7 | +This file maps README.adoc claims to their implementation evidence for |
| 8 | +sceptical developers. |
| 9 | + |
| 10 | +== "Platform-agnostic Rust library for intelligent AI routing on constrained devices" |
| 11 | + |
| 12 | +[quote, README.adoc] |
| 13 | +____ |
| 14 | +mobile-ai-orchestrator is a platform-agnostic Rust library for intelligent AI |
| 15 | +routing on constrained devices. It decides where and how to run AI inference — |
| 16 | +locally, remotely, or hybrid. |
| 17 | +____ |
| 18 | + |
| 19 | +How this is implemented:: |
| 20 | +The library crate in link:src/[`src/`] contains the following modules: |
| 21 | +`src/orchestrator.rs` (main coordinator), `src/router.rs` (routing decisions), |
| 22 | +`src/expert.rs` (rule-based safety layer), `src/context.rs` (conversation |
| 23 | +history). These are compiled as a library (`lib.rs` exports the public API). |
| 24 | +The binary crate in the workspace provides the optional CLI tool. The Cargo |
| 25 | +workspace root (`Cargo.toml`) confirms no platform-specific dependencies in |
| 26 | +the default feature set; the `network` feature flag gates all `reqwest` usage. |
| 27 | + |
| 28 | +Caveat:: |
| 29 | +Platform-agnostic means no Android/iOS SDK dependencies in the library — not |
| 30 | +that it has been tested on all platforms. Actual Android integration is in the |
| 31 | +companion https://github.com/hyperpolymath/neurophone[neurophone] repo. |
| 32 | + |
| 33 | +== "Zero unsafe blocks" |
| 34 | + |
| 35 | +[quote, README.adoc] |
| 36 | +____ |
| 37 | +Safety-First: Zero `unsafe` blocks in entire codebase |
| 38 | +____ |
| 39 | + |
| 40 | +How this is implemented:: |
| 41 | +The codebase uses only safe Rust. This can be verified via `cargo geiger` or |
| 42 | +by grepping for the `unsafe` keyword: `grep -r "unsafe" src/` returns no |
| 43 | +results in the library crates. |
| 44 | + |
| 45 | +Caveat:: |
| 46 | +Transitive dependencies may contain `unsafe` — `cargo geiger` reports those |
| 47 | +separately. The library's own code contains zero `unsafe`. |
| 48 | + |
| 49 | +== "Expert system + reservoir computing + MLP + SNN" |
| 50 | + |
| 51 | +[quote, README.adoc] |
| 52 | +____ |
| 53 | +Neural Components: Reservoir Computing (ESN), Multi-Layer Perceptron, |
| 54 | +Spiking Neural Network |
| 55 | +____ |
| 56 | + |
| 57 | +How this is implemented:: |
| 58 | +`src/reservoir.rs` implements an Echo State Network for temporal compression |
| 59 | +of conversation history. `src/mlp.rs` implements a simple feed-forward network |
| 60 | +for learned routing decisions. `src/snn.rs` implements a spiking neural network |
| 61 | +for wake-word detection. All three are pure Rust, no external ML frameworks. |
| 62 | + |
| 63 | +Caveat:: |
| 64 | +These are lightweight in-process implementations, not production ML models. |
| 65 | +The reservoir has fixed dimensions (configured in `OrchestratorConfig`); the |
| 66 | +MLP weights are not pre-trained and require a training step before learned |
| 67 | +routing outperforms the heuristic baseline. |
| 68 | + |
| 69 | +== "Automatic sensitive data detection" |
| 70 | + |
| 71 | +[quote, README.adoc] |
| 72 | +____ |
| 73 | +Privacy-Preserving: Automatic detection of sensitive data patterns. |
| 74 | +Configurable blocking rules. |
| 75 | +____ |
| 76 | + |
| 77 | +How this is implemented:: |
| 78 | +`src/expert.rs` implements rule-based safety. The `block_patterns` field in |
| 79 | +`OrchestratorConfig` accepts a `Vec<String>` of regex patterns (e.g. |
| 80 | +`r"password|secret|api.?key"`). The expert system applies these patterns to |
| 81 | +query text before routing; matches return `Route::Blocked` with a reason |
| 82 | +string. |
| 83 | + |
| 84 | +Caveat:: |
| 85 | +Pattern matching is regex-based and language-agnostic — it will not detect |
| 86 | +sensitive data expressed in unusual encodings (base64, ROT13, etc.). For |
| 87 | +high-assurance privacy, the blocking rules must be configured carefully by the |
| 88 | +integrating application. |
| 89 | + |
| 90 | +== Dogfooded Across The Account |
| 91 | + |
| 92 | +[cols="1,2,2", options="header"] |
| 93 | +|=== |
| 94 | +| Technology / Pattern | Used here | Also used in |
| 95 | + |
| 96 | +| Rust library crate |
| 97 | +| AI routing logic as reusable library |
| 98 | +| link:https://github.com/hyperpolymath/k9-rs[k9-rs], |
| 99 | + link:https://github.com/hyperpolymath/launch-scaffolder[launch-scaffolder] |
| 100 | + |
| 101 | +| Feature-gated network support |
| 102 | +| `features = ["network"]` for optional HTTP |
| 103 | +| link:https://github.com/hyperpolymath/a2ml-rs[a2ml-rs] |
| 104 | + |
| 105 | +| Reservoir computing (ESN) |
| 106 | +| Temporal compression for context history |
| 107 | +| Unique to this repo in the estate |
| 108 | + |
| 109 | +| Rule-based safety expert system |
| 110 | +| Privacy pattern blocking |
| 111 | +| link:https://github.com/hyperpolymath/hypatia[hypatia] |
| 112 | + (rule-module architecture) |
| 113 | +|=== |
| 114 | + |
| 115 | +== Known Gaps |
| 116 | + |
| 117 | +[CAUTION] |
| 118 | +==== |
| 119 | +The `.machine_readable/6a2/` A2ML checkpoint files (STATE, META, ECOSYSTEM) |
| 120 | +are the canonical metadata location for this repo. The older `.machine_readable/` |
| 121 | +SCM files referenced in some docs should be treated as superseded. |
| 122 | +==== |
| 123 | + |
| 124 | +The MLP weights are not pre-trained — the learned routing component requires |
| 125 | +integration of a training pipeline before it can outperform the heuristic |
| 126 | +baseline. The README is honest that the neural components are "optional |
| 127 | +enhancements over the heuristic baseline." |
0 commit comments