AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Rule Of 72 Agent Guide

Agent guide for investment doubling-time and implied-rate estimates using the Rule of 72.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Rule Of 72 in the alexandrai-tools project.

Project overview

This guide covers src/tools/rule-of-72. yearsToDouble returns 72 divided by annual rate percentage, and impliedRate returns 72 divided by target years. Both helpers return Infinity for non-positive denominator inputs.

Primary source files

  • src/tools/rule-of-72/index.ts defines meta, yearsToDouble, and impliedRate.
  • src/tools/rule-of-72/index.test.ts covers 8 percent, 6 percent, zero and negative rates, six years, nine years, and zero years.
  • src/tools/rule-of-72/Body.astro owns mode selection, input fields, and result display.
  • src/tools/rule-of-72/i18n.ts owns localized labels.
  • 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

  • Return Infinity when rate percentage is zero or negative.
  • Return Infinity when target years is zero or negative.
  • Use 72 as the approximation constant.
  • Do not mix exact compound-interest calculations into these helpers.
  • Keep percent display and rounding in UI code.
  • Present the result as an estimate, not investment advice.
  • Add a separate helper if exact compounding is introduced.

Testing

Test common rates, common year targets, zero and negative inputs, Infinity display, decimal rates, displayed rounding, mode switching, and finance disclaimer copy.

PR checklist

  • npm test passes for rule-of-72.
  • Calculator formulas, units, and rounding expectations are documented.
  • Currency and display formatting remain outside pure helpers.
  • Invalid-input behavior is covered by tests and UI validation.