← All docs
Companion App
App — AI pipeline
From context to validated tool call, entirely on the iPhone.
The companion's AI runs on the iPhone through Apple MLX. No conversation content is sent to the cloud. Each turn flows through a fixed pipeline:
ContextBuilder → PromptPipeline (7 layers) → CompanionOrchestrator
→ MLX Gemma 4 (4-bit) → StreamSanitizer → ToolParser → ToolValidatorModel
A PLE-safe 4-bit Gemma 4 model handles text, audio waveforms and images in one runtime. Audio reaches the model as raw bytes — there is no transcription step, ever.
Performance
- Two-phase warmup pre-compiles Metal kernels and the full attention graph, so there's no cold-start lag on the first message.
- A session-level KV prompt cache diffs token IDs and re-prefills only the delta, dropping time-to-first-token from ~174 ms to ~30–50 ms on later turns.
- Streaming output is sanitized at three gates so raw tool markup never reaches the screen.
Memory
Long-term facts are stored on-device with two-pass deduplication — lexical (Jaccard) then semantic (cosine over 384-dim MiniLM embeddings). Retrieval is decay-weighted by confidence, recency, use and importance tier.
Have a question about this?
Talk to the team