mdnaimurrahman.com
Roots AI
Date
Jun 2025
Category
Next.js
Source Code
N/A

RootsAI

Overview

When a student struggles with a topic in Class 9, the real problem is often something from Class 7 or 8 that was never fully understood. Most learning tools don't go looking for that. RootsAI does.

The system takes a student's problem, maps it onto an authored curriculum graph, traverses prerequisites to build a "Concept MRI," diagnoses knowledge gaps through targeted quizzes, and guides the student through a gamified remediation path — ending with a Feynman-style verification where the student teaches the concept back to the AI.

Core principles:

  • The graph is the source of truth, not the LLM. Every AI output is validated against the real curriculum graph. The LLM maps problems to existing nodes — it never invents curriculum.
  • Deterministic where it matters. Same problem → same concept map → same prerequisite tree → same quiz. Reproducible diagnostics, every time.
  • Mastery is earned, not assumed. Students prove understanding by re-answering missed questions and explaining concepts back (Feynman technique).

How It Works

Student submits problem (text or photo)
        │
        ▼
   ┌─────────┐    Zod-validated against
   │   Map   │───▶ real graph slugs
   └────┬────┘    (hallucinated slugs rejected)
        │
        ▼
  ┌──────────┐    Deterministic BFS
  │ Traverse │───▶ prerequisite subtree
  └────┬─────┘    ("Concept MRI")
       │
       ▼
   ┌────────┐     Authored questions verbatim,
   │  Quiz  │────▶ or generate-once + cache
   └────┬───┘     in Firestore
        │
        ▼
  ┌──────────┐    Duolingo-style serpentine path,
  │  Learn   │───▶ foundational-first ordering,
  └────┬─────┘    sequential unlock
       │
       ▼
  ┌──────────┐    Student teaches concept back
  │  Verify  │───▶ to the AI (Feynman technique)
  └──────────┘

Two modes

  • Legacy (demo): Hardcoded NCTB Class 9 Physics graph — mechanics vertical with 19 authored nodes and hand-written quiz questions.
  • Classroom: Teachers upload materials → AI extracts a concept graph → students run diagnostics against that graph. Works with any subject.

Features

Diagnostic Engine

  • GraphRAG mapping: LLM routes problems to existing curriculum nodes with Zod hard-validation — no hallucinated concepts.
  • Concept MRI: Deterministic BFS traversal builds the same prerequisite tree for the same root, every time.
  • Hybrid quizzes: Authored questions used verbatim; unauthored nodes get AI-generated questions cached in Firestore.
  • Adaptive remediation: All gaps recorded and ordered foundational-first. Lesson plans are deterministically structured from the graph.

Learning Path

  • Serpentine path: Duolingo-style winding path of medallion nodes with strict sequential unlock.
  • Earned mastery: Each gap node reuses the exact MCQ the student missed (options shuffled). Answer correctly → mastered.
  • Feynman verification: Students teach the concept back to the AI via voice or text+photo before moving on.
  • Gamification: Progress bar, XP system (+10/mastered), celebration animations (reduced-motion guarded).

Classroom System

  • Teacher workflows: Create classrooms, upload materials (PDF/syllabus/notes/textbook), manage students.
  • Dynamic graph extraction: AI extracts concept dependency graphs from uploaded materials for any subject.
  • RAG-powered tutoring: LangGraph agent retrieves from teacher's knowledge base — never fabricates content.
  • Analytics: Teacher dashboard with student progress and engagement tracking.

Additional

  • Multimodal input: Students can photograph problems (camera/upload) — image is sent alongside text to the diagnostic engine.
  • Voice transcription: Audio input transcribed via Gemini for Feynman verification.
  • Real-time chat: Contextual AI tutor grounded in classroom materials with citation support.
  • Role-based access: Firebase Auth with student/teacher roles and onboarding flow.

Architecture

LayerStackResponsibilities
FrontendNext.js 16, React 18, Chakra UI, TailwindRole-based app shell, diagnostic flow, serpentine learning path
Diagnostic EngineCustom pipeline (map → traverse → quiz)Problem mapping, prerequisite traversal, quiz resolution
Tutor AgentLangGraph + LangChainStateful multi-tool agent: RAG retrieval, mastery check, grounded response
Curriculum GraphAuthored graph + Neo4j (optional)Source-of-truth concept dependencies, BFS traversal
RAG PipelineLangChain TextSplitters + Gemini EmbeddingsChunk materials, embed, store in Supabase pgvector, HNSW cosine search
LLM ProviderGemini (primary) + fallback chainStructured JSON generation with retry + model-chain fallback
Auth / DataFirebase Auth + FirestoreIdentity, roles, diagnoses, classrooms, quiz cache, progress
File StorageSupabase StorageProblem photos, Feynman verification uploads

The Infinity AI BuildFest

Built for The Infinity AI BuildFest organized by CloudCamp Bangladesh. The idea: when a student struggles with a Class 9 topic, the real gap is often something from Class 7 or 8 that was never fully understood. RootsAI goes looking for that root cause.

Team

Copyright © 2026 by Md. Naimur Rahman | All Rights Reserved