Skip to content
← Back to the bridge

CASE FILE / 2026INDEPENDENT BUILD

SatoriAI

Hybrid on-device + cloud LLM assistant for Android and iOS

Independent experiment2026Independent experiment; public MIT repository; Android build v1

Overview

A mobile assistant that answers locally first. A quantized Gemma 3 1B (GGUF) runs on the phone through llama.rn; a rules-based router escalates harder requests to Claude or Gemini through Deno Edge Functions that normalise both providers into one SSE stream. Users can upload PDFs and ask questions over them: Gemini embeddings go into pgvector (HNSW, cosine) behind per-user row-level security, with daily cloud-spend caps and per-message token accounting.

The problem

Cloud LLM apps cost money on every message and stop working offline. I wanted an assistant that runs on the phone for most of the day and only reaches for a frontier model when the question needs one.

Outcome

Learning outcome: a signed Android build (v1.1.0) demonstrated the local-first model path, a normalized stream for cloud fallbacks, and server-enforced spend limits.

Key decisions

  • Local first, cloud on demand. A rules-based router decides per message whether the on-device Gemma answer is enough or the request escalates to Claude or Gemini, so most chats cost nothing and work without a connection.
  • One stream shape for every provider. Edge Functions normalise Claude and Gemini into the same SSE format, so the client renders tokens the same way whatever produced them.
  • Tenant isolation in the database, not the app. Row-level security on every table and private storage buckets mean a bug in the client cannot leak another user's documents; spend caps are enforced per user, per day.

What it does

  • Quantized Gemma 3 1B runs fully on-device; no network needed for everyday chat
  • Rules-based router escalates to Claude or Gemini through Edge Functions, normalised into a single SSE stream
  • RAG over user PDFs: Gemini text-embedding-004 into pgvector with HNSW cosine search
  • Per-user row-level security on every table, private storage buckets, daily spend caps with per-message token accounting

Technology

React Native (Expo)llama.rn / llama.cppSupabase Edge FunctionsPostgreSQL + pgvectorClaude APIGemini API

Current status

Independent experiment; public MIT repository; Android build v1.1.0 released August 2026.