Judge quickstart — 30 seconds, no signup
- Open https://futureselves.vercel.app/?demo=day30 (or click "Step into Day 30" on the landing page). You land inside Maya's lived-in Day-30 timeline — Sunday letter, six-voice constellation, seven-letter archive, memory ledger.
- In the judge bar, toggle Free (
PREFER_ON_DEVICE) ↔ Awakened (PREFER_IN_CLOUD) — the entitlement rewires the inference lane live. - Click "Write live letter", give today one word, and a real letter is generated in front of you.
- Read the Inference Receipt beneath the
P.S.— exact lane, model, latency, andCONFESSION HELD LOCAL · 0 BYTES SENT. - Tap Inspect › to open the inference lane panel: every request's asked-lane vs. served-lane, model id, latency, App Check and Prompt API status.
- Open the archive — all seven letters carry their lane receipts (three
on-device · Gemini Nano, fourcloud · gemini-3.8-flash), so the hybrid split is demonstrable even on a machine that can run neither lane live.
Inspiration
A daily voice ritual is the kind of product where inference cost is the business model. Most AI apps pay per user, once — a daily ritual means per-user inference that repeats every day, forever. That constraint became the product idea: an app that doesn't have an AI feature with a paywall bolted on, but an architecture where the billing tier is the inference lane. The subscription decision and the infrastructure decision are the same decision.
What it does
Future Selves is a daily voice ritual. You open the app, give today one word, and your future self leaves you a voicemail: a short transmission about the choice you're circling, a cliffhanger for tomorrow, and one specific thing to do today. Do it for thirty days and the archive becomes a portrait of who you're becoming — and of the selves you didn't become.
The two lanes:
- Free —
PREFER_ON_DEVICE, Gemini Nano via Chrome's Prompt API: when the machine can serve Nano — ~zero marginal cost, works offline, nothing leaves it. When it can't, the cloud lane serves instead and the receipt says so honestly. - Awakened —
PREFER_IN_CLOUD,gemini-3-flash-preview(degradinggemini-3.8-flash→gemini-3.5-flash-lite): better prose, Gemini TTS voice, and the live-voice conversation where you can speak back to your future self. - The personal confession is
ONLY_ON_DEVICE, by policy. The answer to "what door are you not opening?" never falls back to cloud: when Gemini Nano is available it is reflected strictly on-device; when it isn't, it is held local —0 bytes sent— rather than silently uploaded. Hybrid here isn't plumbing, it's a promise the user can read.
One SDK, one call site (getGenerativeModel(ai, { mode })), two lanes, and response.inferenceSource tells the user which one served them — persisted on the row and rendered as an Inference Receipt beneath the letter's P.S. — the exact lane, model and latency. Tap Inspect › and you get the session's inference log: every request, the lane that actually served it, the model, the latency, and whether App Check attestation and the Prompt API are in place. The claim is checkable, per request, not a line in a README.
How we built it
Everything generative goes through Firebase AI Logic. Nothing else is called.
apps/default/lib/firebase-ai.ts— one hybrid model factory for both text features (daily transmission, weekly synthesis), with JSON-schema constrained decoding on both sides (responseMimeTypein cloud,responseConstrainton-device) so the same parser handles either lane.apps/default/lib/firebase-tts.ts— OS speech synthesis for the free tier (which keeps the free ritual genuinely free), Gemini TTS (gemini-3.8-flash-tts) for Awakened.apps/default/lib/firebase-live.ts— Gemini Live API: Awakened users can speak back to their future self, with the cast's voice and live transcription. This is the feature the paywall actually sells.apps/default/lib/firebase-image.ts— cast portraits via Nano Banana.apps/default/lib/firebase.ts— app init + App Check. Production web is registered on reCAPTCHA Enterprise (Fraud Defense) and the app verifiably reaches the cloud lane on the public URL, not just the debug token path.
Design decisions worth calling out:
- The tier gate is a single boolean threaded into one function. There is no second code path for premium — the same call site takes a different
mode. That's why the paywall can be flipped live without a release, and why the free tier's cost profile is a structural property rather than a promise. - Degradation is designed, not accidental.
PREFER_*falls back silently, so a fallback that fired would look like success. The inference log exists precisely so a fallback is visible — to the user and to me. - On-device cold starts are announced. Gemini Nano is a large one-time download;
hooks/use-ondevice-readiness.tsprobesLanguageModel.availability()and streamsdownloadprogressinto the app's existing readiness UI. A hidden download is a hang. - No other AI provider is reachable in this build. I audited every call site; the pre-existing Anthropic/ElevenLabs avatar and voicemail paths are gated off in firebase mode rather than left dormant-but-live.
Design evidence, if the judges want receipts: docs/design.md is the design system written as rules (positioning, type, the letter, consequence, wait states, motion budget) with an explicit 1–2-changes-per-pass protocol; docs/craft-pass.md is the diff history against those rules, including one where the shipped code violated the spec (a 12.6-second typewriter reveal) and was measured and removed; docs/design-research.md records the comparable products whose mechanics were studied and what was deliberately not copied. The arrival surface the video shows — the generated letter, its byline, the lane line during the wait, the per-request inference panel — is the output of those documents, not a coat of paint over them.
Challenges we ran into
- The on-device lane is Chrome-desktop-only in the JS SDK. Firebase's Android/iOS on-device adapters are native (Kotlin/Swift), so a React Native app cannot reach them without writing an Expo module that wraps
firebase-ai-ondevice. I chose to submit Web only rather than ship a hybrid claim I couldn't stand behind on two platforms — the rules prefer an outstanding single-platform app to a shaky multi-platform one, and a native bridge is the documented fast follow. - On-device availability is hardware, not flags. The Prompt API is GA in current Chrome — no origin-trial token needed — but on machines without enough memory
LanguageModel.availability()returnsunavailableandPREFER_ON_DEVICEsilently becomes cloud-only. You cannot ship hybrid assuming the device lane exists: degradation has to be designed, announced in the UI, and visible per request. Diagnosing that silent fallback is what produced the environment block in the lane panel. - Structured output across two very different models. Nano wants a
responseConstraint; Gemini wantsresponseMimeType: application/json. Keeping one parser meant constraining both sides and testing the repair path on real malformed output. - Chrome's model download is invisible to the SDK. The first on-device request can block for minutes. Pre-warming and announcing it was the difference between "on-device AI" and "the app is broken."
- The backend had 153 TypeScript errors, and they were hiding bugs. Two root causes — an
...(authTables as any)spread that collapsed the schema's data model, and a duplicateconvexinstall — meantctx.dbwas untyped everywhere. Fixing them took the count to zero and surfaced eight real defects, two of them in this submission's own path:getStatereturned a field its validator didn't declare, and the entitlement fields (tier,voicemailCredits) never reached the client at all, so the premium gate comparedundefined. The write-up isdocs/typecheck.md.
Accomplishments that we're proud of
- Both lanes verified live in production, with receipts. On the final day in ordinary desktop Chrome on the public URL, the free lane generated a real letter receipted
GEMINI-3.5-FLASH-LITE · CLOUD FALLBACK · 4.2Sand the Awakened laneGEMINI-3-FLASH-PREVIEW · AWAKENED CLOUD LANE · 7.8S— not a staging environment, not the debug-token path. And the wait can no longer strand a reader: every generation await is bounded at ninety seconds (lib/inference-timeout.ts), rejecting into the same honest failure card — a lane that never answers becomes a failure you can retry, not a ceremony you cannot leave. - Failure is honest, not templated. A generation that fails in every lane shows a calm failure state with retry — the app never stitches a canned letter and presents it as generated. And a judge never hits the day-one wall:
?demo=day30steps straight into a lived-in 30-day timeline, because the retention mechanics that make this a good product are exactly what would hide it in a 5-minute review. - The hybrid claim is verifiable, not asserted. Every generation persists the SDK-reported
inferenceSource; the lane pill and the per-request inference log show the lane that actually served, the model, and the latency. On hardware where Nano is actually available, offline in DevTools the free ritual still completes — proof, not marketing. - The type-safety restoration: 153 → 0 TypeScript errors, eight latent bugs fixed, two of them squarely in this submission's own path (
docs/typecheck.md). - The deploy repair nobody planned for. Production turned out to be a paused deployment owned by a different account — and a paused deployment still accepts pushes, so earlier "verified" deploys were false greens. Production was rebuilt end to end: schema + 12 components, 370 rows across 20 tables imported and verified table-by-table, 11 env vars copied including a PEM private key reconstructed and proved against the deployment's own
JWKS, the RevenueCat webhook moved and re-tested to 200.docs/deploying.mdis the record. - The design convergence pass. A pre-commit guard (
scripts/verify-design-register.mjs) now enforces the lintable part of the design spec on every commit — the census of violations went 420 → 195, with every surface a judge touches fully clean, and the spec can no longer regress behind the passes. - The craft passes themselves, held to the one-surface-one-or-two-changes protocol: the letter as one typography, the arrival reveal rebuilt from 12.6s to ~1.1s, the wait line naming the inference lane, the day closing in the letter's voice with one line kept for the morning — which the next letter answers as its epigraph.
What we learned
- Silent fallback is the central UX problem of hybrid inference:
PREFER_*makes degradation invisible, so the instrumentation is the feature. - The Prompt API being GA doesn't mean the on-device lane exists: availability is per-machine, so the honest answer to "which lane served?" is per-request instrumentation, not a capability matrix.
- Constraining two very different models into one parser means constraining both sides and testing the repair path on real malformed output, not fixtures.
- A design spec without enforcement decays: the ratchet (block new violations in touched files, burn down the census) converged the codebase faster than any craft pass.
- App Check attestation is environment-sensitive in a way that matters for reviews. reCAPTCHA Enterprise scores the browser, so automated or datacenter review environments can fail attestation (
403/401) even when production is perfectly configured — we verified both sides of that line on the same day. The right response was copy that tells the reviewer what happened and points at what still works, not loosening the threshold.
What's next for Future Selves
- Android + iOS beyond the JS SDK: a thin Expo module bridging
firebase-ai-ondevice(Android) and Apple Foundation Models (iOS) so on-device inference stays inside the AI Logic surface — App Check attested andinferenceSource-reporting. - Remote Config driving the tier→model map, so model churn and paywall experiments don't need a release.
- Firestore offline persistence for the ritual journal, so a check-in survives a cold offline day.
Built With
- app-check
- chrome-prompt-api
- convex
- expo.io
- firebase
- firebase-ai-logic
- gemini-nano
- react-native
- typescript