Apple Health Sync
This skill manages health data pushed from the companion iOS app (Health Sync for OpenClaw). It stores all incoming snapshots in a local SQLite database and answers health-related questions from that data.
Data Flow
iPhone (Health Sync app)
↓ POST /api/sessions/main/messages
OpenClaw Gateway
↓ agent receives message
This skill: ingest → SQLite → respond
When to Use (Auto-trigger)
Activate this skill automatically whenever a message arrives that starts with 🍎 Apple Health 数据更新. This is the standard header sent by the Health Sync iOS app.
Do NOT ask the user to confirm or describe the data — just ingest it silently and reply with a one-line acknowledgment.
When to Use (User Query)
Activate when the user asks about their health, fitness, or body data:
- "今天走了多少步?"
- "最近心率怎么样?"
- "给我看看本周健康数据"
- "我的睡眠质量"
- "健康摘要"
- "体重趋势"
- Or any question about steps, heart rate, sleep, calories, weight, workouts, HRV, SpO2, etc.
When NOT to Use
- User asks about medical advice → always defer to a doctor
- User asks about app installation → refer to the iOS app README
- Data is from a source other than Apple Health
Ingesting Incoming Data
When a message starts with 🍎 Apple Health 数据更新, run this command to store the data:
python3 ~/.openclaw/skills/apple-health-sync/ingest.py << 'HEALTH_EOF'
[paste the full message here]
HEALTH_EOF
Then reply with a brief acknowledgment in the format:
✅ 已存储 [N] 条 [类型] 数据([时间])
Keep it to one line. Do not repeat or summarize the raw data.
Important: The ingestion script is idempotent — running it twice on the same data is safe. If the script fails, tell the user and show the error.
Answering Health Queries
When the user asks about their health data, run the query script:
python3 ~/.openclaw/skills/apple-health-sync/query.py --type "[data_type]" --period "[today|week|month|all]"
Common type mappings (translate user intent → identifier):
| User says | --type value |
|---|---|
| 步数 / 步 / steps | stepCount |
| 心率 / heart rate | heartRate |
| HRV / 心率变异 | heartRateVariabilitySDNN |
| 血氧 / SpO2 | oxygenSaturation |
| 体重 / weight | bodyMass |
| 睡眠 / sleep | sleepAnalysis |
| 卡路里 / 热量 / calories | activeEnergyBurned |
| 运动 / workout | workout |
| 呼吸率 / respiratory | respiratoryRate |
| 体温 / temperature | bodyTemperature |
| 血压收缩 | bloodPressureSystolic |
| 血压舒张 | bloodPressureDiastolic |
| 血糖 | bloodGlucose |
If the user asks for a summary or doesn't specify a type, run:
python3 ~/.openclaw/skills/apple-health-sync/query.py --summary --period "[today|week|month]"
Format the query output into a clean, readable reply in Chinese. Do not dump raw JSON — interpret it naturally.
Database Location
All data is stored at ~/.apple-health-sync/health.db (SQLite). The scripts create this automatically on first run.
To check database status:
python3 ~/.openclaw/skills/apple-health-sync/query.py --status
Example Interactions
Incoming data (auto-ingest):
User: 🍎 Apple Health 数据更新
时间:2026-05-08 10:30:00
类型:步数
条数:5
---
• 05-08 08:00: 3,421 步
• 05-08 09:00: 1,892 步
...
Response: ✅ 已存储 5 条步数数据(05-08 10:30)
User query:
User: 今天走了多少步?
Action: Run query.py --type stepCount --period today, then reply naturally:
今天共走了 12,847 步,相当于约 9.3 公里。最活跃时段是上午 10-11 点。
Weekly summary:
User: 给我本周的健康摘要
Action: Run query.py --summary --period week, then format as a structured summary with emojis for each category.
Rules
- Always ingest before responding — run the ingest script first if the message is health data.
- Never fabricate data — only report what's in the database. If no data exists for a period, say so clearly.
- Be concise — health data responses should be scannable, not walls of text.
- Use Chinese for all responses (the data comes from a Chinese-configured iOS app).
- Respect privacy — don't log or repeat health values beyond what the user asked.
- Dates are local time — interpret all timestamps as the user's local timezone.