Gary Miller

LEAD_APPLIED_AI.ENG // FULL_STACK_AI.SYSTEMS // QUANT.DEV

SYS.LOG: Learning Tree

>_ EXECUTIVE SUMMARY

The Learning Tree is a local-first AI education platform centered on an interactive 3D canopy. The system connects model-generated lessons to persistent learner profiles, backend-scored challenges, mastery progression, and a visual curriculum that changes with the learner's state.

Designed for privacy-conscious environments, it combines deterministic curriculum contracts with local Ollama inference so profiles, lesson history, assessment results, and mastery data remain on infrastructure controlled by the user.

>_ ARCHITECTURE & STACK

  • Frontend (React 18 + TypeScript + R3F): A full-screen React Three Fiber (Three.js) interface that maps API mastery coordinates into renderable, interactive scene data.
  • Backend (Python + FastAPI): Owns the correctness-sensitive control loops—lesson construction, quiz scoring, and local AI health checks.
  • Data & Inference: SQLite (via SQLAlchemy) enforces strict relational foreign keys for learning persistence, while an Ollama container powers localized NLP tasks.

>_ CORE ENGINEERING CHALLENGES

1. Privacy-Preserving State Tracking: Most AI tutors do not actually track mastery or maintain local history. I engineered a robust SQLite schema that associates local profiles with specific leaf mastery. A selected leaf resolves into a LessonGenerationContext, allowing the backend to track exact pedagogical progress without ever transmitting data to the cloud.

2. Structured Curriculum Contracts: Raw LLM text is a liability in education. If a model hallucinates inconsistent quiz answers, the UI breaks. I designed a rigid validation boundary using Pydantic schemas. The model must produce a LessonPackage with required teaching sequences, guided practice, and backend-scored answer keys, or the generation is rejected.

3. Streaming Responsiveness via SSE: To maintain UI fluidity during slow local inference, I decoupled generation from rendering. The lesson reader opens immediately with a provisional state, and a Server-Sent Events (SSE) stream incrementally pushes JSON state transitions (start, token, replace, complete), providing a recoverable state machine without the heavy overhead of WebSockets.

4. 3D Visual Mastery Projection: The 3D canopy is not merely decorative; it is a live reflection of database state. A completed challenge idempotently updates the profile_leaf_progress table, triggering an API refresh that visually rejuvenates the tree branch, explicitly linking backend assessment logic to frontend 3D rendering.

>_ ENGINEERING SIGNAL

The Learning Tree demonstrates AI product design beyond text generation: structured domain contracts, SSE state machines, recovery paths, relational integrity, profile-specific progression, backend assessment, accessible interaction goals, and a data-driven 3D frontend.

ACCESS_SOURCE_CODE()