# AIWOD.fit — Full AI Agent, Remote MCP & Siri Integration Guide

> Canonical technical reference for AI agents, personal assistants (Google Antigravity, Gemini, ChatGPT / Dots, Claude, Meta Muse, Grokbot, Cursor), and Apple Shortcuts integrating with AIWOD.fit.

## 1. Product Summary

AIWOD.fit is a functional fitness and CrossFit programming platform built specifically for home/garage gyms and 10-foot wall-mounted Gym TVs:

1. **Exact Equipment Awareness:** Programs strictly from the athlete's enabled equipment inventory (barbells, specialty bars, racks, cables, dumbbells, kettlebells, rings, air bikes, rowers, turf, or commercial/hotel Globo Gym mode).
2. **Household Multi-Athlete Rx Weights:** Supports solo sessions, couples/partners ("me and my wife"), and Kids WOD obstacle sessions, prescribing exact individualized weights inline (e.g. `(Chico: 225 lb | Sarah: 135 lb)`) from each athlete's Lift Ledger.
3. **Real-Time Garage TV Sync:** Staging a workout via MCP or Siri immediately pushes the workout over Supabase Realtime to the user's open/waking Gym TV browser at `https://aiwod.fit/dashboard`.
4. **Post-Workout Logging & Lift Ledger Sync:** Athletes can log times, rounds/reps, lifts, or whiteboard photos (Gemini Vision OCR) to automatically update estimated 1RMs, heavy working weights, and metcon loads.

---

## 2. Remote MCP Server (`https://aiwod.fit/api/mcp`)

- **Transport:** MCP Streamable HTTP (`GET`, `POST`, `DELETE`, `OPTIONS` at `https://aiwod.fit/api/mcp`)
- **Authentication Option A — OAuth 2.1 (Recommended for Google Antigravity, Gemini, ChatGPT / Dots, Claude, Meta Muse, Cursor):**
  - Protected Resource Metadata (RFC 9728): `https://aiwod.fit/.well-known/oauth-protected-resource/api/mcp`
  - Authorization Flow: Standard OAuth 2.1 Authorization Code + PKCE with user consent at `https://aiwod.fit/auth/consent`
- **Authentication Option B — Personal API Key (Headless Agents, Grokbot, Gemini CLI, Apple Shortcuts):**
  - Generate a revocable key (`aiwod_sk_...`) at `https://aiwod.fit/dashboard/account#ai-agents`
  - Pass header: `Authorization: Bearer aiwod_sk_<your_key>`

### Exposed MCP Tools

1. **`get_gym_context`** *(read-only)*
   - Returns household athlete profiles (names, aliases, youth flags, top Lift Ledger PRs), available WOD Focus modes, enabled equipment inventory summary, current active Gym TV whiteboard workout, and remaining daily generation quota.
2. **`stage_gym_workout`** *(generates & pushes live to Gym TV)*
   - Inputs:
     - `prompt` *(optional string)*: Natural-language request, e.g. `"It's me and my wife today, CrossFit workout, my legs are fried"`.
     - `athletes` *(optional string[])*: Names, aliases, or keywords (`["me", "wife"]`, `["Sarah"]`, `["kids"]`, `["everyone"]`).
     - `focus` *(optional string)*: e.g. `"CrossFit"`, `"Globo Gym"`, `"Kids WOD"`, `"Bounce WOD"`, `"Surprise Me"`.
     - `conditions` *(optional string)*: Daily constraints, soreness, or time caps, e.g. `"Legs are sore, cap total session at 30 minutes"`.
   - Side effect: Reserves 1 generation credit, compiles personalized prompt with household Lift Ledgers + equipment + cooldown rules, generates structured workout, and stages it live onto the user's Garage Gym TV whiteboard.
3. **`get_active_whiteboard`** *(read-only)*
   - Returns the full structured workout currently displayed on the user's Gym TV whiteboard.
4. **`log_workout_result`** *(writes workout log & updates Lift Ledger)*
   - Inputs:
     - `score` *(optional string)*: Primary or shared team score, e.g. `"13:42 Rx"`.
     - `athleteScores` *(optional array of `{ athlete, score }`)*: Individual household athlete results, e.g. `[{ "athlete": "me", "score": "13:42 Rx" }, { "athlete": "wife", "score": "14:55 @ 65 lb" }]`.
     - `notes` *(optional string)*: Post-workout training notes.
   - Side effect: Logs today's active whiteboard workout to `workout_logs`, marks the Gym TV whiteboard as Logged, and updates personalized Lift Ledger stats.
5. **`get_recent_training`** *(read-only)*
   - Inputs: `limit` *(1–25, default 10)*.
   - Returns recent completed workout logs and Lift Ledger strength benchmarks.

---

## 3. Siri, Apple Watch & HomePod REST Endpoint (`POST https://aiwod.fit/api/agent/stage`)

Designed for 2-step Apple Shortcuts voice workflows ("Hey Siri, Prep AIWOD"):

```bash
curl -X POST "https://aiwod.fit/api/agent/stage" \
  -H "Authorization: Bearer aiwod_sk_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "It is me and my wife today, CrossFit workout, my legs are fried"}'
```

Response includes `spokenSummary` (concise 1-sentence voice confirmation for Siri / Apple Watch / HomePod playback) plus the full structured `workout` JSON now live on the Gym TV.

---

## 4. Public Unauthenticated Sample Feed

Agents researching AIWOD for prospective users can inspect live example workouts without credentials:
- `GET https://aiwod.fit/api/wods/examples`
