-
-
Your family chat already holds the dates. SideNote finds them on your device.
-
Confirm three answers: when it started, did it stop when the pill stopped, did it come back on restart.
-
What leaves this device: 3 coded facts, 1,349 bytes. Not sent: 400 chat messages or anyone else's words.
-
Network off: the cloud-first ranker runs on Gemini Nano, and the ledger shows every call ran on this device.
-
The FDA MedWatch 3500B draft, filled from confirmed facts, in English or Arabic.
-
iPhone app: no on-device model here, so chats stay closed and nothing from them is sent.
-
Android app, same codebase: the suggestion comes from Google cloud, approved by you.
-
One routing table: the reader never leaves the device; only coded facts you approve reach the cloud.
Inspiration
Margaret, 71, takes six medicines. Her legs have ached for weeks, and she thinks it might be the new cholesterol pill. The FDA's form asks the questions that matter most: when did it start, did it stop when you paused the pill, did it come back when you restarted? She can't remember. Her daughter Sarah can, because it's all in their WhatsApp chat. Most suspected side effects are never reported: across 37 studies, the median under-reporting rate was 94% (Hazell & Shakir, Drug Safety, 2006). SideNote turns the evidence patients already have into the dates regulators need, and keeps everyone else's words on the device.
All names and messages here and in the demo are synthetic.
What it does
Patients stop filling in a form from memory and start showing their own receipts. You import a WhatsApp chat; the timeline builds itself from your messages while you watch; you confirm three answers (when it started, did it stop when you stopped the pill, did it come back when you restarted); SideNote drafts the FDA MedWatch 3500B, the UK Yellow Card or the Egyptian Drug Authority report, in English or Arabic.
How we built it: Firebase AI Logic hybrid inference at the core
Why two kinds of routing: the Reader sees raw family messages (other people's words and health details), so it must fail closed, never fall back to the cloud. The coder and ranker only see a short phrase or coded facts you have already approved, so automatic fallback is safe there: the coder still works on devices without Nano, and the ranker keeps working offline. Privacy where the data is private, resilience where it isn't.
- On device only (Gemini Nano in Chrome,
ONLY_ON_DEVICEbehind a guard): the Reader reads the chat. If there is no on-device model, chats stay closed and nothing is sent; the person answers 5 short questions instead. - Hybrid, on-device first (
PREFER_ON_DEVICE): the Coder maps a short phrase in your own words to a reaction term from public FDA labels; Nano does it on the device, and on devices without a model the SDK falls back to Gemini in the cloud (verified live). - Hybrid, cloud first (
PREFER_IN_CLOUD): the Suspect ranker compares two or more medicines from confirmed, coded facts (JSON, no free text); offline, the SDK moves it to Nano automatically (verified with the network cut). Code keeps only the reasons the data supports. - You approve the exact bytes: nothing that can reach the cloud is sent until you approve it on "What leaves this device".
- Every call is visible: the ledger shows each step, where it ran (
inferenceSource) and the exact bytes that left. - Three platforms, one codebase (React + Capacitor): the web app (Chrome, the only browser with Gemini Nano today), an Android app and an iOS app. On the phones the on-device reader stays closed (no Nano in the WebView), so they show the fail-closed path, the 5 questions, and the hybrid Coder and Suspect ranker running in the cloud through Firebase AI Logic (the full flow verified on an Android emulator, with the AI call returning 200 through native App Check; the iOS app verified to the fail-closed start on the simulator).
- App Check enforced on the AI endpoint: reCAPTCHA Enterprise on the web; native App Check in the apps through
@capacitor-firebase/app-check(debug providers on the emulator and simulator; store builds would switch to Play Integrity and App Attest, not set up yet). Firebase Hosting serves the judge URL.
Named agents and their handoffs
Importer → Prefilter → Reader (on device) → Evidence Challenger → Timeline → Safety (red flags) → Lookup coder → Model coder (Nano first, approved) → Payload builder → Suspect ranker (cloud first, approved) → Report → You.
Each hands its output to the next; the Challenger rejects any fact whose quote it can't find in the chat; you approve before anything leaves. The three model agents (Reader, Coder, Suspect ranker) appear in the ledger with where each call ran; the code agents do their work on screen (facts appear with their quote while the Reader runs; the timeline shows what the Challenger kept). See the architecture diagram in the gallery.
How we know (measured)
- Chat test on 10 held-out planted chats (written by another model family, never seen while tuning): 43 of 49 timeline facts right, 4.4% unsupported claims before confirmation, +3.3 needed dates per chat over 5 questions alone (95% CI 2.2 to 4.5); median 33 s per chat; 0 requests to the AI endpoint while reading.
- Leakage test: 0 of 135 cloud payloads and report exports from 30 chats share a phrase with anyone else's messages; leaks we planted on purpose were caught (it also caught a real one in the report draft, which we fixed).
- Coder on 111 unseen everyday phrases that map to a reaction term (from a 179-phrase test set, kept local): word lookup 27%, Nano 58%, cloud 72%; both models clear the +0.15 bar over the lookup.
Challenges we ran into
ONLY_ON_DEVICErequests reach the cloud when the browser has noLanguageModel, so the private reader needed its own guard that fails closed. We raised it with the Firebase team on the hackathon Discord.- Nano isn't held to the cloud's JSON schema: offline, it once ranked the same medicine twice. Code now keeps each medicine once, with a test for it.
- Other people's words must never leave, even inside a coded fact, so every cloud payload is built from an allowlist and checked by the leakage test.
What's next
The private-evidence core ships as its own package (packages/private-evidence: the WhatsApp importer, quote locator, date resolver and the on-device guard), with no medical terms inside; the routing table, payload builder and leakage checker are domain-free too, so any "private records in, coded facts out" app can reuse them. Next: per-agent latency and leak checks as dashboards, and other evidence sources (pharmacy receipts, calendar).
Built With
- android
- capacitor
- chrome-built-in-ai
- firebase-ai-logic
- firebase-app-check
- firebase-hosting
- gemini
- gemini-nano
- ios
- playwright
- react
- recaptcha-enterprise
- typescript
- vite
- vitest