Skip to content
← All posts

Asking an AI running coach typed questions

How Run Coach asks Jev whether to run today, why it gets numbers back instead of prose, and how the questions have changed since version one.

  • run-coach
  • jev
  • ai
  • typescript

Most mornings I ask myself the same question: should I run today, and if so, what kind of run? My watch has an opinion, Strava has the training history, and I have a vague feeling about my legs. None of them talk to each other.

Run Coach is my attempt to join them up. It takes last night’s recovery data from Garmin (sleep, HRV, resting heart rate, body battery, training readiness), six weeks of activities from Strava, and asks Jev for a decision. This post is about that last step: how I ask Jev, how I read its answers, and what changed once real responses started coming back.

Why Jev and not a chat model?

My first thought was the obvious one: dump the data into an LLM and ask “should I run today?”. You get a friendly paragraph back. Then you have to parse that paragraph to show anything useful on a page, and the wording is different every time.

Jev works differently. It’s a decision model: you send it some state (any JSON) and a set of typed questions, and it answers each one with numbers, not prose. There are three question types:

  • noul: a yes/no question. The answer is the probability of yes.
  • choice: pick one of a set of options. You get the winner, a probability for every option, and a confidence.
  • score: place something on a scale of levels you define, e.g. “Very poor” to “Excellent”.

That maps really nicely onto a UI. A probability becomes a percentage. A choice with probabilities becomes a bar chart. A score becomes a label. Nothing to parse.

Version one: three questions

The first version asked three questions about the same state:

questions: {
  should_run: {
    type: "noul",
    instructions: "Acting as a cautious running coach, should this runner go for a run today...?",
    true: "Recovery looks adequate and recent load leaves room for a run today",
    false: "Poor sleep, suppressed HRV, elevated resting HR... means today should be a rest day",
  },
  run_type: { type: "choice", instructions: "...", criteria: RUN_TYPES },
  readiness: { type: "score", instructions: "...", criteria: READINESS_LEVELS },
}

The options are plain objects in my own code, and the same objects go to Jev and drive the UI. RUN_TYPES is a map from a key to a description (“Conversational aerobic run at comfortable effort (30-60 min)”), declared as const. So the TypeScript type of a run type is just its keys:

export const RUN_TYPES = {
  recovery: "Very short, very slow run (20-30 min) purely to loosen up",
  easy: "Conversational aerobic run at comfortable effort (30-60 min)",
  ...
} as const;

export type RunType = keyof typeof RUN_TYPES;

Add an option and the request, the types and the bar chart all pick it up. One list, no drift.

I also didn’t make Jev do arithmetic. Before calling it, the server works out a load summary itself: km this week against the week before, hard sessions, days since the last run, the active-day streak. Jev judges those numbers. It doesn’t have to add them up.

Reading the answers

Scores are continuous. A readiness score comes back as something like 2.94, not a whole level. That’s more useful than it sounds: 2.94 is solidly “Good”, while 2.55 is barely above “Fair”. So the page keeps the raw score and rounds only to pick the label:

// Scores come back fractional (e.g. 2.94), so round to the nearest level for its label.
const level = Math.min(READINESS_LEVELS.length - 1, Math.max(0, Math.round(readinessScore)));
label: readiness.legend?.[level] ?? READINESS_LEVELS[level],

The legend comes back too. Jev echoes the score levels as an object keyed "0" to "4", so the label comes from Jev’s own answer, with my list as a fallback:

// Seen live as an object keyed "0"–"4"; arrays index the same way.
legend?: Record<string, string>;

I also show Jev’s untouched response on the page. It sits in a little expandable “Jev response” box under the run type chart. When something looks off, I can compare what Jev said with what my mapping did, without opening any logs.

When the answers disagreed with each other

Looking at it again later, I spotted a problem with the design, not the code. The three questions are answered independently. So Jev could say there’s a 48% chance a run is right (rest, then), rate my readiness “Good”, and pick tempo as the run type. All three are reasonable on their own. Together they say “rest, but if you do run, go hard”.

The fix was to stop asking two questions that make the same decision. rest is now one of the run types, so a single choice decides the day:

// "rest" sits among the run types so a single choice makes the whole call and
// can't contradict itself (e.g. "rest" alongside "tempo").
export const RUN_TYPES = {
  rest: "Rest day: no running; walking or gentle mobility is fine",
  recovery: "...",
  ...
} as const;

I kept the noul question, but demoted it to a second opinion. If its probability is close to even, or it disagrees with the choice, the page says it’s a borderline call instead of pretending to be sure:

const shouldRun = runType !== "rest";
const nearEven =
  runProbability > 0.5 - BORDERLINE_MARGIN && runProbability < 0.5 + BORDERLINE_MARGIN;
const borderline = nearEven || shouldRun !== runProbability >= 0.5;

Asking “why” without asking for prose

A verdict without a reason is hard to trust. The chat-model answer would be a paragraph. The Jev answer is another choice:

limiting_factor: {
  type: "choice",
  instructions: "What is the single biggest factor limiting this runner's training today?",
  criteria: {
    none: "Nothing stands out: recovery and recent load both look fine",
    sleep: "Short or poor-quality sleep last night",
    hrv: "Overnight HRV below the runner's normal range or trending down",
    load_spike: "This week's mileage is well above the 4-week average",
    ...
  },
},

