Hevy Program Generator (hevy-program-generator) is an open-source, evidence-grounded training & nutrition engine that treats exercise science, nutritional bioenergetics, and Hevy training programs as executable, test-driven software.
Define training routines in Python, validate them against deterministic structure and coaching-policy checks (volume screens, RPE ceilings, scheduling and duration estimates), push routines seamlessly to your mobile Hevy app via REST API, and pull workout history into clean, git-friendly JSON.
- Zero-Dependency Guarantee: Built 100% on the Python 3 standard library (
urllib,json,dataclasses,argparse,math,pathlib,unittest). Nopip install, novirtualenv, no package manager headaches. - Evidence with stated limits: Research summaries distinguish study findings from coaching choices. Checks detect malformed data and configured-policy violations; they cannot establish physiological safety or an optimal workout.
- Consensus Literature Integration & Program Synthesis: Query peer-reviewed sports science via the Consensus Academic API, validate citations offline via
data/consensus_cache.json(Gate 6), and synthesize custom training programs with automated compiler pre-flight (scripts/suggest_program.py). - AI Agent Native: Turn Claude, Antigravity, Gemini, Cursor, Copilot, or Windsurf into your personal strength & conditioning scientist using structured elicitation protocols and compiler-in-the-loop refinement.
- Idempotent Hevy Synchronization: Declarative sync engine matches routines by day or title, updating existing routines in place (
PUT) and creating missing ones (POST) without polluting your Hevy library. - Time-Cap Simulator: Estimates warmups, reps, both sides, rests and transitions with an explicit planning range. Compare only matching program versions with logged history; estimates are not guaranteed finish times.
Hevy's built-in ChatGPT Plugin and Claude Connector optimize for fast, zero-setup routine generation in chat, whereas hevy-program-generator treats training programs as tested, versioned code where an LLM proposes changes and deterministic scripts validate them before syncing.
| Dimension | Hevy ChatGPT / Claude Connector | hevy-program-generator |
|---|---|---|
| Setup & UX | 1-click OAuth in Hevy; works from web or mobile chat with no terminal. | Local Git repo + Python 3 (zero external dependencies) + optional HEVY_API_KEY. |
| Pre-sync validation | Best-effort LLM judgment; no automated checks before saving. | 9 deterministic QA gates (scripts/qa_program.py) checking catalog matching, time cap, volume, spacing, RPE ceiling, citations, and gym-note rules. |
| Session duration | Rough LLM estimate. | Per-set, warmup, unilateral, and rest simulator calibrated against logged Hevy workouts (scripts/calibrate_session_time.py). |
| Evidence & citations | Model memory or ad-hoc search; study findings and coaching opinions can blend together. | Audited evidence docs (docs/evidence_base.md) + offline 309-paper Consensus cache (data/consensus_cache.json) separating study limits from coaching choices (QA checks configured rules and citation resolution, not medical clearance or optimal programming). |
| Sync & versioning | Direct chat writes; plans live in chat threads and the Hevy app. | Git-versioned Python source of truth, --dry-run diffs, idempotent PUT/POST reconcile (scripts/build_routines.py), orphan detection, and drift-checked HTML export (scripts/render_program.py). |
| Data & portability | Workout history pulled into cloud chat sessions tied to ChatGPT or Claude. | Local gitignored JSON archive (scripts/fetch_workouts.py) with pre-commit leak protection (scripts/check_privacy_leaks.py); works with any coding agent or pure CLI. |
- Use Hevy's native ChatGPT / Claude connector when you want the fastest, zero-setup way to brainstorm and save routines from chat.
- Use
hevy-program-generatorwhen you want programmable guardrails, calibrated time budgets, auditable citations, Git diffs/rollbacks, and local ownership of your training data.
git clone https://github.com/savvides/hevy-program-generator.git
cd hevy-program-generator- (Optional — for Hevy sync or workout history) Set up
HEVY_API_KEY(offline QA, program synthesis, and cached citation checks work with no API keys):- Requires Hevy Pro. Open
https://hevy.com/settings?developerin a web browser (not the mobile app), sign in, and click Generate API Key. - Run
python3 scripts/setup_hevy.pyto save and verify your key in.env(or copy.env.exampleto.env, setHEVY_API_KEY=..., and runpython3 scripts/setup_hevy.py --check). .envis gitignored and never committed. (For live literature queries, you can also addCONSENSUS_API_KEYto.env.)
- Requires Hevy Pro. Open
- (Optional — recommended before committing) Install the pre-commit privacy hook to block accidental commits of workout logs, custom programs, or secrets:
python3 scripts/install_hooks.pyOpen this repository in Claude Code, Antigravity, Gemini CLI, Cursor, GitHub Copilot, or Windsurf. The repo's instruction files (AGENTS.md, CLAUDE.md, GEMINI.md, and .cursorrules) guide the assistant to ask clarifying intake questions when needed, write or edit Python program definitions, run scripts/qa_program.py, and handle dry-run or sync when asked.
Copy and adapt any of these prompts — you don't need to mention file names or commands, because the assistant maps plain English to the right scripts and docs automatically:
-
Build a new program from scratch
"Design a 3-day full-body program on Mon/Wed/Fri under a 55-minute time cap using a barbell, adjustable bench, dumbbells, and a stationary bike. Account for mild lower-back sensitivity, separate research findings from coaching choices, and make sure all checks pass."
-
Modify an existing program
"In my 2-day starter program, swap Box Squat for a joint-friendly single-leg exercise, keep sessions under 55 minutes without cutting rest times, add a 40-minute Zone 2 bike ride on Sunday, and re-check the program."
-
Sync to Hevy & update the printable plan
"Validate my program, preview what will change in Hevy first, and once I confirm, sync it to Hevy and update the readable workout plan."
-
Pull & analyze Hevy workout history
"Pull my latest Hevy workouts, summarize my recent consistency and top sets, and compare my actual gym times against the program's time estimates."
-
Ask evidence or nutrition questions
"Using this repo's evidence base, what does the research say about rest intervals for hypertrophy and protein intake around morning workouts? Separate study findings and limits from coaching choices."
# 1. Validate a program against all 9 QA gates (starter_full_body_2x.py, upper_lower_4x.py, three_day_split_3x.py)
python3 scripts/qa_program.py --program programs/starter_full_body_2x.py
# 2. Synthesize a new program from movement patterns with automatic QA pre-flight
python3 scripts/suggest_program.py --days 3 --time-cap 60 --focus "Strength" --output programs/my_program.py
# 3. Render the readable HTML plan (docs/program.html)
python3 scripts/render_program.py
# 4. Preview Hevy sync without writing, then push routines to Hevy
python3 scripts/build_routines.py --program programs/starter_full_body_2x.py --dry-run
python3 scripts/build_routines.py --program programs/starter_full_body_2x.py
# 5. Pull workout history and print a deterministic lift/frequency summary
python3 scripts/fetch_workouts.py && python3 scripts/analyze_history.pyPrograms are defined as declarative Python modules conforming to the strict schema enforced by scripts/program_loader.py:
"""Example program definition (programs/my_program.py)."""
PROGRAM_METADATA = {
"title": "Full-Body 2x — Strength & VO2 Max",
"version": "1.0.0",
"target_demographic": "General Strength & Longevity (Men 40+)",
"session_time_cap_minutes": 60,
"min_recovery_buffer_hours": 48,
"description": "2-day full-body strength paired with polarized stationary bike cardio.",
}
ROUTINES = [
{
"name": "Full-Body A — Squat / Bench / Pull",
"day_key": "Tuesday",
"notes": "RPE 8 and warmup ramps are coaching choices; Grgic 2022 supports non-failure training.",
"exercises": [
{
"name": "Box Squat (Barbell)",
"compound": True,
"warmup_reps": [5, 5, 3],
"work_sets": 3,
"reps": "3-5",
"rpe": 8,
"rest_seconds": 120,
"muscle_groups": ["quads", "glutes"],
"evidence_citation": "Grgic et al. 2022 (non-failure training; exact RPE and dose are coaching choices)",
},
{
"name": "Hip Abduction (Machine)",
"compound": False,
"warmup_reps": None,
"work_sets": 3,
"reps": "15-20",
"rpe": 10,
"rest_seconds": 60,
"muscle_groups": ["glutes"],
"evidence_citation": "Grgic et al. 2022 (failure is not required; accessory effort is a coaching choice)",
},
],
},
]
CARDIO_SCHEDULE = [
{
"day": "Thursday",
"modality": "Stationary Bike",
"type": "VO2 Max 4x4",
"duration_minutes": 40,
"evidence_citation": "Milanović et al. 2015, Schumann et al. 2021",
},
{
"day": "Sunday",
"modality": "Stationary Bike",
"type": "Zone 2",
"duration_minutes": 60,
"evidence_citation": "Seiler 2010 (endurance-athlete context; exact easy dose is a coaching choice)",
},
]The current policy choices and their evidence limits are documented in exercise evidence and nutrition evidence. They are not universal physiological invariants. In particular, the 48-hour buffer, 3–18 weighted-set screen and selected rest/warmup scheme are coaching defaults. A resolved author/year citation does not prove its attached claim.
The November 2, 2026 review accounts for all selected papers with source depth and population limits. The authority manifest distinguishes selected sources, eight explicit program-citation supplements and background cache material. Original-paper checks qualify exported takeaways. API queries and ordinary document mentions do not promote a background source into the authority.
Run python3 scripts/qa_program.py --program <path> before syncing. A successful
scorecard means configured checks passed, not “100% compliant with sports science.”
Actual recovery, training outcomes and individual suitability still require review.
The default readable plan is generated from
programs/starter_full_body_2x.py, including set counts, instructions and time estimates:
python3 scripts/render_program.py
python3 scripts/render_program.py --checkA unilateral prescription such as 6-8 per side or 30-45s per side means both
sides before logging one set and taking the prescribed rest. Invalid text stops
export instead of silently becoming five reps.
python3 scripts/test_program_loader.py # Schema validation & resolution unit tests
python3 scripts/test_build_routines.py --program <path> # Structural assertions & catalog resolution
python3 scripts/eval_program_volume.py --program <path> # configured weighted-volume bounds
python3 scripts/eval_recovery_interference.py --program <path> # configured spacing and cardio accounting
python3 scripts/estimate_session_time.py --program <path> # Gym duration simulator vs time cap
python3 scripts/calibrate_session_time.py --program <path> # Model vs actual logged wall clock
python3 scripts/eval_evidence_grounding.py --program <path> # Deterministic evidence & Consensus citation gatehevy-program-generator integrates directly with the Consensus Academic API to ground training prescriptions in peer-reviewed scientific studies. A local, offline-first citation cache (data/consensus_cache.json) ensures fast, zero-credit evaluations without network requests.
Add your optional Consensus API key to .env (offline queries and pre-cached citations require no key):
cp .env.example .env
# Edit .env:
CONSENSUS_API_KEY=your_consensus_api_key_hereSearch sports science literature or inspect cached studies:
# Query literature with instant caching (or 0-credit offline cache hit)
python3 scripts/consensus_client.py --query "seated leg curl lengthened hamstring" --limit 3
# Inspect study by DOI from local cache
python3 scripts/consensus_client.py --doi "10.1249/MSS.0000000000002523"
# Format markdown citation for evidence documentation
python3 scripts/consensus_client.py --query "rest intervals hypertrophy" --format markdownGenerate a customized, evidence-grounded program tailored to specific weekly days, time caps, and joint constraints. The generator automatically validates movement patterns against the Hevy catalog and executes scripts/qa_program.py pre-flight checks before saving:
# Synthesize an adult split with explicit reported context and a 60-minute time cap
python3 scripts/suggest_program.py --days 3 --time-cap 60 --focus "Strength" --age-years 46 --sex "male" --primary-goal "strength" --output programs/my_program.pyOptional age_years, sex and primary_goal describe reported context. Omitted
values stay unknown; a focus/title such as "Men 40+" does not supply them. No automatic
training or calorie dose follows. Explicit ages under 18 stop the adult generator.
Joint-profile labels preserve selection constraints and do not provide clinical clearance.
hevy-program-generator is engineered for autonomous AI development. Detailed operating standards are built into AGENTS.md, CLAUDE.md, and GEMINI.md.
┌─────────────────────────────────────────────────────────────┐
│ 1. Lifter Elicitation (Days, Time Cap, Equipment, Goals) │
│ Agent conducts structured intake assessment │
└──────────────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 2. Synthesize Program Definition │
│ Agent writes custom program to programs/my_program.py │
└──────────────────────────────┬──────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ 3. Run Pre-Flight QA Gatekeeper │
│ python3 scripts/qa_program.py --program <path> │
└──────────────────────────────┬──────────────────────────────┘
│
┌────────────────┴────────────────┐
▼ ▼
[ QA Errors ✗ ] [ QA Green ✓ ]
│ │
▼ ▼
┌───────────────────────────┐ ┌────────────────────────────┐
│ 4. Autonomous Refinement │ │ 5. Dry-Run & Hevy Sync │
│ Fix volume, RPE, rest, │ │ python3 │
│ spacing, or time cap │ │ scripts/build_routines │
│ Loop back to Step 3 │ │ .py --program <path> │
└───────────────────────────┘ └────────────────────────────┘
Need an API key? See Setup (Once) or run
python3 scripts/setup_hevy.py(verify an existing key withpython3 scripts/setup_hevy.py --check).
Sync your full Hevy workout history into local, gitignored JSON files:
python3 scripts/fetch_workouts.py
# Or isolate logs completely outside the repository directory:
python3 scripts/fetch_workouts.py --data-dir ~/.hevy/workouts
# Or via environment variable:
export HEVY_DATA_DIR=~/.hevy/workouts- Paginates through
GET /v1/workouts(pageSize=10). - Stores each session in
data/workouts/<workout_id>.json(gitignored) or your designatedHEVY_DATA_DIR. - Automated pre-commit privacy gatekeeper (
scripts/check_privacy_leaks.py) blocks accidental staging of session files, API keys, or custom routines. Install it with:python3 scripts/install_hooks.py
Push your program definition to Hevy:
python3 scripts/build_routines.py --program programs/starter_full_body_2x.py- Automatically runs
qa_program.pypre-flight checks before touching the network. - Resolves prescribed exercise names against cached templates (
data/exercise_templates.json) using token similarity. - Reconciles routines by weekday key or title: performs
PUTfor updates andPOSTfor new routines. - Reports orphaned/stale routines for manual cleanup in the Hevy app (the Hevy API does not expose a routine deletion endpoint).
The local knowledge base that informs program generation and citation verification lives in five files:
- Exercise evidence — synthesized resistance-training and cardio guidance with study populations and limits.
- Nutrition evidence — protein, energy-deficit, and fueling guidance.
- November 2, 2026 Consensus review — 100-paper corpus index with DOIs, populations, policy notes, and appraisal depth.
- Evidence authority manifest — machine-readable corpus allowlist and program-citation supplements.
- Consensus bibliographic cache — offline-first bibliographic metadata for 309 papers (
doi,citation_key,authors,title,year,journal,consensus_url) used by Gate 6 without network requests or verbatim third-party text.
Cached metadata and unappraised records do not certify a prescription.
Contributions are welcome. See CONTRIBUTING.md for guidelines, evidence requirements, and local QA checks before opening a pull request.
This software is provided for educational and training-planning purposes only. It is not medical advice, physical therapy, or clinical clearance, and automated QA checks do not establish individual physiological safety or optimal programming.
- Repository source code and original documentation are licensed under the MIT License (
Copyright (c) 2026 Philippos Savvides). - Built-in exercise catalog entries in
data/exercise_templates.jsonand bibliographic records indata/consensus_cache.jsonsupport local validation; optional cloud integrations use the Hevy API and Consensus Academic API under their respective terms of service and do not redistribute verbatim third-party paper abstracts or takeaways.