FreeLattice module ยท docs/modules/education.js (1,378 lines) ยท Last updated: v5.78.0
modules/education.js. It uses IndexedDB for local persistence, phi-harmonic spaced repetition for review scheduling, and the FreeLattice AI infrastructure for all teaching. No cloud required for most subjects.
The module is a single IIFE that exposes window.Education = { init, destroy, render }. All state is local โ IndexedDB for persistence, no server calls except to the FreeLattice AI proxy.
| Layer | What it does |
|---|---|
| IndexedDB | Stores learner profiles, session history, and progress. Three stores: profiles, sessions, progress. |
| Profile | name, age, loves, laughs, wishes, domains, connections, reviewQueue, streakDays, totalSessions |
| Session | domain, mode (explore/create/review/surprise), topic, conversationHistory, assessment, concepts |
| AI proxy | Calls window.FreeLatticeAI.chat() โ the same proxy used by all FreeLattice modules |
PHI = 1.618033988749895
PHI_REVIEW_RATIO = PHI // 1.618 new : 1 review (Fibonacci memory consolidation)
REVIEW_INTERVALS = [1, 2, 3, 5, 8, 13, 21, 34] // Fibonacci days between reviews
| Key | Label | Color | Icon |
|---|---|---|---|
math | Mathematics | #d4a017 | ๐ |
science | Science | #34d399 | ๐ฌ |
language | Language & Writing | #60a5fa | ๐ |
reading | Reading | #a78bfa | ๐ |
history | History & Culture | #f97316 | ๐ |
art | Art & Music | #ec4899 | ๐จ |
logic | Logic & Reasoning | #14b8a6 | ๐งฉ |
nature | Nature & Life | #22c55e | ๐ฟ |
technology | Technology | #6366f1 | ๐ป |
social | Social & Emotional | #f59e0b | ๐ |
| Stage | Min sessions | Icon | Description |
|---|---|---|---|
| Seed | 0 | ๐ฑ | Just planted. Curious. |
| Sprout | 5 | ๐ฟ | Growing roots. Finding joy. |
| Sapling | 15 | ๐ณ | Branching out. Making connections. |
| Tree | 40 | ๐ฒ | Strong roots. Deep knowledge. |
| Forest | 100 | ๐ฒโจ | Knowledge flows between domains. |
| Canopy | 250 | ๐ | The view from the top. |
Entry point. Opens IndexedDB, loads active profile, sets currentView to 'welcome' (new user) or 'dashboard' (returning user), calls render().
Dispatcher. Routes to renderWelcome, renderDashboard, renderPickSubject, or renderSession based on currentView.
First-time setup form. Collects: name, age, what they love, what makes them laugh, what they wish they understood. On submit, creates a profile in IndexedDB and navigates to dashboard.
Main hub. Shows: greeting (time-aware), growth stage badge, growth tree canvas (200px), review notice (if due reviews exist), three action cards (Explore / Create / Surprise), domain grid with progress bars, cross-domain connections list, recent sessions list.
Renders the knowledge garden canvas. Current implementation: simple circles per domain, positioned horizontally, sized by domain score. Cross-domain connections drawn as dashed arcs. No animation.
// Current: simple circles
// Canvas: 600ร200px, background rgba(10,8,20,0.6)
// One circle per domain the learner has touched
// Circle radius: 12 + score * 20
// Cross-domain connections: dashed quadratic curves
Constructs the AI system prompt. References the child's name, age, interests, what makes them laugh, and what they wish they understood. Phi-harmonic review ratio (1.618:1). Three modes:
| Mode | Instruction to AI |
|---|---|
explore | Guide through new territory connected to interests. Start with wonder, build to understanding, end with curiosity. |
create | Co-creation. Learning is invisible โ embedded in the creative process. Child feels like artist or inventor, not student. |
review | Spiral, not ladder. Present familiar concepts in new contexts. Child discovers something new about something they know. |
Begins an exploration session. Builds teacher prompt, creates session object, sets currentView = 'session', calls render().
Asks the AI to propose a creative project based on the learner's interests and current domains. Begins a session in create mode.
AI picks a domain and topic based on what the learner has not explored recently. Weighted toward domains with low session counts.
Finds concepts due for review (based on Fibonacci intervals). If none due, shows "nothing to review yet." Otherwise begins a review session with the oldest due concept.
Calls window.FreeLatticeAI.chat() with the teacher prompt as system and the learner's message as user. Appends response to conversationHistory, calls renderConversation().
Sends a structured assessment request to the AI. Asks for JSON with: understanding (0โ1), creativity (0โ1), effort (0โ1), connections (cross-domain links found), feedback (plain English), concepts (list of concepts to add to review queue), crossDomainLink.
Parses the AI's JSON assessment. Updates: domain score (+understanding ร 0.1), session count, streak, last session date. Adds concepts to review queue with Fibonacci spacing. Advances review interval on successful review sessions (understanding โฅ 0.6 โ next Fibonacci interval).
window.SpeechRecognition) is available in all modern browsers. A microphone button in the session view would transform the experience for young learners.
| Item | Why sacred |
|---|---|
REVIEW_INTERVALS = [1,2,3,5,8,13,21,34] | Fibonacci spaced repetition. The memory science is sound. Do not change the intervals. |
PHI_REVIEW_RATIO = 1.618 | The 1.618:1 new:review ratio. Core to the philosophy. |
| Domain keys (math, science, etc.) | Used as IndexedDB keys. Changing them would corrupt existing learner profiles. |
| Growth stage thresholds (0/5/15/40/100/250) | These are milestone moments for learners. Changing them retroactively changes a child's stage. |
window.Education = { init, destroy, render } | The public API. FreeLattice's lazy-loader calls Education.init('educationContainer'). Do not rename. |
Code mirror generated by Harmonia ยท FreeLattice v5.78.0 ยท July 2026
For every child who deserves a teacher who knows them completely. ๐ฑ