FEAT-78 - AI Typing Game
Status
Integrated (v1 + v1.1 gameplay quality fixes) - canonical feature doc: docs/features/FEAT-78-Typing-Game.md
Temporary improvement plan: docs/features/FEAT-78-Typing-Game-Improvement-Plan.md
Overview
FEAT-78 introduces a Monkeytype-inspired typing game as an AI learning tool. Instead of random words, the game generates meaningful passages from the user's study materials so every typed sentence reinforces course knowledge, definitions, and key concepts. It extends the AI learning-tools foundation from FEAT-60 and FEAT-61, combining passage generation, a real-time typing interface, scoring, and session persistence around document-backed educational content.
- Added
TypingGameToolas a registered AI tool (toolId: "typing-game"). - Reused existing AI registry flow (
POST /ai/tools/:toolId) for generation. - Reused existing game persistence tables:
ai_game_sessions(game_type: "typing")ai_game_attempts(stores score + typing metrics payload)
- Added typing-game retrieval/session endpoints:
GET /ai/tools/typing-game/recentGET /ai/tools/typing-game/:sessionIdPOST /ai/tools/typing-game/:sessionId/submit
- v1.1 fix: raised backend passage safety caps (
easy=120,medium=260,hard=480) and trim-to-word-boundary behavior to prevent mid-word truncation.
Frontend Behavior
- Added new route:
/ai/typing-game. - Implemented typing gameplay loop:
- document selection via
DocumentPicker - difficulty selection (
easy,medium,hard) - live progress, WPM, and accuracy
- paste-blocked typing input
- complete/skip/abandon submit flow
- document selection via
- Added typing-game history support through
AiHistoryPanel. - Added AI hub entry points for Typing Game in
/ai. - v1.1 fix: timer now starts on first keystroke and advances via a continuous
setInterval(1000)ticker using floored elapsed seconds, so it stays accurate during idle pauses and stops on completion/submit.
Notes
- Feature flags: None — listed on the AI hub.
- Dependencies: FEAT-60 AI document intelligence foundation, FEAT-61 AI learning-tools reusable architecture, the AI tool registry and base tool pattern, scope resolution and ownership enforcement, and existing AI output/session persistence (
ai_game_sessions,ai_game_attempts). - Known limitations / non-goals: no multiplayer or competitive play, no leaderboards, no audio feedback, no mobile gesture typing, and no generic random-word practice disconnected from study materials. FEAT-78 uses single-passage gameplay in the initial integration; multi-passage progression is a Phase 2 follow-up.
Security Notes
- The feature inherits authenticated user context from the FEAT-31 cookie-auth flow.
- Scope resolution enforces ownership boundaries; AI generation never exposes other users' document content.
- Persisted session data remains tied to the authenticated user.
- Standard AI plan-access checks and throttling remain in force.
Canonical Feature Document
Implementation and QA requirements are tracked in: docs/features/FEAT-78-Typing-Game.md