Overview

Distill turns any web page, foreign-language form or official letter into only what matters. It runs Gemini on your own device first, through Firebase AI Logic hybrid inference, and every result says where it ran.

What it does

One engine powers several everyday jobs, each with a chip that says where the work ran (on this device or in the cloud):

  • Read. One click on a cluttered page leaves only the content. Distill can also translate the page in place into your language, or rewrite it in plain words. The original page is never lost: one control always brings back the untouched page.
  • Ask. Ask a page a question. The answer comes only from the page's own text, runs on the device, and "Show me" highlights the sentence it came from. Your question is never sent to the cloud.
  • Fill. A foreign form becomes an English step-by-step wizard in a side panel. Each answer is typed into the real field of the original form. Your answers stay on the device; a cloud prompt only ever sees the form's structure, never its values. Forms with a guide from the guide library use steps written in advance, and only a named person can mark a guide as checked against the official instructions.
  • Check. Distill finds the claims in a story worth checking. After you agree, it checks them in the cloud with Google Search grounding and shows the sources.
  • Layout. A long page becomes a clear layout built only from a closed set of components. Whatever the model invents outside that set is dropped, and the dropped count is shown on screen.
  • Letter. Take a photo of a paper letter, and Gemini Nano reads the image on the device: who sent it, the deadline, the amount due and what to do. The answer streams in as it is read. If the device can't read images, the photo goes to the cloud only after you say yes.
  • Shop pages and more. Distill gathers a product's price, stock, delivery and returns into one line, with "Show me the price". It also turns dates and deadlines into a to-do list and offers short guided tours of a page.

How we built it

  • One engine, one contract. A TypeScript engine (packages/engine) holds the wire contract that the web app, the Chrome extension and an agent bridge share. The bridge, Handrail, lets an AI agent propose form answers that a person must confirm before any field changes.
  • Firebase AI Logic hybrid inference. Every AI task goes through one router. It picks prefer_on_device, only_on_device or only_in_cloud for each task by its privacy class. A task that carries a person's typed values is always only_on_device and has no cloud fallback; if the device has no model, the feature says so. The inferenceSource from the SDK response drives the "On this device" / "In the cloud" chip on every result.
  • Hybrid capabilities used:
    • On-device image input (the letter photo).
    • Streaming answers (Ask and the letter).
    • Structured output, using responseConstraint on the device and a JSON schema in the cloud.
    • The SDK's own model download, initializeDeviceModel, with progress shown.
    • Google Search grounding for cloud fact checks.
  • One validation door. Model output is untrusted. Every generated layout and form wizard passes a single validation step: a closed vocabulary, no HTML, and unknown parts dropped and counted. If nothing valid comes back, Distill falls back to the plain reading view.
  • Firebase around it:
    • App Check with reCAPTCHA Enterprise guards every AI call.
    • Remote Config steers the inference mode, the cloud model, the layout vocabulary and the prompt version, in real time.
    • Auth signs people in anonymously, and they can link a Google account later.
    • Firestore keeps settings, a shared form-guide library and saved form words, and never a person's values. Security rules enforce this.
    • Hosting serves the web app.
  • Built with agents. We used Claude Code throughout, with Firebase Agent Skills for the AI Logic and security-rules reviews. Implementation agents worked in parallel git worktrees, and every change passed one gate: typecheck, about 1,800 unit tests, a guide check, a secret scan, a design-token check and a CSP check. The Chrome extension also has an end-to-end suite of about 190 tests in real Chromium.
  • The demo film is a build artifact. The film was made with a script:
    • the narration was generated with ElevenLabs and measured before anything was recorded;
    • a Playwright recorder drove the real extension and the live web app in Chrome with the real Gemini Nano, checking every claim the narration makes while recording;
    • Remotion assembled the cut.

Challenges we ran into

  • Keeping a person's values on the device while still using the cloud. We split every prompt into classes: a form's structure may go to the cloud, its values never do. A payload-privacy test fails the build if a value ever reaches a cloud prompt.
  • Small-model reliability. Gemini Nano is fast and private, but smaller, slow and unreliable.
  • Working inside other people's pages. The extension changes a live page without breaking it.
  • Saying where it ran, honestly. The chip comes from the SDK's own response, never from a guess.
  • The one-model-at-a-time reality. The on-device model handles one session at a time..

Accomplishments that we're proud of

  • A hybrid AI app where privacy is enforced by the router and by tests, not just promised: values-class tasks cannot reach the cloud.
  • Every AI result in the product shows where it ran.
  • On-device multimodal input in the browser: a photographed official letter is read with no upload.
  • The demo film is reproducible: if the product changes, one command re-records and re-renders it.

What we learned

  • Hybrid inference is a product decision for each task, not a global switch.
  • Small on-device models do well when their output is constrained and validated. Freedom is what breaks them.
  • Firebase's surrounding services (App Check, Remote Config, Auth, Firestore rules)

What's next for Distill

  • Cross-device LLM companion with single brain
  • Privacy/Spam protector for web browsing
Share this project:

Updates

Submission history