whoop-cli:面向 AI Agent 的 WHOOP 健康数据访问 - Openclaw Skills

作者:互联网

2026-03-30

AI教程

什么是 whoop-cli?

whoop-cli 技能是 @andreasnlarsen/whoop-cli 软件包的专用配套工具,旨在为 AI Agent 提供稳定、JSON 格式的 WHOOP 健康与健身数据访问。通过消除对原始 API 的对接需求,该技能允许 Agent 在编程或自动化环境中直接分析恢复、压力、睡眠和健康标记。

利用 Openclaw Skills 进行生物识别数据分析,确保开发者可以构建尊重安全边界的个性化健康追踪 Agent。该技能强调本地身份验证和只读操作命令,在确保敏感凭据安全的同时,为教练、趋势分析和活动解读提供高保真数据。

下载入口:https://github.com/openclaw/skills/tree/main/skills/andreasnlarsen/whoop-cli

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install whoop-cli

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 whoop-cli。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

whoop-cli 应用场景

  • 监控每日恢复和压力分数,以提供上下文相关的生产力建议。
  • 分析 7 天或 30 天的健康趋势,以识别生理标记或表现下滑。
  • 切分活动数据,以区分有意识的训练负荷和偶然的活动。
  • 通过结构化的生命周期管理来计划和跟踪健康实验(例如:咖啡因摄入时机或睡眠协议)。
  • 将历史健康数据导出到本地 JSONL 文件,用于自定义数据科学或可视化项目。
whoop-cli 工作原理
  1. Agent 通过 whoop auth status 命令检查本地身份验证状态来初始化连接。
  2. 在确认凭据有效后,Agent 可以执行高级摘要或每日简报命令来检索用户当前的生理状态。
  3. 数据以结构化 JSON 格式返回,通常使用 --pretty 标志以提高可读性,或通过 jq 进行特定字段提取。
  4. 对于活动分析,Agent 应用 --labeled-only 等过滤器,以确保其仅解释已确认的训练数据。
  5. 如果用户发起实验,Agent 会更新存储在本地 experiments.json 文件中的规范状态,随着时间的推移跟踪假设、协议和结果。

whoop-cli 配置指南

要开始使用,请通过 npm 全局安装 whoop-cli 软件包:

npm install -g @andreasnlarsen/whoop-cli@0.3.1

接下来,安装特定的 Openclaw Skills 软件包:

whoop openclaw install-skill --force

您还必须配置以下环境变量:WHOOP_CLIENT_IDWHOOP_CLIENT_SECRETWHOOP_REDIRECT_URI。请注意,初始登录应由用户在本地 shell 中执行,以保护 OAuth 令牌的安全。

whoop-cli 数据架构与分类体系

该技能跨本地配置文件和结构化命令输出管理数据:

数据类型 位置 / 格式 描述
身份验证 ~/.whoop-cli/profiles/.json 存储 OAuth 令牌和个人资料设置的本地存储。
实验状态 ~/.whoop-cli/experiments.json 所有计划中和运行中健康实验的规范真相来源。
活动记录 JSON 数组 包含每个记录事件的 sport_idstrain 和持续时间的结构化输出。
每日摘要 JSON 对象 特定日期的恢复、睡眠和压力指标的组合视图。
name: whoop-cli
description: Companion skill for @andreasnlarsen/whoop-cli: agent-friendly WHOOP access via stable CLI JSON (day briefs, health flags, trends, exports) without raw API plumbing.
metadata:
  openclaw:
    requires:
      bins:
        - whoop
      env:
        - WHOOP_CLIENT_ID
        - WHOOP_CLIENT_SECRET
        - WHOOP_REDIRECT_URI
    primaryEnv: WHOOP_CLIENT_SECRET
    homepage: https://github.com/andreasnlarsen/whoop-cli
    install:
      - kind: node
        package: "@andreasnlarsen/whoop-cli@0.3.1"
        bins:
          - whoop
        label: Install whoop-cli from npm

whoop-cli

Use the installed whoop command.

Security + credential handling (required)

  • Never ask users to paste client secrets/tokens into chat.
  • For first-time auth, the user should run login locally on their own shell.
  • Prefer read-only operational commands in agent flows (summary, day-brief, health, trend, sync pull).
  • Do not run whoop auth login unless the user explicitly asks for login help.
  • Tokens are stored locally at ~/.whoop-cli/profiles/.json by the CLI.

Install / bootstrap

If whoop is missing:

npm install -g @andreasnlarsen/whoop-cli@0.3.1

Optional OpenClaw skill install from package bundle:

whoop openclaw install-skill --force

Core checks

  1. whoop auth status --json
  2. If unauthenticated, ask the user to run local login:
    • whoop auth login --client-id ... --client-secret ... --redirect-uri ...
  3. Validate:
    • whoop day-brief --json --pretty

Useful commands

  • Daily:
    • whoop summary --json --pretty
    • whoop day-brief --json --pretty
    • whoop strain-plan --json --pretty
    • whoop health flags --days 7 --json --pretty
  • Activity analysis:
    • whoop activity list --days 30 --json --pretty
    • whoop activity trend --days 30 --json --pretty
    • whoop activity types --days 30 --json --pretty
    • training-only: whoop activity trend --days 30 --labeled-only --json --pretty

Activity interpretation guardrail (important)

  • WHOOP generic activity rows (often sport_id=-1) are auto-detected and may be unlabeled movement (housework/incidental activity), not intentional training.
  • Do not treat generic activity as confirmed training volume by default.
  • For coaching/training recommendations, default to --labeled-only and report both total vs filtered counts.

Agent filtering pattern (jq-friendly)

  • Canonical source: whoop activity list --json
  • Prefer built-in filters first (--labeled-only, --generic-only, --sport-id, --sport-name).
  • If custom slicing is needed and jq is available, filter shell-side from raw JSON (example):
whoop activity list --days 30 --json | jq '.data.records | map(select(.sport_id != -1))'
  • Export:
    • whoop sync pull --start YYYY-MM-DD --end YYYY-MM-DD --out ./whoop.jsonl --json --pretty

Experiment protocol (agent-required)

  • Canonical state: ~/.whoop-cli/experiments.json only.
  • Plan experiments with context at creation time:
    • whoop experiment plan --name ... --behavior ... --start-date YYYY-MM-DD [--end-date YYYY-MM-DD] --description ... --why ... --hypothesis ... --success-criteria ... --protocol ... --json --pretty
  • Update context without creating duplicate state:
    • whoop experiment context --id ... [--description ... --why ... --hypothesis ... --success-criteria ... --protocol ...] --json --pretty
  • Check lifecycle/status with:
    • whoop experiment status [--status planned|running|completed] [--id ...] --json --pretty
  • Evaluate outcomes with:
    • whoop experiment report --id ... --json --pretty
  • Profile scope is strict by default (active --profile only).
    • Use --all-profiles only when cross-profile visibility is explicitly needed.
  • Prefer output field sourceOfTruth (path to canonical state file); experimentsFile is kept as compatibility alias.
  • Avoid duplicating experiment state into other files unless the user explicitly asks for separate notes.

Safety

  • Never print client secrets or raw tokens.
  • Keep API errors concise and actionable.
  • Treat this integration as unofficial/non-affiliated.