Parse Apple Health exports into a local SQLite database — queryable by AI agents, the CLI, or directly via SQL.
The primary motivation is to make your Apple Health data accessible to AI coding agents. Run healthsync skills install to give Claude Code, Codex CLI, or OpenClaw the schema, CLI reference, and SQL examples it needs to answer questions about your health data in conversation.
Docs: healthsync.sidv.dev
curl -fsSL https://healthsync.sidv.dev/install | bashOr install with Go:
go install github.com/BRO3886/healthsync@latestOr download a pre-built binary from GitHub Releases (macOS and Linux, arm64 and amd64).
Or build from source (requires Go 1.24+):
git clone git@github.com:BRO3886/healthsync.git
cd healthsync
go build -o healthsync .Export your Apple Health data from the Health app on iPhone (Settings > Health > Export All Health Data). Then:
healthsync parse export.zip
healthsync parse export.zip -v # verbose loggingAccepts .zip (auto-extracts export.xml) or raw .xml files.
healthsync query heart-rate --limit 10
healthsync query steps --from 2024-01-01 --to 2024-06-30
healthsync query workouts --format json
healthsync query spo2 --format csv
healthsync query resting-heart-rate --limit 30
healthsync query blood-pressure --limit 20
healthsync query body-mass --limit 30Output formats: table (default), json, csv
Use --total with steps, active-energy, or basal-energy for deduplicated daily totals:
healthsync query steps --total --from 2024-01-01
healthsync query active-energy --total --from 2024-01-01Install the healthsync skill to teach your AI coding agent how to query your health data:
healthsync skills installThis writes the database schema, CLI reference, and SQL query examples to ~/.claude/skills/healthsync/ (Claude Code), ~/.agents/skills/healthsync/ (Codex CLI), or ~/.openclaw/skills/healthsync/ (OpenClaw). The agent picks it up automatically on the next session start and can then answer questions like "What was my average heart rate last week?" by running queries against your local database.
# Check installation status
healthsync skills status
# Uninstall
healthsync skills uninstall --agent claudeStart a server for receiving uploads (e.g. from iPhone Shortcuts over Tailscale):
healthsync server --port 8080 --host 0.0.0.0Endpoints:
POST /api/upload— upload a.zipor.xmlfile (multipart form, field:file). Returns202 Acceptedand parses asynchronously.GET /api/upload/status— poll parse job progress.GET /api/health/{table}?from=&to=&limit=— query health data as JSON.
# Upload
curl -F "file=@export.zip" http://localhost:8080/api/upload
# Check progress
curl http://localhost:8080/api/upload/status
# Query
curl "http://localhost:8080/api/health/heart-rate?limit=5"Cardiac / Vitals
| Table | Apple Health Type | Notes |
|---|---|---|
heart_rate |
HKQuantityTypeIdentifierHeartRate |
BPM |
resting_heart_rate |
HKQuantityTypeIdentifierRestingHeartRate |
Daily RHR |
hrv |
HKQuantityTypeIdentifierHeartRateVariabilitySDNN |
ms (SDNN) |
heart_rate_recovery |
HKQuantityTypeIdentifierHeartRateRecoveryOneMinute |
Post-exercise |
respiratory_rate |
HKQuantityTypeIdentifierRespiratoryRate |
Breaths/min |
blood_pressure |
HKQuantityTypeIdentifier BloodPressureSystolic/Diastolic |
Paired mmHg |
spo2 |
HKQuantityTypeIdentifierOxygenSaturation |
0-1 fraction |
vo2_max |
HKQuantityTypeIdentifierVO2Max |
mL/min·kg |
Activity / Energy
| Table | Apple Health Type | Notes |
|---|---|---|
steps |
HKQuantityTypeIdentifierStepCount |
--total supported |
active_energy |
HKQuantityTypeIdentifierActiveEnergyBurned |
kcal; --total supported |
basal_energy |
HKQuantityTypeIdentifierBasalEnergyBurned |
kcal; --total supported |
exercise_time |
HKQuantityTypeIdentifierAppleExerciseTime |
Minutes |
stand_time |
HKQuantityTypeIdentifierAppleStandTime |
Minutes |
flights_climbed |
HKQuantityTypeIdentifierFlightsClimbed |
Count |
distance_walking_running |
HKQuantityTypeIdentifierDistanceWalkingRunning |
km/mi |
distance_cycling |
HKQuantityTypeIdentifierDistanceCycling |
km/mi |
Body
| Table | Apple Health Type | Notes |
|---|---|---|
body_mass |
HKQuantityTypeIdentifierBodyMass |
kg/lb |
body_mass_index |
HKQuantityTypeIdentifierBodyMassIndex |
|
height |
HKQuantityTypeIdentifierHeight |
m/ft |
Mobility / Walking
| Table | Apple Health Type |
|---|---|
walking_speed |
HKQuantityTypeIdentifierWalkingSpeed |
walking_step_length |
HKQuantityTypeIdentifierWalkingStepLength |
walking_asymmetry |
HKQuantityTypeIdentifierWalkingAsymmetryPercentage |
walking_double_support |
HKQuantityTypeIdentifierWalkingDoubleSupportPercentage |
walking_steadiness |
HKQuantityTypeIdentifierAppleWalkingSteadiness |
stair_ascent_speed |
HKQuantityTypeIdentifierStairAscentSpeed |
stair_descent_speed |
HKQuantityTypeIdentifierStairDescentSpeed |
six_minute_walk |
HKQuantityTypeIdentifierSixMinuteWalkTestDistance |
Running
| Table | Apple Health Type |
|---|---|
running_speed |
HKQuantityTypeIdentifierRunningSpeed |
running_power |
HKQuantityTypeIdentifierRunningPower |
running_stride_length |
HKQuantityTypeIdentifierRunningStrideLength |
running_ground_contact_time |
HKQuantityTypeIdentifierRunningGroundContactTime |
running_vertical_oscillation |
HKQuantityTypeIdentifierRunningVerticalOscillation |
Sleep / Mindfulness / Other
| Table | Apple Health Type | Notes |
|---|---|---|
sleep |
HKCategoryTypeIdentifierSleepAnalysis |
Sleep stages (no unit) |
mindful_sessions |
HKCategoryTypeIdentifierMindfulSession |
Category (no unit) |
stand_hours |
HKCategoryTypeIdentifierAppleStandHour |
Category (no unit) |
wrist_temperature |
HKQuantityTypeIdentifierAppleSleepingWristTemperature |
°C deviation |
time_in_daylight |
HKQuantityTypeIdentifierTimeInDaylight |
Minutes |
dietary_water |
HKQuantityTypeIdentifierDietaryWater |
mL/L |
physical_effort |
HKQuantityTypeIdentifierPhysicalEffort |
MET |
walking_heart_rate |
HKQuantityTypeIdentifierWalkingHeartRateAverage |
BPM |
workouts |
All HKWorkoutActivityType* |
duration, distance, energy |
| Category | Types |
|---|---|
| Audio | EnvironmentalAudioExposure, HeadphoneAudioExposure, EnvironmentalSoundReduction |
| Category | HandwashingEvent, ToothbrushingEvent, MenstrualFlow |
- Streaming XML parser — constant memory (~10MB) for 950MB+ files using
xml.Decodertoken-based parsing - Dedup —
INSERT OR IGNOREwith UNIQUE constraints for idempotent re-imports - Batch inserts — 1000 rows per transaction for performance
- Async uploads — HTTP server parses in background, poll
/api/upload/statusfor progress - Pure Go SQLite — uses
modernc.org/sqlite, no CGO required - Agent skills — embedded skill files (go:embed) installed via
healthsync skills install
Database is stored at ~/.healthsync/healthsync.db by default (override with --db).
MIT