Inspiration

When a robot stops in the field, an engineer has to scrub dozens of telemetry channels by hand to find out why. Cloud AI could help, but these logs often can't leave the building: customer-site data, export-controlled drone telemetry, and data that feeds incident reports. The new agentic log tools upload the log and trust the model's numbers. We wanted the opposite: the AI comes to the data, and it never gets the last word on a number.

What it does

  • Parses the robot log (MCAP) in the browser, in a Web Worker. The raw log is never uploaded.
  • Ranks anomaly onsets across every channel by time. This is deterministic, with no AI, so the app is useful even without a model. It also counters the documented tendency of LLM agents to fixate on the first anomaly they notice.
  • Explains the incident with Gemini Nano on-device, through Firebase AI Logic in ONLY_ON_DEVICE mode. Nano gets a chart image of the window plus a compact stats table.
  • The model never states a number. It points: channel, time window, statistic, direction. A deterministic verifier recomputes every value from the raw samples and marks each claim VERIFIED or REJECTED. Channel names are constrained by the schema, so the model can't invent a channel.
  • Consented cloud fallback. If Nano isn't available, or the engineer wants a deeper multi-window investigation, Rootcite shows an egress preview: the exact JSON that would leave, its size in bytes, and "raw log sent: 0 bytes". The cloud runs only after approval.
  • Cloud investigation with a fetch_window tool. Cloud Gemini can ask for more data across several windows, and every finer-resolution request goes back through the approval gate before anything is sent.
  • Self-improving loop, driven by the verifier, not by the model's opinion of itself:
    • Verify-and-repair. Verifier rejections become exact feedback (which claim, which window, why) for one on-device retry. The card shows attempt 1 and attempt 2 verified counts, and the retry is kept only if it verifies at least as well.
    • Consented escalation. If Nano still fails verification after repair, Rootcite offers to escalate to cloud Gemini, with the byte count stated in the consent dialog.
    • Experience library. Confirmed diagnoses are kept in this browser's localStorage and recalled as worked examples when a new incident has a similar onset pattern. The library never leaves the browser.
    • Adaptive routing. Rootcite tracks Nano's measured verified-claim rate on this device and compares it to a Remote Config bar (min_on_device_verified_rate). If Nano is underperforming, the router recommends cloud up front, with the measured rate as the reason, and still asks for consent.
  • WebGL 3D incident replay driven by the telemetry. Wheels spin at the logged RPM, the battery bar follows voltage, and the robot moves by odometry. Amber marks an out-of-range reading and orange marks the earliest-onset channel. The replay is synced with a timeline playhead.
  • Ground-truth check on synthetic incidents. The answer card says whether the model's root cause "Matches the injected fault", next to the actual injected cause.
  • Every answer shows a routing record: the requested mode, the path that actually ran (response.inferenceSource), why, latency, and bytes that left the device. A footer tracks the verified-claim rate per path (on-device versus cloud).
  • Findings can be confirmed or rejected and saved to Firestore (verified claims and routing only, never raw data). An evidence pack exports as Markdown.

How we built it (Firebase AI Logic)

  • Hybrid inference via getGenerativeModel(ai, { mode, onDeviceParams, inCloudParams }). On-device requests use responseConstraint for structured JSON and image input. Cloud requests use responseSchema and function calling.
  • We deliberately don't use the SDK's silent PREFER_* fallback for log data. On-device is ONLY_ON_DEVICE, so it cannot leak to the cloud. Cloud is ONLY_IN_CLOUD, issued only after consent. For sensitive data, fallback should be a decision the engineer makes, not plumbing.
  • App Check (reCAPTCHA Enterprise in production; a dev-only debug token for localhost).
  • Anonymous Auth, so judges have no login wall.
  • Firestore: every save needs explicit consent in a dialog that states the byte count being stored. Owner-only rules accept only an allow-list of fields, so raw-sample fields cannot be written.
  • Remote Config as the policy lever: cloud_egress_allowed, the on-device token budget, the onset threshold, min_on_device_verified_rate, and cloud_model (currently gemini-3.5-flash-lite). When the first cloud model we picked hung, we changed it centrally in Remote Config, which is a real example of an org switching policy without a redeploy.
  • Hosting for the public demo.
  • 49 unit tests. The onset detector is tested for separation: it fires on both injected faults and stays silent on five fault-free logs, across a threshold sweep.

Challenges

  • Measured, not assumed. A deeply nested JSON schema took 19 s on Nano even for a one-line prompt, so we trimmed the evidence and turned channel names into enums, which also made invented channel names impossible.
  • Nano cited single instants ("at 42 s"). Rather than silently rejecting those, the verifier reads a point citation as a 1-second window and says so on screen.
  • Our first noise threshold verified "drops" in quiet data. We measured clean data at 2.2–3.1σ and raised the bar to 5σ.
  • We found an App Check debug token being inlined into the production bundle by Vite (import.meta.env as an object); we revoked it, issued a dev-only token and verified the live bundle no longer contains it.
  • The first cloud model we picked hung; switching it centrally through Remote Config fixed production without a redeploy.

Measured (one development laptop, observed runs, not benchmarks)

  • Gemini Nano context window: 9,216 tokens. Session creation: ~1.6 s.
  • Full on-device triage: 30–92 s, with the correct root cause and all claims verified in the observed runs.
  • Cloud: ~1.0–1.6 s for triage; ~3.5 s for the investigation, including one approved fine-window request.
  • Bytes sent: 826 B for a cloud triage versus 0 B on-device.

Accomplishments

  • The on-device path finds the injected root cause with 0 bytes leaving the device.
  • A hybrid design where fallback is visible and consented, the model is never trusted with arithmetic, and the system learns from what the verifier confirms rather than what the model claims.

What we learned

On-device models are good at where to look and bad at what the number is. Splitting those jobs (model for attention, code for values) is what made a small model trustworthy, and it also gave us an honest signal to learn and route from.

What's next for Rootcite

  • An Android companion at the robot (Firebase AI Logic on Android; it needs a Gemini Nano 4 device).
  • Support for more MCAP encodings (CDR) and real public fault datasets once licences are clarified.
  • A fleet-level prompt comparison using Remote Config conditions, judged on aggregate verified-claim counts only.

Data notice

Demo incidents are synthetic (generated with known injected faults so correctness can be checked), and they are labelled as such in the app. This is new work built during the submission period.

Built With

  • cloud-firestore
  • firebase
  • firebase-ai-logic
  • firebase-app-check
  • firebase-authentication
  • firebase-hosting
  • firebase-remote-config
  • gemini
  • gemini-nano
  • mcap
  • recaptcha-enterprise
  • runware
  • three.js
  • typescript
  • vite
  • webgl
Share this project:

Updates

Submission history