How I Built an AI Coach That Knows When I'm Overtrained (Using Just My Apple Watch)
Last month, I ran myself into the ground.
My Apple Watch had all the data: elevated resting heart rate, declining HRV, shorter sleep cycles. The signs were there. I just wasn't looking at them together.
So I built something that does.
An AI agent that pulls my Watch data, correlates it with my calendar, and tells me when to push—and when to rest. No app subscription. No human coach. Just my own data, running through my own agent.
Here's exactly how I did it.
Running 24/7? If you're deploying this as a permanent setup accessible from the internet, secure your instance properly. Learn about the risks or deploy securely with Clawctl →
The Problem: Apple Locks Everything Down
Apple doesn't let third-party servers talk directly to your Watch. No API. No webhooks. Nothing.
The data flows like this:
Apple Watch → iPhone → HealthKit → [locked inside Apple's ecosystem]
But there's a workaround. Apple Shortcuts can read HealthKit data and make HTTP requests. That's our bridge.
Apple Watch → iPhone → HealthKit → Shortcuts → Webhook → OpenClaw
Step 1: Create Your OpenClaw Webhook Endpoint
First, you need somewhere for the data to land. OpenClaw gives you a secure webhook URL that your agent monitors.
If you're using Clawctl, your endpoint looks like:
https://your-tenant.clawctl.com/webhook/health
Every event that hits this URL gets logged, timestamped, and fed to your agent.
Step 2: Build the Apple Shortcut
Open the Shortcuts app on your iPhone. Create a new shortcut with these actions:
1. Get Health Data
Add the "Find Health Samples" action:
- Type: Heart Rate (or Sleep, Workouts, etc.)
- Start Date: 24 hours ago
- Sort by: Start Date
- Limit: 50 samples
2. Format as JSON
Add a "Text" action with your payload:
{
"event": "health.daily_sync",
"timestamp": "[Current Date]",
"metrics": {
"resting_hr": "[Average of Health Samples]",
"hrv": "[Get HRV value]",
"sleep_hours": "[Get Sleep Analysis]",
"steps": "[Get Step Count]"
}
}
3. POST to Your Webhook
Add "Get Contents of URL":
- URL:
https://your-tenant.clawctl.com/webhook/health - Method: POST
- Headers:
Content-Type: application/json - Request Body: [Your JSON from step 2]
4. Automate It
Go to the Automation tab. Create a new Personal Automation:
- Trigger: "Time of Day" → 6:00 AM daily
- Action: Run your shortcut
- Disable "Ask Before Running"
Now your health data syncs to OpenClaw every morning before you wake up.
Step 3: The Smart Alternative (Health Auto Export)
Building Shortcuts is free but tedious. For about $5, Health Auto Export does the heavy lifting:
- Exports 150+ HealthKit metrics automatically
- Supports REST API with custom headers
- JSON or CSV format
- Configurable sync schedules
Set your OpenClaw webhook URL as the REST endpoint. Configure your metrics. Done.
Step 4: Tell Your Agent What to Do
Here's where it gets interesting. Your OpenClaw agent now receives daily health data. What should it do with it?
My agent runs this logic:
# health-advisor.yaml
on_event: health.daily_sync
actions:
- analyze:
if: "hrv < 7_day_average * 0.85"
then: flag_recovery_needed
- analyze:
if: "resting_hr > 7_day_average * 1.1"
then: flag_potential_illness
- correlate:
data: [sleep_hours, yesterday_workout_intensity, today_calendar]
output: training_recommendation
- notify:
channel: slack
message: "{{ training_recommendation }}"
The agent compares today's metrics against my rolling averages. If my HRV drops 15% below normal, or my resting heart rate spikes, it flags recovery.
Then it checks my calendar. Heavy meeting day? Skip the workout. Open afternoon? Suggest a light session.
What This Actually Looks Like
Last Tuesday, I woke up to this message:
"Your HRV dropped 18% overnight (42ms vs 51ms 7-day avg). Resting HR elevated to 58 (vs 52 avg). Combined with yesterday's interval session, I recommend rest or light mobility today. You have a 2-hour focus block at 2pm—good day to recover."
The Watch had all this data. It just couldn't connect the dots. Now my agent does.
The Workout Trigger (Bonus)
You can also trigger on workout completion. Create a Shortcut that runs when you finish a workout:
{
"event": "workout.completed",
"type": "running",
"duration_min": 45,
"distance_km": 8.2,
"avg_hr": 156,
"calories": 620
}
Automate it with: Automation → "When Workout Ends" → Run Shortcut.
Now your agent knows about every workout within seconds of completion. Mine logs it, updates my training spreadsheet, and adjusts tomorrow's recommendation automatically.
Why This Matters
Apple Watch collects incredible data. But it's siloed. Sleep in one app. Heart rate in another. Workouts somewhere else.
The AI agent sees everything together. It correlates patterns you'd never notice. And it acts on them—without you lifting a finger.
That's the difference between tracking your health and understanding it.
Security Note
Health data is sensitive. Clawctl encrypts everything at rest, logs every webhook event for audit, and lets you control exactly which external services your agent can contact. Your data stays yours.
Ready to build your own health agent?