# Devpost Submission Kit — #BuildHybridAI 2026

> Ready-to-paste Devpost copy, architecture overview, visual proof gallery, judging alignment, and 115-second demo video script for **Aristotele `v0.8.0` — Sovereign Hybrid AI Studio**.

---

## Project Details

- **Project Name:** Aristotele — Sovereign Hybrid AI Studio
- **Tagline (Short Description):** Zero-dependency, `0`-unsafe Rust & Firebase AI Logic Hybrid Studio uniting Chrome Gemini Nano, Gemini 3.8 Flash, App Check, Live Offline Continuity, BigQuery Savings Telemetry, and a Harness/Loop/Graph Diff-Gate Control Plane.
- **Hackathon:** `#BuildHybridAI` 2026 (Google / Firebase AI Logic)
- **Live Hosted App (Zero Install, Firebase Hosting):** <https://ailogic-74fae.web.app>
- **Project Website & Mirror:** <https://aristotele.vaked.dev/> · <https://8b-is.github.io/aristotele/studio.html>
- **Source Repository:** <https://github.com/8b-is/aristotele>
- **Firebase App Directory:** [`firebase-app/`](../firebase-app/)

---

## Inspiration

Modern AI apps force users and developers into a broken binary:

1. **Cloud-only wrappers** break whenever connectivity drops, leak sensitive personal memory and `.env`/token context to remote APIs, and hide where every turn actually ran.
2. **Local-only runtimes** lack seamless cloud multimodal escalation, polished cross-device UX, structured team observability, and loop guardrails that keep autonomous agents from reward-hacking tests or spiraling in retry loops.

We built **Aristotele `v0.8.0`** so every prompt takes the **lowest-latency, highest-privacy path first** — `O(1)` Engram -> On-Device Chrome **Gemini Nano** -> Local Rust / Maple 20B-A1B / LAN -> **Cloud Gemini 3.8 Flash** via Firebase AI Logic — with live proof of offline continuity, dollar savings, and harness safety built right into the interface.

---

## What It Does

**Aristotele `v0.8.0`** pairs the official **Firebase JS Modular SDK (`firebase@13.4.0`)** with a **`0`-`crates.io`-dependency, `0 unsafe` Rust 2024 workspace** across 6 crates (`1.34 MiB` stripped macOS arm64 / `1.38 MiB` static Linux musl) and a companion **`adk-agent-loop`** server:

1. **4-Tier Hybrid Routing & Zero-Friction Judge Experience:**
   - Pre-wired to live project `ailogic-74fae` (`InferenceMode.PREFER_ON_DEVICE`, `GoogleAIBackend` & `AgentPlatformBackend`, `gemini-3.8-flash`, `ReCaptchaEnterpriseProvider` App Check) with an interactive **60-Second 3-Step Judge Tour**.
   - Top-bar **Live Privacy & Savings Pills** (`100% Private`, `$X.XXXX saved · YY% local`) plus transparent per-message attribution (`On-Device`, `Instant Cache O(1)`, `Firebase Cloud`, `HF Free`, `Local Offline`).
2. **1-Click `Simulate Offline` & Auto-Flush Continuity Queue:**
   - Toggle **Simulate Offline** directly in `.hybrid-bar` (without opening DevTools) to verify offline continuity on-device while turns queue locally and auto-flush cleanly on reconnect.
3. **Live Cost-Savings Ticker + BigQuery `agent_events` Sink (`adk-agent-loop/`):**
   - Tracks on-device/Engram token savings vs. cloud Gemini rates, syncs owner-scoped Firestore telemetry (`users/{uid}/telemetry`), exports 12-column NDJSON into `ailogic-74fae.aristotele_prod.agent_events`, and polls `/v1/savings` via `adk-agent-loop`.
4. **Harness, Loop & Graph Engineering Control Plane (`/v1/harness/*`):**
   - Root [`AGENTS.md`](../AGENTS.md) repo map (< 3 KiB), [`tools.rs`](../crates/aristotele-ayefire/src/tools.rs) sensitive-path deny rules + secret redaction + 16 KiB tool output caps, and [`harness.rs`](../crates/aristotele-ayefire/src/harness.rs) (`TaskContract`, `LoopExit`, `GraphNode`, `HarnessState`) persisted with `0600` atomic writes.
   - Includes a live **Try to Reward-Hack (Diff-Gate Demo)** in **Apps -> Harness & Loop**: attempts to modify `.env.production`, a protected existing test (`tests/existing_auth.rs`), and an out-of-contract file are rejected per round and automatically transition `implement -> verify -> escalate` (`LoopExit::Stalled`) after flat retries.
