Writing bike workouts as plain text
I have been doing triathlon for a decade now. It’s a good escape from daily stress and keeps me balanced. The work is repetitive, but the process of building endurance over months and years really is what keeps me coming back. Every Sunday, I plan my week from the workouts my coach sent the day before and enter them in TrainingPeaks (a platform athletes and coaches use to plan, schedule and log workouts).
The workouts
A typical bike workout is expressed in steps with watt targets (% of FTP) for a specific period of time. Depending on what my coach wants to focus on, a workout can have many steps.
The problem
My coach sends the week as a PDF’d Excel sheet, with each step written as a duration and a coloured zone. To ride these workouts on Zwift, I have to rebuild every workout by hand in the TrainingPeaks workout builder, dragging blocks and typing durations and targets one step at a time. A single workout can have twenty steps or more, so planning the week easily eats an hour of my Sunday.
The solution
I (with the help of agents) wrote zb, a small CLI that turns plain-text workouts into .zwo files that Zwift can read.
Each line is a step written as a duration and a target. Here is the workout from the screenshot above:
# warm up
20m45%
# main set
4x
6m90%
3m55%
# cool down
10m45%Running zb build sweet-spot.txt -o sweet-spot.zwo turns it into a .zwo file, ready to drop into TrainingPeaks.
Because workouts are plain text files, I get a lot for free: I can copy and paste steps between sessions, duplicate last week’s workout and tweak it, keep everything in git, and reach for grep, sed, awk or any other tool when I want to search or change many workouts at once.
Next steps
I still read the PDF and type each workout myself.
Next, I want to see if AI can read the PDF my coach sends and write the .zwo files directly, ready to drag and drop into TrainingPeaks.