Recovery-aware AI workout planner
Builds each workout from per-muscle recovery, available equipment and a time budget, with instant offline logging, the AI choosing and explaining while code owns the arithmetic.
Problem
Generic workout apps ignore which muscles are still recovering, what equipment is available that day and how much time there is. A household sharing one app also needs separate histories and optional sync that never blocks logging.
Goal
Generate each session from real per-muscle recovery, the day's equipment and a time budget; keep set logging instant and offline; and let the AI choose and explain while code owns anything that is arithmetic.
My role
Sole designer and engineer across the product, the front end, the serverless functions, the AI integration, the export formats and verification.
Solution
An installable, local-first web app. Deterministic code computes recovery, volume and progression, and an AI model chooses and explains exercises from a candidate list that code has already filtered, under a strict response schema. A thin serverless layer proxies the model and handles opt-in sync across devices, and neither can ever block logging a set.
How it works
Logging. Sets are logged to on-device storage, together with the muscles each exercise loads.
Recovery. A recovery engine compares the hours since each muscle was last trained with a per-muscle recovery window, and picks a focus: a classic split day, whatever is rested, muscles the user chooses, or the next day of a four-day favourite rotation that moves on only when a session is finished.
Weekly coverage. Sets are counted per muscle over a rolling seven days against a weekly floor, so the suggested focus leans toward muscles that are behind, while recovery stays a hard gate.
Candidates. Code builds a candidate list filtered by the day's equipment and biased toward movements not done recently, while one compound lift with the longest logged history is held steady so its load can keep rising.
Equipment. Body weight is an equipment choice of its own, so ticking it alone builds a session with no gym equipment, and a warning before the session names any muscle it cannot cover well. Plans, replacements, stretches and the stair stepper suggestion use only the equipment the user ticked; the exercise search can still show anything, clearly marked as outside today's plan.
Volume. A volume model works out how many sets fit the time budget from work time per set, transitions and optional warm-up and stretch blocks, and caps sets per muscle at a research-based ceiling, enforced in code and shared across that muscle's exercises, of which there are at most three.
The model's part. A server function sends the model the candidates, the goal's repetition and rest prescription, and each exercise's last performance (comfortable, hard, partial or new), and requires a structured JSON reply. The model picks the exercises, their set counts and rep ranges, and writes a short explanation; rest, working weight, names and order come from code. Code validates the plan, bounds every number the model chose and fills any gaps, and a plan that cannot be made safe is rejected so the offline planner takes over.
Progression. Weight suggestions come from code, anchored on the heaviest set actually performed, and only a maximal effort rating holds the weight back.
Failover. A fallback chain tries several providers in order, including an edge-hosted model, all inside one shared time budget, and if every one fails an offline planner builds the session locally.
The session. Timers, rest overlays, supersets and effort ratings run on the device, a checkpoint survives refreshes, and finishing a session is transactional. A cardio machine is logged as one total, such as steps or minutes.
Reps per side. An exercise done one side at a time, or alternating, is labelled so. The label comes from the exercise's own instructions; when those are unclear, the exercise stays unlabelled. Setup choices are saved the moment they change.
Export and sync. Sessions export to standard fitness file formats (binary FIT with strength-set messages, and TCX), and cross-device sync is optional. Sync pulls the cloud copy before every push and keeps a workout marked as unsent until the cloud shows it.
Technical challenges
A short candidate pool silently produced short sessions until the budget counted sets.
One arithmetic module shared between the browser and the serverless bundle, with no runtime imports.
Provider outages and exhausted quotas, with every provider's time limit derived from one budget that a test checks.
Keeping the model to the choices it is better at, while code owns rest, weight, order and every ceiling.
Rotating exercises from week to week without stalling progression, which needs a logged previous session to add weight.
A per-muscle ceiling shared across exercises instead of trimmed off the last one.
Saves from several devices that must not overwrite each other's workouts.
Valid binary fitness files, proven by byte-level decode round trips.
Sessions that survive refreshes, closing the app and device sleep.
A scripted end-to-end verification run for every fixed bug.
An equipment filter that quietly added body weight exercises behind the ticked list. The fix applies one shared rule wherever the app picks or suggests an exercise, including stretches and the later stair stepper offer.
Telling per-side and alternating exercises apart from their written instructions, with rules tightened wherever they gave a wrong answer on a real exercise.
Capabilities
- Recovery-driven focus selection
- Equipment- and time-aware session generation
- Progressive-overload guidance
- Weekly per-muscle volume tracking
- A four-day favourite rotation
- Supersets and rest timers
- Exercise media and muscle diagrams
- Logging of outside workouts
- Cardio logged as a single total
- History and summaries
- Fitness-file export
- Several profiles on one device
- Opt-in cross-device sync
- An offline fallback planner
Technology
Impact
An app in regular use whose plans reflect real recovery and the time available. Logging never depends on the network, and an AI failure degrades to a locally built plan instead of blocking a workout. Body weight sessions, per-side rep labels and the stricter equipment rule are live.
Skills demonstrated
- Separating deterministic logic from generative output
- Structured output from an LLM
- Failover across providers
- Local-first architecture
- Binary file-format generation
- End-to-end verification discipline
Demo
Live demoOne invented profile with a generated three-week log. See each muscle’s recovery, pick a focus, today’s equipment and a time budget, and get a plan where code works out the sets, reps and loads while a scripted stand-in for the model picks and explains the exercises; code drops its mistakes and fills the gap it leaves. Pretend every model is down to see the offline planner, then log the session and download it as a sample FIT file made in your browser.
A demo here uses only invented names and data.