# Aristotele โ€” Complete Technical Reference (`v0.8.0`) Live Hosted Studio (Firebase Hosting): https://ailogic-74fae.web.app Canonical Landing URL: https://aristotele.vaked.dev/ Studio WebApp Mirror: https://aristotele.vaked.dev/studio.html Repository: https://github.com/8b-is/aristotele Author / Maintainer: 8b-is / PeetPedro Attribution Notice: Some internal naming (`aristotele-spherepop`, `SpherepopOp`) drew loose conceptual inspiration from Flyxion's essays on event-sourced semantics. Aristotele is an independent 8b-is engineering project with no collaboration, endorsement, or formal equivalence claimed to Flyxion's mathematical papers. --- ## 1. Architecture Summary (`6` Workspace Crates + `adk-agent-loop`) Aristotele is a cross-platform AI runtime and Studio across **6 workspace crates** (`0` `crates.io` dependencies, `0` `unsafe` blocks/functions in `crates/`, plus `8b-is/kolibry` subcrates pinned via git revision in `Cargo.lock`) plus the standalone `adk-agent-loop` companion service. Core library crates (`aristotele-spherepop`, `aristotele-beehive`, `aristotele-hiverl`) build `#![no_std]` on `aarch64-unknown-none`, while the `aristotele` CLI/daemon (`aristotele-engine`, `aristotele-ayefire`, `aristotele-cli`) is a standard OS-hosted binary targeting `macos/aarch64`, `linux/aarch64-musl`, `x86_64-apple-darwin`, and Windows. 1. **`aristotele-spherepop` (`#![no_std]` + optional `std`):** - Pure-Rust BLAKE3-256 hashing & keyed MACs. - `AuditFrame64` (64-byte cache-line-aligned header with `GATE_MAGIC = 0x62` wire discriminator; canonical wire serialization strictly via `to_le_bytes`/`from_le_bytes`), signed Q7.8 `scale_q8: i16` (`256 == 1.0`), saturating `next_origin_gen` (`255` cap), and domain-separated BLAKE3 `state_digest_u64`. - `CapabilityToken` checks local MAC, rung (`0..=3`), scope hash, and optional expiry (no global replay ledger or execution correctness guarantee). - `SPHIST/1` append-only hash-chained WAL (`replay_verify` validates sequence order, local MACs, and payload hashes โ€” not external side-effect determinism). 2. **`aristotele-beehive` (`#![no_std]` + optional `std`):** - Bounded 9-step heuristic `F_TOSS` schedule (`[8, 7, 6, 5, 4, 4, 3, 2, 1]`) with explicit `F_REFUSE_ALL = 0` (`NoAdmissibleCandidate`) universal refusal for empty/inadmissible inputs. - Two-head `O(1)` hash-addressed `EngramTable` with canonical `1.60-bpw` `pack5` verification and `GEN_DIRECT` provenance tracking. - Integer multi-lane router (`workers.rs`) and layer sensitivity classifier (`SensitivityGate`). 3. **`aristotele-hiverl` (`#![no_std]` + optional `std`):** - Provenance-filtered (`origin_gen == 0`) lossy heuristic trace compaction (`TARGET_KEEP_RATIO_Q16 = 21_845` ~33.3% soft byte budget; does NOT train model weights or guarantee lossless evidentiary preservation). - `SKILL.md` / `trajectories.jsonl` export and `OSPOP1` (`1.60-bpw pack5`) binary capsules with full BLAKE3 payload-digest verification (`PayloadDigestMismatch` in `verify_ospop_capsule`). 4. **`aristotele-engine`, `aristotele-ayefire`, `aristotele-cli`:** - Maple 20B-A1B Ternary MoE (`ggml-org/llama.cpp#27000`): `TQ1_0` (`54B`/256 = `1.6875 bpw`), `TQ2_0` (`66B`/256 = `2.0625 bpw`), `pack5` (`1.60 bpw`), zero-copy GGUF ternary scanner, `eval_maple_moe_probe`, cached `HardwareProfile`. - Loopback HTTP/1.1 + SSE + MCP/A2A server, single-source embedded Studio (`webapp.rs`), `24` provider presets, Hugging Face Free Router, Device Capability Model Advisor, Kokoro-82M Voice Studio, `llm-belie-fs` 7-scorer Independence Audit, Honcho + MemPalace memory, WebMCP (`window.AristoteleWebMCP`, `navigator.modelContext`), and `6` built-in workflow skills. - **Harness, Loop & Graph (`harness.rs` + `tools.rs` + `/v1/harness/*`):** Root `AGENTS.md` repo map (< 3 KiB), `is_sensitive_path` deny rules (`.env*`, `.pem`, `.key`, `id_rsa`, credentials), `sanitize_and_cap_tool_output` (16 KiB cap + token redaction), `TaskContract` + `HarnessState` (`Plan -> Implement -> Verify -> Review / Escalate`, stall/oscillation/budget exits, protected-test & contract-diff gate, atomic `0600` persistence), and Studio interactive `"Try to Reward-Hack (Diff-Gate Demo)"`. 5. **`adk-agent-loop/` (`adk-rust` Companion Service):** - HTTP server (`--serve`, `GET /health`, `GET /v1/savings`, `POST /v1/telemetry`, `POST /v1/agent/turn`, `POST /v1/bigquery/flush`) with CORS allowlist and 12-column BigQuery NDJSON sink (`ailogic-74fae.aristotele_dev.agent_events` / `ailogic-74fae.aristotele_prod.agent_events`). - Supports `Gemini` (`gemini-3.8-flash`), `HuggingFace`, `OpenAI`, `Anthropic`, and `Ollama`. --- ## 2. Quantization Accounting & Benchmark Scope - **Density Arithmetic:** `pack5` packs 5 trits per byte = `1.60` bits/trit (`8/5`), compared against the theoretical `log2(3) โ‰ˆ 1.585` Shannon limit for uniformly distributed symbols. `TQ1_0` uses `1.6875` bpw and `TQ2_0` uses `2.0625` bpw. - **Scope Separation:** Ternary weight encoding applies to storage/packing/matvec codecs; it does **not** imply three-valued logical semantics or end-to-end ternary arithmetic across all runtime stages. Single-slice `1024x4096` comparisons (`820 KiB` `pack5` vs `864 KiB` `TQ1_0` vs `1,056 KiB` `TQ2_0` vs `8,192 KiB` `FP16`) exclude total resident RSS, KV-cache/activations, runtime libraries, or end-to-end LLM perplexity/throughput. --- ## 3. Firebase AI Logic, WebMCP, Offline Continuity & Telemetry (`ailogic-74fae`) - Official Firebase JS Modular SDK `13.4.0` supporting `google_ai` (`GoogleAIBackend`) and canonical `agent_platform` (`AgentPlatformBackend` / `VertexAIBackend`), inference modes (`prefer_on_device`, `only_on_device`, `prefer_in_cloud`, `only_in_cloud`, `local_rust`, `hf_free`), default cloud model `gemini-3.8-flash`, public reCAPTCHA Enterprise App Check key (`6LfNzzYuAAAAALtPp5Y_3dQv-KrID2oykF3Q60B4`), Multimodal (`PNG`, `JPG`, `WebP`, `PDF`, `MP3`, `WAV`, `OGG`, `MP4`), Google Search Grounding (`googleSearch`), and WebMCP function calling (`local_hardware_probe`, `maple_20b_a1b_probe`, `memory_palace_search`, `session_export_markdown`). - Live `Simulate Offline` cutover switch + automatic `offlineQueue` auto-flush on reconnect; owner-scoped Cloud Firestore telemetry (`users/{uid}/telemetry`); live Cost-Savings Ticker (`$X.XXXX saved ยท YY% local`); Firebase Remote Config live defaults; Service Worker FCM async HITL alerts; SHA-256 Sovereign Artifact Vault (`.ospop.json`). - Air-gapped `--local-only` mode plus Ollama (`:11434`), `llama.cpp` Maple 20B-A1B (`:8080`), vLLM (`:8000`), LM Studio (`:1234`), and custom LAN OpenAI-compatible nodes. - `18` `8b-is` ecosystem entries (`GET /v1/ecosystem`), `13` Hugging Face entries from `eightb` / `PeetPedro` / `deepgrove` (`GET /v1/models/catalog`), and `6` workflow skills (`GET /v1/skills`). --- ## 4. Security Controls, Explicit Boundaries & Verified Suite (`SECURITY.md`) - Loopback `Host` DNS-rebinding rejection, validated loopback `Origin` CORS, `Sec-Fetch-Site: cross-site` block, per-session `X-Aristotele-Token` CSRF protection (covering `/v1/harness/*`, `/v1/firebase`, `/v1/memory/*`, `/v1/sessions/*`), CSP, `X-Frame-Options: DENY`. - Zero dynamic inline `onclick`/`onchange` JS template handlers; RAII `0600` `--config` curl secrets (`--proto =https`); strict CLI bridge allowlist (`claude`, `gemini`, `codex`, `ollama`); symlink-skipping workspace jail + `.env`/`.pem`/key deny rules + 16 KiB tool output redaction & cap; `/dev/urandom` entropy for `sovereign.key`; `0600` atomic writes. - Explicit boundaries: `0x62` is a framing byte (not security); keyed MAC proves local integrity (not authorization or truth); Rust memory safety does not isolate same-user local OS processes; `replay_verify` verifies local log integrity rather than re-executing external side effects. - Verified on `v0.8.0`: `cargo clippy --workspace --all-targets -- -D warnings -F unsafe_code` (`0` warnings), `cargo test --workspace` (**42/42** passed), `adk-agent-loop` clippy + **5/5** tests passed, private-key scan `CI_SECRET_SCAN_CLEAN`, and **13/13** live headless Chrome CDP E2E tests on `https://ailogic-74fae.web.app` (`0` runtime exceptions, `0` console errors).