freezmo/lib
Martin Dvorak 6036238bf0 Teach it back: the AI becomes the curious student
A new mode where the user explains a topic in their own words and the AI
plays a curious classmate: short reactions, exactly one follow-up question
at a time, never "correct"/"wrong", never lecturing, and everything it knows
comes from the user's own decks and notes.

- Entry points: a sidebar row next to Exam mode and a "Teach it back" action
  in every deck's menu (which prefills the topic and scope).
- Start screen: deck or typed topic, friendly/skeptical student, the same
  context and model chips as Chat (/teach?deck=<id> pre-selects the deck).
- Session: the student prompt is a mode of the existing /api/chat route, so
  model resolution, allowlists, rate limits and the streaming client are the
  same code; the personality lives in lib/prompts.ts (TEACH_*). The deck's
  cards travel as a numbered checklist and the student is told to ask about
  the ideas that were skipped; it must say so rather than guess when the
  notes cover nothing. One constant (TEACH_MAX_EXCHANGES = 10) ends the
  session, or the Finish button does.
- Recap: a teach_summary call (JSON, one repair retry) yields well / gaps
  with card references / next steps; each gap links to the card it means.
  "Add missed cards to review" schedules those activities due now; "Turn
  gaps into cards" generates one flashcard per gap from the deck's notes and
  shows an editable review list before saving.
- Sessions are chat conversations with a mode:"teach" marker + session
  record: same IndexedDB history, backup and sync, filtered out of the Chat
  screens; the recent list reopens a recap or continues a session.
- Reused pieces: MessageRow, Composer (now optional attach/scope chips and a
  mic), Markdown/KaTeX, AiDisclaimer, ContextPicker/ModelPicker, plus a
  shared useChatModels hook and useKeyboardInset extracted from Chat.
- Dictation: Web Speech API recognition (lib/speech-input.ts); the mic only
  renders where the browser supports it, and dictated phrases land in the
  draft.
- All strings in en + cs. teach-test: 44 checks (API prompts and guards,
  both entry points, the session, recap actions, history, exchange limit,
  360/390px layouts, mic on/off). Version 0.8.1, SW v103.
