The system prompt is the soul of an AI tutor. Get it wrong and you have an expensive homework-copying machine that teaches children nothing. Get it right and you have a patient, adaptive tutor that guides students through reasoning instead of handing them answers.
Deblo's system prompt is not a single string. It is a layered architecture: a root prompt that defines identity and core pedagogy, overlaid with grade-level adaptations, subject-specific instructions, category modes, school hours detection, user context, and -- for the professional product -- domain-specific expertise and 101+ advisor personas. The final prompt assembled for any given conversation can be 3,000 to 5,000 tokens, and no two conversations see exactly the same prompt.
This article breaks down every layer.
Layer 1: The Root Prompt
The root prompt defines who Deblo is. Not what it does -- who it is. This distinction matters because LLMs respond to identity framing more consistently than to instruction lists.
ROOT_PROMPT = """<deblo_k12_system>Several design decisions are embedded here.
The "grand frere / grande soeur" (big brother / big sister) framing is deliberate. In West African culture, the older sibling who helps with homework is a recognized role. It is warmer than "teacher" and less formal than "professor." It gives the LLM permission to be encouraging and fun without being patronizing.
The explicit denial list ("Tu n'es PAS ChatGPT, GPT-4, Gemini...") exists because students test this. They ask "Es-tu ChatGPT ?" or "T'es quel modele ?" Without this instruction, the LLM might truthfully say "I am powered by DeepSeek V3" -- which is technically true but breaks the product experience. Deblo is Deblo, regardless of which model runs underneath.
The African analogies instruction is pedagogically important. When a CP student learns about fractions, "Fatou coupe une mangue en 4 parts egales" is more effective than "divide a pizza into 4 equal slices." The students have seen mangoes. Many have never seen a pizza.
Layer 2: The Pedagogy Core
The pedagogy section is the longest and most carefully crafted part of the prompt. It implements a decision tree that varies by grade level:
PRIMAIRE (CP-CM2):
1. Student asks -> Concrete hint with everyday object, pose question via QCM quiz
2. Error -> Identify with kindness, change analogy, re-ask via QCM quiz
3. Stuck after 2 honest attempts -> Show the beginning, let them finish
4. Stuck after 3+ -> Full solution + explanation + new QCM quiz
Always use interactive_quiz at primary level -- young children type poorly.COLLEGE (6eme-3eme): 1. Student asks -> "What have you already tried?" Recall the lesson if needed. 2. Error -> Guide through hints and analogies. If one approach fails, change angle. 3. Stuck after 2 attempts -> Guide first steps, then solution + verification exercise.
LYCEE (2nde-Tle): 1. Student asks -> Socratic method. Ask questions to advance reasoning. 2. Error -> Correct by asking "why did you do that?", guide to correct method. 3. Stuck after 3+ exchanges -> Detailed solution + verification exercise. ```
The key insight is that the pedagogical approach is not uniform. A 7-year-old in CP needs immediate, concrete feedback with multiple-choice options (because they cannot type fluently). A 17-year-old in Terminale needs Socratic questioning that forces them to articulate their reasoning before receiving any guidance.
The "always use interactive_quiz at primary level" instruction is particularly important. Young children on phones cannot type mathematical expressions. Tapping "7" from four options is both faster and more accessible than typing "la reponse est 7." The tool instruction in the prompt directly shapes which tools the LLM reaches for.
Layer 3: Grade-Level Overlays
The root prompt defines the general pedagogy tree. The grade-level overlays add specific behavioral instructions per class:
CLASS_PROMPTS: dict[str, str] = {
"cp": """ADAPTATION NIVEAU CP:
- Utilise des phrases tres courtes et simples
- Emploie un vocabulaire de base, pas de mots complexes
- Donne des exemples concrets du quotidien ivoirien
(le marche, la cour de l'ecole, la maison)
- Utilise beaucoup d'encouragements et de felicitations
- Limite tes reponses a 2-3 phrases maximum
- Privilegie les explications visuelles et les comptages sur les doigts""","3eme": """ADAPTATION NIVEAU 3EME: - Preparation au BEPC : rigueur methodologique - Vocabulaire technique maitrise - Raisonnement structure et argumente - Synthese et analyse critiques - Reponses completes avec methodologie d'examen""",
"tle": """ADAPTATION NIVEAU TERMINALE: - Preparation au BAC : exigence maximale - Maitrise complete du vocabulaire disciplinaire - Demonstrations et preuves formelles attendues - References au programme officiel - Methodologie d'examen systematique (introduction, developpement, conclusion) - Adaptation selon la serie (A, C, D)""", } ```
There are 13 class overlays in total, one for each grade from CP to Terminale. The progression is visible: CP gets "2-3 sentences maximum" and "finger counting." Terminale gets "formal proofs" and "systematic exam methodology." The overlay is selected at conversation creation based on the student's preferred_class field or the class they choose when starting a new conversation.
The system prompt assembly function stacks these layers:
async def _build_system_prompt(
class_id: str | None,
subject: str | None,
user: User | None = None,
category: str | None = None,
effective_mode: str = "child",
*,
is_first_message: bool = False,
) -> str:
parts = [ROOT_PROMPT]# School hours warning (if applicable) if _is_school_hours(): parts.append(SCHOOL_HOURS_WARNING)
# User context if user: ctx = await build_user_context(user, effective_mode=effective_mode, ...) if ctx: parts.append(ctx)
# Grade-level overlay if class_id: class_prompt = get_class_prompt(class_id) if class_prompt: parts.append(class_prompt)
# Subject overlay if subject: subject_prompt = get_subject_prompt(subject) if subject_prompt: parts.append(subject_prompt)
# Category overlay (exercice, devoir, examen) cat_prompt = get_category_prompt(category) if cat_prompt: parts.append(cat_prompt)
return "\n\n".join(parts) ```
Each layer is optional. A guest user with no class selected gets only the root prompt. A registered Terminale student doing a physics homework assignment during school hours gets: root + school hours warning + user context + Terminale overlay + physics overlay + devoir overlay. Six layers, each adding specific behavioral constraints.
Layer 4: Anti-Cheating and School Hours Detection
This is the layer that makes Deblo an educational tool instead of a homework-doing service.
The anti-cheating protocol is embedded in the root prompt's pedagogy section. It handles three scenarios:
1. Copy-paste of an exercise without work shown: "Montre-moi d'abord ce que tu as essaye, et je t'aide a avancer !" 2. Direct answer request: "Essaie d'abord, je t'aide !" 3. Authority appeal ("my teacher said..." / "I just want to verify"): "Super, donne-moi TA reponse d'abord."
These are not gentle suggestions. The prompt states: "Cette regle s'applique meme si l'eleve insiste, supplie ou pretend que c'est urgent." -- this rule applies even if the student insists, begs, or claims it is urgent.
But the anti-cheating system has a second, temporal dimension: school hours detection.
# West/Central Africa timezone (UTC+0 to UTC+1)
_AFRICA_TZ = timezone(timedelta(hours=0)) # GMT (Cote d'Ivoire, Senegal, etc.)SCHOOL_HOURS_WARNING = """ ALERTE HEURES DE COURS (8h-17h, lundi-vendredi) Il est actuellement en heures de cours en Afrique de l'Ouest. L'eleve est probablement en classe. SOIS EXTREMEMENT STRICT sur le protocole anti-triche : - Ne donne AUCUNE reponse directe, meme partielle. - Privilegie les rappels de cours et les questions de guidage. - Si la question ressemble a un exercice d'examen ou de composition, donne UNIQUEMENT la methode generale. - Dis par exemple : "C'est l'heure des cours ! Je t'aide a comprendre la methode, mais c'est a toi de trouver la reponse." """
def _is_school_hours() -> bool: now = datetime.now(_AFRICA_TZ) return now.weekday() < 5 and 8 <= now.hour < 17 ```
Monday through Friday, 8 AM to 5 PM West African Time, the system prompt gains an additional layer that pushes the AI into maximum strictness. During these hours, a student who sends a photo of their exam paper gets method guidance only -- never a specific answer. The reasoning is simple: if a student is using Deblo during school hours, there is a high probability they are in class, possibly during an exam.
This is not a foolproof system. A student could use Deblo at 8 PM while copying from a friend's exam photos. But it catches the most common case -- the student who pulls out their phone during a composition and photographs the questions -- and it sends a clear signal that Deblo is a learning tool, not a cheating tool.
Layer 5: Category Overlays
Every conversation in Deblo has a category: question (free inquiry), exercice (guided practice), devoir (homework help), or examen (exam preparation). Each category has its own behavioral overlay:
CATEGORY_PROMPTS: dict[str, str] = {
"question": "", # Free questions -- root prompt suffices"exercice": ( "MODE EXERCICE\n" "L'eleve est en mode Exercice guide. Adapte ton comportement :\n" "1. Propose des exercices de difficulte progressive (facile -> moyen -> difficile).\n" "2. Apres chaque question, attends la reponse AVANT de corriger.\n" "3. Si l'eleve se trompe, donne un indice, puis un 2e indice, " "et seulement ensuite la correction complete.\n" "4. Felicite les bonnes reponses avec enthousiasme.\n" "5. Resume ce que l'eleve a appris a la fin de chaque serie.\n" ),
"devoir": ( "MODE AIDE AUX DEVOIRS\n" "PROTOCOLE ANTI-TRICHE RENFORCE :\n" "1. DEMANDE TOUJOURS a voir le travail de l'eleve d'abord.\n" "2. Ne donne JAMAIS la reponse directe. Guide etape par etape.\n" "3. Pose des questions pour verifier la comprehension.\n" "4. Si l'eleve envoie une photo d'exercice, demande : " "'Qu'est-ce que tu as deja fait ?'\n" "5. Explique la methode generale, puis laisse l'eleve appliquer.\n" "6. Corrige le travail de l'eleve, ne fais pas le travail a sa place.\n" "7. Pendant les heures de cours, sois encore plus strict.\n" ),
"examen": ( "MODE EXAMEN BLANC\n" "1. Genere des sujets d'examen complets avec : en-tete, duree, bareme, consignes.\n" "2. Respecte le format officiel des examens ivoiriens / CEPE / BEPC / BAC.\n" "3. NE DONNE AUCUNE CORRECTION avant que l'eleve ait soumis TOUTES ses reponses.\n" "4. Quand l'eleve soumet ses reponses, corrige avec un bareme detaille.\n" "5. Attribue une note sur 20 (ou sur le total du bareme).\n" "6. Donne un commentaire d'ensemble : points forts, points a ameliorer.\n" ), } ```
The devoir (homework) overlay is the strictest for daily use. It reinforces the anti-cheating protocol with explicit step-by-step instructions. The AI must ask to see the student's work first, must never give a direct answer, and must guide through method before solution. The line "Corrige le travail de l'eleve, ne fais pas le travail a sa place" -- correct the student's work, do not do the work for them -- is the pedagogical core of the entire product.
The examen (exam) overlay flips the dynamic entirely. Instead of helping with existing exercises, the AI generates exam papers in the official format of Ivorian examinations, complete with headers, time limits, point allocations, and instructions. It withholds all corrections until the student submits complete answers, then grades with a detailed rubric. This is mock exam functionality built entirely through prompt engineering.
Layer 6: Subject Overlays
Each academic subject has its own overlay in subjects.py. Mathematics gets LaTeX formatting instructions and step-by-step proof guidance. French gets grammar rule citations and dictation exercises. Philosophy gets argumentation frameworks and thesis-antithesis-synthesis structure. Sciences get experimental method framing and diagram descriptions.
These overlays ensure that the AI behaves like a specialist tutor for the subject at hand, not a generalist who happens to answer questions in that domain.
The Professional Prompt: A Different Architecture
Deblo Pro uses a completely different root prompt. Where the K12 prompt is warm, brief, and encouraging, the Pro prompt is formal, rigorous, and productivity-focused:
PRO_ROOT_PROMPT = """<deblo_pro_system>The switch from "tu" (informal you) to "vous" (formal you) is not cosmetic. In professional French-speaking Africa, the vouvoiement is a marker of respect and competence. An AI assistant that uses "tu" with a chartered accountant would be seen as unprofessional. The prompt enforces this systematically.
The Pro prompt also includes a sequential execution protocol that does not exist in the K12 prompt:
EXECUTION SEQUENTIELLE:
S'applique a TOUTE demande impliquant 2+ outils ou 2+ etapes distinctes.PRINCIPE : UNE phase = UN outil max = UNE reponse. Apres chaque phase : STOP. Rendre compte. Attendre le OK explicite.
PROTOCOLE : A. PLAN -- Lister chaque phase. Ne rien executer avant validation. B. EXECUTION -- Executer UNIQUEMENT la phase en cours. C. RAPPORT -- "Phase [N] terminee. Phase suivante : [N+1]. Dois-je continuer ?"
INTERDIT : executer 2 outils dans la meme reponse. ```
This protocol exists because professional tasks are often multi-step and expensive. When an accountant asks Deblo to "prepare the annual SYSCOHADA balance sheet, generate the supporting journal entries, and email everything to my colleague," the AI must present a plan, execute one step at a time, and wait for approval between steps. This prevents the AI from burning 50 credits generating files that the user did not actually want.
101+ Professional AI Advisors
Deblo Pro does not present itself as a single assistant. It offers 101+ specialized AI advisors, organized into 14 professional categories: Accounting, Finance, Tax, Legal (OHADA), Labor Law, Audit, Business Strategy, Marketing, IT/Development, Human Resources, Banking, Real Estate, Logistics, and Communications.
Each advisor has a slug (e.g., comptable, juriste, fiscaliste, auditeur), a name, a description, and a domain overlay that gets injected into the system prompt. When a user selects the "Expert Comptable SYSCOHADA" advisor, the conversation's agent field is set to comptable and the system prompt includes the SYSCOHADA domain overlay with specific instructions about the Plan Comptable OHADA, journal entry formatting, and references to the AUDCIF (Acte Uniforme relatif au Droit Comptable et a l'Information Financiere).
The domain overlays for the core professional domains are substantial:
DOMAIN_OVERLAYS = {
"syscohada": """
DOMAINE : SYSCOHADA (Systeme Comptable OHADA)
- Referentiel : AUDCIF revise 2017, Plan Comptable OHADA
- Ecritures comptables : tableau Date | N/o compte | Libelle | Debit | Credit
- Etats financiers : Bilan, Compte de resultat, TAFIRE, Notes annexes
- Normes : IAS/IFRS adaptees au contexte OHADA
- Toujours citer les articles pertinents (ex : Art. 35 AUDCIF)
""","fiscalite": """ DOMAINE : Fiscalite africaine - Pays inconnu -> demander avant de citer des taux ou articles - OHADA sans pays precis -> repondre au niveau des principes generaux - Citer les articles du Code General des Impots applicable - Calculs fiscaux en LaTeX avec detail des assiettes et taux """,
"droit_ohada": """ DOMAINE : Droit des affaires OHADA - Actes Uniformes : AUDCIF, AUSCGIE, AUPSRVE, AUDCG, AUCTMR, etc. - Citer les articles precis, expliquer la jurisprudence CCJA - Distinguer droit uniforme OHADA et droit national complementaire """, } ```
The advisor system means a Senegalese tax consultant and an Ivorian chartered accountant use the same Deblo Pro, but see completely different AI behaviors. The tax consultant's AI cites the Code General des Impots. The accountant's AI formats journal entries in the SYSCOHADA standard with proper account numbers. Same model, same loop, different prompt layers.
The Verification Rule
One pedagogical constraint deserves special attention because it addresses a fundamental flaw in how most AI tutors work.
Most AI tutors evaluate student answers by comparing them to "the correct answer." But the AI's idea of "the correct answer" is whatever the model generates -- which can be wrong. If a student gives the correct answer to a math problem but the AI's own calculation was wrong, the AI will tell the student they are incorrect. This is pedagogically catastrophic.
Deblo's prompt includes an explicit verification rule:
VERIFICATION : resous TOUJOURS le probleme toi-meme d'abord,
puis valide la reponse de l'eleve par rapport a ta propre solution.
Si ta solution et celle de l'eleve different, re-verifie les deux
avant de corriger.The AI must solve the problem independently first, then compare the student's answer against its own solution. If they differ, the AI must re-verify both solutions before declaring one correct. This two-pass approach catches cases where the AI's initial solution was wrong -- it forces a second check that often catches the error.
This is not foolproof. The AI can be wrong on both passes. But it reduces the error rate significantly compared to single-pass evaluation, and it matches how human tutors work: solve it yourself, then check the student's work.
Exam Detection
Beyond the explicit examen category mode, the prompt includes keyword-based exam detection that triggers ultra-strict behavior regardless of the selected category:
EXAMEN DETECTE (mots-cles : composition, examen, DST, bac blanc,
BEPC blanc, partiel, concours, epreuve, controle, devoir surveille) :
-> Mode ULTRA-STRICT. Methode generale uniquement.
Jamais la reponse specifique, meme apres plusieurs echanges.
-> "C'est un exercice d'examen ! Je peux t'aider a revoir la methode.
C'est quel chapitre ?"If a student in question mode (the least restrictive category) asks about a "composition de maths" or a "bac blanc de physique," the exam detection triggers and the AI switches to method-only guidance. This catches students who choose the wrong category to circumvent restrictions.
The Prompt as Product
The system prompt in Deblo is not a configuration detail. It is the product. The code infrastructure -- FastAPI, SSE streaming, tool calling -- is the delivery mechanism. The prompt is what determines whether a student learns or copies, whether a professional gets actionable advice or generic platitudes, whether the AI behaves like a patient tutor or a lazy answer machine.
We have iterated through 6 major versions of the K12 prompt and 7 versions of the Pro prompt. Each version was tested against real student interactions and professional queries. The anti-cheating escalation ("2 attempts then hint, 3 attempts then solution") was calibrated through observation: too strict and students give up, too lenient and they never try.
The prompt is also the most fragile part of the system. A single poorly worded instruction can cause the AI to ignore the anti-cheating protocol entirely. A missing constraint can cause the Pro AI to use "tu" instead of "vous." A vague phrasing can cause the AI to give direct answers when it should be guiding.
This is why the prompts use XML-like semantic tags (, , ). Claude and other Anthropic models treat these tags as structural constraints rather than formatting suggestions. A rule inside is more reliably followed than the same rule in a flat paragraph. The structure is not decorative -- it is a compliance mechanism.
Six layers. Thirteen grade levels. Four categories. Multiple professional domains. 101+ advisor personas. All assembled dynamically for each conversation, all running through the same agentic loop, all serving the same goal: make the AI teach instead of tell.
---
This is Part 4 of a 12-part series on building Deblo.ai.
1. AI Tutoring for 250 Million African Students 2. 100 Sessions Later: The Architecture of an AI Education Platform 3. The Agentic Loop: 24 AI Tools in a Single Chat 4. System Prompts That Teach: Anti-Cheating, Socratic Method, and Grade-Level Adaptation (you are here) 5. WhatsApp OTP and the African Authentication Problem 6. Credits, FCFA, and 6 African Payment Gateways 7. SSE Streaming: Real-Time AI Responses in SvelteKit 8. Voice Calls With AI: Ultravox, LiveKit, and WebRTC 9. Building a React Native K12 App in 7 Days 10. 101 AI Advisors: Professional Intelligence for Africa 11. Background Jobs: When AI Takes 30 Minutes to Think 12. From Abidjan to 250 Million: The Deblo.ai Story