AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Heart Rate Zones in the alexandrai-tools project.
Project overview
This guide covers src/tools/heart-rate-zones/index.ts. The tool calculates maximum heart rate with either the standard age formula or the Tanaka formula, maps that maximum into five percentage-based zones, and returns rounded low and high beats-per-minute bounds.
Primary source files
- src/tools/heart-rate-zones/index.ts defines meta, HrFormula, HrZone, zone definitions, maxHr, and heartRateZones.
- src/tools/heart-rate-zones/index.test.ts covers standard formula, Tanaka formula, default formula, five zones, ascending ranges, zone five maximum, and zone one lower bound.
- src/tools/heart-rate-zones/Body.astro owns browser inputs.
- src/tools/heart-rate-zones/i18n.ts owns localized copy.
- src/lib/tools.ts registers metadata.
Setup commands
npm install npm test npm run typecheck npm run build npm run dev
Change rules
- Keep the standard formula as 220 minus age.
- Keep the Tanaka formula as 208 minus 0.7 times age, rounded.
- Keep exactly five zones unless the UI, copy, and tests are changed together.
- Compute low and high values from percentage definitions and rounded max heart rate.
- Do not present zones as medical clearance for exercise intensity.
- If resting heart rate or Karvonen zones are added, expose them as a separate mode.
- Keep calculations browser-local.
Testing
Test both formulas, default formula, all five zones, ascending lows, zone five high equal to max heart rate, age boundaries, and any new formula mode.
PR checklist
- npm test passes for heart-rate-zones.
- Pure calculation stays separate from display formatting.
- Copy presents outputs as estimates, not medical advice.
- Health or fitness input remains browser-local.