Workout Window AI Users System
Overview
The AI Users system generates synthetic users to populate workout window teams and squads. This allows:
- Testing the system with users spread across the U.S.
- Ensuring full teams and squads even with low real user adoption
- Real users can naturally replace AI users over time as they join
Database Schema
Migration: 026_add_ai_users.sql
profiles.is_ai: Boolean flag marking AI usersworkout_window_ai_users: Table storing AI user configuration- Region, city, state, timezone
- Activity type and time window
- Check-in probability (default 85%)
- Active status
AI User Generation
Default Configuration
-
Regions: 5 U.S. regions with major cities
- West Coast (25%): LA, SF, Seattle, San Diego, Portland
- East Coast (30%): NYC, Boston, Philly, DC, Miami
- Midwest (20%): Chicago, Detroit, Minneapolis, KC, Milwaukee
- South (15%): Atlanta, Dallas, Houston, Nashville, Austin
- Mountain West (10%): Denver, Phoenix, Salt Lake City, Las Vegas
-
Activity Distribution:
- Cardio: 30%
- Strength: 25%
- Walk: 20%
- Meditation: 10%
- Reading: 10%
- Homework: 3%
- Other: 2%
-
Time Windows: Distributed across day
- Early morning (6-8am): 15%
- Morning (8-10am): 10%
- Lunch (12-2pm): 20%
- Afternoon (2-4pm): 15%
- Evening (4-6pm): 25%
- Late evening (6-8pm): 15%
-
Check-in Probability: 85% (configurable)
API Endpoints
Admin Only (Super Admin)
-
POST
/api/workout-window/admin/ai-users/generate- Generate AI users
- Body:
{ count: number, config?: Partial<AIGenerationConfig> } - Returns:
{ created, failed, users, errors }
-
GET
/api/workout-window/admin/ai-users- Get all AI users with profiles
-
DELETE
/api/workout-window/admin/ai-users/:id- Delete an AI user (removes all associated data)
-
PUT
/api/workout-window/admin/ai-users/:id/toggle- Toggle active status
- Body:
{ isActive: boolean }
-
GET
/api/workout-window/admin/teams/:date- Get team and squad breakdown showing AI vs real users
- Shows Red/Blue teams, squads, and member breakdown
Admin UI
Accessible via Admin Panel → Workout Window tab.
Features
-
Generate AI Users
- Specify count (1-1000)
- Users distributed across U.S. regions
- Automatically creates:
- Auth user account
- Profile with display name
- Workout window configuration
- Location data
- AI user record
-
View AI Users
- List all AI users
- Shows: name, location, activity, time window, status
- Actions: activate/deactivate, delete
-
Team Breakdown
- View teams and squads for any date
- Shows AI vs real user counts
- Color-coded indicators:
- 🤖 Blue dot = AI user
- 👤 Green dot = Real user
- Check-in status (✓ for completed)
-
Squad Breakdown
- View all 3-person squads
- Shows team color (Red/Blue)
- Member breakdown with AI/real indicators
Integration with Chain Matching
AI users are automatically included in chain matching because:
- They have
workout_windowsentries withis_active = true - They have
workout_window_locationsentries with coordinates - Chain matching queries all active workout windows
No special handling needed - AI users are treated like real users in the matching algorithm.
AI User Replacement
As real users join:
- Daily chain regeneration includes all active users (AI + real)
- Real users naturally get matched into chains/squads
- Over time, real users replace AI users as the system grows
- AI users can be deactivated as real user density increases
Best Practices
- Initial Population: Generate 50-100 AI users to ensure full teams
- Geographic Distribution: AI users are automatically distributed across U.S.
- Activity Variety: Mix of activity types and time windows
- Gradual Replacement: As real users join, deactivate AI users in high-density areas
- Monitoring: Use team breakdown to track AI vs real user ratios
Check-in Behavior
AI users have an 85% check-in probability. This means:
- Most AI users will check in daily
- Some will "miss" check-ins (simulating real behavior)
- Battle chips are earned based on actual check-ins
Future Enhancements
- Automatic Check-ins: Option to auto-check-in AI users based on probability
- Smart Replacement: Automatically deactivate AI users when real users join nearby
- Regional Targeting: Generate AI users in specific regions
- Activity Patterns: More sophisticated activity and time window patterns
- Performance Metrics: Track AI user participation rates