AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Conception Date Agent Guide

Agent guide for estimating conception from due date or LMP with UTC date arithmetic.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Conception Date in the alexandrai-tools project.

Project overview

This guide covers src/tools/conception-date. conceptionFromDueDate estimates conception as due date minus 266 days and estimates LMP as conception minus 14 days. conceptionFromLMP estimates conception as LMP plus 14 days and due date as LMP plus 280 days. The date helper uses UTC arithmetic and the validator checks date string shape.

Primary source files

  • src/tools/conception-date/index.ts defines meta, ConceptionResult, addDays, isValidISO, conceptionFromDueDate, and conceptionFromLMP.
  • src/tools/conception-date/index.test.ts covers due-date subtraction, LMP estimate, year boundary, leap year, LMP addition, due-date estimate, month boundary, and invalid strings.
  • src/tools/conception-date/Body.astro owns mode selection, date input, and result display.
  • src/tools/conception-date/i18n.ts owns localized labels and health-scope copy.
  • src/lib/tools.ts registers the tool metadata.

Setup commands

npm install npm test npm run typecheck npm run build npm run dev

Change rules

  • Use due date minus 266 days for due-date mode.
  • Estimate LMP as conception minus 14 days in due-date mode.
  • Use LMP plus 14 days for LMP mode.
  • Estimate due date as LMP plus 280 days in LMP mode.
  • Use UTC date arithmetic to avoid local timezone drift.
  • Do not overstate date certainty; this is an estimate.
  • If strict calendar validation is added, update tests for invalid months and days.

Testing

Test both modes, year boundaries, leap years, month boundaries, invalid strings, malformed date shapes, strict calendar validation if added, empty UI input, and health disclaimer copy.

PR checklist

  • npm test passes for conception-date.
  • Date, random, or hash behavior is documented exactly as implemented.
  • Health outputs remain framed as estimates, not medical decisions.
  • UI labels, validation, and pure helper tests stay aligned.