AI Marathon Coach Grounded in 28 Days of Actual Training Data
Built a marathon coach whose daily recommendation comes from a rules engine reading 28 days of activity and recent recovery signals, with a language model that explains the call but never makes it.
The Problem
Generic marathon training plans are static and do not adapt to current readiness, recovery, or long-run recency.
Data-heavy platforms can show ATL, CTL, and TSB trends, but athletes still need to interpret those signals and translate them into concrete next-step training decisions.
For marathon preparation, the daily recommendation had to reflect recent workload and recovery, with an explicit decision from rules that could be inspected. Conversational coaching needed grounded context without being confused with that deterministic daily decision.
The Approach
Integrated Garmin Connect to ingest activity history, heart rate, and daily wellness (sleep, HRV, resting HR, body battery, stress, readiness), starting with a 90-day activity backfill. A scheduled poller plus an on-demand "force sync" keeps the data current, with a sync-status panel surfacing freshness and failures.
Made the typed daily recommendation deterministic: the pipeline computes metrics from a 28-day activity window and combines them with recovery signals. Fourteen guardrail rules feed a decision engine that returns one of seven typed calls (PROCEED_AS_PLANNED, REDUCE_INTENSITY, SHORTEN_WORKOUT, SUBSTITUTE_RECOVERY_RUN, CROSS_TRAIN_OR_REST, FULL_REST, NEEDS_MORE_DATA), and the LLM narrates that decision.
Built a Whoop/Oura-style dashboard around endurance-critical signals: 12-week weekly volume and training load with an acute:chronic workload (ACWR) status pill, aerobic-efficiency drift, a training-consistency calendar heatmap with run-log drill-down, and recovery trends for sleep, HRV/resting HR, and readiness.
Computed training load (TRIMP) at read time so CSV imports and Garmin-polled activities share one formula, with no source-dependent drift, and no silently-zeroed load.
Implemented a separate multi-turn AI coaching interface using metrics derived from a 28-day activity window, the latest ten activities, and current recovery data. Chat calls the model directly on that constructed context; its conversational answers do not carry the daily recommendation's deterministic guarantee.
Exposed the public demo with the same safety controls as the finance tool: a hard daily cost ceiling, per-session rate caps, and a default-off kill switch.
The Impact
- Each production recommendation is written to an audit record with its inputs, the guardrails that fired, and the call, so a day's training decision traces to the rule that produced it: an active pain flag, for example, returns FULL_REST whatever the training load says
- The production coach reads real Garmin data through a 90-day initial activity backfill, scheduled polling, and on-demand sync; daily recommendations and chat metrics use a 28-day activity window
- A wellness metric that fails to load stays empty instead of becoming a zero, so a sync failure cannot pass as a recovery reading in the recommendation
- A glanceable dashboard turns raw history into trends (weekly load with an ACWR pill, aerobic-efficiency drift, a consistency heatmap, and recovery panels), each degrading gracefully when a signal is missing
- Anyone can try the coaching interface without connecting an account: the public demo uses a fixed sample athlete with a right-calf pain flag. The demo does not run the rules engine; it returns a fixed REDUCE_INTENSITY call that the model narrates against the sample's data
Evidence
Related
Marathon Coach
Visualize training load, mileage, and HR zones, and chat with a coach grounded in your real data.
Coach me
See a training recommendation for a fixed sample athlete.
Building an AI Marathon Coach: Deterministic Rules, LLM Narratives, and the 2026 NYC Marathon
How I built a personal AI coaching system for marathon training, layering deterministic guardrails over an LLM narrative engine, ingesting Garmin FIT files, and designing for my own injury history.
Wiring Garmin Into My Marathon Coach: A Live Data Integration Without an Official API
How I replaced manual CSV exports with a live Garmin data feed for my AI marathon coach: a scheduled unofficial-API poller, resilient session handling, and the design calls that keep training and recovery data fresh and trustworthy.
A One-Day Security Baseline for a Solo Fleet
You cannot out-staff a security team when you are the whole team. But the failures that actually end a solo operation are a short, known list, and each has a cheap defense you set up once. Here is the catastrophic floor I stood up in an afternoon.
Building an AI-Native Platform: A Retrospective
A year of building and operating a small fleet of finance and content products almost entirely through an AI coding agent. What worked, what was hard, the honest failures (including a flagship signal that measured nothing and an edge that vanished net of costs), and the lessons that transfer.