Remove obsolete VALID_VOICES validation that was rejecting the new
"model:voice" format from the voices endpoint integration. The old
validation expected simple voice names like "onyx" but the new format
uses "tts-1:onyx", causing validation to fail and produce malformed
API requests that returned HTTP 400 errors.
Changes:
- Remove VALID_VOICES constant (no longer needed)
- Update syncInputsAndQueryString() to accept any voice value from dropdown
- Default to "tts-1:onyx" format if no value present
Fixes the TTS errors seen in production where voice selection was
failing with HTTP 400 status.
Update TTS implementation to fetch available voices from the API and
support multiple TTS models:
- Add VOICES_API_URL constant for /v1/voices endpoint
- Create populateVoiceDropdown() to dynamically populate voice options
- Group voices by model using optgroups in the dropdown
- Implement voice fetching with localStorage caching (1 minute)
- Update speakText() to parse model:voice from dropdown value
- Update speakTextQueued() to use dynamic model and voice
- Add backward compatibility for legacy voice-only format
- Update both desktop and mobile voice selectors
- Add fallback to tts-1:onyx if voice fetch fails
Voice dropdown now displays all available models (tts-1, tts-1-hd,
tts-1-silero, tts-1-kokoro) with their respective voices organized
by optgroups for better UX.
This activity provides an immersive, open-ended exploration of Earth's
prehistoric eras where users can:
- Travel through Triassic, Jurassic, and Cretaceous periods
- Explore climate, geography, dinosaurs, marine reptiles, and pterosaurs
- Learn about specific creatures on demand
- Understand the evolution of life and flowering plants
- Witness the K-T extinction event
- Jump freely between time periods
Features:
- Central "control room" hub for navigation
- Detailed information about 30+ dinosaurs and creatures
- Covers vegetation changes including flowering plant revolution
- Open-ended exploration with AI-guided learning
- Comprehensive extinction event explanation
- Supports looping and non-linear exploration
The activity validates successfully and follows best practices for
engagement, education, and proper termination.
Enhanced moon navigation to allow easy return to the host planet's details.
Previously, moon navigation only had "leave_jupiter" which took you to the
final navigation menu. Now you can also go back to see the planet itself.
New Navigation Pattern (implemented for Jupiter's moons):
From any moon, you can now:
1. **Jump to other moons** - "Europa", "Ganymede", etc.
2. **Return to moon menu** - "moon menu" shows all moon options
3. **Back to planet** - "Jupiter" or "back to Jupiter" returns to planet details
4. **Leave entirely** - "leave Jupiter" goes to planet-to-planet navigation
Example Navigation Flow:
- Visit Jupiter → See planet details
- Choose "Io" → See Io's volcanoes
- Say "back to Jupiter" → Return to Jupiter's details (storms, bands, etc.)
- Say "Europa" → Jump directly to Europa
- Say "leave Jupiter" → Continue to Saturn
Updated Navigation Steps:
- moon_io_nav: Added back_to_planet → jupiter:jupiter_details
- moon_europa_nav: Added back_to_planet → jupiter:jupiter_details
- moon_ganymede_nav: Added back_to_planet → jupiter:jupiter_details
- moon_callisto_nav: Added back_to_planet → jupiter:jupiter_details
- jupiter_other_moons_nav: Added back_to_planet → jupiter:jupiter_details
This same pattern can be extended to Saturn, Uranus, and Neptune moons,
allowing seamless navigation: Moon → Moon, Moon → Planet, Planet → Planet.
Enhanced the Solar System Explorer with comprehensive moon navigation menus,
allowing users to jump freely between moons within each planet's system.
New Navigation Features:
- Moon selection menus after each planet's moon intro
- Individual navigation after each moon's details
- Ability to jump directly to any moon or back to the menu
- "Stay" option to ask questions without penalty
Jupiter (95 moons):
- Moon menu: Choose Io, Europa, Ganymede, Callisto, or other moons
- Navigation after each Galilean moon
- Can jump between any moons freely
Saturn (146 moons):
- Moon menu: Choose Titan, Enceladus, Mimas, or other moons
- Navigation after each major moon
- Jump between moons or back to menu
Uranus (28 moons):
- Moon menu: Choose Miranda or other major moons
- Navigation from Miranda to other moons
- Can explore Ariel, Umbriel, Titania, Oberon via other moons
Neptune (16 moons):
- Moon menu: Choose Triton or other moons
- Navigation after Triton
- Can jump back to major moon or continue journey
Example Usage:
1. Visit Jupiter → Choose moon menu
2. Say "Europa" → See Europa details
3. Say "I want to see Io" → Jump directly to Io
4. Say "moon menu" → Back to selection
5. Say "other moons" → See smaller moons
6. Say "leave Jupiter" → Continue to Saturn
This makes exploration truly non-linear and interactive, exactly as
requested for exploring moons like jumping between Uranus's moons!
Created an interactive, open-ended educational activity that allows students to explore the entire solar system at their own pace.
Features:
- Complete coverage of all major celestial bodies
- The Sun with detailed structure and solar activity
- All 8 planets with comprehensive details
- 200+ moons documented with attributes:
- Jupiter's 95 moons (4 Galilean moons + others)
- Saturn's 146 moons (Titan, Enceladus, Mimas, etc.)
- Uranus's 28 moons (Miranda and major moons)
- Neptune's 16 moons (Triton and others)
- Earth's Moon, Mars's Phobos & Deimos
- Asteroid Belt (Ceres, Vesta, Pallas, Hygiea)
- Kuiper Belt (Pluto, Eris, Makemake, Haumea, etc.)
Activity Structure:
- 13 main sections (Introduction, Sun, 8 planets, Asteroid Belt, Kuiper Belt, Conclusion)
- Non-linear exploration - jump to any location at any time
- Detailed scientific information with current data
- Engaging presentation with emojis and formatting
- Educational content based on latest discoveries (New Horizons, Cassini, Juno missions)
Technical:
- Fully validated YAML structure
- All transitions properly mapped
- Proper termination paths
- Interactive Q&A at each location
- "Stay" option allows asking questions without counting as attempts
Perfect for astronomy education and space exploration learning!
NEW ACTIVITIES:
activity48-monty-hall-simulation.yaml - Monty Hall paradox proof
- Simulate stay vs switch strategies
- Prove switching wins 2/3 through code
- Any programming language support
activity49-multi-armed-bandit.yaml - Adaptive algorithms beat A/B testing
- Epsilon-greedy implementation
- 88% regret reduction vs traditional A/B
- Real-world applications (web optimization, clinical trials)
activity50-genetic-algorithms.yaml - Evolution-based optimization
- String evolution challenge
- Fitness, selection, crossover, mutation
- 803,181x faster than brute force
activity51-connect-four.yaml - Complete game development
- 2D arrays and game state
- Win detection algorithms (horizontal, vertical, diagonal)
- Full game loop implementation
All activities:
- Support ANY programming language choice
- Follow pedagogical best practices (concepts first, code in feedback)
- Validate with zero errors/warnings
- Engaging and fun (aha moments, real games, simulations)
NEW ACTIVITIES:
activity46-game-theory-python.yaml - Game theory implementation in Python
- Representing games with dictionaries
- Payoff matrix as dict with tuple keys
- Query functions and game simulation
- One-shot and repeated games
- Tit-for-Tat strategy implementation
- Function composition and abstraction
activity47-game-theory-c.yaml - Game theory implementation in C
- Defining Payoff struct for outcomes
- 2D arrays for payoff matrices
- Memory-efficient game representation
- Strategy lookup functions
- Enum for self-documenting code
- Pointer and struct fundamentals
Both activities:
- Teach programming through game theory concepts
- Follow pedagogical best practice (concepts first, code examples in feedback)
- Validate with zero errors/warnings
- Progressive difficulty (structures → functions → simulation)
- Real-world application of abstract concepts
- Engage students with strategic thinking + coding
PROBLEM: activity37 was showing complete code examples in Python, JavaScript,
Java, and C++ BEFORE asking students to write code themselves. This turns
learning into copy-paste practice.
FIXED:
- Hello World section: Removed multi-language code examples from content_blocks
- Variables section: Removed multi-language code examples from content_blocks
- Now explains CONCEPTS (what, why, how languages differ) without showing syntax
- Code examples remain in AI feedback for when students struggle or ask for help
PEDAGOGICAL APPROACH:
1. Explain the concept (stdout, variables, etc.)
2. Explain language differences conceptually (dynamic vs static typing)
3. Ask students to TRY writing code in THEIR language
4. Provide language-specific examples in AI FEEDBACK if they struggle
This way students actually have to THINK and LEARN, not just copy.
UPDATED CLAUDE.md:
- Added new pitfall: "Showing answers before questions"
- Guidance: Explain concepts in content_blocks, provide code examples in ai_feedback
Still validates perfectly with zero errors/warnings.
activity38-fashion-today.yaml - Fun, interactive style discovery
- Personal style identification (classic, boho, streetwear, etc.)
- Color psychology and preferences
- Outfit building for occasions
- Statement pieces and accessories
- Fashion philosophy reflection
- Encourages self-expression and confidence
activity39-fashion-history.yaml - Educational timeline 1800-2025
- Victorian era corsets and social restrictions
- 1920s flappers and women's liberation
- WWII rationing and practical fashion
- 1950s ultra-femininity and gender politics
- 1960s-70s revolution (mod, hippie, disco, punk)
- 1980s excess and 1990s grunge backlash
- 2000s-2010s fast fashion and social media
- 2020s sustainability, inclusivity, technology
- Critical thinking about fashion as social mirror
Both activities:
- Follow expert guide validation requirements
- Include engaging content with emojis and formatting
- Support language switching
- Use metadata strategically
- Have multiple response paths with tailored feedback
- Terminate properly with activity_completed markers
- Passed activity_yaml_validator.py with zero errors/warnings
This guide empowers agents to create activities that validate properly,
are fun and engaging, and terminate correctly.
Key additions:
- Core activity structure with detailed examples
- Critical validation requirements checklist
- Four termination patterns with code examples
- Ten engagement techniques from successful activities
- Best practices for activity development
- Common pitfalls table with fixes
- Complete development workflow
- Quick reference for essential fields
- Minimal working activity example
References activity26-magic-8-ball.yaml, activity31-scientific-method.yaml,
and activity37-programming-languages.yaml as exemplary activities.
- Increased from 1,148 to 1,895 lines (+65%)
- Added detailed explanations before each coding exercise
- Enhanced Hello World section with stdout concepts and multi-language examples
- Expanded Variables section with box analogy, naming rules, and typing differences
- Enhanced Data Types with comprehensive type explanations and string formatting
- Expanded If Statements with conditional logic fundamentals and comparison operators
- Enhanced Loops with detailed for loop explanations, execution traces, and common patterns
- Expanded Functions with DRY principle, parameter explanations, and best practices
- Enhanced Return Values with display vs return differences and common mistakes
- All sections now teach fundamentals thoroughly before asking students to code
- Validation passed successfully
- Textarea now automatically expands as user types multiline messages
- Resets to minimum height after message is sent
- CSS: Set min-height (60px) and max-height (400px) with auto overflow
- Removed fixed rows attribute to allow dynamic height
- Disabled manual resize to prevent user confusion
- Provides better UX for composing longer messages
These scripts document the automated fixes applied to activities 30-37:
- fix_activity37.py: Changes 'close' bucket behavior + fixes completion
- fix_all_new_activities.py: Fixes final step completion for all activities
Keeping for reference and potential reuse on future activities.
This commit addresses two critical issues:
1. Completion Bug (activities 30-37):
- Final steps were looping forever, preventing activity completion
- Fixed by removing next_section_and_step from completion transitions
- Kept off_topic transition looping to avoid validator terminal step errors
- Activities now complete properly when users give valid final answers
2. Activity37 Bucket Logic:
- Changed "close" bucket to retry same step instead of advancing
- Only "correct" bucket now advances to next step
- All other buckets (close, incomplete, wrong_language, etc.) retry
- This ensures students must get correct answers to progress
Technical Details:
- Final steps are not considered "terminal" if at least one transition
has next_section_and_step (validator requirement)
- Off-topic transitions loop back to allow another attempt
- Completion happens when get_next_step() returns None, None
Validation:
- All 8 activities pass activity_yaml_validator.py
- No errors or warnings
Affects: activity30-37 (all new merged activities)
When MODEL_X references (MODEL_0, MODEL_1, etc.) are used, the code now
properly looks up actual model names from the dynamic registry (MODEL_CLIENT_MAP)
instead of hardcoding "model" or requiring MODEL_NAME_X environment variables.
Changes:
- app.py: Look up models from MODEL_CLIENT_MAP for the specified endpoint
- guarded_ai.py: Query endpoints for actual model names at initialization
- guarded_ai.py: Use dynamic registry for MODEL_X lookups
This fixes the "model not found" error when using activities with MODEL_X
references like activity37.
Respects existing stable configuration where:
- MODEL_0 = Hermes (default for classification and feedback)
- MODEL_1 = Qwen (for code generation)
- MODEL_2 = GPT
Updated:
- All function defaults in activity.py: MODEL_1 -> MODEL_0
- activity37: Uses MODEL_0 for classification, MODEL_1 for code feedback
This works with the existing environment variable setup without requiring changes to vars.sh.
Critical fix for activity model configuration:
- Handle MODEL_1, MODEL_2, MODEL_3 references in get_openai_client_and_model()
- Look up MODEL_ENDPOINT_{n}, MODEL_API_KEY_{n}, MODEL_NAME_{n} from environment
- Fall back gracefully to default model if MODEL_{n} not configured
- Matches implementation in research/guarded_ai.py
Fixes error: 'NoneType' object has no attribute 'chat'
This error occurred when activities tried to use classifier_model="MODEL_1"
but the app didn't know how to resolve the MODEL_X reference.
Now activity37 (programming languages) will work correctly with:
- classifier_model: "MODEL_1" (Hermes for classification)
- feedback_model: "MODEL_3" (Qwen3-Coder for code generation)
Critical fix for guarded_ai.py:
- Add MODEL_NAME_{n} environment variable support
- Fixes hard-coded "model" string that breaks Azure OpenAI and other endpoints
- Falls back to "model" if MODEL_NAME_{n} not specified
- Some endpoints require actual deployment name in model parameter
Validator improvement:
- Allow feedback_prompts as alternative to feedback_tokens_for_ai
- Prevents false warning when using metadata_feedback_filter with new prompt system
Documentation:
- Added MODEL_NAME_{n} examples to CLAUDE.md
- Documented that Azure and similar endpoints need this variable
All 8 activities validated: 0 errors, 0 warnings
Added comprehensive Activity YAML Schema section covering:
- Model Configuration feature (classifier_model and feedback_model)
- Why separate models (speed, quality, cost, flexibility)
- Model defaults (MODEL_1/Hermes as universal default)
- Recommended model combinations table
- Environment variable configuration
- Example programming activity with dual models
- Activity YAML validation instructions
- CLI testing with model configuration
- Qwen3-Coder-30B setup guide (llama.cpp and ollama)
This documents the new dual-model architecture that allows:
- Fast classification with Hermes (8B)
- Specialized feedback with domain models (e.g., Qwen3-Coder 30B)
- Activity and step-level model overrides
Transformed planning document into comprehensive completion report:
- Status: 8 activities completed (30-37), 6,112 lines of YAML
- Documented new classifier_model and feedback_model feature
- Added model setup guide for Qwen3-Coder-30B
- Detailed activity summaries with special features
- Technical architecture and implementation decisions
- Usage examples and future enhancements
Key highlights:
- All activities validated with 0 errors
- Dual-model architecture explained
- Activity 37 flagship feature: universal programming language support
- Hermes excellence in role-playing scenarios
Added detailed comments showing how to use the recommended model:
- hf.co/unsloth/Qwen3-Coder-30B-A3B-Instruct-GGUF:Q4_K_M
- Setup instructions for llama.cpp (with GPU offloading)
- Alternative setup with ollama
- Environment variable configuration examples
This 30B parameter model is specifically optimized for code generation
across all programming languages, making it perfect for the universal
programming activity.
Changes:
- Enhanced get_openai_client_and_model() to support MODEL_X references
- Added model parameter (default "MODEL_1") to all AI functions:
- categorize_response()
- generate_ai_feedback()
- provide_feedback()
- provide_feedback_prompts()
- translate_text()
- Updated simulate_activity() to:
- Read classifier_model and feedback_model from YAML
- Support step-level model overrides
- Pass appropriate models to classifier vs feedback functions
This ensures the CLI simulation tool matches the production activity.py behavior.
Hermes is always available in every install, making it the perfect default.
All model parameters now default to "MODEL_1" instead of None:
- classifier_model: Fast, accurate classification
- feedback_model: Great for role-playing and general feedback
Activities can still override these defaults:
- At activity level for all steps
- At step level for specific interactions
This ensures activities work out-of-the-box without requiring model configuration.
Allow activities to specify separate models for classification and feedback:
- classifier_model: Used for categorizing user responses into buckets
- feedback_model: Used for generating AI feedback and translations
Both fields can be set at activity level (defaults) and overridden at step level.
Updated activity37 to use:
- MODEL_1 (Hermes) for classification
- MODEL_3 (Qwen 3 Coder) for feedback
This allows using specialized models for different tasks, e.g., fast classification
with accurate feedback generation from domain-specific models.
Created 3 comprehensive educational activities without embedded Python:
1. activity35-american-history.yaml - Advanced American History for gifted students
- Founding principles and Constitutional design
- Civil War causes and Reconstruction failure
- Civil Rights Movement strategies
- Primary source analysis and critical historical thinking
- Connects past to present issues
2. activity36-biblical-history.yaml - Biblical History & Ancient Near East
- Ancient Near Eastern context (Mesopotamia, Egypt, Canaan)
- Archaeological evidence and historical reconstruction
- Israelite history (Exodus, Monarchy, Exile)
- Roman period and early Christianity
- Foundation myths vs historical facts
- Cultural adaptation and religious transformation
3. activity37-programming-languages.yaml - Universal Programming Concepts
- Student chooses ANY programming language (Python, C++, COBOL, anything)
- AI adapts all examples/feedback to chosen language via metadata
- Covers: stdout/output, variables, data types, control flow, loops, functions
- All examples use stdout to display messages
- Concepts applicable to every language
- Language-specific syntax provided by AI
All activities:
- Use only YAML features (no embedded Python)
- Validate successfully with 0 errors
- Provide sophisticated educational content
- Use AI feedback for personalization
- Include critical thinking and reflection
- Track progress via metadata
Total: 8 new educational activities across 2 commits (5 from previous commit + 3 now)
Move all CSS from base.html to static/css/style.css for better:
- Separation of concerns
- Browser caching
- Maintainability
- Code organization
Changes:
- Created static/css/style.css with all application styles
- Updated base.html to link to external stylesheet
- Reduced base.html from ~980 to ~407 lines
Add custom scrollbar styles that properly match dark and light themes:
- Webkit browsers: styled scrollbars with theme-appropriate colors
- Firefox: thin scrollbars with matching color scheme
- Dark mode: darker gray scrollbars that blend with the UI
- Light mode: light gray scrollbars for better visibility
Created 5 comprehensive educational activities that use only YAML features
(buckets, transitions, metadata operations, AI feedback) without Python scripts:
- activity30-logic-puzzles.yaml: Critical thinking through deductive reasoning,
contrapositives, syllogisms, and knights/knaves puzzles
- activity31-scientific-method.yaml: Learn scientific method through historical
case studies (Semmelweis, Newton) and experimental design principles
- activity32-world-geography.yaml: Choose-your-own-adventure journey exploring
continents, countries, capitals, and cultural facts
- activity33-environmental-science.yaml: Role-playing as environmental consultant
making sustainability decisions on transportation, energy, land use, waste, and food
- activity34-media-literacy.yaml: Develop critical media consumption skills,
evaluate sources, recognize bias, fact-check claims, and spot manipulation
All activities:
- Follow existing YAML schema and validate successfully
- Use Socratic buckets for educational feedback
- Include set_language support
- Track progress via metadata
- Provide AI-generated personalized feedback
- Are educational, engaging, and progressively challenging
- Include final reflection steps
Also added NEW_ACTIVITIES_PLAN.md documenting the planning process and
design rationale for each activity.
Added CSS variables for link colors with better contrast:
- Light mode: #0066cc (normal), #004499 (hover)
- Dark mode: #58a6ff (normal), #79b8ff (hover)
Applied general link styling rules that adapt to both themes,
ensuring links are clearly visible and distinguishable in dark mode.
Added CSS variables for code execution result colors that adapt to theme:
- --text-info: Blue for informational text (language labels)
- --text-success: Green for successful output
- --text-error: Red for errors and warnings
Updated JavaScript to use CSS variables instead of hard-coded colors,
ensuring proper contrast and readability in both light and dark modes.
Address CodeRabbit feedback by replacing bare except clauses with
specific Exception handling:
- test_activity_integration.py: Fix 2 tearDown methods
- test_app_integration.py: Fix 1 tearDown method
Changes:
- Replace bare 'except:' with 'except Exception as e:'
- Add explanatory comments for why exceptions are caught
- Maintain same functionality while improving code quality
Tests still pass: 11/13 integration tests passing (85%)
- Switch from default highlight.js theme to GitHub themes
- Use github-dark theme for dark mode with better color contrast
- Use github theme for light mode
- Dynamically switch themes when user toggles dark/light mode
- Apply correct theme on page load based on saved preferences