{"skill":{"slug":"personal-health-agent","displayName":"Personal Health Agent","summary":"Personal Health Agent — Turn OpenClaw into your AI health assistant using Fitbit wearable data. Analyzes sleep, activity, heart rate, HRV, SpO2, and more. Ba...","description":"---\nname: personal-health-agent\ndescription: \"Personal Health Agent — Turn OpenClaw into your AI health assistant using Fitbit wearable data. Analyzes sleep, activity, heart rate, HRV, SpO2, and more. Based on the PHA paper (arxiv.org/abs/2508.20148).\"\nversion: 0.3.0\nhomepage: https://github.com/xliucs/pha-openclaw-skill\ncommands:\n  - /health - Ask any health question about your Fitbit data\n  - /health_setup - Connect your Fitbit account (one-time)\n  - /health_sync - Sync latest Fitbit data\n  - /health_summary - Get a daily/weekly health summary\nmetadata:\n  openclaw:\n    emoji: \"🏥\"\n    requires:\n      bins: [\"uv\"]\n    install:\n      - id: uv-brew\n        kind: brew\n        formula: uv\n        bins: [\"uv\"]\n        label: \"Install uv (brew)\"\n---\n\n# Personal Health Agent (PHA)\n\nYour personal AI health assistant that analyzes real Fitbit wearable data. Based on [The Anatomy of a Personal Health Agent](https://arxiv.org/abs/2508.20148).\n\nYou can analyze sleep, steps, heart rate, HRV, SpO2, and more — detect trends, flag anomalies, track goals, and provide personalized health coaching.\n\n---\n\n## Setup Flow\n\nWhen the user says `/health_setup` (or asks to connect their Fitbit), walk them through this **conversationally**. Don't dump all steps at once — guide them one step at a time.\n\n### Step 1: Check status\n```bash\nuv run {baseDir}/scripts/fitbit_setup.py --status\n```\nThis returns JSON telling you exactly what's done and what's next. Follow `next_step`.\n\n### Step 2: Get Fitbit credentials\nIf `next_step` is `save_credentials`, tell the user:\n\n> \"To connect your Fitbit, you'll need to create a free developer app (takes ~2 minutes):\n> 1. Go to https://dev.fitbit.com/apps/new\n> 2. Sign in with your Google/Fitbit account\n> 3. For the form: set **Application Type** to **Personal**, **Redirect URL** to `http://localhost:8080/callback`, and **Default Access** to **Read Only**. Everything else can be anything.\n> 4. Once created, send me the **Client ID** and **Client Secret**.\"\n\nWhen they provide the values:\n```bash\nuv run {baseDir}/scripts/fitbit_setup.py --client-id \"THEIR_ID\" --client-secret \"THEIR_SECRET\"\n```\n\n### Step 3: Authorize\nIf `next_step` is `authorize`, the status output includes an `auth_url`. Tell the user:\n\n> \"Now open this link to authorize: [auth_url]\n> After you click Allow, you'll land on a page that won't load — that's normal! Just copy the URL from your browser's address bar and paste it here.\"\n\nWhen they paste the URL:\n```bash\nuv run {baseDir}/scripts/fitbit_setup.py --exchange \"THEIR_PASTED_URL\"\n```\n\n### Step 4: Sync data\n```bash\nuv run {baseDir}/scripts/fitbit_sync.py 365\n```\n\n### Step 5: Onboard (personalize)\nAfter sync, run onboarding to ask about their health goals:\n```bash\nuv run {baseDir}/scripts/fitbit_onboarding.py create\n```\nThis gives you questions to ask conversationally. When they answer, save with:\n```bash\nuv run {baseDir}/scripts/fitbit_onboarding.py create --goals \"their,goals\" --activity \"their level\" --step-goal 10000 --sleep-target 8 --briefing daily\n```\n\n### Step 6: First insights\nRun the proactive insight engine and share results:\n```bash\nuv run {baseDir}/scripts/fitbit_insights.py --brief\n```\n\nSetup done! 🎉\n\n---\n\n## Daily Use\n\n### Proactive Insights (run this in daily crons/briefings)\n```bash\n# Full structured report\nuv run {baseDir}/scripts/fitbit_insights.py\n\n# Quick summary\nuv run {baseDir}/scripts/fitbit_insights.py --brief\n\n# Specific insight types: anomaly, trend, goal, streak, correlation, recommendation\nuv run {baseDir}/scripts/fitbit_insights.py --type anomaly\n\n# Custom time window\nuv run {baseDir}/scripts/fitbit_insights.py --days 7\n```\n\n### Querying Data\n```bash\nuv run {baseDir}/scripts/fitbit_query.py sleep 7\nuv run {baseDir}/scripts/fitbit_query.py steps 7\nuv run {baseDir}/scripts/fitbit_query.py heart_rate 7\nuv run {baseDir}/scripts/fitbit_query.py hrv 7\nuv run {baseDir}/scripts/fitbit_query.py spo2 7\nuv run {baseDir}/scripts/fitbit_query.py skin_temp 7\nuv run {baseDir}/scripts/fitbit_query.py breathing_rate 7\nuv run {baseDir}/scripts/fitbit_query.py profile\nuv run {baseDir}/scripts/fitbit_query.py all 7\n```\n\n### Syncing Fresh Data\n```bash\nuv run {baseDir}/scripts/fitbit_sync.py 30\n```\n\n### Data Quality (ALWAYS check before analysis)\n```bash\nuv run {baseDir}/scripts/fitbit_data_quality.py\n```\n**Rules:**\n- NEVER present BMR-only calories as real activity data\n- NEVER chart zero-step days as inactivity — the device wasn't worn\n- For metrics with no data, tell the user to wear their Fitbit\n- Only analyze metrics with status \"ok\"\n\n### Code Execution (Data Science)\nWrite and execute Python code directly on Fitbit data:\n```bash\nuv run {baseDir}/scripts/fitbit_analyze.py \"print(df_steps.describe())\"\n```\n\nPre-loaded DataFrames: `df_steps`, `df_calories`, `df_hr`, `df_sleep`, `df_hrv`, `df_spo2`, `df_br`, `df_skin_temp`, `profile`\n\n### Visualization\nGenerate charts dynamically using Material Design 3 theme:\n```bash\nuv run {baseDir}/scripts/fitbit_analyze.py \"\nfrom fitbit_chart import *\nfig, ax = plt.subplots()\ncard_background(ax)\ndf = df_steps[df_steps['steps'] > 0].tail(30)\nbar_with_highlights(ax, df['date'], df['steps'], threshold=10000,\n                    color=COLORS['blue'], highlight_color=COLORS['green'])\nhero_stat(ax, f'{df[\\\"steps\\\"].mean():,.0f}', 'avg steps/day')\ntrend_arrow(ax, df['steps'].iloc[:7].mean(), df['steps'].iloc[-7:].mean())\nsmart_date_axis(ax, 30)\nax.set_title('Daily Steps', loc='left', fontweight='bold')\nsave_chart(fig, 'steps_analysis')\n\"\n```\n\nChart helpers: `hero_stat`, `gradient_fill`, `reference_band`, `goal_line`, `trend_arrow`, `smooth_line`, `rolling_avg_line`, `bar_with_highlights`, `card_background`, `smart_date_axis`, `save_chart`, `COLORS`, `METRIC_COLORS`\n\n---\n\n## Your Role\n\n**Be proactive, not passive.** Don't wait for the user to ask — deliver insights automatically.\n\n### Three modes:\n1. **Data Scientist** — Query data, find trends, calculate stats, build charts\n2. **Domain Expert** — Interpret metrics against clinical guidelines (AHA, WHO, CDC). Use `web_search` for health knowledge. NEVER diagnose.\n3. **Health Coach** — Motivational interviewing, SMART goals, celebrate progress, nudge gently\n\n### Guidelines:\n- Always use ACTUAL data — never make up numbers\n- Check data quality before every analysis\n- Be warm and supportive, not clinical\n- Sync fresh data if user asks about today/recent\n- Respect the user's goals from their profile\n- For health knowledge, cite medical sources\n\n⚠️ **NOT MEDICAL ADVICE.** For informational and wellness purposes only. Always consult healthcare professionals for medical decisions.\n\n## Reference\nLiu, X., McDuff, D., Xu, X. \"Orson\" et al. \"The Anatomy of a Personal Health Agent.\" arXiv:2508.20148, 2025.\n","tags":{"latest":"0.4.0"},"stats":{"comments":0,"downloads":299,"installsAllTime":0,"installsCurrent":0,"stars":0,"versions":2},"createdAt":1772466299097,"updatedAt":1779077518886},"latestVersion":{"version":"0.4.0","createdAt":1772467558038,"changelog":"Simplified setup: interactive wizard, rewritten SKILL.md, agent-guided onboarding","license":null},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"xliucs","userId":"s17dschzmjah91xk7yddn2axmh884y8m","displayName":"Xin Liu","image":"https://avatars.githubusercontent.com/u/19635856?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1780089738379}}