# Sprint 1 — Chess Tutor: Local Setup + OpenRouter + Playable Board **Goal:** Get the chess tutor running locally with a playable board, AI coach via OpenRouter, and model selection. ## Now - [x] Merge chess_tutor codebase into Tony_tech/chess-project - [x] Preserve Hermes agent files (agents/, .gitea/, AGENTS.md) - [x] Add OpenRouter abstraction layer (`src/lib/openrouter.ts`) - [x] Create model selector dropdown (`src/components/ModelSelector.tsx`) - [x] Update API routes to use OpenRouter (chat + opening explanation) - [x] Update APIKeyInput for OpenRouter keys - [ ] Install dependencies and start dev server - [ ] Verify board renders at localhost:3050 - [ ] Test AI chat with an OpenRouter model - [ ] Test AI chat with a different model (switch via dropdown) ## Next - [ ] Add model selection persistence across sessions - [ ] Verify stockfish engine works in browser - [ ] Test opening trainer functionality - [ ] Test tactical puzzle mode - [ ] Add "Chess Coach" personality presets page ## Backlog - [ ] Add saved game management UI improvements - [ ] Add PGN import/export - [ ] Add game analysis mode (AI reviews your game) - [ ] Multi-language support polish - [ ] Performance optimization for mobile - [ ] Docker setup for easy deployment ## Setup Notes ```bash # 1. Install dependencies cd Tony_tech/chess-project npm install # 2. Start dev server (default port 3050) npm run dev # 3. Open browser to http://localhost:3050 # 4. On first visit, the onboarding page will prompt for: # - Language selection # - OpenRouter API key (get one at https://openrouter.ai/keys) # - Model selection (pick your preferred AI model) ``` ### Env Configuration Create `chess-project/.env.local`: ``` OPENROUTER_API_KEY=sk-or-v1-your-key-here NEXT_PUBLIC_DEFAULT_MODEL=google/gemini-2.5-flash ``` If `OPENROUTER_API_KEY` is set as an env var, the opening explanation endpoint uses it automatically. For the tutor chat, users enter their key through the UI (stored in localStorage). ### Available Models Users can switch between any of these in the model selector dropdown: | Model | Provider | Cost | |-------|----------|------| | Gemini 2.5 Flash | Google | Low | | Gemini 2.5 Pro | Google | Medium | | Claude Sonnet 4 | Anthropic | Medium | | Claude 3.5 Haiku | Anthropic | Low | | GPT-4o | OpenAI | Medium | | GPT-4o Mini | OpenAI | Low | | DeepSeek Chat | DeepSeek | Very Low | | Grok 3 | xAI | Medium | | Llama 3.1 70B | Meta | Low | ### Port The dev server runs on port **3050** by default (configured in package.json).