Case study · Computer Engineering capstone
Lery AI
A screenless voice tutor for spoken English running on a Raspberry Pi. Computer Engineering capstone at UNISAL, graded 10/10.
- Role
- Device, services, apps and evaluation lab
- Year
- 2026
- Stack
- Python · TypeScript · Fastify · Gemini · PostgreSQL · React Native · React
01
The problem
Many people study English for years and still freeze when they have to speak. The literature calls it foreign language speaking anxiety: fear of judgment blocks even those who know the grammar. The phone, where apps teach, also competes for attention. So: what if practice left the screen?
02
Demo
03
The device
No screen, no keyboard: a Raspberry Pi 3 with a USB microphone, two speakers and a 16-LED ring. The ring shows the state of the conversation: yellow listening, green thinking, blue speaking. The wake word is detected on the device itself.
Open image at full size04
Inside a turn
The device detects “Hey Lery” locally and records. A TypeScript service transcribes, assembles the context, asks the tutor for a draft and checks the level in code before anything is spoken. Grading happens afterwards so the learner does not wait. No provider keys live on the device.
05
Context engineering and patterns
The hard part was not calling a model, it was controlling context: deciding what it sees, when it sees it and how the reply is checked. The tutor prompt is built in layers, from what rarely changes to what changes every lesson. Learner details are fetched through tools when needed, and a card written at the end of a session is the memory for the next.
Lery is not an autonomous agent: it is a fixed workflow that generates, checks in code and only then speaks. I chose predictability.
↓ Most stable
- PersonaWho the tutor is, and that the reply will be spoken.changes on deploy
- Tutor styleThe chosen tone.per learner
- Learner snapshotRecurring mistakes and open topics.per session
- Session stateCEFR level rules and reply limit.per session
- Lesson scriptGuided lessons only; overrides general behavior.per lesson
↓ Most volatile
Open image at full sizeContext techniques
| Technique | In Lery | Caveat |
|---|---|---|
| Layered context | In LeryThe stack above | CaveatPrompt cache gains were not measured |
| Just-in-time retrieval | In LeryTools for recent errors, mastered structures and open topics | CaveatA short snapshot is also in the prompt |
| Structured notes across sessions | In LeryThe summarizer writes a card the next session reads | CaveatMemory, not window compaction |
| Single-purpose calls | In LeryTutor, evaluator, summarizer and reflector, each with its own prompt, model, reasoning effort and structured output | CaveatNot autonomous sub-agents |
Workflow and design patterns
| Pattern | In Lery | Origin and caveat |
|---|---|---|
| Workflow, not agent | In LeryCode decides the next step | Origin and caveatAnthropic, Building effective agents |
| Routing by rules | In LerySupport level, mode and CEFR level, with no model call | Origin and caveatAnthropic, Building effective agents |
| Generate, check, rewrite | In LeryA gate in code; one rewrite with the reason | Origin and caveatAdapted from evaluator-optimizer |
| Deferred evaluation | In LeryThe grade is computed after speaking | Origin and caveatOff the path the learner waits on |
| Human-in-the-loop reflection | In LeryA disputed grade may become a versioned, capped calibration note | Origin and caveatInspired by Reflexion; effect not measured |
| Strategy + Adapter | In LeryOne interface, several provider implementations | Origin and caveatGamma et al.; only Gemini was measured |
| State machine | In LeryThe device never records while it talks | Origin and caveatClassic pattern |
| Local decision first | In LeryWake word, noise gate and repetition score with no model | Origin and caveatNo call cost |
What I studied and what made it in
| Topic | In Lery |
|---|---|
| Tokens and cost | In LeryMinimal reasoning on tutor and evaluator; a cost script (pnpm cost) |
| External and episodic memory | In LeryLearner snapshot and session card |
| Tool calling | In LeryFour pedagogical tools |
| Specialized roles and LLM as judge | In LeryOne call per role; the judge only in the lab, as a secondary signal |
| Vector RAG | In LeryNot used: one learner’s facts fit in a structured card |
| LangChain and LangGraph | In LeryNot used: the flow is short and lives in my own TypeScript |
| MCP | In LeryNot used |
| Context window compression | In LeryNot used as a technique of its own |
06
Bridge mode
Beginners start in their own language: answer a question, hear how to say it in English, repeat it. The state machine and the repetition score are deterministic and local; the model only writes the next question and the target sentence, as structured JSON. If the model picked the language, progress could not be measured.
Open image at full size07
Decisions and what went wrong
Decision
Code instead of a second model
An LLM reviewer checked reply length and cost about 5 s before the tutor could speak. With less reasoning it got cheaper and stopped counting words, letting over-length replies through. Sentence and word limits became a few lines of code, testable without a model.
Mistake
My prompt broke my own rule
The tutor kept using three sentences against a limit of two. The model was not ignoring the instruction: the correction example inside my own prompt had three sentences. Fixing the example clearly reduced length failures at B1.
Mistake
The room is not the lab
On the device, some transcriptions had nothing to do with what was said, including Whisper hallucinations on weak audio. I added a noise gate and a hallucination filter. I have not re-measured on the device yet, so I do not claim it is solved.
08
Results
With simulated students, turns passing every project rule went from 76.7% to 91.7%. Median tutor latency is 2.8 s. On the device the wait for a reply is still about 6 s, which is slow for a conversation.
Context: simulated A1, B1 and C1 students, 60 turns per run; 91.7% is the mean of four runs (88.3% to 96.7%) and the 76.7% baseline is a single run, so part of the gap is noise. The 2.8 s is the tutor alone; the whole server turn had a median of 2.7 s over 36 turns. The 6.0 s is on the Pi with a commercial voice over 12 turns. This measures rule adherence, not learning.
09
Limits and next steps
- No study with real learners: nothing here shows that anyone learns faster or feels less anxious.
- p95 tutor latency misses its target, and the wait on the device still has to come down.
- Wake word v3 scored 15 of 15, but over 15 recordings of a single person: my own voice.


