YunhaoDou

whoop-copilot

Read real WHOOP recovery/strain/sleep/workout data via the official WHOOP developer API (OAuth 2.0) and reason about it directly — training advice, recovery trends, sleep debt, whether today is a good day to push hard. Can also act on that reasoning by writing to macOS Calendar/Reminders (adjust today's training, block recovery time, log a note) via AppleScript. Triggered when the user asks about their WHOOP data, recovery score, strain, sleep, wants training/schedule advice grounded in it, or wants today's calendar/reminders adjusted based on it (e.g. "我今天recovery怎么样", "该不该练", "帮我看看这周睡眠趋势", "根据我的恢复情况调整今天安排").

YunhaoDou 0 Updated 3d ago

Resources

10
GitHub

Install

npx skillscat add yunhaodou/whoop-copilot

Install via the SkillsCat registry.

SKILL.md

whoop-copilot

把真实 WHOOP Recovery / Strain / Sleep / Workout 数据接进 Claude Code / Codex 这类 agent。走 WHOOP 官方 OAuth API,不是抓包,不是逆向。

前置检查

pip install -r "${CLAUDE_SKILL_DIR}/requirements.txt"

一次性授权(首次使用)

  1. developer-dashboard.whoop.com 用你的 WHOOP 账号登录,创建 Team → 创建 App
  2. App 的 Redirect URI 填 http://localhost:8721/callback(必须和下面的环境变量完全一致)
  3. Scopes 全部勾选:read:recovery read:cycles read:sleep read:workout read:profile read:body_measurement offlineoffline 必须勾,不然拿不到 refresh_token,access_token 一小时后就得重新走一遍授权)
  4. 复制 App 的 Client ID / Client Secret:
export WHOOP_CLIENT_ID=xxxxx
export WHOOP_CLIENT_SECRET=xxxxx
python "${CLAUDE_SKILL_DIR}/scripts/oauth_setup.py"

会自动开浏览器跳转 WHOOP 授权页,授权后 token 存到 ~/.whoop-copilot/tokens.json(不进仓库,权限 600)。之后每次调用会用 refresh_token 自动续期,不用重新授权,除非你在 WHOOP 里手动撤销了这个 App 的访问权限。

用法

export WHOOP_CLIENT_ID=xxxxx WHOOP_CLIENT_SECRET=xxxxx
python "${CLAUDE_SKILL_DIR}/scripts/report.py" --days 7

输出最近 7 天的 recovery / strain / sleep / workout 真实数据(数字直接来自 API response,脚本不做任何解读)。拿到这份输出后,agent 自己基于真实数字给建议——不是脚本编好话术,是当场读数据推理。

写入日历/提醒事项(Phase 2)

calendar_tool.py 只负责执行,不做判断——先用 report.py 读真实数据,agent 自己推理该怎么调整,再调用这个工具落地:

python "${CLAUDE_SKILL_DIR}/scripts/calendar_tool.py" list-calendars
python "${CLAUDE_SKILL_DIR}/scripts/calendar_tool.py" list-reminder-lists
python "${CLAUDE_SKILL_DIR}/scripts/calendar_tool.py" list-today-events --calendar 健身

python "${CLAUDE_SKILL_DIR}/scripts/calendar_tool.py" add-reminder \
  --list 每日计划 --title "标题" --notes "备注"

python "${CLAUDE_SKILL_DIR}/scripts/calendar_tool.py" add-event \
  --calendar 健身 --title "标题" --start "2026-07-20 09:00" --end "2026-07-20 10:00" --notes "备注"

首次调用会触发 macOS 的自动化权限弹窗(允许终端/Claude Code 控制 Calendar/Reminders),同意一次即可。

数据字段说明

  • Recoveryrecovery_score(0-100%) resting_heart_rate hrv_rmssd_milli spo2_percentage skin_temp_celsiusscore_state 不是 SCORED 时(比如 PENDING_SCORE)当天分数还没算出来。
  • Strain(来自 Cycle):strain(0-21对数刻度) average_heart_rate max_heart_rate kilojoule
  • Sleepsleep_performance_percentage sleep_efficiency_percentage respiratory_rate,加各睡眠阶段时长(清醒/浅睡/深睡/REM)
  • Workout:单次训练的 strain average_heart_rate,可选距离/爬升

局限

  • 只读,WHOOP 开发者 API 目前没有开放"写回训练计划"的接口——第二阶段的"自动化决策"只能是 agent 读数据后去操作别的系统(日历、待办、Slack),不能反向控制 WHOOP app 本身
  • user_calibrating: true 时说明这项指标还在建立你的个人基线(通常前2-4周),数字参考价值低
  • Access token 默认有效期较短(脚本按 expires_in 自动判断续期),refresh_token 长期有效但会因用户手动撤权失效
  • 本 skill 不做任何自己的算法解读——所有"建议"都是调用它的 agent(Claude Code/Codex)当场基于真实数字生成的,不是本脚本内置的规则