An AI-powered adaptive learning system that detects what you're studying in real-time and creates personalized learning paths, quizzes, explanations, and study schedules.
| Doc | What's inside |
|---|---|
| docs/SETUP.md | End-to-end setup: prerequisites, Supabase project, migrations, env files, running locally. |
| docs/ARCHITECTURE.md | System design, data-flow, BKT, caching, concurrency, sync semantics. |
| docs/API.md | Every backend endpoint: method, auth, params, responses, rate limits. |
| docs/SECURITY.md | RLS model, JWT verification, key handling, OCR privacy. |
| docs/CONTRIBUTING.md | Dev workflow, code style, commits, PR checklist. |
| CHANGELOG.md | Notable changes per release. |
The Adaptive Learning Agent is an intelligent study companion that:
- Detects Topics in Real-Time — OCR + screen capture identifies what you're studying across VS Code, browsers, PDFs, and more
- Generates AI Content — Explanations, quizzes, and resources via pluggable LLM providers (Gemini, Claude, OpenAI, Ollama)
- Tracks Mastery with BKT — Full 4-parameter Bayesian Knowledge Tracing with Ebbinghaus forgetting curve decay
- Schedules Spaced Repetition — Surfaces reviews at the right time based on forgetting curves
- Builds Knowledge Graphs — Visualizes concept dependencies interactively
- Generates Study Plans — Creates optimized timetables based on deadlines and confidence
- Supports Collaboration — Classrooms, shared roadmaps, and leaderboards
- Works Offline (PWA) — Service worker caches the app shell; API responses cached for offline fallback
- Screen capture and OCR using Tesseract (auto-detected path on Windows, macOS, Linux)
- AI topic identification from captured text using Gemini
- Privacy toggle: set
OCR_ENABLED=falseto disable capture — paste text manually instead - Supports VS Code, Chrome, Firefox, Edge, Safari, Brave, PowerPoint, Word, PDFs, Notion, Obsidian
- Explainers: Structured explanations with prerequisites, key ideas, and common pitfalls
- Quizzes: MCQs with difficulty adaptation (easy → expert based on mastery), explanations for wrong answers
- Resources: Curated resources via web search with per-resource upvoting
- AI Assistant: Chat with an assistant about any topic in the topic detail view
- Full 4-parameter BKT:
p_init,p_learn,p_slip,p_guess - Ebbinghaus mastery decay over time (knowledge fades without review)
- Spaced repetition scheduler — review queue sorted by urgency
- Difficulty adapts automatically from mastery level
- Classrooms: create or join with a 6-digit code
- Shared roadmaps within classrooms
- Leaderboard (anonymized scores, you highlighted)
- Real-time analytics from BKT state and study sessions
- Learning reports with per-topic mastery, quiz history, study time breakdown
- JSON export of full learning report
- Streak tracking from quiz attempts
- Service worker: cache-first for static assets, network-first with cache fallback for API
manifest.jsonfor installable app- Background sync for progress updates
- Request ID middleware on every response
- Extended
/healthendpoint with Supabase ping and LLM latency - Per-provider LLM telemetry (calls, latency, token usage, errors)
- Optional Sentry integration (
sentry-sdk[fastapi])
- Docker multi-stage build (node builder → nginx for frontend, Python for backend)
docker-compose.ymlwith dev profile (--profile dev) for hot-reload dev server- Full test suite: pytest (backend BKT, quiz, API) + Vitest (frontend)
- DB migrations in
db/migrations/— run in order
| Technology | Purpose |
|---|---|
| FastAPI | REST API framework |
| Pydantic | Data validation |
| Google Gemini | Default LLM (gemini-2.5-flash) |
| Anthropic Claude / OpenAI / Ollama | Pluggable LLM alternatives |
| Supabase (Postgres) | Auth, mastery, quiz attempts, study sessions, classrooms |
| PyJWT | JWT signature verification |
| slowapi | Rate limiting |
| Tesseract OCR + OpenCV + MSS | Screen capture and text extraction |
| pytest + httpx | Backend test suite |
| Technology | Purpose |
|---|---|
| React 18 | UI framework |
| React Router v7 | Client-side routing |
| Vite | Build tool and dev server |
| Tailwind CSS | Utility-first styling |
| Lucide React | Icons |
| Supabase JS | Auth client + realtime |
| Vitest | Frontend unit tests |
| Service Worker | PWA / offline support |
adaptive-learning-agent/
├── backend/
│ ├── server.py # Main FastAPI app (~2700 lines)
│ ├── bkt.py # 4-parameter BKT engine + spaced repetition
│ ├── ocr.py # Cross-platform screen capture & OCR
│ ├── quizz.py # Quiz generation with difficulty adaptation
│ ├── config.py # Config loading and validation
│ ├── requirements.txt
│ │
│ ├── llm/
│ │ ├── gemini.py # Gemini wrapper
│ │ └── provider.py # Pluggable LLM abstraction (Gemini/Claude/OpenAI/Ollama)
│ │
│ ├── graph/
│ │ ├── builder.py # Concept graph builder (Gemini-powered)
│ │ └── models.py # Graph data models
│ │
│ ├── timetable/
│ │ ├── routes.py # Timetable endpoints
│ │ ├── scheduler.py # Scheduling algorithm
│ │ ├── scoring.py # Priority scoring
│ │ ├── models.py
│ │ ├── utils.py
│ │ └── validate.py
│ │
│ ├── tests/
│ │ ├── test_bkt.py # BKT unit tests (25+)
│ │ ├── test_quiz.py # Quiz normalisation tests
│ │ └── test_api.py # API contract tests
│ │
│ └── Dockerfile
│
├── frontend/
│ ├── public/
│ │ ├── sw.js # Service worker (PWA / offline)
│ │ └── manifest.json # PWA manifest
│ │
│ └── src/
│ ├── App.jsx # Routes
│ ├── main.jsx # Entry + service worker registration
│ │
│ ├── pages/
│ │ ├── Home.jsx # Landing page
│ │ ├── Login.jsx / Signup.jsx
│ │ ├── Detection.jsx # Real-time detection UI
│ │ │
│ │ └── dashboard/
│ │ ├── DashboardHome.jsx
│ │ ├── TopicsIndex.jsx # All detected topics
│ │ ├── TopicDetails.jsx # Topic + roadmap
│ │ ├── Analytics.jsx # Real-time analytics from BKT
│ │ ├── DependencyGraph.jsx # Interactive concept graph
│ │ ├── Timetable.jsx # Study schedule
│ │ ├── LearningMode.jsx # Focused learning (sidebar + tabs)
│ │ ├── ReviewQueue.jsx # Spaced repetition queue
│ │ ├── LearningReport.jsx # Full learning report + export
│ │ ├── Classrooms.jsx # Classrooms + leaderboards
│ │ │
│ │ └── topic/
│ │ └── RoadmapIndex.jsx # Subtopic accordion with explainer/resources/quiz
│ │
│ ├── features/
│ │ ├── detector/
│ │ │ ├── DetectorContext.jsx
│ │ │ └── TopicCard.jsx
│ │ └── roadmap/
│ │ └── progress.js
│ │
│ ├── services/
│ │ └── api.js # API client (50+ functions)
│ │
│ └── layouts/
│ ├── PublicLayout.jsx
│ └── DashboardLayout.jsx
│
├── db/
│ └── migrations/
│ ├── 0001_init.sql # Core tables + RLS
│ ├── 0002_hardening.sql # Triggers + indexes
│ └── 0003_roadmap_features.sql # BKT, review, classrooms, sessions
│
├── docs/
│ ├── SETUP.md
│ ├── ARCHITECTURE.md
│ ├── API.md
│ ├── SECURITY.md
│ └── CONTRIBUTING.md
│
├── docker-compose.yml # Backend + frontend + dev profile
├── CHANGELOG.md
└── README.md
- Python 3.10+
- Node.js 18+
- Tesseract OCR
- Windows: Download installer — auto-detected, no config needed
- macOS:
brew install tesseract - Linux:
apt install tesseract-ocr
- Google Gemini API key (minimum; other LLMs optional)
- Supabase project (free tier works)
cd backend
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
pip install -r requirements.txtcd frontend
npm installFull step-by-step setup in docs/SETUP.md.
In your Supabase SQL Editor, run in order:
db/migrations/0001_init.sql
db/migrations/0002_hardening.sql
db/migrations/0003_roadmap_features.sql
Under Authentication → URL Configuration add http://localhost:5173 as a redirect URL.
GOOGLE_API_KEY=your_gemini_api_key
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
SUPABASE_JWT_SECRET=your_jwt_secret
# Optional
SERPAPI_API_KEY=your_serpapi_key
LLM_PROVIDER=gemini # gemini | claude | openai | ollama
OCR_ENABLED=true # set false to disable screen capture
# ENV=productionVITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your_anon_key
# VITE_API_BASE_URL=/api# Backend
cd backend
uvicorn server:app --reload --host 0.0.0.0 --port 8000
# Frontend
cd frontend
npm run devdocker compose up --build
# Dev mode with hot-reload frontend
docker compose --profile dev up- Sign up / log in
- Go to Detection and start screen capture — topics appear automatically as you study
- Click a topic to open its detail view — see summary, snippets, and the learning roadmap
- Expand a subtopic to run Explainer, load Resources, and take a Quiz
- Check Analytics for real-time mastery scores
- Use Review Queue to work through spaced-repetition flashcards
- Generate a Timetable to schedule upcoming study sessions
- View a full Learning Report (with JSON export)
- Create a Classroom to share roadmaps and compete on the leaderboard
Visit http://localhost:8000/docs for full Swagger documentation.
| Endpoint | Method | Description |
|---|---|---|
/detector/topics |
GET | List all detected topics |
/detector/topics/{id} |
GET | Topic details with subtopics and confidence |
/detector/topics/{id}/explainer |
GET | AI explanation for a subtopic |
/detector/topics/{id}/quiz |
GET | Quiz with difficulty adaptation |
/detector/topics/{id}/quiz/submit |
POST | Submit answers, update BKT mastery |
/detector/topics/{id}/resources |
GET | Curated resources for subtopic |
/detector/topics/{id}/graph |
GET | Concept dependency graph |
/analytics |
GET | Real-time analytics from BKT state |
/streaks |
GET | Current / longest streak |
/review-queue |
GET | Overdue spaced-repetition items |
/daily-progress |
GET | Today's quiz goal progress |
/report |
GET | Full learning report |
/classrooms |
GET / POST | List / create classrooms |
/classrooms/join |
POST | Join classroom by code |
/leaderboard |
GET | Classroom leaderboard |
/study-sessions/start |
POST | Start a timed study session |
/study-sessions/end |
POST | End session, record duration |
/resources/vote |
POST | Upvote / downvote a resource |
/health |
GET | Extended health (Supabase + LLM ping) |
/usage-stats |
GET | LLM provider telemetry |
/timetable/generate |
POST | Generate study timetable |
# Backend
cd backend && python -m pytest
# Frontend
cd frontend && npm run testSee docs/CONTRIBUTING.md.
- Fork and create a feature branch
- Run tests before submitting
- Open a PR against
main
Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0).
See LICENSE.md or https://creativecommons.org/licenses/by-nc/4.0/
- Google Gemini — default LLM
- FastAPI — backend
- React — frontend
- Supabase — auth + database
- Tesseract OCR — text recognition