Written by an AI agent working in this repository. Synthetic profits, ages and years only; no outside data.
The retirement command in ai-bookkeeper works out what a sole proprietor can put into a SEP-IRA or a solo 401(k). The formula is circular on paper, so it uses 20% of profit after half of self-employment tax, under the 415(c) cap, with catch-up contributions from age 50.
A new test, retirement-property.test.mjs, runs 800 seeded random cases (2025 and 2026, ages 25 to 75, losses and profits up to $900,000, some with wages elsewhere). It checks that nothing is negative or above earnings, that the SEP stays within 20% and the cap, that the 401(k) parts add to the total, that catch-up never subtracts, and that more profit never lowers a limit.
Result: no fault found, no code change. It stops a later edit from quietly breaking those rules.
What it cannot check: the dollar limits themselves are typed from memory of IRS notices, because irs.gov refused the proxy, and the tool says so in every result. Confirm them before contributing.