Inspiration
A photo used to be proof. Now anyone can generate one in seconds or photograph a screen. Fitness challenges, fishing derbies and sponsor contests still pay out on "pics or it didn't happen", so they run on trust, and honest people get doubted along with the cheats. Faking one frame is easy. Faking a whole session is hard: minutes of GPS, motion, timing and video that all agree with each other. So I didn't build a better photo checker. I built something that records the session.
What it does
Verified is an on-device intent and evidence factory. You say what you're about to do, and it builds the proof while you do it.
- Say it. A short voice interview runs on the device (Gemini Nano in Chrome and on Android, Apple Foundation Models on iOS) and turns one sentence ("10 mile run") into claims that can each be checked (a place, an action, a count) and an evidence plan: the minimum a fair skeptic would need.
- Do it. The phone records GPS, motion, video and proof shots. Every 5 seconds it closes a chunk that is SHA-256-chained to the previous one, so changing one byte later breaks the chain.
- Get coached, on-device. Each proof shot is checked against your intent locally in under a second, offline, without the image leaving the phone. The on-device model has exactly one power: it can say "retake". It can never say "verified".
- Answer the witness. A live AI witness asks for whatever the plan still needs ("show me the view behind you"). Drafts run on-device; a cloud pass sharpens them when there is signal.
- Prove it. When online, the Moment syncs (offline-first). In the cloud, Gemini watches the whole video claim by claim, and three independent reads (judge, skeptic, scorer) look at the frames. Then a Cloud Function re-checks the hash chain, timing and physics and is the only thing allowed to write the seal.
- Share it. Sealed Moments appear in a public feed with the map, video, frames, motion chart, AI reasons and every check. Fakes (like an AI-generated fish filmed off a laptop) come back Rejected with the skeptic's reason.
Push-ups are only the demo. Any intent works: a run, a catch, a repair, a recipe, a song.
Value proposition: anyone who pays or ranks people on real-world proof (tournaments, challenges, sponsors, coaches) gets evidence they can audit instead of a photo they have to trust. Recording and the baseline review are free. When the stakes are high, owners can buy extra checks on a verification ladder; credits are spent whether a check passes or fails, so paying buys scrutiny, never a score.
How I used Firebase AI Logic (hybrid inference)
Every client AI call goes through the Firebase AI Logic hybrid inference SDK, on three platforms, and each job runs where it makes sense:
- On-device first (
InferenceMode.PREFER_ON_DEVICE): the live coach on every proof shot, interview turns, the difficulty preview and witness drafts. These run many times per session, often with no signal, so they need to be instant, private and free. Falls back to Gemini in the cloud when the device has no local model.- Web (Chrome): Gemini Nano via the Prompt API, image + text input, JSON-constrained output.
- Android: Gemini Nano through
OnDeviceConfig(mode = InferenceMode.PREFER_ON_DEVICE). - iOS:
.hybridModel(primary: SystemLanguageModel.default, secondary: Gemini). Apple Foundation Models is text-only, so the app feeds it Apple Vision labels for each image.
- Cloud only (
InferenceMode.ONLY_IN_CLOUD): structuring the intention into a strict schema, the judge, the skeptic and the scorer. These are once-per-Moment, multimodal over many frames, and need a bigger model. - Server (Cloud Functions + Gemini on Vertex AI): the difficulty bar, the full-video review and paid ladder checks, because no client may set its own bar or result.
Routing is visible, not assumed. Every hybrid response's inferenceSource is stored with the Moment and shown in the app as an On-device or Cloud chip.
Hybrid is a trust boundary, not just a cost trade-off. The small local model coaches; it never judges. A hallucinating or tampered local model can at worst ask for a retake. AI only proposes; deterministic code seals.
How I built it
- Three native apps, one contract: React + Vite + TypeScript (web), Kotlin + Jetpack Compose (Android), Swift + SwiftUI (iOS). One shared spec (
docs/ARCHITECTURE.md), one prompts file (shared/prompts.json) used by every platform and the functions, and shared SHA-256 test vectors so all three hash chains match byte for byte. A Moment recorded on any platform is sealed by the same function and shows in the same feed. - Firebase AI Logic with App Check on every platform: reCAPTCHA Enterprise (web), Play Integrity (Android), App Attest + DeviceCheck (iOS).
- Firebase Authentication (one Google sign-in, same uid on all three), asked for only when something must be written. Guests can browse and record without an account.
- Cloud Firestore with offline persistence plus a local raw vault. Security rules make chunks append-only and the seal, feed, score and credits server-only.
- Cloud Functions (v2, Node 22) for the deterministic seal, video review, verification ladder and credits; Cloud Storage for video clips, re-hashed against the chain; Remote Config to switch the cloud Gemini model without a new build; Firebase Hosting for the web app.
- Built with Claude Code as the coding agent.
Challenges I ran into
- Making a small model useful without trusting it. The answer was to limit its power to "retake" and move every decision into code.
- Apple Foundation Models is text-only, so iOS pairs it with the Apple Vision framework to describe images.
- Offline-first without losing data. Raw data is deleted from the phone only after the server provably holds all of it.
- Keeping three platforms identical: same bytes hashed, same prompts, same seal rules, enforced by shared test vectors.
Accomplishments that I'm proud of
- One hybrid AI product shipped on Web, Android and iOS in under two weeks, live and testable today.
- The on-device / cloud split is a deliberate design, and every answer shows which side ran.
- It catches real fakes: a photo of a screen gets Rejected with the reason.
What I learned
On-device and cloud models are good at different jobs. Hybrid works best when you decide per job and give the local model a narrow, safe role. And "AI says so" is not proof; AI evidence plus deterministic checks is.
What's next for Verified
- Move judge, skeptic and scorer server-side and add device attestation of the sensor streams.
- On-device counting and measuring (reps, length against a ruler) before upload.
- A human-reviewer ladder check.
- An embed SDK so tournament and challenge apps can request a Verified Moment.
Built With
- apple-foundation-models
- apple-vision
- chrome-prompt-api
- cloud-firestore
- cloud-functions-for-firebase
- cloud-storage-for-firebase
- firebase-ai-logic
- firebase-app-check
- firebase-authentication
- firebase-hosting
- firebase-remote-config
- gemini
- gemini-3.5-flash
- gemini-nano
- hybrid-inference
- jetpack-compose
- kotlin
- node.js
- react
- swift
- swiftui
- typescript
- vertex-ai
- vite