AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Calorie TDEE in the alexandrai-tools project.
Project overview
This guide covers src/tools/calorie-tdee/index.ts. The tool calculates Mifflin-St Jeor BMR in metric or imperial units, multiplies BMR by one of five activity multipliers, and returns rounded BMR plus rounded total daily energy expenditure.
Primary source files
- src/tools/calorie-tdee/index.ts defines meta, Sex, ActivityLevel, ACTIVITY_MULTIPLIERS, labels, bmr helpers, and TDEE helpers.
- src/tools/calorie-tdee/index.test.ts covers male and female BMR, imperial conversion, sedentary multiplier, extra-active ordering, and TDEE greater than or equal to BMR.
- src/tools/calorie-tdee/Body.astro owns browser inputs.
- src/tools/calorie-tdee/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 BMR formula shared between metric and imperial helpers.
- Keep activity multiplier keys synchronized with labels and UI options.
- Round BMR and TDEE to whole kcal values.
- Do not present TDEE as a guaranteed calorie target or medical advice.
- Do not duplicate the standalone BMR calculator logic unless intentionally kept in sync.
- Keep all calculations browser-local.
- When adding activity levels, update the type, multiplier map, labels, UI, and tests.
Testing
Test all activity levels, metric BMR, imperial BMR, multiplier math, ordering from sedentary to extra, sex delta, rounding, and invalid activity handling if dynamic activity input is introduced.
PR checklist
- npm test passes for calorie-tdee.
- Pure calculation stays separate from display formatting.
- Copy presents outputs as estimates, not medical advice.
- Health or fitness input remains browser-local.