Inspiration

In Rwanda, as across East Africa, mobile money is how people get paid, pay rent, buy airtime and send money home. Every transaction arrives as an SMS: dozens a month, in English, French or Kinyarwanda. Nobody adds them up, and fees hide in the small print of each message. The messages are also intimate. They hold names, phone numbers and balances, so sending them to a cloud model as they are is not acceptable.

What it does

Paste a month of mobile-money SMS, one per line. Where Did My MoMo Go? reads every message, puts each payment in a category, and shows:

  • what you spent, what you paid in fees and the fee share of what you sent;
  • a "money river" from money in to each category and to what is still with you;
  • plain-language insights and one practical action.

Every row says where it was processed: On this device, Cloud, names masked, Cloud, totals only or Read by rules. The status line counts them, and What left this device lists the exact masked text of every cloud call. Add ?mode=cloud to the URL to switch the on-device model off and watch the masked cloud path on any browser.

How we built it

Firebase AI Logic hybrid inference decides where each step runs, according to what the data contains:

Step Data it sees Inference mode
Read a message the rules cannot parse (for example Kinyarwanda) the full message ONLY_ON_DEVICE (Gemini Nano, transaction JSON schema as responseConstraint); if the device has no model or it is too slow, the text is masked locally and sent ONLY_IN_CLOUD with a responseSchema
Categorise a counterparty the name, or a pseudonym for individuals ONLY_ON_DEVICE with the category list as an enum constraint, then ONLY_IN_CLOUD on the masked name
Write the insights totals and pseudonyms only PREFER_ON_DEVICE
  • A deterministic parser reads standard formats first: instant, free and private.
  • Masking runs in the browser: names become Person-A, phone numbers, meter and transaction IDs become #1, #2, amounts stay. It knows English, French, Kinyarwanda and Swahili cue words and also masks any name written just before a phone number. The pseudonym map never leaves the device, and cloud answers are mapped back to real names locally.
  • Numbers stay honest: every total comes from plain code. Each amount, fee and balance a model reads is checked against the RWF figures written in that message, and an insight line that quotes a figure not in the totals is left out.
  • On-device sessions are text-only, one warm session keeps Gemini Nano in memory, and a slow on-device prompt is aborted after a time limit so it never blocks the next message. While Gemini Nano downloads, the masked cloud path answers, and a one-time button starts the download with progress.
  • App Check with reCAPTCHA Enterprise is enforced for Firebase AI Logic, and the key only works on the app's domains.
  • Firebase Hosting, Vite, plain JavaScript, 8 Node tests (parser, masking in three languages, totals, figure checks, insight guard). Apache 2.0.

Challenges we ran into

  • One JSON constraint on every on-device call made Gemini Nano write a full transaction object when asked for a one-word category, and calls timed out. Giving each task its own constraint brought on-device categorisation to about 2.5 to 3.5 seconds on a laptop CPU; a full Kinyarwanda read takes about 25 seconds.
  • Gemini Nano once read 10,000 RWF as 10. That is why every model-read figure is now checked against the message itself.
  • The cloud demo showed a Kinyarwanda name slipping through the masking, which only knew English cue words. We fixed it and added a test for Kinyarwanda and French messages.
  • An on-device insight once worked out its own "money left" figure and forgot the fees. The insight guard now drops any line with a figure that is not in the totals.

Accomplishments that we're proud of

  • On a laptop in Chrome, all 10 sample messages read in under a minute: 4 by rules, 6 on this device, and nothing sent to the cloud.
  • In cloud mode the same month takes 7 cloud calls, and every one is listed with its masked text; no raw SMS appears in any request.
  • A live, App Check protected app anyone can try, with a demo switch for browsers without Gemini Nano.

What we learned

Hybrid inference is a privacy tool as much as a cost or latency tool: choosing the mode per step, by what the data contains, lets one app be both private and capable. And small on-device models need guard rails in code, not just better prompts.

What's next

  • An Android version that reads the SMS inbox directly with Gemini Nano on the phone.
  • Monthly budgets, alerts when fees climb, and suggestions for cheaper ways to send money.
  • French and Kinyarwanda interfaces, and pilots with savings groups for financial-literacy sessions.

Try it: https://where-did-my-momo-go.web.app · Cloud demo: https://where-did-my-momo-go.web.app/?mode=cloud · Code: https://github.com/fkamanzi/where-did-my-momo-go

Built With

Share this project:

Updates

Submission history