Analyze a cycling or gym workout. Use when the user says 'analyze ride', 'analyze my ride', 'how was my ride', 'review today's ride', 'analyze workout', 'analyze my gym workout', 'how was my gym session', or any variation asking about a recent ride, workout, or gym session.
The core coaching loop. Pull workout data from TrainingPeaks (cycling) or Strava (gym/strength), run analysis, compare to prescription, identify patterns, and file the analysis in the knowledge base.
Read the project's CLAUDE.md before your first analysis in a session — it defines zones, methodology, coaching rules, and the athlete profile.
The user may say:
analyze ride — analyze the most recent rideanalyze my ride from Saturday — specific dayanalyze workout 12345 — specific TrainingPeaks workout IDanalyze my gym workout — most recent gym/strength session (uses Strava)how was my ride? — most recentExtract:
| Parameter | Default | Meaning |
|---|---|---|
| workout | most recent | A date, name, or TrainingPeaks workout ID |
| type | auto-detect | (TrainingPeaks) or (Strava) |
cyclinggymIf the user explicitly mentions gym/strength/weight training, use the Strava gym pipeline below. Otherwise, check TrainingPeaks first. If the workout isn't in TrainingPeaks (e.g., gym sessions), fall back to Strava.
Strava gym pipeline: For gym/strength workouts, use Strava instead of TrainingPeaks:
get-activities to find the session (filter by date or pick most recent non-cycling activity)get-activity-details for duration, HR data, activity name, descriptionget-activity-streams with keys ["heartrate", "time"] for HR time-series if availablesport: Gym, no power metrics, include duration_minutes, average_hr, max_hr, rpeFor cycling workouts, continue with Step 1 below.
If the user specifies a date or name, use that. Otherwise, pull the most recent ride via tp_get_workouts for the last 3 days. If multiple workouts exist, list them and ask which one.
Run in parallel:
tp_analyze_workout for detailed analysis (time-series, zones, laps)tp_get_athlete_settings for current FTP and zonestp_analyze_workout returns two things:
totals (TSS, NP, IF, VI, EF, distance, elevation), dataElements (channel metadata with zone definitions), lapData (per-lap summaries)/var/folders/.../tp-mcp/analysis/workout_{id}.json. Contains data array with rows at ~4-second intervals, each with: time, Power, HeartRate, Cadence, Speed, Altitude, Grade, Distance, Torque, Structure (target % FTP). This file is typically 200-400KB and cannot be read directly into context.Capture the data file path from the response — you'll need it for Step 3.
Use the analysis script to process the raw timeseries file:
python3 <skill-path>/scripts/analyze_workout.py <data_file_path> <command>
Available commands:
| Command | What it computes |
|---|---|
summary | NP, VI, aerobic decoupling, time-in-zone (power + HR) |
pacing | Quarter-by-quarter breakdown, negative split check, matches burned |
intervals | Per-lap table, hard interval consistency (CV%), fade analysis, HR progression |
distribution | Power histogram (25W buckets), percentiles, coasting time |
fatigue | 5-min rolling windows for power/HR/cadence/efficiency with trend detection |
all | Run all of the above |
Recommended approach:
all for a comprehensive viewintervals for structured workouts, fatigue for long rides, pacing for races/group ridesUse tp_get_workout_prs to see if personal records were set during this workout.
Read the current training plan page(s) from the knowledge base (plans/tp-*.md) to find what was prescribed for this date. If no prescription exists, note that.
If Apple Health MCP is connected, query for the same date:
If data is unavailable or stale, skip and note the gap.
Use tp_get_weekly_summary to see how this workout fits into the week's overall training load.
wiki/index.md to find the 3-5 most recent workout analyses (analyses/wa-*.md)wiki/overview.md for current fitness contextPresent the analysis to the athlete using the structured output format below. Combine the inline MCP data, script output, PRs, prescription comparison, and historical patterns into a coaching narrative.
This is a conversation checkpoint — wait for the athlete to respond before filing.
Create analyses/wa-<slug>.md in the knowledge base. Slug format: YYYY-MM-DD-<descriptive-name> (e.g., wa-2026-04-12-saturday-group-ride).
Include full frontmatter:
---