How it’s built
The split between this computer and the cloud is set by the problem: the settings pages are the private data, so they are read here, and the cloud only ever sees what kind of access was found.
| Piece | Runs | Why it is used |
|---|---|---|
Gemini Nano through Firebase AI Logic (ONLY_ON_DEVICE) | This computer | Reads and sorts the private settings pages, reads a page a site has changed, reads a screenshot of a phone location app (image input), and orders the plan when the person turns plan help from the cloud off. No cloud fallback, on purpose: the pages and pictures are the private data. |
Gemini through Firebase AI Logic (ONLY_IN_CLOUD, function calling) | Google’s cloud | Orders the plan from finding types only, when plan help is on. It asks the device yes or no questions with ask_device and the person with ask_user, and reads the public steps with get_steps. |
| Two-voice check | Google’s cloud | Two arguments over the plan, each from the steps library’s facts about what the other person would see, and a third call that settles it and says, kind by kind, what each voice argued. Finding types only. |
| URL context tool | Google’s cloud | Checks that a library entry’s steps still match the official help page. (Search grounding is not on the free tier.) |
Hybrid inference (PREFER_ON_DEVICE) | Either | The practice check on this site, which holds only made-up data: Gemini Nano when the browser has it, the cloud when it does not. It reads changed practice pages and Jordan’s made-up phone screenshot the same way; the screenshot is checked by its hash before it can be sent. |
| Firebase AI Logic server prompt templates | Firebase’s server | The plan’s instructions, answer format and three functions stay on Firebase’s server. The extension, this site and the Android app send only the template’s id and the finding codes. The template’s input schema allows only codes and answers, so the server is a second check: a name where a code goes was refused before any model saw it. Two templates on two models, then the direct call, as backups. |
| Firebase App Check (reCAPTCHA Enterprise) | Site and extension | Only Spare Key can spend its model quota. The extension gets tokens from a small page on this site that answers only the extension. |
| Firebase Remote Config | Every install | Page readers, the words the code rules read, models and switches. When a site changes a page, a fix reaches every install with no store update: each install fetches it at most once an hour. The layout drift test runs every fix through the same code the extension runs. |
| Cloud Firestore | Google’s cloud | The public steps library, which the extension refreshes when it is newer. Opt-in anonymous reports when a page looked different: five fixed fields, create-only, sent only when the person presses the button. |
| Firebase Hosting | Google’s cloud | This site, the practice pages and the Steps API. |
| Step-by-step phone check | Any phone | For iPhone and Android: the person looks in Find My, Apple family, Life360, tracker alerts, the phone plan and the apps that can watch a phone, and answers. The same plan code and safety rules run in the page. No model is needed, because the person did the reading, and nothing is sent. |
| Chrome extension APIs | This computer | Side panel, the scan tab, permissions asked for per site, the extensions check, history cleanup. |
Firebase AI Logic for Android, on device (InferenceMode.ONLY_ON_DEVICE) | The phone | Gemini Nano, through AICore, says what kind of app each one seems to be: monitoring, family locator, parental control, assistive, everyday. The list of apps on a phone is private, so there is no cloud fallback. It can add a caution to a card; a note that would reassure is never shown, and it can never hide a finding. Run on one real phone (a Pixel on Android 17): it read all 13 listed apps on the phone in 9.8 seconds. A caution from it counts only when the app’s name, its source or its powers back it up: its first run raised a caution on 10 of 13 ordinary apps, and with the rule 2 were kept and 6 set aside. |
Firebase AI Logic for Android, in the cloud (InferenceMode.ONLY_IN_CLOUD, function calling) | Google’s cloud | Orders the phone’s plan from finding types only. ask_device asks the phone things like “did this app come from outside the store?”, and the phone answers yes, no or unknown. |
Which on-device model, from Remote Config (OnDeviceModelOption) | The phone | Gemini Nano 4 Fast, then Gemini Nano 4 Full (previews built on Gemma 4, for phones in the AICore developer preview), then the Gemini Nano the phone ships with. The first one the phone has is used; the list can change with no app update. |
Jetpack JavaScriptSandbox (androidx.javascriptengine) | The phone | Runs the extension’s own rules on the phone, in a process with no network and no files: the finding types, the cloud gate, the plan and the safety rules. One engine, so the phone and the extension cannot drift apart. If the sandbox cannot start, the same rules run in a hidden WebView with network loads off. |
| App Check on Android, through the site | The phone | An app installed from this site has no Play Integrity, so it gets reCAPTCHA Enterprise tokens from the same small page the extension uses, over a message channel the app adds to that page. Another Android app could load the page the same way, so this guards the model quota less well than Play Integrity would. It is what an app outside the Play Store can have. |
| WebCrypto | This computer | The locked copy: PBKDF2 with 600,000 rounds and AES-GCM. Opening one beside a new check shows what is new since then. |
| A wrapper around fetch | This computer | The ledger under “What left this computer”: every request by where it went and its size, and how many hold anything from the check. |
| MCP server | The developer’s computer | Steps and plans for AI assistants, from finding types only. |
What happens when a piece fails
Every step has a backup, and the last one never needs the cloud.
| Piece | In order |
|---|---|
| Ordering the plan in the cloud | Server prompt template 1, then template 2 on a second model, then the direct call to model 1 and then model 2 (one retry when a model is busy), then the plan made by code, which is already on the screen before any of them answer. |
| Gemini Nano on the computer | Gemini Nano, then code’s own reader and sorter. A page neither can read is listed as not checked, never as nothing found. |
| Gemini Nano on the phone | Gemini Nano 4 Fast, then Gemini Nano 4 Full, then the Gemini Nano the phone ships with, then code’s own sorting (the order is a Remote Config list). |
| Reading a settings page | A reader fixed through Remote Config, then the bundled reader, then Gemini Nano reading the page text, then “Not checked” with the page to check by hand. |
| The rules engine on Android | Jetpack’s JavaScript sandbox, then the same rules file in a hidden WebView with network loads, file access and content access off. On the builder’s phone both gave the same result: 72 apps read, 13 listed, the same 7-step plan. |
| App Check for the extension | The bridge page on spare-key-app.web.app, then a fresh copy of it, then the same page on spare-key-app.firebaseapp.com. With no token, nothing goes to the cloud and the plan made by code is shown. |
| App Check for the phone | The bridge page, then one wait and a second try, then the plan made by code. |
| Settings and switches | Remote Config, then the last copy fetched, then the defaults built into the app. |
| The steps library | The Firestore copy when it is newer and passes its checks, then the copy built into the extension and the app. The MCP server: the live Steps API, then its own copy. |
| Checking that steps still match the help pages | The URL context tool, then a fetch from the device with no cookies, then “not sure”. |
| The two-voice check | If it fails, the cloud plan stays, and the safety rules still check it. |
| Someone to talk to | The National Domestic Violence Hotline by call, text or chat, then loveisrespect by call or text, then 911 for danger right now. The numbers can be changed through Remote Config, and a malformed number falls back to the built-in one. |
Not backed up yet: the site and the extension download are on Firebase Hosting only. A copy on GitHub Releases waits for the repository to be public.
Privacy-tiered routing
Each step runs at the most private tier its data allows, and the tier is set by the data, not by convenience:
- Device only (
ONLY_ON_DEVICE): anything that can name a person. The settings pages, a page a site has changed, a phone screenshot. Without Gemini Nano these are read by code or not at all, never by the cloud. - The person’s choice: finding types and the answers the person chooses to share. With plan help from the cloud on, Gemini in the cloud orders and explains the plan; with it off, Gemini Nano does, on this computer. Either way, code’s safety rules decide what is shown.
- Cloud (
ONLY_IN_CLOUD): public text. The steps library, the official help pages, and the two voices arguing over finding types.
One check, checkOutgoing(), sits between the tiers. The made-up practice check on this site is the one place a lower tier’s data may go up, because none of it is real.
What code decides, and what Gemini adds
Code decides everything that keeps a person out of danger. The plan made by code, with no model, passes every safety measure on its own, and the safety rules check any plan a model writes. Gemini adds what code cannot do:
| What | Without Gemini | With Gemini |
|---|---|---|
| Read settings pages a site has changed (all four kinds of change at once) | 6 of 24 ways in shown | 18 of 24, by Gemini Nano on the computer |
| Read a phone app’s sharing screen from a screenshot | Nothing: code cannot read a picture | 3 of 3 made-up people, with “Me” left out, on 1 of 3 runs. One run split the names, and one could not start |
| Order the plan for this situation and explain each step in plain words | One fixed order and stock sentences | Per-situation order and wording, asking the computer yes or no questions it needs |
| Put a step in simpler words, on request | Not possible | Gemini Nano on the computer, or the cloud for the public steps only |
Ordering is where models still fall short, so the rules stay in charge. Before the rules ran, the cloud’s plans needed 63 fixes on 38 situations (45 after the two voices) and Gemini Nano’s 103 on 35. The accuracy page has the measures.
The cloud asks, the device answers
Gemini in the cloud orders the plan without ever learning who anyone is. When it needs a fact, it can call back to the device, and the device answers with an enum. The shape of an exchange:
cloud: ask_device({ ref: "f3", question: "filter_also_deletes" })
device: { "answer": "no" }
cloud: ask_user({ ref: "f1", question: "set_up_by_you" })
person: Not sure → { "answer": "not_sure" }
How often each function was called in the measured runs is on the accuracy page.
Every request and every answer passes one check, checkOutgoing(), which accepts only finding codes and fixed answers, and refuses any request holding a name, address or device this check found. Every request is shown word for word under “What left this computer”, with the fixed instructions sent with it.
One rules engine, two platforms
The extension’s rules are plain JavaScript modules with no browser in them: finding types, toCloud() and checkOutgoing() (the only way anything leaves), the plan, and the safety rules. The build bundles the same files for the Android app, which runs them in Jetpack’s JavaScript sandbox. Kotlin reads the phone and makes the model calls; everything that decides runs in the shared code.
That is why the phone found its first real bug in the gate, not around it: on the emulator, the gate refused its own answer because a setting’s label matched a line in the public steps library. The fix and its test are in the shared code, so the extension has them too.
Authentication only for developers
Survivors never sign in, and the extension has no sign-in at all: an account would be one more thing to find. The Steps API needs no key.
Reused code
The Firebase AI Logic wrapper and the App Check bridge for a Chrome extension come from the author’s other #BuildHybridAI entry, Still Recalled, with the backend changed to the free Gemini Developer API.