{"slug": "your-fitness-agent-needs-reliable-data-before-better-advice", "title": "Your Fitness Agent Needs Reliable Data Before Better Advice", "summary": "A fitness-assistant integration built on WHOOP and Strava data must resolve cycle identity, local-date labelling and missing-score states before improving its prompts, according to a first-person engineering account on cutler.sg. The mapper keeps WHOOP's physiological cycle as the join key, retains the UTC-derived `date` for compatibility while adding a separate `date_local` derived from sleep end, then cycle end, then cycle start plus twelve hours, and maps absent recovery scores to `null` rather than zero. The author distinguishes WHOOP's `SCORED`, `PENDING_SCORE` and `UNSCORABLE` recovery states from a missing record or failed fetch, noting that Google Sheets skips null inputs so an empty string is required to blank a cell.", "body_md": "# Your Fitness Agent Needs Reliable Data Before Better Advice\n\n## $ grep -n \"^##\" 2026-10-fitness-agent-needs-reliable-data.md\n\nA fitness assistant should establish which observations are current and comparable before using them to explain your day.\n\nIn [The Reverse Tamagotchi](https://cutler.sg/blog/2026-06-reverse-tamagotchi-ai-keeping-me-alive), I described the plumbing behind a personal assistant: WHOOP and Strava data landing in a Google Sheet. The next question is what a row in that sheet actually means.\n\nA row can exist while its recovery score is pending. Two records can describe the same exercise. A date can identify the night before the day you intended to discuss. Before improving the prompt, I would inspect those joins and missing-data paths.\n\n## [Start with the source’s idea of a day](#start-with-the-sources-idea-of-a-day)\n\n[WHOOP organises its data around physiological cycles](https://developer.whoop.com/docs/developing/user-data/cycle/), which need not align with calendar days. A current cycle may have a start time without an end. Treating its date as the key for everything else throws away that distinction before the assistant sees it.\n\nThe current integration builds one Daily-sheet row per cycle. Recovery joins by `cycle_id`. Sleep also joins by cycle ID, preferring a non-nap record and then the later start among records of the same kind. A sleep without a cycle ID is skipped by this join.\n\nCycle identity determines which records belong together. The local date labels the result; it does not determine the join.\n\nThose are explicit selection rules. They do not prove the selected sleep is always the exact sleep referenced by the recovery record, which has its own `sleep_id`. That relationship is worth checking if a later analysis depends on a particular sleep rather than the cycle as a whole.\n\nThe calendar label is a separate decision. Consider this **synthetic example**, in Singapore time:\n\n| Observation | Timestamp | \n|---|---|\n| Cycle starts | 27 September, 23:30 | \n| Sleep ends | 28 September, 07:00 | \n| Intended active-day label | 28 September | \n\nTruncating the cycle’s UTC start timestamp produces 27 September. That is a valid date for the start, but the wrong label for this morning’s briefing.\n\nThe mapper retains that old UTC-derived `date` for compatibility and supplies a separate `date_local`. For the local active day, it uses sleep end, then cycle end, then cycle start plus twelve hours. The last fallback is a heuristic for an ongoing cycle. It cannot resolve every travel itinerary, shift pattern or unusual sleep schedule.\n\nKeep the cycle identity and original timestamps even when a friendly daily label is useful. A label should help display a record, not silently redefine which observations belong together.\n\n## [A missing score is a state](#a-missing-score-is-a-state)\n\n[WHOOP’s recovery schema](https://developer.whoop.com/docs/developing/user-data/recovery/) distinguishes `SCORED`, `PENDING_SCORE` and `UNSCORABLE`. The score object is present only for a scored recovery. An unscorable recovery can reflect insufficient metric data for the interval.\n\nFor the assistant, these are different situations:\n\n- **Pending:** a record exists, but the provider has not produced its score.\n- **Unscorable:** the provider could not score that record.\n- **No matching record:** the join or fetch supplied nothing for the requested interval.\n- **Fetch failed:** the integration could not establish what the provider currently holds.\n\nNone means a recovery score of zero.\n\nThe current Daily mapper carries scoring-state fields and maps absent scores to `null`. The recovery tool exposed to the bot likewise returns a score state and nullable metrics. That gives a consumer information it can preserve instead of manufacturing a number.\n\n[Google Sheets skips null inputs](https://developers.google.com/workspace/sheets/api/reference/rest/v4/spreadsheets.values#ValueRange); setting a cell to an empty value requires an empty string. The current update path sends the mapper’s values unchanged. When updating an existing row, an absent score mapped to `null` can therefore leave the previous cell value in place. Appending a fresh row has no previous score to preserve. This is a risk in the implementation, not an observed incident. Missingness needs to survive the complete journey, including what the assistant eventually reads.\n\nMy rule would be to withhold an interpretation that requires a missing observation, while allowing a precise account of the observations available. “Recovery is still pending” is useful information. Turning it into “you recovered poorly” adds a claim the source never made.\n\n## [Existing rows can be stale](#existing-rows-can-be-stale)\n\nThe API types include source `created_at` and `updated_at` timestamps. The Daily-sheet projection does not carry those update timestamps, and the bot’s recovery output omits them too. A consumer can therefore see a score without being told when its source record last changed.\n\nThe sync paths also do different jobs. WHOOP forwarding refetches a recent window—72 hours by default—and inserts or updates matching cycles. The Strava reconciliation route defaults to 25 hours and processes activity IDs missing from the sheet. That latter operation fills gaps; it does not refresh every existing activity. WHOOP deletion events currently leave Daily rows intact.\n\nCalling both operations “sync” does not make their completeness guarantees equivalent. A row’s presence answers whether something was written, not whether later changes or deletions have been reconciled.\n\n[WHOOP recommends reconciliation](https://developer.whoop.com/docs/developing/webhooks/) because notifications can be missed or duplicated. A bounded lookback is useful, but a correction outside its window needs another path. The assistant should not infer complete history from a recent successful webhook.\n\nSource identity matters across providers too. If WHOOP and Strava both describe one workout, two rows are not automatically two workouts. Matching those representations needs an explicit rule before summing training volume. Preserve units as well: sleep-stage milliseconds and activity seconds are a poor place to rely on a model guessing correctly.\n\n## [Give the assistant the gaps](#give-the-assistant-the-gaps)\n\nI would extend the input contract to retain source identity, observation interval, source update time, retrieval time and scoring state. That is a proposed improvement beyond the current projections, not an already implemented freshness guarantee.\n\nThis **synthetic record** illustrates the shape, without personal measurements:\n\n```\nprovider: whoop\ncycle_id: example-cycle\ntimezone: Asia/Singapore\ncycle_start: \"2026-09-27T23:30:00+08:00\"\ncycle_end: null\nactive_date: \"2026-09-28\"\nactive_date_basis: sleep_end\nrecovery:\n  score_state: PENDING_SCORE\n  score: null\n  source_updated_at: \"2026-09-28T07:05:00+08:00\"\n  fetched_at: \"2026-09-28T07:10:00+08:00\"\ngaps:\n  - recovery_not_scored\n```\n\nHere, retrieval time says when the integration checked. Source update time says when the provider changed the record. Neither says a pending score has become available. An open cycle is also not a finished observation interval.\n\nFreshness requirements should follow the question. A historical weekly summary and a briefing about this morning need different checks. Define the required inputs and acceptable age for each, rather than declaring every row universally fresh or stale.\n\nFor this example, the assistant can say: “The recovery record was checked at 07:10 Singapore time and is still pending. I cannot compare today’s recovery score with earlier scores yet.” That statement preserves what the system knows and identifies what another fetch might resolve.\n\nClean data would still not validate a wearable’s measurements or establish that generated training advice is medically sound. The narrower engineering job is achievable: preserve the source’s meaning, carry uncertainty through the pipeline, and make the assistant state the missing observation before reasoning past it.\n\n$ subscribe --newsletter\n\n## Practical AI engineering, in your inbox\n\nField notes for technical leaders building agents, evaluation systems, governance, and production infrastructure.\n\n## Related\n\n[October 30, 2026 | 5 min read](https://cutler.sg/blog/2026-10-agent-timeout-safe-retry)\n\n### The Agent Timed Out. Did the Action Happen?\n\nA decision table for retrying agent actions when the response is lost, with stable intent, provider-specific idempotency and an explicit unknown outcome.\n\n[October 26, 2026 | 20 min read](https://cutler.sg/blog/2026-10-ai-assisted-pcb-design-kicad-nfc-business-card)\n\n### Back to PCB Design With AI Doing the Legwork: An NFC Business Card in KiCad\n\nI let coding agents research, source, generate and iterate three native KiCad revisions of an NFC business card over three days in October. The files are real and the checks are clean; the confidence came from datasheets, exact part numbers and independent re-examination, not from the renders.\n\n[July 09, 2026 | 6 min read](https://cutler.sg/blog/2026-07-when-should-agent-ask-permission)\n\n### When Should an Agent Ask Permission?\n\nA useful agent acts within delegated authority, prepares consequential actions for review, and asks again when the action changes.", "url": "https://wpnews.pro/news/your-fitness-agent-needs-reliable-data-before-better-advice", "canonical_source": "https://cutler.sg/blog/2026-10-fitness-agent-needs-reliable-data", "published_at": "2026-10-23 01:00:00+00:00", "updated_at": "2026-11-18 13:44:15.687571+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "artificial-intelligence"], "entities": ["WHOOP", "Strava", "Google Sheets", "cutler.sg"], "also_reported_by": [], "takeaway": "Join WHOOP records by `cycle_id` rather than calendar date, derive the local active-day label from sleep end, then cycle end, then cycle start plus 12 hours, and map `PENDING_SCORE` and `UNSCORABLE` recoveries to null instead of zero.", "recommendation": {"advice": "Key fitness-agent joins on the provider's cycle ID, keep original timestamps alongside any local date label, and pass missing scores through as null with an explicit state rather than defaulting to zero.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/your-fitness-agent-needs-reliable-data-before-better-advice", "markdown": "https://wpnews.pro/news/your-fitness-agent-needs-reliable-data-before-better-advice.md", "text": "https://wpnews.pro/news/your-fitness-agent-needs-reliable-data-before-better-advice.txt", "jsonld": "https://wpnews.pro/news/your-fitness-agent-needs-reliable-data-before-better-advice.jsonld"}}