AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Love Calculator in the alexandrai-tools project.
Project overview
This guide covers src/tools/love-calculator. loveScore lowercases names, removes non-letter characters, sorts the normalized pair so input order does not matter, joins the pair with a null separator, hashes the string with a djb2-style 32-bit hash, and returns a score from zero through one hundred.
Primary source files
- src/tools/love-calculator/index.ts defines meta, hash, normalise, and loveScore.
- src/tools/love-calculator/index.test.ts covers determinism, score range, order independence, different pairs, case insensitivity, and empty names.
- src/tools/love-calculator/Body.astro owns name inputs and result display.
- src/tools/love-calculator/i18n.ts owns localized labels and entertainment-only 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
- Normalize names to lowercase.
- Strip non-ASCII letters from names before hashing.
- Sort normalized names so score is order-independent.
- Keep the null separator between the two normalized names.
- Return hash modulo 101 so the score is from zero through one hundred.
- Keep this tool explicitly entertainment-only.
- Do not replace deterministic output with non-repeatable randomness unless tests change.
Testing
Test determinism, order independence, case insensitivity, punctuation stripping, empty names, output range, unchanged score snapshots if desired, and entertainment-only copy.
PR checklist
- npm test passes for love-calculator.
- 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.