How czerw0/training-coach-ai works
ApexFit is a Django AI training coach: Garmin and weather data feed persistent athlete records; the web chat assembles a current snapshot, runs a tool-using coach, and stores recommendations and usage. Separate product paths cover sync ingestion, deterministic training-plan checks, calendar/activity/statistics views, and on-demand insights. Edges are limited to relationships shown in excerpts, the source index, or README; unsampled subsystem links are omitted where callers are not evidenced.
Main entry points: sync/models.py Fitness records · tools.py Agent tools · coach/models.py Coach records · context.py Athlete context
Components 24
Data ingestion
- Garmin sync
sync/management/commands/sync_garmin.py - Weather fetch
sync/weather.py - Fitness records
sync/models.py - Weather sync
sync/management/commands/sync_weather.py - Exercise catalog sync
sync/management/commands/sync_exercises.py
Coaching engine
- Athlete context
coach/context.py - AI coach loop
coach/agent.py - Agent tools
coach/tools.py - Coach records
coach/models.py
Training planning
- Athlete rules
coach/athlete_rules.py - Completed training
coach/training_log.py - Training skills
coach/training_skills.py - Week checker
skills/training-planner/scripts/check_week.py - Planner skill files
skills/training-planner/scripts/frontmatter.py
Athlete experience
- Django web app
coach/views.py - Today dashboard
coach/dashboard.py - Activity detail
coach/activity.py - Training statistics
coach/stats.py - AI insights
coach/insights.py - Profile settings
coach/settings_views.py - Usage dashboard
coach/metrics.py
Other components
- Athlete
- Garmin Connect
- Open-Meteo
Connections 30
- Athlete → Django web app: chats with
- Garmin Connect → Garmin sync: provides activities
- Garmin sync → Fitness records: writes records
sync/management/commands/sync_garmin.py - Open-Meteo → Weather fetch: serves forecasts
sync/weather.py - Weather fetch → Fitness records: stores forecasts
sync/weather.py - Weather sync → Weather fetch: fetches forecast
sync/weather.py - Django web app → AI coach loop: calls chat
coach/views.py - AI coach loop → Athlete context: builds snapshot
coach/agent.py - AI coach loop → Agent tools: dispatches tools
coach/agent.py - Athlete context → Fitness records: reads fitness data
coach/context.py - Athlete context → Coach records: reads coaching data
coach/context.py - Athlete context → Athlete rules: loads rules
coach/context.py - Athlete context → Completed training: uses activity history
coach/context.py - Agent tools → Coach records: reads and writes
coach/tools.py - Agent tools → Fitness records: reads catalogs
coach/tools.py - Agent tools → Athlete rules: checks restrictions
coach/tools.py - Agent tools → Week checker: validates week
coach/tools.py - Agent tools → Training skills: loads methodology
coach/tools.py - Training skills → Planner skill files: reads skill files
skills/training-planner/scripts/frontmatter.py - Exercise catalog sync → Fitness records: loads exercise catalog
sync/management/commands/sync_exercises.py - Today dashboard → Fitness records: reads metrics
coach/dashboard.py - Today dashboard → Coach records: reads plans and feelings
coach/dashboard.py - Today dashboard → Completed training: uses training summary
coach/dashboard.py - Activity detail → Completed training: shows done versus planned
- Training statistics → Completed training: summarizes activity
- AI insights → Fitness records: analyzes fitness data
- AI insights → Coach records: stores insights
- Profile settings → Fitness records: updates profile
- Usage dashboard → Coach records: reads API usage
coach/metrics.py - AI coach loop → Coach records: stores recommendation and trace
coach/agent.py