How I Over-Engineered an AI Tutor on WhatsApp — And Why 4 Tenth Graders Humbled Me A solo engineer built Masterji, a WhatsApp-based AI tutor for Indian Class 10 board exam students that uses a multi-agent supervisor router, Socratic state machines, and a curriculum RAG grounded in official marking schemes. The engineer solved a split-brain hallucination bug caused by Meta firing concurrent webhooks for rapid-fire student messages by implementing an in-process per-phone serialization mutex that chains each student's messages into an asynchronous FIFO queue. Testing with four tenth graders revealed the bot's tone was too condescending for 15-year-olds. Confessions of a solo engineer building Masterji for Indian Class 10 Boards: How I built multi-agent supervisors, Socratic state machines, and concurrency mutexes, only to realize my bot was talking to 15-year-olds like they were five. India's Class 10 Board Exams CBSE, ICSE, and State Boards like Karnataka SSLC are an emotional pressure cooker. For over 20 million students every year, this is their first national standardized exam. It dictates streaming Science, Commerce, Arts , family prestige, and immense personal anxiety. Yet, the after-school support system for most students is deeply flawed: The Masterji Thesis was simple: Build a 24/7 personal tutor on WhatsApp — where students and parents already live — that refuses to spoon-feed answers. Instead, it guides the student step-by-step using the Socratic method, grounds every hint in official board marking schemes, and sends parents a daily digest of what their child actually practiced. No app installs. No logins. Just send a photo of your notebook or text a doubt on WhatsApp, and Masterji helps you solve it yourself. As a software engineer, when I looked at this problem, I didn't see pedagogy first; I saw distributed systems problems. I asked myself: So, I built an enterprise-grade backend. php flowchart TD User "Student on WhatsApp" -- Ingress "Meta Cloud API Webhook" Ingress -- Mutex "Per-Phone Webhook Mutex queue.ts " Mutex -- Dedup "CSO-02 Idempotency & Replay Guard" Dedup -- Router "Supervisor Router supervisor/router.ts " subgraph State "Persistence & Grounding Layer" L1 "L1 In-Memory RAM Cache" L2 "L2 Supabase PostgreSQL socratic threads " RAG "Curriculum RAG & PYQ Bank 2022-2026 " end Router <-- State Router -- ModeDecision{"Intent & Pedagogical Mode"} ModeDecision -- |Quadratic / Geometry / AP| MathsSir "Maths Sir Specialist" ModeDecision -- |Circuits / Optics / Reactions| ScienceTeacher "Science Teacher Specialist" ModeDecision -- |Motivation / Banter| GeneralMentor "General Mentor Specialist" MathsSir -- Guardrails "Post-Flight Anti-Cheat Sanitizer" ScienceTeacher -- Guardrails GeneralMentor -- Guardrails Guardrails -- Outbound "Meta WhatsApp Outbound Dispatcher" Outbound -- User router.ts : LEARN PRACTICE EVALUATE On paper and in the terminal, the system was a marvel. Over several weeks of intense development, we conquered tricky real-world engineering bugs: Teenagers do not send one neat, well-formed paragraph. They send five rapid fragments in two seconds: "sir" "in question 4" "why is current same?" "in series" "tell me" Initially, Meta fired five concurrent webhook POST requests to our Fastify server. Because LLM inference takes 800ms–2s, request 2 would read state from Supabase before request 1 finished persisting it. The system suffered split-brain hallucinations: the bot would answer question 3, evaluate question 2 as a math answer, and wipe out the conversation thread. We had to design an in-process per-phone serialization mutex : js // src/modules/whatsapp/queue.ts const phoneQueues = new Map