Skip to content

Instantly share code, notes, and snippets.

@cconcannon
Created January 6, 2026 21:49
Show Gist options
  • Select an option

  • Save cconcannon/c027cb91b5635ad3f7ed01359331e1ba to your computer and use it in GitHub Desktop.

Select an option

Save cconcannon/c027cb91b5635ad3f7ed01359331e1ba to your computer and use it in GitHub Desktop.
DawnCoach Phase 1 Implementation - Issues #7, #8, #9, #10

DawnCoach Phase 1 Implementation Session

Session Summary

This session completed Phase 1 (Foundation) of DawnCoach, implementing the AI chat interface with Strava training context awareness.

Issues Completed

Issue #7: Fetch expanded Strava activity history (30-90 days)

  • Added /api/training-context endpoint
  • 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

Issue #8: Build training context prompt for Claude

  • Created buildSystemPrompt() function for dynamic prompts
  • Includes athlete training summary in system prompt
  • Shows weekly breakdown (last 4 weeks)
  • Handles missing data gracefully

Issue #9: Create chat UI component

  • 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

Issue #10: Add navigation between Activity View and Coach views

  • 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

Files Modified

  • main.go - Added training context types, endpoint, and dynamic system prompts
  • public/index.html - Added chat UI, navigation tabs, and related JavaScript
  • CLAUDE.md - Updated gh CLI usage to require --repo flag

Commits

  1. 947bcad - Add expanded Strava activity history endpoint (Closes #7)
  2. de06a2b - Add training context-aware system prompt for Claude (Closes #8)
  3. 9979cdb - Add chat UI component for AI coach interaction (Closes #9)
  4. 57741da - Add tab navigation between Activity and Coach views (Closes #10)

PR Created

PR #35: https://github.com/cconcannon/dawncoach/pull/35

Technical Details

Training Context Structure

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
}

API Endpoints Added

  • GET /api/training-context?days=60 - Returns aggregated training data
  • POST /api/chat - Now accepts optional training_context in request body

Frontend Features

  • Alpine.js reactive data for chat state
  • Conversation history support for multi-turn chats
  • Deep linking via URL hash for shareable view links
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment