Inspiration

"Hi Mum, I dropped my phone, this is my new number. Can you send £640? Don't tell Dad."

Messages like this work because they create panic before the reader has time to think. An AI chatbot can spot them, but checking means pasting family chats, bank emails and account numbers into someone else's server. Many people won't do that, and they are often the people these scams target. I wanted a scam checker that is private by default and only uses the cloud when it adds real value.

What it does

GhostSignal is a Chrome web app. You paste a text, email or chat, or drop in a screenshot, and it tells you whether it looks like a scam, which pressure tactics it uses (false urgency, secrecy, changed bank details, gift-card payments and more), and what to do next.

  • On your device first. Gemini Nano runs inside Chrome, so most checks never leave your computer and still work offline.
  • Personal details hidden. Names, phone numbers, emails, card numbers, IBANs, sort codes and one-time codes become placeholders like [NAME_1] before anything can reach the cloud. The real values are swapped back in locally for display.
  • Cloud only when unsure. Borderline or uncertain messages get a second opinion from a larger Gemini model, which sees only the redacted copy.
  • Full transparency. A "What left this device" panel shows exactly what the cloud received, or "Nothing" when the whole check stayed local.

How I built it

The app is React and TypeScript, built with Vite. All AI runs through the Firebase AI Logic hybrid inference SDK:

  1. Rules on device: deterministic redaction and scam-pattern checks run instantly.
  2. First opinion (PREFER_ON_DEVICE): Gemini Nano when available, cloud Gemini otherwise. response.inferenceSource reports where each answer actually ran.
  3. Escalation policy: low confidence, a grey-zone risk score, disagreement between the pattern checks and the AI, or very long text triggers a second opinion.
  4. Deeper privacy scan (ONLY_ON_DEVICE): Nano reads the raw text to find names and addresses the rules missed. This mode throws instead of falling back, so raw text can never reach the cloud.
  5. Cloud second opinion: a larger Gemini model reviews the fully redacted text.
  6. Restore on device: placeholders are swapped back for the user.

Other Firebase products:

  • App Check (reCAPTCHA Enterprise) protects every AI call.
  • Remote Config delivers scam patterns, escalation thresholds and model names in real time, so new scam wording reaches every user without a release.
  • Anonymous Authentication and Firestore keep a private, offline-capable history that stores only redacted text, enforced by security rules.
  • Hosting serves the app, and a service worker makes it work offline.

Challenges

  • Hybrid fallback and privacy. PREFER_ON_DEVICE silently falls back to the cloud when Nano is unavailable. That meant I could never give the hybrid model raw text. I redact before the hybrid call and use ONLY_ON_DEVICE for the one step that must read raw text.
  • Trusting small-model output. Nano sometimes returns contradictory results, such as "safe" with a risk of 85. Every model response is validated and clamped against a JSON schema before it is shown.
  • Redaction without false alarms. "Hi Mum" is not a name, but "Hi Sarah" is. The rules handle greetings, sign-offs and payee lines, and a token map restores values exactly.
  • Bad remote config must never break scanning. Patterns from Remote Config are compiled defensively, and any invalid pattern is skipped.

What I learned

How to design around Chrome's built-in AI: responseConstraint for structured output on Nano, the user-gesture requirement for initializeDeviceModel(), and how to treat the cloud as an escalation path instead of the default.

What's next

A Chrome extension that checks messages in Gmail and web chat directly, an Android version with Gemini Nano through the same SDK, and support for more languages.

Built With

  • chrome-built-in-ai
  • cloud-firestore
  • firebase
  • firebase-ai-logic
  • firebase-app-check
  • firebase-authentication
  • firebase-hosting
  • firebase-remote-config
  • gemini-api
  • gemini-nano
  • react
  • recaptcha-enterprise
  • service-worker
  • typescript
  • vite
  • vitest
Share this project:

Updates

Submission history