The Google Health API Got a CLI: ghealth is an Open-Source Tool for Your Fitbit Air Data
ghealth is an open-source, agent-first CLI tool built in Go that wraps the Google Health API v4, simplifying access to health data for terminals and AI agents. The tool exposes 40 verified data types (such as sleep, heart rate, and steps) as structured JSON with deterministic exit codes, enabling seamless piping into LLM contexts. It includes dedicated Agent Skills (SKILL.md files) and supports features like dry-run modes, raw output toggles, and lossless pagination to enhance automation reliabi
Analysis
TL;DR
- ghealth is an open-source, agent-first CLI tool built in Go that wraps the Google Health API v4, simplifying access to health data for terminals and AI agents.
- The tool exposes 40 verified data types (such as sleep, heart rate, and steps) as structured JSON with deterministic exit codes, enabling seamless piping into LLM contexts.
- It includes dedicated Agent Skills (SKILL.md files) and supports features like dry-run modes, raw output toggles, and lossless pagination to enhance automation reliability.
- Authentication relies on user-provided OAuth 2.0 credentials with PKCE S256 challenges, ensuring security without shared keys, while supporting both desktop and headless flows.
- ghealth bridges the gap between raw API complexity and practical usage by offering simplified JSON envelopes, CSV/table exports, and reconciliation of multi-source data points.
Why It Matters
This tool significantly lowers the barrier for AI practitioners and developers to integrate personal health data into agentic workflows, removing the boilerplate associated with OAuth and complex API structures. By providing a standardized, agent-friendly interface, it enables rapid prototyping of health-aware applications that can analyze trends in sleep, fitness, and biometrics using large language models.
Technical Details
- Architecture & Language: Implemented as a single self-contained Go binary, ensuring portability and ease of deployment without external dependencies beyond the Go runtime.
- Data Interface: Wraps Google Health API v4, exposing 40 data types including clinical metrics like ECG (requ specific scopes) and standard metrics like steps and heart rate. It supports operations such as
list,rollup,daily-rollup,reconcile,create,update, anddelete. - Agent Integration: Designed explicitly for AI agents with stable JSON output shapes, deterministic exit codes, and pre-packaged
SKILL.mdfiles for installation vianpx skills add. This allows agents to understand authentication, setup, and data patterns natively. - Security & Auth: Utilizes Google OAuth 2.0 with PKCE (Proof Key for Code Exchange) and S256 challenges for headless flows. Users must provide their own OAuth client credentials, with tokens stored securely in
~/.config/ghealth/with restricted file permissions (0600). - Output Flexibility: Provides multiple output formats including simplified JSON (default), raw API responses (
--raw), CSV, and tables. It handles pagination losslessly vianextPageTokenand supports file output with schema previews.
Industry Insight
- Rise of Agentic Data Pipelines: The explicit inclusion of
SKILL.mdfiles highlights a growing trend where tools are designed not just for human CLI users but for autonomous AI agents, facilitating the creation of self-healing and self-configuring data pipelines. - Standardization of Health Data Access: As health APIs become more fragmented, community-led wrappers like ghealth that standardize output formats (JSON envelopes) and handle complex auth flows will become critical infrastructure for building reliable health-tech applications.
- Privacy-First Development: The requirement for users to bring their own OAuth credentials and the absence of shared keys reflect a shift towards decentralized, user-controlled data access models, which is essential for maintaining trust in consumer health AI applications.
Disclaimer: The above content is generated by AI and is for reference only.