AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Compound Interest Agent Guide

Agent guide for future value, contribution totals, and interest earned with monthly contributions.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Compound Interest in the alexandrai-tools project.

Project overview

This guide covers src/tools/compound-interest/index.ts. The tool computes future value for a principal with configurable annual rate, horizon, compounding frequency, and optional monthly contribution. It returns futureValue, totalContributed, and interestEarned.

Primary source files

  • src/tools/compound-interest/index.ts defines meta, CompoundResult, and calcCompoundInterest.
  • src/tools/compound-interest/index.test.ts covers annual compounding, monthly compounding, zero-rate contributions, invalid years, negative principal, zero rate, and multi-year contributions.
  • src/tools/compound-interest/Body.astro owns browser inputs and result display.
  • src/tools/compound-interest/i18n.ts owns localized copy.
  • src/lib/tools.ts auto-discovers metadata.

Setup commands

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

Change rules

  • Return zeros for negative principal, non-positive years, or non-positive compoundsPerYear.
  • Use the lump-sum compound formula for principal.
  • Use the monthly annuity formula for positive monthly contributions and positive rate.
  • At zero rate, contributions should add linearly.
  • Keep totalContributed as principal plus monthly contribution times months.
  • Do not frame projections as guaranteed investment returns.
  • If contribution timing changes, such as beginning-of-period payments, update tests and copy.

Testing

Test annual compounding, monthly compounding, daily compounding if exposed, zero rate, zero contributions, positive contributions, invalid inputs, long horizons, and interestEarned as futureValue minus totalContributed.

PR checklist

  • npm test passes for compound-interest.
  • Pure calculation stays independent from UI formatting.
  • Browser-local behavior is preserved.
  • Copy does not present calculator output as personalized financial advice.