The page shows it as a “Why” line on the verdict. Because it’s one of a fixed set, it’s also a value I could count over time: how often is sleep the thing holding me back?

I did the same for the session itself. A duration choice picks from 20–30 minutes up to 90+. The heart-rate target, though, isn’t asked of Jev at all. It’s a formula (a percentage of heart-rate reserve per run type, from my resting and max heart rate). A formula gives the same answer every time, so there was nothing to gain from asking a model.

Giving it context it was missing

Version one also left Jev short of context. The questions were fine; the state was thin. Three gaps:

  • No baselines. “HRV 48” means nothing on its own. It’s great for one person and worrying for another. Jev now also gets my HRV weekly average and normal range, and my 7-day resting heart rate average, so it can compare today against me.
  • Too short a history. Two weeks can’t tell a comeback week from a normal one. The load summary now covers six weeks, including how this week compares with the 4-week average.
  • No idea who I am. There’s now a small athlete profile: goal, usual weekly volume, preferred long-run day, injuries. Only the fields I’ve filled in get sent.

I still keep the state focused. The summary covers six weeks, but only the last two weeks of individual runs go in as detail. Jev only needs the recent detail, and the summary covers the rest.

Planning the week: ask about the shape, not the days

The newest part is a plan for the next seven days. A good training week has a few fixed ingredients: at least one speed session, one or two strength sessions, a long run, and rest in between. What changes from week to week is how much, depending on how recovered you are. And every 4 or 5 weeks, a training plan usually backs off completely for a recovery week.

My first attempt asked Jev about each day: six more choice questions, one per date. It didn’t work well. Each day was answered on its own, so nothing stopped intervals on Tuesday and tempo on Wednesday. There was no strength work at all, and nothing made sure the week had a long run. I ended up writing code to correct the plan afterwards, which meant overriding a lot of Jev’s picks. Jev also only knows how I slept last night, so asking it about Thursday was a guess.

So I split the job. Jev answers one question it can actually judge: what shape should this week take?

export const WEEK_SHAPES = {
  build: "Build week: two speed sessions (intervals and tempo), a long run, two strength sessions and one rest day. For good recovery with recent load steady or below the 4-week average",
  steady: "Steady week: one speed session (tempo), a long run, two strength sessions and two rest days. For normal recovery and load",
  lighter: "Lighter week: one short speed session (intervals), a shorter long run, one strength session and two rest days. For poor recovery, a mileage jump, or a run of hard days",
  recovery: "Recovery week: no speed work, a shorter long run, one light strength session and two rest days, with total running cut by about a third. Training plans usually include one every 4-5 weeks (see weeksSinceRecoveryWeek in the training load), or sooner if recovery has been poor for several days",
} as const;

Every option already has the ingredients. They only differ in how much, and the recovery week drops speed work altogether.

That recovery week needs one more piece of context. Jev can’t know a recovery week is due unless it can see the last one. So the load summary now includes weekly km for the last six weeks, and weeksSinceRecoveryWeek: how long ago a week came in well below the others. The option’s description points straight at that field. Jev still makes the call, but it has the number it needs.

Then plain code places the sessions on days:

  • The long run goes on my preferred day.
  • Speed sessions go wherever leaves the most room between hard days. With seven days and at most two sessions, the code can just try every placement.
  • Rest days follow hard days.
  • Strength goes on easy days, and stays off the day before a hard run where possible.
  • If today was hard, tomorrow isn’t.

The week is valid by construction, so there’s nothing to fix afterwards. It’s also one question instead of six. And because the rules are plain code, I can test them properly: every shape, starting on every day of the week, after every kind of day today.

That’s the pattern I’ve settled on. Jev makes the judgement call it has the information for, and plain code handles the structure I already know is right.

Keeping it cheap and predictable

Jev answers are cached by their inputs: the Garmin data, the Strava data and the date. Same inputs, same cached answer, no new charge. I pass a YYYY-MM-DD date rather than a timestamp, so the key doesn’t change every second.

I’ve also pinned the model to jev-1.13.0 rather than jev-latest, which is about to move to 1.14. If the advice changes, I want it to be because my data changed, not because the model did. And the cost turned out to be smaller than I’d guessed: billing is by input tokens, and a real call with all six questions and plenty of context came to about 2,800 tokens. That’s roughly a tenth of a cent for a morning’s answer.

What I’d tell someone starting out

  • Ask for types, not text. If the answer is going on a page, a typed answer means no parsing code.
  • One decision, one question. Questions are answered independently, so two questions about the same thing can disagree. Ask about the decision itself (the day, the shape of the week), not about every piece of it.
  • Show the probability, not just the verdict. A 51% chance that a run is right and a 70% chance both come out as “run”, but the first is nearly a coin toss. The number tells you how much to trust the call.
  • Let code do the parts you’re sure of. Load maths, heart-rate zones and where each session goes in the week don’t need a model.

The latest changes (the “why”, the session and the week plan) haven’t been tested against live Jev answers yet. Next is a few weeks of real mornings, including a bad night’s sleep or two, to see whether the advice holds up.