Inspiration
Final-year health students sit vivas and oral exams. Rehearsing with a real examiner is scarce: the senior who could do it is free once a week, so most people recite to a half-listening roommate or silently re-read. The AI tutors they try answer "Great answer!" to a bluff. A real examiner hears "resuscitate, fluids, PPI, scope" and asks "at what haemoglobin do you transfuse?". And a plain keyword checker will happily credit "I would give aspirin" on a question about what to stop.
Viva and OSCE practice tools exist already. What Hot Seat adds is the receipt: no mark is given without a quote of your own words, and the screen shows which brain (your laptop or the cloud) decided each step.
Hot Seat is for those students. It builds the exam from your own revision notes, examines you out loud, and gives a mark only when two checkers agree you really said it.
What it does
- Rubric Forge. Paste your notes. The cloud turns them into a Rubric Card of must-say points. Each point shows the exact line of your notes it came from, and code drops any point whose line is not really in your notes.
- The viva. The examiner asks aloud (or you type). Naming a thing is not answering it: it probes the keyword you named ("You named endoscopy. Within what time?").
- Two-checker marking. Keyword code and an AI model (Gemini Nano on your laptop, or the cloud model on a machine that cannot run Nano) each judge every candidate point. A mark needs both to agree, a quote from your own words, and the right direction. A deterministic direction check stops "give aspirin" from earning a "stop aspirin" point.
- Appeals. Where the checkers disagree, the point is Disputed and goes to the cloud for one appeal by itself (it waits in a queue if you are offline). Only disputed points are sent, with your answer, and the cloud must quote you too. No quote, no mark.
- Routing Board. Every feature shows which path actually answered,
on_deviceorin_cloud. - Offline and private. On a laptop with Gemini Nano, marking keeps working with Wi-Fi off. Appeals wait in a visible queue and send themselves when data returns. A "Never send my answers" switch pins marking to the laptop and locks appeals (building a rubric from your notes is a cloud step, so notes are sent when you forge one).
- Report, Tomorrow's queue, Calibration. A cited report (templated offline twin), a queue of what you missed, and a page that shows the checkers' measured behaviour and lets you rerun it.
How we built it: Firebase AI Logic
Every model call goes through one function, callFeature() in src/ai/hybrid.ts, built on getGenerativeModel(ai, { mode, inCloudParams, onDeviceParams }) from firebase/ai. Each feature picks its own InferenceMode:
| Feature | InferenceMode | Where it runs | Offline |
|---|---|---|---|
| Rubric Forge | ONLY_IN_CLOUD |
Cloud, gemini-3.5-flash-lite |
Locked; sample topic still works |
| Marking | PREFER_ON_DEVICE (ONLY_ON_DEVICE with the privacy switch on) |
Gemini Nano in Chrome via the Prompt API; without Nano, one batched cloud call | Keeps working on the laptop |
| Appeals | ONLY_IN_CLOUD |
Cloud adjudicator, must quote the answer | Queued, drained on reconnect |
| Examiner's Report | PREFER_IN_CLOUD |
Cloud, items must cite a real point | Templated report built by code |
- inferenceSource. The chip on the Routing Board is read from
result.response.inferenceSourcecompared withInferenceSource.ON_DEVICE, and nothing else. No UI code writes a chip value. - On-device Nano.
onDeviceParamsdeclares English text in and out, andresponseConstraintpasses the same JSONSchemato Nano and to the cloud model, so both paths return the same shape. The one-time model download starts only from the Wake the examiner button, because it needs a user gesture. - App Check. reCAPTCHA Enterprise protects every cloud call, with enforcement on. A direct REST call to the endpoint without a token returns HTTP 401 (recorded in the wire phase).
- Privacy switch.
ONLY_ON_DEVICEcan fall back to the cloud when Chrome'sLanguageModelis missing (Firebase JS SDK issue 10635). So the app checksLanguageModel.availability()itself and refuses before anything is sent, then discards any result whoseinferenceSourceis not on-device. One recorded run: 0 network requests during a whole answer (a JavaScript-level request log). - Offline queue. Appeals are stored in the Data Window and drain by themselves on reconnect.
- Code owns every mark. Models propose,
decide()insrc/domain/marking.tsis the only function that can credit a point. A failed model call is "no vote", never a credit.
Challenges
A live false credit. Testing the hosted app on Nano, "I would give aspirin for the pain" was credited for a point about stopping or reversing drugs. We fixed it with a deterministic direction check plus action-verb anchors, then re-tested live: not credited. A regression test pins it. Evidence: evidence/t2-forge-and-typed-viva-2026-11-29.json, evidence/debug-live-2026-11-29-post-fix.json.
A model that hung. We tried gemini-3.8-flash for appeals. Through Firebase AI Logic it hung for more than 25 seconds, so we reverted. Appeals use the same cloud model as the other cloud calls.
Honest limits. Without Nano, marking is one batched cloud call on the same cloud model, and the app says so.
Accomplishments
- A hybrid design where each feature has its own mode and the user can see which path answered.
- A privacy switch that refuses rather than silently falling back to the cloud.
- 724 passing tests, including 139 stress tests, and 18 stress findings fixed.
- A Calibration page that shows the checkers' behaviour on 66 checks and invites you to rerun it. Across the 20 saved runs, the two checkers together gave 0 unearned marks and missed 2 to 4 correct points per run, while Gemini Nano on its own gave 3 to 4 unearned marks. The checkers disagreed on 4 to 6 of the 66 checks, and only those went to the cloud. One hand-authored rubric, 20 saved runs, non-deterministic, rubric and answers by the same author.
What we learned
Per-feature routing is a product decision, not a toggle. Cloud for building and judging, device for the high-volume private step. Let the SDK tell you which path answered instead of assuming. And a model should propose while plain code decides, especially where a wrong mark is worse than a missing one.
What's next
Clinician sign-off for seed topics, Wi-Fi-off sessions with real students, Remote Config to flip modes without a redeploy, more languages (Yoruba, Hausa, Igbo, Pidgin) once local speech exists for them, and Android.
Built with
Firebase AI Logic (firebase/ai, hybrid inference), Gemini Nano via Chrome's Prompt API, gemini-3.5-flash-lite, Firebase App Check (reCAPTCHA Enterprise), Firebase Hosting, React, TypeScript, Vite, Vitest, Claude Code.
Links
- Live app: https://hotseat-viva.web.app (desktop Chrome, no sign-in; Nano optional)
- Repo: https://github.com/dmustapha/hotseat (Apache-2.0)
- Judge path: JUDGES.md in the repo (3 minutes)
Disclosures
- Seed topics are drafts. The Upper GI bleed topic is not signed by a clinician and the app labels it DRAFT.
- Hot Seat is exam practice, not medical advice. It tests you against your own notes and never says what is clinically true. No patient data.
- Built with AI assistance (Claude Code). All code was written Nov 28 to 30, 2026 in this repo; there was no pre-existing app.
- Speech recognition and the examiner voice are browser features running locally in Chrome, not Firebase AI Logic calls. Speech accuracy for real accents is unmeasured.
- On-device marking cannot be verified from a machine without Nano; the video shows it. The offline path needs desktop Chrome on Nano-capable hardware. Elsewhere the same app marks in the cloud and says so. A real Wi-Fi-off run was recorded on Nov 30 with the macOS Wi-Fi switch off: marking ran on the laptop in 708 ms, the path bar showed 0 KB of cloud use, and the disputed point waited in the appeal queue (
evidence/wifi-off-run-2026-11-30.json). - Calibration figures are one rubric, 66 checks, saved runs on one laptop. They are not a general measure, and the saved runs were recorded before the last marking fixes on Nov 30, so the page invites a rerun.