5. **Firebase Remote Config, Async HITL Web Push, SHA-256 Vault, Kokoro Voice & Beliefs:**
   - Live **Firebase Remote Config** parameter sync, Service Worker **FCM Async HITL** interactive notifications (*Approve & Run* / *Force On-Device*), **SHA-256 Sovereign Artifact Vault** (`.ospop.json`), **Kokoro-82M** WebGPU/SpeechSynthesis TTS, **Hugging Face Free Router**, Device Capability Model Advisor, **`llm-belie-fs` 7-Scorer Independence Audit**, **MemPalace + Honcho** grounded memory, and **Maple 20B-A1B Ternary MoE** (`TQ1_0` / `TQ2_0` / `pack5`) support.

---

## Visual Proof Gallery (Captured Live Against `https://ailogic-74fae.web.app`)

| View | Desktop / Mobile Proof | Screenshot |
|---|---|---|
| **1. Zero-Friction Welcome & 60s Judge Tour** | Live `ailogic-74fae` preset, `gemini-3.8-flash` badge, `Simulate Offline` button, and `$ saved · % local` pill | ![Welcome & Judge Tour](screenshots/01-studio-welcome-tour.png) |
| **2. Hybrid Continuity + Voice + HITL Guard** | Tour Steps 1–3 completed (`3/3 Complete`), Kokoro-82M Voice Studio open, queue flushed online | ![Hybrid Continuity & Voice](screenshots/02-hybrid-chat-offline-continuity.png) |
| **3. Live Savings Ticker & BigQuery Telemetry** | Live routing split bar, token savings KPIs, `#bq-live-ticker` (`ailogic-74fae.aristotele_prod.agent_events`), and event table | ![Savings & BigQuery Telemetry](screenshots/03-savings-bigquery-telemetry.png) |
| **4. Harness "Try to Reward-Hack" Diff-Gate** | `TaskContract` prefix, `.env.production` & protected-test rejection log, and `Node: escalate · Exit: stalled` after 3 flat rounds | ![Harness Diff-Gate Escalated](screenshots/04-harness-diff-gate-escalated.png) |
| **5. Remote Config & SHA-256 Sovereign Vault** | Live Remote Config parameter pills, FCM Async HITL status, and SHA-256-sealed `.ospop.json` capsule | ![Remote Config & Vault](screenshots/05-remote-config-vault-ondevice.png) |
| **6. Responsive Mobile Layout (`390x844`)** | Zero horizontal overflow (`390/390px`) with touch-friendly routing bar and voice controls | ![Mobile 390x844 Studio](screenshots/06-mobile-390x844-studio.png) |

---

## Architecture

```mermaid
flowchart LR
    U[User Prompt + Optional Media] --> E{Pinned Instant Engram?}
    E -- Hit --> ER[Sub-microsecond Local Reply]
    E -- Miss --> H[Contract Prefix + MemPalace + Honcho Grounding]
    H --> O{Online or Simulate Offline?}
    O -- Offline / Private Only --> NANO[On-Device Gemini Nano / Local Continuity + Sync Queue]
    O -- Online Hybrid / Cloud --> FB[Firebase AI Logic SDK 13.4.0 + App Check reCAPTCHA Enterprise]
    FB -- On-Device Available --> NANO
    FB -- Escalate / Fallback --> GEM[Cloud Gemini 3.8 Flash + Search Grounding / WebMCP]
    NANO --> TEL[Live Savings Ticker · Firestore · BigQuery NDJSON · SPHIST/1 WAL]
    GEM --> TEL
    U -. Agent Verification .-> DG[Rust / Studio Harness Diff-Gate: Plan -> Implement -> Verify -> Escalate]
```

---

## Alignment With `#BuildHybridAI` Judging Criteria

