How LAFINA Works (Technical Q&A Guide)
What this page is for
A study guide for the technical Q&A. It explains the parts of LAFINA that panelists usually ask about, using simple diagrams. It is based on the current app source (v1.0.7), so a few details differ from the original research design in the paper. Those differences are listed in Paper design vs. the built app. When you’re ready, test yourself with Q&A Practice.
LAFINA in one minute
LAFINA is an Android app (React Native + TypeScript) that acts as an AI student companion. It keeps your classes, tasks, notes, reminders, and alarms on the phone, and you can manage them by tapping, typing, or talking. With Online Mode it also chats about anything, answers general and trivia questions, and helps you study.
Remember four ideas and you can answer most questions:
- Offline-first. The phone’s own SQLite database is the source of truth. Planning, alarms, reminder calls, and basic voice commands work without internet. Online services (DeepSeek, ElevenLabs, Pinecone) are optional extras.
- The AI proposes, the student confirms. When the assistant wants to add, change, or delete something, it shows a review card. Nothing is saved until the student taps Confirm (or says “yes”).
- Reminders arrive as a simulated call. Android’s alarm system triggers a full-screen incoming-call screen inside LAFINA. The student answers and speaks “done” or “snooze”, or uses the buttons.
- It’s a companion, not only a planner. Online, DeepSeek powers open conversation and study help. Offline, LAFINA still handles small talk and planner commands, and asks for Online Mode for trivia.
The big picture
| Layer | What it does | Built with |
|---|---|---|
| App / UI | Screens, chat, call screen, review cards | React Native 0.86, TypeScript |
| Brain (app services) | Understands requests, checks them, prepares review cards | TypeScript in src/ai, src/scheduler |
| Local storage | Working copy of all planner data | SQLite (OP-SQLite), schema version 28 |
| Native Android | Alarms, microphone, speech, PDF/OCR | Kotlin + C/C++ (JNI) |
| Cloud (optional) | Account, sync, online AI and voice | FastAPI on Vercel, Neon PostgreSQL |
Q: Why is SQLite the source of truth instead of the cloud?
So the app never depends on the internet to save or ring a reminder. Every edit is written locally first. Sync is a background job that sends queued changes later, when the student is signed in and connected.
How a conversation works
This is what happens when a student sends a message in the AI tab, whether typed or spoken.
Step 1: understanding the message (intent extraction)
LAFINA turns a sentence into a structured intent: the action plus details such as title, date, and time. It tries the cheapest method first.
The possible intents include create_task, create_reminder, create_time_block, create_note, create_alarm, their update/delete versions, snooze, acknowledge, query_schedule, query_notes, list_alarms, chat, and out_of_scope.
Step 2: routing (who is allowed to write?)
Every intent belongs to one of three routes. The list is fixed in code, so a new intent cannot be added without choosing its route.
| Route | Examples | Writes data? |
|---|---|---|
| Reviewed change | create / update / delete tasks, reminders, notes, alarms | Only after Confirm |
| Read only | ”What’s on my schedule?”, “List my alarms” | Never |
| Conversation | greetings, study questions, handbook questions | Never |
Step 3: the review card (confirm before saving)
A few low-risk actions skip the card and apply right away, with an Undo offer: completing a task, acknowledging or snoozing a reminder, and pinning or re-categorizing a note.
Q: Why not let the AI save things directly?
Language models can misunderstand dates and times. A review card lets the student catch mistakes before they become wrong reminders. It also keeps the AI from deleting data on its own: deletion is never prepared from the model’s words alone.
Online vs. offline conversation
| Offline | Online (signed in + Online Mode) | |
|---|---|---|
| Understanding | Rule parser + optional on-device model | Same, plus DeepSeek extraction for planner commands |
| Replies | Built-in local replies for supported commands | DeepSeek, streamed word by word |
| Multi-step help | No | Chat agent: DeepSeek can look up the planner (up to 4 steps) and prepare one review card. The tools run on the phone |
| Handbook | Local search of the USTP handbook pack | Retrieved passages + DeepSeek answer, with citations |
Q: Does the cloud see my whole schedule?
No. Planner details are only sent when the question is about the student’s own plans. When the chat agent needs data, DeepSeek asks for it with a tool call, and the tool runs on the phone and sends back only what that question needs.
How the reminder call works
When a reminder is due, LAFINA does not just show a notification. It shows a simulated incoming call: a full-screen call screen inside the app. It is not a real telephone call and does not use a phone number.
Key details:
- Trigger: Android
AlarmManagerregisters each reminder. Recovery code re-registers pending alarms after a reboot or timezone change. - Listening: Whisper (
ggml-tiny.en-q5_1) runs on the phone. A keyword matcher turns the transcript into acknowledge or snooze (with minutes), e.g. “five more minutes” becomes snooze 5. - Buttons always work. If the microphone or speech model is not available, the call switches to Acknowledge / Snooze buttons.
- Missed calls: declining or not answering auto-snoozes. Once the snooze limit is reached, the reminder is marked missed. A repeating reminder still schedules its next occurrence.
- Online voice option: if the student is online with online voice enabled, LAFINA first says the reminder, then hands the call to the online conversation (see below).
Q: What if the phone is locked or the app is closed?
The alarm is registered with Android itself, so the app does not need to be open. Android wakes LAFINA and shows the call screen over the lock screen. Exact timing still depends on the phone’s permissions and battery settings, which is why Profile has an Alarm & Reminder Health screen with a test alarm.
How Call LAFINA works
Call LAFINA is different from a reminder call. The student starts it, to talk to LAFINA hands-free like a phone call. It has two modes, and LAFINA picks one when the call starts.
Online call
Offline call
The offline call works like a walkie-talkie: one speaker at a time (half-duplex), so LAFINA never hears her own voice as the student.
Q: Does LAFINA always listen in the background?
No. There is no wake word and no always-on microphone. The microphone opens only during a call or push-to-talk the student started, and only after microphone permission is granted.
How sync works (short version)
Seven record types sync: profile, tasks, events, time blocks, reminders, notes, and custom categories. Alarm clocks stay on the phone where they were created. Guest mode works without an account and never syncs.
Paper design vs. the built app
The original research pages describe the first design. The app changed during development. If a panelist asks about a difference, these are the honest answers.
| Topic | Original design | Current app | Why it changed |
|---|---|---|---|
| Reminder call | Real outgoing phone call via telephony | Simulated in-app call screen | No phone number or carrier needed, and it works offline |
| Text-to-speech | Kokoro-82M | Phone’s built-in TTS (react-native-tts) offline, ElevenLabs online | Kokoro is not used. System TTS is lighter and already on the phone |
| Understanding | SmolLM2 reads every reply | Rule-based parser first. On-device model (SmolLM2, Qwen 2.5, Gemma 3) only when needed | Rules are instant and predictable. The model adds latency and RAM |
| During a reminder call | SmolLM2 judges intent | Keyword matcher for acknowledge / snooze | A ringing call has to respond fast |
| Scope | Offline only, closed-domain scheduler, no chit-chat | AI student companion: offline planner core + online conversation, trivia, study skills, Ask USTP, sync | Students use a companion every day. Online features add value but are never required |
Likely panel questions
Is LAFINA a chatbot?
It’s an AI student companion. Online, it chats, answers general and trivia questions, and helps with studying through DeepSeek. Underneath is a task-oriented planner that works offline. Whatever the conversation, any change to the planner still goes through a review card.
What happens with no internet?
Tasks, notes, calendar, alarms, and reminder calls all keep working. Voice commands work after the offline speech model is set up. Only open-ended AI chat, online voice, document generation, and sync need internet.
How does it understand Taglish or casual phrasing?
The rule parser handles clear commands. When it sees Taglish or colloquial scheduling phrases, it does not trust itself and asks the on-device model (or DeepSeek, if online). The result is always validated before it is used.
What stops the AI from making a wrong change?
Three layers: (1) the intent is validated, and invalid output becomes plain chat, which never writes; (2) every change becomes a review card the student must confirm; (3) deletes are never prepared from model output alone.
Where is the data stored, and is it private?
On the phone in SQLite. Nothing goes to the cloud unless the student signs in. Online features send only what that request needs, and provider API keys stay on the backend server, not in the app.
Does answering the reminder call mark the task as done?
No, on purpose. Acknowledging only means “I heard it”. The student still marks the task complete, so a reminder answered while half-asleep doesn’t hide unfinished work.
Quick numbers to remember
| Fact | Value |
|---|---|
| Platform | Android 11+ (API 30), React Native 0.86 |
| Local database | SQLite, schema version 28, 36 tables |
| Synced record types | 7 |
| Offline speech model | Whisper tiny.en (q5_1), plus Silero VAD |
| Intent “confident” threshold | 0.85 |
| Reminder call retries before auto-snooze | 3 |
| Chat agent steps (online) | Up to 4 |
| Offline call limits | 20 min max, ends after 3 silent listens |
| Backend | FastAPI on Vercel + Neon PostgreSQL |
For more depth, see System Architecture, AI Models, and the Glossary. For many more practice questions with hidden answers, go to Q&A Practice.