Skip to content

Workout Recovery Stamp

Built 2026-04-30 as Build 4 of the Garmin + Hevy integration plan (reference_garmin_workout_integration.md).

Files

  • forge/scripts/forge_workout_recovery_stamp.py — engine + CLI
  • Cron: 30 11 * * * (UTC = 06:30 CT CDT) → logs to forge/logs/integrations/workout-recovery-stamp.log

What it does

  1. Schema bootstrap (idempotent): ensures Next-Day HRV, Next-Day Sleep, Next-Day Readiness exist on the Workouts DB (3510950b-d7a9-812e-a23c-d20bf0b2f23a). Patched 2026-04-30 on first run.
  2. Queries Hevy Workouts DB for rows with Date == yesterday (or backfill window)
  3. For each, looks up the next-morning recovery from Wellness Daily Notion (preferred) or live /context (fallback when morning == today)
  4. Writes the three numbers via Notion public API PATCH
  5. Skips rows already fully stamped (idempotent re-runs)

Usage

# Default: stamp yesterday's workouts
~/forge/scripts/integrations/.venv/bin/python ~/forge/scripts/forge_workout_recovery_stamp.py

# Backfill last N days
~/forge/scripts/integrations/.venv/bin/python ~/forge/scripts/forge_workout_recovery_stamp.py --backfill 30

# Dry-run: show what would be written
~/forge/scripts/integrations/.venv/bin/python ~/forge/scripts/forge_workout_recovery_stamp.py --backfill 7 --dry-run

Why 06:30 CT cron

The wellness daily summarizer runs at 22:00 CT the night before, so the prior morning's Wellness Daily row is settled by 06:30 CT. The stamp writes from that authoritative row, not live /context, except when the workout was actually today.

Auth

Requires NOTION_INTEGRATION_TOKEN in ~/.forge-secrets/notion-cookie.env (already loaded by forge_notion_api.NotionAPI). Direct Notion query for Wellness Daily uses the same env var via os.environ.get.

[Claude Code, Build 4 of Garmin + Hevy plan]