App Icon Coach GPT App

AI-Driven Training Audit System Architecture

This system integrates Intervals.icu as the source of truth, ChatGPT for reasoning and reporting, LangChain as the orchestration layer, and GitHub as the repository for knowledge and Python audit logic.

High-Level Architecture Diagram

                   ┌────────────────────────────────────────────┐
                   │                User / Coach                │
                   │  (chat interface, report requests)         │
                   └────────────────────────────────────────────┘
                                        │
                                        ▼
┌──────────────────────────────────────────────────────────────────────────┐
│                     CHATGPT (LLM Reasoning Layer)                        │
│  • Parses user intent and report mode                                    │
│  • Calls LangChain tools to fetch + audit data                           │
│  • Formats validated outputs into readable reports                       │
└──────────────────────────────────────────────────────────────────────────┘
                                        │
                                        ▼
┌──────────────────────────────────────────────────────────────────────────┐
│                       LANGCHAIN ORCHESTRATOR                             │
│  • Defines tools: fetch_intervals_data(), run_audit_pipeline()           │
│  • Executes Tier0 hygiene, Tier1 validation, Tier2 audit                 │
│  • Returns structured JSON to ChatGPT                                    │
└──────────────────────────────────────────────────────────────────────────┘
                                        │
                                        ▼
┌──────────────────────────────────────────────────────────────────────────┐
│                   INTERVALS.ICU DATA SOURCE (API)                         │
│  • JSON schema for /activities and /wellness endpoints                   │
│  • Unique activity IDs, canonical training metrics                        │
│  • Accessed via authenticated LangChain tools                            │
└──────────────────────────────────────────────────────────────────────────┘
                                        │
                                        ▼
┌──────────────────────────────────────────────────────────────────────────┐
│                     GITHUB REPOSITORY (Knowledge Base)                   │
│  • Stores AuditCoreModule.py, Coach v16, and heuristic documents         │
│  • Acts as source of truth for audit rules                               │
└──────────────────────────────────────────────────────────────────────────┘
                                        │
                                        ▼
┌──────────────────────────────────────────────────────────────────────────┐
│                     AUDIT PIPELINE EXECUTION (Python)                    │
│  • Executes hygiene, validation, and freeze checks                       │
│  • Returns JSON: {\"auditStatus\": \"✅\", \"totals\": {...}}                 │
└──────────────────────────────────────────────────────────────────────────┘
                                        │
                                        ▼
┌──────────────────────────────────────────────────────────────────────────┐
│                     RENDERING + OUTPUT                                   │
│  • ChatGPT formats human-readable summary reports                        │
│  • Weekly, Season, and Wellness modes supported                          │
│  • Exports Markdown, PDF, or HTML                                        │
└──────────────────────────────────────────────────────────────────────────┘

System Flow

  1. User initiates a command in ChatGPT (e.g., “Run season report”).
  2. ChatGPT calls LangChain Tool run_audit_pipeline(mode='season').
  3. LangChain fetches Intervals.icu JSON and executes AuditCoreModule.
  4. Audit validates via Tier0 hygiene → Tier1 validation → Tier2 audit.
  5. Validated totals frozen and returned as structured JSON.
  6. ChatGPT formats and delivers the final report.