AI coach: memory, search, tools

The coach is a tool-using agent with multi-turn memory, hybrid retrieval over your ride and chat history, and versioned prompts.

Memory

  • Profile memory: durable facts, goals, equipment, athlete signals. FTP / LTHR / max HR live in Settings; chat changes ask for confirmation.
  • Episodic memory: session summaries and past chats, retrieved by hybrid semantic (pgvector) + keyword search with recency decay.
  • Fire-and-forget extraction: after each response a background pass updates profile facts and session summaries — never blocks the stream.

Routing and skills

A fast intent router classifies each message (coaching, workout, off-topic…) before tools bind. Skills — weekly review, form check, training plan, workouts — load on demand via slash commands or load_skill.

Tools available to the coach

  • searchRides, getRideDetails, getRideSegment, findRideEfforts — find rides and dig into intervals and best efforts.
  • getZones, getRideTimeInZones, getTimeInZones — power and HR zones at the ride date.
  • weeklySummary, fitnessAnalysis — load and form views.
  • searchPois, recentChats, update_profile.

Prompt versioning

System prompts are versioned in Postgres (draft / published / archived) with an admin editor; the coach loads the published version at request time, so prompt iteration is independent of deploy cadence. Every call is traced in Langfuse — tokens, model, tool steps, latency — for cost accounting and offline eval.

Rate limits & quotas

Per-user daily caps — 50 chat messages, 25 MCP ask_coach calls — UTC midnight reset, entitlement-gated.

Read the full write-up on Orbital: the reinforcing evals loop →