This session completed Phase 1 (Foundation) of DawnCoach, implementing the AI chat interface with Strava training context awareness.
- Added
/api/training-contextendpoint - Fetches activities from Strava API with pagination (up to 1000 activities)
- Aggregates weekly metrics: distance, time, elevation, activity count
- Calculates training trends (increasing/stable/decreasing)
- Identifies primary activity type
- 5-minute cache to reduce API calls
- Created
buildSystemPrompt()function for dynamic prompts - Includes athlete training summary in system prompt
- Shows weekly breakdown (last 4 weeks)
- Handles missing data gracefully
- Chat container with message list
- User/assistant message styling (Strava orange theme)
- Loading indicator with animated dots
- Auto-scroll to latest message
- Error handling with user feedback
- Tab navigation UI
- Activity View shows latest Strava activity
- Coach View shows full-height chat interface
- URL hash deep linking (#activity, #coach)
- State persists during tab switches
main.go- Added training context types, endpoint, and dynamic system promptspublic/index.html- Added chat UI, navigation tabs, and related JavaScriptCLAUDE.md- Updated gh CLI usage to require--repoflag
947bcad- Add expanded Strava activity history endpoint (Closes #7)de06a2b- Add training context-aware system prompt for Claude (Closes #8)9979cdb- Add chat UI component for AI coach interaction (Closes #9)57741da- Add tab navigation between Activity and Coach views (Closes #10)
PR #35: https://github.com/cconcannon/dawncoach/pull/35
type TrainingContext struct {
TotalActivities int
WeeklyVolume []WeekSummary
RecentTrend string // "increasing", "stable", "decreasing"
PrimaryActivity string
LastActivityDate string
TotalDistanceKm float64
TotalTimeHours float64
AvgWeeklyDistKm float64
AvgWeeklyTimeHrs float64
DaysAnalyzed int
}GET /api/training-context?days=60- Returns aggregated training dataPOST /api/chat- Now accepts optionaltraining_contextin request body
- Alpine.js reactive data for chat state
- Conversation history support for multi-turn chats
- Deep linking via URL hash for shareable view links