- **Technological Implementation:** Official `firebasejs/13.4.0` (`initializeApp`, `getAI`, `getGenerativeModel`, `GoogleAIBackend`, `AgentPlatformBackend`, `InferenceMode`, `generateContentStream`, `initializeAppCheck`, `ReCaptchaEnterpriseProvider`, `getRemoteConfig`, `getFirestore`), backed by **6 zero-external-dep, `0`-unsafe Rust crates** (`SPHIST/1` WAL, `pack5`/`TQ1_0`/`TQ2_0` ternary kernels, `/v1/harness/*`, `/mcp`, `/a2a`).
- **Design:** Calm, accessible multi-theme UI (`Midnight Honey`, `Daylight Paper`, `Nordic Frost`, `Matcha Sage`, `Sunset Ember`, `High Contrast`), Dev Mode tucked off by default, keyboard `Cmd+K` palette, and zero mobile horizontal overflow (`390/390px`).
- **Potential Impact:** Keeps personal memory, offline workflows, and routine inference free and private on-device while transparently accounting every saved turn in BigQuery / Firestore and guarding multi-turn loops against secret leaks and test tampering.

---

## 115-Second Demo Video Script (6 Beats)

1. **`0:00 – 0:15` | Hook & Instant First Load (`01-studio-welcome-tour.png`):**
   - Open <https://ailogic-74fae.web.app> cold — show zero login wall, **Live Judge Default Active (`ailogic-74fae · prefer_on_device · gemini-3.8-flash`)**, and switch quickly between dark & daylight themes.
2. **`0:15 – 0:38` | Interactive 60s Judge Tour (`02-hybrid-chat-offline-continuity.png`):**
   - Click Steps `1 -> 2 -> 3` in the Tour banner: point out WebMCP hardware probing, automatic on-device fallback continuity, **Kokoro-82M Voice Studio** speaking live, and **HITL Guard Cloud** protection.
3. **`0:38 – 0:55` | 1-Click `Simulate Offline` Proof (Tiebreaker A):**
   - Click **Simulate Offline** right in `.hybrid-bar`, send a prompt offline, show the **`Sim Offline · On-Device Active · 1 queued`** pill, then click **Reconnect Online** and watch the queue auto-flush to `Online · Hybrid Ready`.
4. **`0:55 – 1:15` | Live Savings Ticker & BigQuery Telemetry (`03-savings-bigquery-telemetry.png` & `05-remote-config-vault-ondevice.png`):**
   - Click the top **`$ saved · % local`** pill to inspect the routing split bar, live BigQuery ticker (`ailogic-74fae.aristotele_prod.agent_events`), **Remote Config** synced pills, and mint a **SHA-256 Sovereign Artifact Vault** capsule.
5. **`1:15 – 1:40` | Harness & Loop `"Try to Reward-Hack"` Diff-Gate Demo (`04-harness-diff-gate-escalated.png`):**
   - Jump via **Diff-Gate Demo ->** to **Apps -> Harness & Loop**, save a `TaskContract`, and click **Try to Reward-Hack** 3 times. Show the diff gate blocking `.env.production`, `tests/existing_auth.rs`, and out-of-contract `src/billing/invoice.rs`, then transitioning cleanly to `Node: escalate · Exit: stalled`.
6. **`1:40 – 1:55` | Zero-Dep Safe Rust Close:**
   - Show terminal verification (`cargo clippy --workspace --all-targets -- -D warnings -F unsafe_code`, `42/42` Rust workspace tests, `5/5` `adk-agent-loop` tests, `13/13` live Chrome E2E) and `1.34 MiB` standalone binary.

---

## Verified Test Matrix (Reproducible)

```sh
git clone https://github.com/8b-is/aristotele.git && cd aristotele

# 42/42 Rust workspace tests + 0 clippy warnings + 0 unsafe in crates/*
cargo clippy --workspace --all-targets -- -D warnings -F unsafe_code
cargo test --workspace

# 5/5 ADK-Rust loop + BigQuery schema tests
cargo clippy --manifest-path adk-agent-loop/Cargo.toml --all-targets -- -D warnings
cargo test --manifest-path adk-agent-loop/Cargo.toml

# JS syntax checks, screenshot gallery generator, & 13/13 live Chrome CDP E2E
cd firebase-app && npm run check && npm run test:e2e
```
