Skip to content

Add health monitoring system: Apple Watch data collection & daily summaries#4

Open
zxt217 wants to merge 2 commits intograpeot:mainfrom
zxt217:claude/flamboyant-burnell
Open

Add health monitoring system: Apple Watch data collection & daily summaries#4
zxt217 wants to merge 2 commits intograpeot:mainfrom
zxt217:claude/flamboyant-burnell

Conversation

@zxt217
Copy link
Copy Markdown

@zxt217 zxt217 commented Apr 11, 2026

Overview

Implements a complete health data pipeline from Apple Watch to daily summaries:

  • health_data_receiver.py: Lightweight HTTP server (port 9876) that receives JSON health data from iPhone Shortcuts and persists to contexts/health/data/
  • health_monitor.py: Daily job (launchd, 08:01) that reads raw health JSON, compares against personal baselines, detects anomalies, and generates markdown summaries to contexts/health/daily/
  • action_advisor.py: Extended to read health summaries and incorporate health signals into daily action recommendations
  • Setup documentation: Comprehensive guide covering Mac service deployment, iPhone Shortcuts configuration, and troubleshooting

Key Features

  • Deterministic data processing (no LLM required for health monitor)
  • Automatic baseline building from 7-14 days of historical data
  • Anomaly detection with configurable thresholds per metric
  • Weekly health reports generated on Sundays
  • launchd integration for automated scheduling
  • Sample data and directory structure included

Components

File Purpose
.local_runtime/launchd/*.plist Service definitions for receiver (always-on) and monitor (daily 08:01)
.local_runtime/scripts/run-scheduled-job Job dispatcher supporting health_monitor
tools/health_data_receiver.py HTTP endpoint for iPhone Shortcuts
periodic_jobs/ai_heartbeat/src/v0/jobs/health_monitor.py Daily analysis & summary generation
contexts/health/ Data storage structure with sample 2026-04-07 files
docs/health_monitor_setup.md Full setup instructions

Metrics Tracked

  • Sleep: total, deep, REM, light, awake durations
  • Heart: resting HR, HRV, min/max HR
  • Activity: steps, active energy, exercise minutes, stand hours
  • Blood Oxygen: average and minimum SpO2

周炫汀 and others added 2 commits April 11, 2026 18:47
…ction_advisor integration

New pipeline: iPhone Shortcuts (08:00) → HTTP receiver (port 9876) → health_monitor.py (08:01) → daily/weekly summaries → action_advisor signal (09:15).

New files:
- health_monitor.py: processes raw JSON, generates daily summaries with baseline comparison, weekly reports on Sundays
- health_data_receiver.py: lightweight HTTP server for iPhone Shortcuts to POST health data
- launchd plists for both health-monitor (daily 08:01) and health-receiver (KeepAlive service)
- Setup guide with Apple Shortcuts configuration instructions

Modified:
- action_advisor.py: added health signal (signal 6) to daily collection
- run-scheduled-job: added health_monitor job routing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Test data (2026-04-07) used to verify the full pipeline:
receiver → JSON landing → health_monitor summary generation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant