Homeschool Lesson-Reinforcement App Outline: Version: 1.1 /* --- Section 1: Project Overview --- */ You are a senior desktop-application engineer and privacy-aware education-software architect. Help me build a lightweight, offline-first homeschool lesson-reinforcement application for Windows 10/11, packaged as a Windows installer using Tauri v2. The app lets parents create short practice cards, record student performance, identify skills needing reinforcement, and locally generate suggested follow-up study questions using an on-device LLM. The app must work without an API key, internet access (after initial model download), or cloud data transmission. I have a single-page HTML/CSS/JS prototype that displays free-text and multiple-choice question cards, checks answers, and lets parents add cards. Currently, data is lost on reload. We will convert this into a persistent Tauri v2 application. /* --- Section 2: Core Requirements --- */ - Target: Windows 10/11 via Tauri v2. - Frontend: Plain HTML, CSS, and modern vanilla JavaScript (avoid React unless strictly necessary). - Backend: Rust via Tauri commands. - Database: SQLite with migrations and local backup/export. - AI Integration: A portable version of Ollama will be bundled directly inside the Tauri installer. The app will silently manage the Ollama background process. Parents must NOT be required to manually install Ollama or any external software; from their perspective, the AI is built directly into the app. - Modes: A PIN-protected Parent/Teacher mode (create, edit, assign, review) and a restricted Student mode (answer questions, see feedback, no answer keys or edit access). - Privacy: Store all data locally. Use random student IDs internally. Never include student names or personal details in AI prompts. - Grading: Deterministic answer matching and parent-approved variants for grading; AI is only for generating suggestions, not grading. /* --- Section 3: Data Model --- */ Design SQLite tables and JS data objects for: - students: local ID, display name, grade range, created date. - subjects: name. - skills: subject ID, skill name, description. - lessons/cards: ID, subject, skill, grade range, difficulty, type (text/multiple_choice), question, choices, accepted answers, explanation, source (parent/AI), status. - assignments: student ID, card ID, assigned date, completed date. - attempts: student ID, card ID, submitted answer, correct boolean, timestamp, attempt number. - ai_suggestions: skill/context summary, model name, generated JSON, review status, created date. /* --- Section 4: Mastery Rules --- */ Implement transparent rules: - Flag a skill for review after 2 incorrect attempts on the same card, OR accuracy below 70% across the most recent 5 completed cards for that skill. - When flagged, offer the parent a "Generate practice suggestions" button. - Never auto-assign AI content. - Provide a parent dashboard showing accuracy, recent attempts, flagged skills, and AI review status. /* --- Section 5: AI Integration --- */ Handle AI inference by silently managing a bundled portable Ollama executable via the Rust backend: - On app startup, the Rust backend will check if Ollama is running at `http://127.0.0.1:11434`. If not, it will silently launch the bundled `ollama.exe` from the app's local resources in a hidden/background state. - Allow the parent to select and download a small local model (e.g., a 2B parameter `.gguf` file) directly through the app's Settings screen. - Set reasonable local timeouts and show clear errors if the model fails to load or Ollama crashes. - Keep prompts anonymous and minimal. Request strict JSON output using this schema: { "cards": [ { "type": "text" | "multiple_choice", "question": "string", "choices": ["string"] or [], "correctAnswers": ["string"], "explanation": "string", "subject": "string", "skill": "string", "difficulty": 1, "ageRange": "string" } ] } - Validate the response strictly. Reject if: - Invalid JSON or wrong number of cards. - Multiple-choice lacks 3-4 choices or exactly one correct answer. - Free-text lacks accepted answers. - Fields are missing, overly long, contain PII, or violate subject/age constraints. /* --- Section 6: Security Requirements --- */ - Hide answer keys from student-mode client code before submission. - Use DOM APIs and textContent for parent/AI text (no innerHTML). - Validate all frontend inputs in the Rust backend before saving. - Use strict Tauri command allowlists; no broad filesystem/shell access (except the specific need to launch the bundled Ollama process). - Store the parent PIN as a salted, slow password hash. - Require user confirmation for data exports/imports and destructive actions. - Zero analytics or external network calls. /* --- Section 7: Deliverables --- */ Work iteratively. First provide: 1. A concise architecture diagram in Mermaid. 2. Proposed project folder structure (must include where the bundled Ollama executable and downloaded models will live). 3. SQLite schema and migrations. 4. Tauri command/API boundary design. 5. A staged build plan with small testable milestones. 6. First implementation step: Convert the prototype to an offline single-page app with persistent local storage and a safe data model. Wait for my approval before generating large amounts of code. When providing code: - Give complete, runnable files with paths. - Preserve the existing simple card interface. - Prefer secure, simple, maintainable code. - Include manual test steps for every milestone. - Call out assumptions only if they block progress. --