arrow_back All posts
Dev Log

Teaching an AI to Coach

Flotti doesn't just chat — it reads your training data and gives specific advice. Here's how the prompt engineering and context assembly actually works.

Building an AI chatbot is easy. Building an AI that gives specific, data-grounded coaching advice about your actual training? That's a different problem entirely.

Flotti isn’t a generic fitness chatbot. When it says “your easy run yesterday was too fast,” it’s because it looked at your heart rate data and compared it to your zones. Here’s how that works under the hood.


The context problem

Large language models are smart, but they’re also blind. They don’t know who you are, what you did yesterday, or what your threshold pace is — unless you tell them. Every single time.

The challenge with Flotti isn’t “make the AI sound friendly” (that’s the easy part). It’s assembling the right data and injecting it into every conversation so the AI can give advice that’s actually about you.

analytics Diagram: data flowing from intervals.icu → context builder → Claude API

What Flotti sees

Every time you send a message to Flotti — or when the dashboard loads and asks for a daily insight — the app assembles a context payload. This isn’t a vague summary. It’s structured data:

14 days
Activities
7 days
Wellness
Live
Fitness / Form

Specifically, Flotti gets:

  • Last 14 days of activities — type, distance, duration, training load, heart rate, pace
  • Last 7 days of wellness — weight, HRV, resting heart rate, sleep duration and quality
  • Current Fitness, Fatigue, and Form — the numbers that tell Flotti where you are in your training cycle
  • Your athlete profile — heart rate zones, threshold pace, FTP
  • Your recent log notes — that free-text box where you write “legs felt heavy” or “best run in weeks”

All of this gets packaged into a JSON payload and sent alongside your message.

lightbulb Why structured data matters

Sending raw numbers in a structured format — not prose summaries — lets the model do its own analysis. If I pre-summarize "your week was hard," the AI can't disagree. If I send the actual training loads, it can decide for itself.


The system prompt: personality + rules

The AI’s personality comes from its system prompt — a set of instructions that stay constant across all conversations. Flotti’s system prompt does three things:

1. Sets the persona. Direct, data-driven, warm but not fluffy. Flotti has opinions and backs them up with numbers.

2. Grounds the responses. The prompt tells the model to reference actual data — specific pace numbers, actual heart rate values, real training loads. No generic advice like “listen to your body.” Instead: “your average HR yesterday was 152, which is Zone 3 for you.”

3. Sets guardrails. Metric units only. Pace in min/km. No medical advice. No fluff. Keep it punchy.

Flotti thinking
Flotti

When I say "your Fatigue is spiking," I'm not guessing. I can see your training load jumped from 45 to 78 this week. When I say "take tomorrow off," it's because your Form is at -22 and your sleep was 5.5 hours. I'm doing the maths so you don't have to.


The biggest lesson: curate the data

Early on, I tried sending everything — full activity streams, every wellness field, the complete athlete profile. The responses were unfocused. The model would latch onto irrelevant details (“I notice your elevation gain was 12m higher than last Tuesday”) instead of the big picture.

The fix was curation. Not less data, but the right data. I removed noise fields, pre-calculated some metrics, and structured the payload so the most important numbers (Fitness, Fatigue, Form, training load trend) are front and centre.

tips_and_updates Prompt engineering lesson

More context isn't always better. The model performs best when you give it the right 20% of the data rather than 100% of it. Think like a coach reviewing an athlete's logbook — you scan for the important patterns, not every number.


Different calls, different depth

Not every interaction needs the same level of analysis. Flott uses different configurations for different tasks:

InteractionWhat’s sentResponse length
Dashboard insightToday’s form + this week’s load2-3 sentences
Activity analysisFull activity data + recent context3-5 sentences
Weekly planFull 14-day history + athlete profileStructured JSON plan
Chat messageEverything + conversation historyDepends on the question
phone_iphone Screenshot: Flotti's dashboard insight vs. full activity analysis

The dashboard insight is fast — it loads in under a second and gives you a quick read on your day. The weekly plan generation is heavier — it takes a few seconds but produces a full 7-day training plan with specific targets.


What I’d do differently

If I started over, I’d build a test harness from day one. Something that takes a fixed set of training data — a hard week, a recovery week, a taper week, an overtraining scenario — and runs it through the prompt to check the output quality.

Right now I evaluate by feel. “Does this advice sound right?” That works when you’re one person testing your own app. It won’t scale.

warning The quality trap

AI coaching advice that's plausible but wrong is worse than no advice at all. If Flotti tells an overtrained athlete to do intervals, that's dangerous. Automated quality checks aren't optional — they're safety-critical.


The takeaway

An AI coach is only as good as the data you give it. Flotti works because every response is grounded in your actual training data — structured, curated, and refreshed with every interaction. The personality is the easy part. The plumbing is everything.

Flotti

The Flott Blog

Training smarts, dev stories, and Flotti opinions.