2026-10-16 23:05:24 +00:00
..
aero-music.ts Frutiger Aero: the theme now plays its soundtrack 2026-10-15 22:47:44 +00:00
ai.ts Podcast mode: notes read aloud with a lyric-style word highlight 2026-10-16 11:42:15 +00:00
backup.ts Podcast mode: notes read aloud with a lyric-style word highlight 2026-10-16 11:42:15 +00:00
chat-active.ts Chat layout: history in the main sidebar, consistent header, cleaner icon 2026-10-11 20:11:11 +00:00
chat-client.ts Teach it back: the AI becomes the curious student 2026-10-16 23:05:24 +00:00
chat-context.ts Chat mode, phase 1: grounded streaming chat over your notes 2026-10-11 18:32:11 +00:00
chat-models.ts Teach it back: the AI becomes the curious student 2026-10-16 23:05:24 +00:00
chat-seed.ts Chat mode, phase 1: grounded streaming chat over your notes 2026-10-11 18:32:11 +00:00
chat-store.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
chat-trim.ts Chat mode, phase 1: grounded streaming chat over your notes 2026-10-11 18:32:11 +00:00
chat.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
client-api.ts Podcast voices: natural provider TTS, and system-voice hygiene 2026-10-16 16:34:46 +00:00
clipboard.ts Add “Make my homework”, and finish the mobile polish pass 2026-10-08 18:30:33 +00:00
confetti.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
config.ts Design pass (all themes + chat UI), model picker, reduce-motion toggle 2026-10-14 05:06:02 +00:00
deck-ops.ts Freezmo: self-hosted notes-to-activities study app 2026-10-06 20:56:55 +00:00
deck-seed.ts Chat mode, phase 2: local history, answer actions, motion polish 2026-10-11 19:03:48 +00:00
dev-mode.ts Infra: split dev and production (releases, services, deploy script) 2026-10-11 19:25:29 +00:00
documents.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
folders.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
haptics.ts Native-feel pass: PWA integration, system back, offline, haptics, undo 2026-10-10 12:16:03 +00:00
history.ts Teach it back: the AI becomes the curious student 2026-10-16 23:05:24 +00:00
homework.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
http-guard.ts Add an English/Czech interface language switch 2026-10-08 13:56:32 +00:00
i18n-dict.ts Teach it back: the AI becomes the curious student 2026-10-16 23:05:24 +00:00
i18n.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
image.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
install.ts Add the Install the app bottom sheet for mobile browsers 2026-10-07 08:27:43 +00:00
language.ts Freezmo: self-hosted notes-to-activities study app 2026-10-06 20:56:55 +00:00
learning.ts Review breakdown: show each deck's own activity total 2026-10-15 21:20:53 +00:00
legal.ts Frutiger Aero: the theme now plays its soundtrack 2026-10-15 22:47:44 +00:00
model-errors.ts Phase 1: backup, encrypted sync and monthly-usage handling 2026-10-10 13:43:42 +00:00
model-guard.ts Security: model budget + concurrency caps, SSRF guards, spoof-proof limits 2026-10-12 20:40:57 +00:00
motion-pref.ts Aero button glass + homework report control; reduced-motion sheet glitch 2026-10-14 09:19:54 +00:00
motion.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
nav.ts Navigation restructure: five-tab bottom bar, no phone drawer 2026-10-10 16:53:55 +00:00
notes-source.ts Study cards: from-your-notes, read aloud, timed runs 2026-10-15 05:53:47 +00:00
ollama.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
openai-compat.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
podcast-audio.ts Podcast voices: natural provider TTS, and system-voice hygiene 2026-10-16 16:34:46 +00:00
podcast-natural.ts Podcast voices: natural provider TTS, and system-voice hygiene 2026-10-16 16:34:46 +00:00
podcast-speech.ts Podcast speech: the highlight clock learns the engine's pace 2026-10-16 21:45:18 +00:00
podcast-voices.ts Podcast voices: an iPhone note on where the other voices live 2026-10-16 13:51:12 +00:00
podcasts.ts Podcast mode: notes read aloud with a lyric-style word highlight 2026-10-16 11:42:15 +00:00
prompts.ts Teach it back: the AI becomes the curious student 2026-10-16 23:05:24 +00:00
providers-client.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
providers-server.ts Bring-your-own keys for cloud providers (OpenAI-compatible) 2026-10-14 06:29:39 +00:00
providers.ts Podcast voices: natural provider TTS, and system-voice hygiene 2026-10-16 16:34:46 +00:00
push-store.ts Security: model budget + concurrency caps, SSRF guards, spoof-proof limits 2026-10-12 20:40:57 +00:00
question-reports.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
rate-limit.ts Security: model budget + concurrency caps, SSRF guards, spoof-proof limits 2026-10-12 20:40:57 +00:00
schemas.ts Teach it back: the AI becomes the curious student 2026-10-16 23:05:24 +00:00
settings.ts Chat mode, phase 1: grounded streaming chat over your notes 2026-10-11 18:32:11 +00:00
share-inbox.ts Native-feel pass: PWA integration, system back, offline, haptics, undo 2026-10-10 12:16:03 +00:00
share-pending.ts Native-feel pass: PWA integration, system back, offline, haptics, undo 2026-10-10 12:16:03 +00:00
share.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
speech-input.ts Teach it back: the AI becomes the curious student 2026-10-16 23:05:24 +00:00
speech.ts Podcast mode: notes read aloud with a lyric-style word highlight 2026-10-16 11:42:15 +00:00
storage.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
sync-auto.ts Deck/homework writes sync themselves when sync is on 2026-10-12 16:40:49 +00:00
sync-key.ts Phase 1: backup, encrypted sync and monthly-usage handling 2026-10-10 13:43:42 +00:00
sync-state.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
sync.ts Podcast mode: notes read aloud with a lyric-style word highlight 2026-10-16 11:42:15 +00:00
teach.ts Teach it back: the AI becomes the curious student 2026-10-16 23:05:24 +00:00
theme.ts Frutiger Aero: the theme now plays its soundtrack 2026-10-15 22:47:44 +00:00
toast.ts Native-feel pass: PWA integration, system back, offline, haptics, undo 2026-10-10 12:16:03 +00:00
ui-events.ts Phase 1: backup, encrypted sync and monthly-usage handling 2026-10-10 13:43:42 +00:00
use-back-close.ts Navigation restructure: five-tab bottom bar, no phone drawer 2026-10-10 16:53:55 +00:00
use-health.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
use-keyboard-inset.ts Teach it back: the AI becomes the curious student 2026-10-16 23:05:24 +00:00
use-notes-intake.ts Add “Make my homework”, and finish the mobile polish pass 2026-10-08 18:30:33 +00:00
use-online.ts Native-feel pass: PWA integration, system back, offline, haptics, undo 2026-10-10 12:16:03 +00:00
use-phone.ts Mobile declutter pass: step flows, compact cards, simplified settings 2026-10-10 10:43:32 +00:00
use-version.ts App versioning + the create page's missing top padding 2026-10-12 20:04:26 +00:00
use-wake-lock.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
utils.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
version.ts App versioning + the create page's missing top padding 2026-10-12 20:04:26 +00:00
wizard-busy.ts Lock the wizard mode switch while a run is generating 2026-10-10 17:47:05 +00:00
wizard-draft.ts Codebase audit: fix bugs, performance issues, dead code, and edge cases 2026-10-14 19:00:17 +00:00
xp.ts Freezmo: self-hosted notes-to-activities study app 2026-10-06 20:56:55 +00:00