@retiregolden/planner-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +181 -0
  3. package/package.json +77 -0
  4. package/src/App.tsx +246 -0
  5. package/src/RouteErrorBoundary.tsx +45 -0
  6. package/src/assets/hero.png +0 -0
  7. package/src/assets/react.svg +1 -0
  8. package/src/assets/vite.svg +1 -0
  9. package/src/data/fedInvestClient.ts +113 -0
  10. package/src/data/localStore.ts +42 -0
  11. package/src/data/planOrigin.ts +24 -0
  12. package/src/data/planStore.ts +165 -0
  13. package/src/data/v2Backup.ts +101 -0
  14. package/src/import/ImportPage.tsx +347 -0
  15. package/src/import/ReviewChecklistView.tsx +38 -0
  16. package/src/import/brokerCsv.ts +395 -0
  17. package/src/import/csv.ts +133 -0
  18. package/src/import/genericCsv.ts +224 -0
  19. package/src/import/projectionLab.ts +350 -0
  20. package/src/import/reviewChecklist.ts +33 -0
  21. package/src/import/tenForty.ts +275 -0
  22. package/src/index.css +630 -0
  23. package/src/index.ts +16 -0
  24. package/src/learn/ArticleBody.tsx +78 -0
  25. package/src/learn/ArticlePage.tsx +57 -0
  26. package/src/learn/GlossaryPage.tsx +33 -0
  27. package/src/learn/LearnAboutScreen.tsx +41 -0
  28. package/src/learn/LearnCards.tsx +41 -0
  29. package/src/learn/LearnLink.tsx +91 -0
  30. package/src/learn/LearningCenterPage.tsx +114 -0
  31. package/src/learn/SourcesPage.tsx +98 -0
  32. package/src/learn/components/ArticleFigure.tsx +34 -0
  33. package/src/learn/components/ArticleShell.tsx +86 -0
  34. package/src/learn/components/ComparisonTable.tsx +42 -0
  35. package/src/learn/components/FormulaBlock.tsx +34 -0
  36. package/src/learn/components/PurchasingPowerChart.tsx +41 -0
  37. package/src/learn/components/RelatedArticles.tsx +27 -0
  38. package/src/learn/components/ScenarioCard.tsx +24 -0
  39. package/src/learn/components/SourceList.tsx +23 -0
  40. package/src/learn/components/charts.tsx +21 -0
  41. package/src/learn/content/about-retiregolden.ts +100 -0
  42. package/src/learn/content/aca-premium-tax-credits-and-magi.ts +103 -0
  43. package/src/learn/content/account-types-overview.ts +106 -0
  44. package/src/learn/content/after-tax-estate.ts +111 -0
  45. package/src/learn/content/agi-magi-and-taxable-income.ts +112 -0
  46. package/src/learn/content/appealing-irmaa-ssa-44.ts +95 -0
  47. package/src/learn/content/assumption-general-inflation.ts +82 -0
  48. package/src/learn/content/assumption-healthcare-inflation.ts +85 -0
  49. package/src/learn/content/assumption-heir-tax-rate.ts +79 -0
  50. package/src/learn/content/assumption-investment-returns.ts +90 -0
  51. package/src/learn/content/assumption-longevity-planning-age.ts +78 -0
  52. package/src/learn/content/assumption-recent-magi.ts +83 -0
  53. package/src/learn/content/assumption-social-security-cola.ts +89 -0
  54. package/src/learn/content/assumption-social-security-trust-fund.ts +83 -0
  55. package/src/learn/content/assumption-state-tax-override.ts +79 -0
  56. package/src/learn/content/beneficiaries-and-account-titling.ts +99 -0
  57. package/src/learn/content/break-even-useful-lens.ts +94 -0
  58. package/src/learn/content/building-a-retirement-spending-budget.ts +100 -0
  59. package/src/learn/content/cola-and-inflation-protection.ts +102 -0
  60. package/src/learn/content/divorced-spousal-and-survivor-records.ts +104 -0
  61. package/src/learn/content/dynamic-spending-guardrails.ts +90 -0
  62. package/src/learn/content/earnings-test-before-fra.ts +100 -0
  63. package/src/learn/content/employer-match-and-contribution-order.ts +104 -0
  64. package/src/learn/content/examplePlanArticles.ts +525 -0
  65. package/src/learn/content/fees-expense-ratios-and-compounding-drag.ts +98 -0
  66. package/src/learn/content/fi-number-and-four-percent-rule.ts +64 -0
  67. package/src/learn/content/filling-a-tax-bracket-with-roth-conversions.ts +98 -0
  68. package/src/learn/content/funded-ratio.ts +70 -0
  69. package/src/learn/content/healthcare-after-65.ts +103 -0
  70. package/src/learn/content/healthcare-before-65.ts +104 -0
  71. package/src/learn/content/historical-vs-random-return-models.ts +101 -0
  72. package/src/learn/content/how-assumptions-change-the-answer.ts +105 -0
  73. package/src/learn/content/how-much-can-i-spend.ts +105 -0
  74. package/src/learn/content/how-social-security-is-taxed.ts +95 -0
  75. package/src/learn/content/how-the-optimizer-thinks.ts +102 -0
  76. package/src/learn/content/how-the-optimizer-values-after-tax-estate.ts +97 -0
  77. package/src/learn/content/how-to-model-accumulation.ts +67 -0
  78. package/src/learn/content/how-to-read-a-retirement-projection.ts +115 -0
  79. package/src/learn/content/hsas-and-qualified-medical-expenses.ts +108 -0
  80. package/src/learn/content/hsas-as-retirement-accounts.ts +101 -0
  81. package/src/learn/content/inflation-risk.ts +98 -0
  82. package/src/learn/content/inherited-ira-10-year-rule.ts +105 -0
  83. package/src/learn/content/insurance-in-your-retirement-plan.ts +103 -0
  84. package/src/learn/content/irmaa-two-year-lookback.ts +99 -0
  85. package/src/learn/content/long-term-care-costs-and-insurance.ts +103 -0
  86. package/src/learn/content/long-term-care-insurance-as-risk-transfer.ts +98 -0
  87. package/src/learn/content/longevity-risk.ts +99 -0
  88. package/src/learn/content/marginal-vs-effective-tax-rate.ts +98 -0
  89. package/src/learn/content/medicare-part-b-vs-part-d-irmaa.ts +102 -0
  90. package/src/learn/content/mortality-weighted-social-security.ts +113 -0
  91. package/src/learn/content/moving-to-retiregolden.ts +86 -0
  92. package/src/learn/content/niit-high-income-investment-tax.ts +98 -0
  93. package/src/learn/content/ordinary-income-vs-capital-gains.ts +103 -0
  94. package/src/learn/content/paying-conversion-taxes-taxable-vs-ira.ts +102 -0
  95. package/src/learn/content/pensions-and-annuities.ts +101 -0
  96. package/src/learn/content/permanent-life-insurance-in-a-plan.ts +106 -0
  97. package/src/learn/content/pia-aime-and-bend-points.ts +103 -0
  98. package/src/learn/content/planner-overview.ts +106 -0
  99. package/src/learn/content/planning-for-couples-and-survivor-years.ts +108 -0
  100. package/src/learn/content/privacy-what-stays-in-your-browser.ts +99 -0
  101. package/src/learn/content/qcds-qualified-charitable-distributions.ts +101 -0
  102. package/src/learn/content/reading-the-results-page.ts +96 -0
  103. package/src/learn/content/reading-the-social-security-analysis-page.ts +106 -0
  104. package/src/learn/content/real-estate-home-equity-and-debt.ts +100 -0
  105. package/src/learn/content/reports-csv-exports-and-sharing.ts +101 -0
  106. package/src/learn/content/risk-based-guardrails.ts +100 -0
  107. package/src/learn/content/rmds-required-minimum-distributions.ts +100 -0
  108. package/src/learn/content/roth-conversion-basics.ts +104 -0
  109. package/src/learn/content/rsus-and-espp.ts +101 -0
  110. package/src/learn/content/rule-of-55-and-72t.ts +107 -0
  111. package/src/learn/content/savings-rate-biggest-lever.ts +66 -0
  112. package/src/learn/content/seed-your-plan-from-your-tax-return.ts +93 -0
  113. package/src/learn/content/sensitivity-testing-what-changes-the-answer.ts +104 -0
  114. package/src/learn/content/sequence-of-returns-risk.ts +98 -0
  115. package/src/learn/content/social-security-bridge.ts +67 -0
  116. package/src/learn/content/social-security-claiming-age-basics.ts +113 -0
  117. package/src/learn/content/social-security-taxes-vs-benefits.ts +76 -0
  118. package/src/learn/content/spending-profiles-and-the-retirement-smile.ts +92 -0
  119. package/src/learn/content/spousal-and-survivor-benefits.ts +120 -0
  120. package/src/learn/content/ssdi-and-retirement-planning.ts +72 -0
  121. package/src/learn/content/standard-deduction-senior-deduction-and-itemizing.ts +97 -0
  122. package/src/learn/content/state-income-taxes-in-retirement.ts +97 -0
  123. package/src/learn/content/step-up-in-basis.ts +102 -0
  124. package/src/learn/content/survivor-planning-for-couples.ts +110 -0
  125. package/src/learn/content/survivor-spending-in-couple-plans.ts +98 -0
  126. package/src/learn/content/tax-cliffs-and-bracket-edges.ts +105 -0
  127. package/src/learn/content/tax-loss-and-gain-harvesting.ts +99 -0
  128. package/src/learn/content/taxable-brokerage-basis-and-capital-gains.ts +99 -0
  129. package/src/learn/content/three-big-questions-spending-time-risk.ts +103 -0
  130. package/src/learn/content/tips-ladders.ts +92 -0
  131. package/src/learn/content/todays-dollars-vs-future-dollars.ts +107 -0
  132. package/src/learn/content/traditional-vs-roth-contributions.ts +113 -0
  133. package/src/learn/content/troubleshooting-surprising-results.ts +105 -0
  134. package/src/learn/content/trust-fund-haircut-scenarios.ts +101 -0
  135. package/src/learn/content/understanding-monte-carlo-success-rate.ts +118 -0
  136. package/src/learn/content/understanding-your-plan-assumptions.ts +134 -0
  137. package/src/learn/content/using-assumptions-and-provenance.ts +98 -0
  138. package/src/learn/content/using-scenarios-to-compare-choices.ts +99 -0
  139. package/src/learn/content/what-changes-when-you-move-states.ts +141 -0
  140. package/src/learn/content/what-is-fire.ts +65 -0
  141. package/src/learn/content/what-monte-carlo-proves.ts +98 -0
  142. package/src/learn/content/what-retiregolden-models.ts +103 -0
  143. package/src/learn/content/what-retirement-healthcare-really-costs.ts +117 -0
  144. package/src/learn/content/why-95-percent-is-not-a-guarantee.ts +98 -0
  145. package/src/learn/content/why-roth-conversions-raise-other-costs.ts +106 -0
  146. package/src/learn/content/why-small-tax-cliffs-can-matter.ts +109 -0
  147. package/src/learn/content/widows-penalty-and-survivor-brackets.ts +106 -0
  148. package/src/learn/content/withdrawal-order-basics.ts +105 -0
  149. package/src/learn/glossary.ts +191 -0
  150. package/src/learn/inlineMarkdown.tsx +54 -0
  151. package/src/learn/learn.css +537 -0
  152. package/src/learn/learningRegistry.ts +502 -0
  153. package/src/longevity/LongevityResults.tsx +85 -0
  154. package/src/longevity/LongevityWizard.tsx +305 -0
  155. package/src/longevity/constants.ts +15 -0
  156. package/src/longevity/factors.ts +125 -0
  157. package/src/longevity/model.ts +31 -0
  158. package/src/longevity/persistedGuard.ts +129 -0
  159. package/src/longevity/storage.ts +40 -0
  160. package/src/mc/messages.ts +118 -0
  161. package/src/mc/monteCarlo.worker.ts +44 -0
  162. package/src/mc/pool.ts +267 -0
  163. package/src/mc/runRequest.ts +125 -0
  164. package/src/optimize/messages.ts +84 -0
  165. package/src/optimize/optimize.worker.ts +29 -0
  166. package/src/optimize/runOptimize.ts +92 -0
  167. package/src/optimize/runSpendingSolve.ts +47 -0
  168. package/src/optimize/runner.ts +21 -0
  169. package/src/optimize/spendingMessages.ts +44 -0
  170. package/src/optimize/spendingRunner.ts +21 -0
  171. package/src/optimize/spendingSolve.worker.ts +18 -0
  172. package/src/planner/AssumptionsCardPage.tsx +136 -0
  173. package/src/planner/BucketLensCard.tsx +114 -0
  174. package/src/planner/ComparePlansPage.tsx +219 -0
  175. package/src/planner/DisclaimerPage.tsx +88 -0
  176. package/src/planner/HowTestedPage.tsx +159 -0
  177. package/src/planner/LiveStatus.tsx +15 -0
  178. package/src/planner/LongevityModal.tsx +55 -0
  179. package/src/planner/Modal.tsx +97 -0
  180. package/src/planner/MonteCarloPage.tsx +907 -0
  181. package/src/planner/OptimizePage.tsx +611 -0
  182. package/src/planner/PlanContext.tsx +198 -0
  183. package/src/planner/PlanPickerPage.tsx +124 -0
  184. package/src/planner/PlanWorkspace.tsx +290 -0
  185. package/src/planner/ProvenancePanel.tsx +45 -0
  186. package/src/planner/RelocationComparePage.tsx +485 -0
  187. package/src/planner/ReportPage.tsx +375 -0
  188. package/src/planner/ResultsPage.tsx +817 -0
  189. package/src/planner/ScenariosPage.tsx +285 -0
  190. package/src/planner/SocialSecuritySection.tsx +556 -0
  191. package/src/planner/SpendingSolverPage.tsx +512 -0
  192. package/src/planner/SsAnalysisPage.tsx +1134 -0
  193. package/src/planner/SurvivalPercentileModal.tsx +161 -0
  194. package/src/planner/SurvivorTransitionPage.tsx +286 -0
  195. package/src/planner/assumptionsExport.ts +371 -0
  196. package/src/planner/bucketLens.ts +89 -0
  197. package/src/planner/chartFrame.ts +8 -0
  198. package/src/planner/chartStyle.ts +11 -0
  199. package/src/planner/dialogViews.tsx +184 -0
  200. package/src/planner/dialogs.tsx +133 -0
  201. package/src/planner/examples/ExampleLibrary.tsx +189 -0
  202. package/src/planner/examples/ExamplePreviewBanner.tsx +55 -0
  203. package/src/planner/examples/ExamplesPage.tsx +25 -0
  204. package/src/planner/examples/OpenExampleButton.tsx +61 -0
  205. package/src/planner/examples/buildAggressiveSaver.ts +102 -0
  206. package/src/planner/examples/buildAnnuityEstate.ts +137 -0
  207. package/src/planner/examples/buildBaristaFire.ts +115 -0
  208. package/src/planner/examples/buildBracketFillRoth.ts +65 -0
  209. package/src/planner/examples/buildBridgeEarlyRetirement.ts +94 -0
  210. package/src/planner/examples/buildBrokerageNoHsa.ts +109 -0
  211. package/src/planner/examples/buildCoastFire.ts +88 -0
  212. package/src/planner/examples/buildContext.ts +20 -0
  213. package/src/planner/examples/buildEarlyCareerMatch.ts +93 -0
  214. package/src/planner/examples/buildEarlyRetireeAca.ts +61 -0
  215. package/src/planner/examples/buildExampleCouple.ts +103 -0
  216. package/src/planner/examples/buildFixedTargetSpending.ts +74 -0
  217. package/src/planner/examples/buildGlidepathAllocation.ts +131 -0
  218. package/src/planner/examples/buildGuardrailsFlex.ts +120 -0
  219. package/src/planner/examples/buildHsaPropertyDepth.ts +109 -0
  220. package/src/planner/examples/buildHsaStealthRetirement.ts +97 -0
  221. package/src/planner/examples/buildLeanFatFire.ts +109 -0
  222. package/src/planner/examples/buildLtcShock.ts +62 -0
  223. package/src/planner/examples/buildMovingStateTax.ts +53 -0
  224. package/src/planner/examples/buildNoAnnuityBrokerage.ts +92 -0
  225. package/src/planner/examples/buildRmdIrmaa.ts +55 -0
  226. package/src/planner/examples/buildSalaryGrowthEscalation.ts +96 -0
  227. package/src/planner/examples/buildStaticAllocationControl.ts +96 -0
  228. package/src/planner/examples/buildSurvivorYears.ts +62 -0
  229. package/src/planner/examples/buildUnderSavedSingle.ts +51 -0
  230. package/src/planner/examples/exampleCopy.ts +23 -0
  231. package/src/planner/examples/loadExample.ts +90 -0
  232. package/src/planner/examples/registry.ts +313 -0
  233. package/src/planner/explainPanels.tsx +233 -0
  234. package/src/planner/fields.tsx +381 -0
  235. package/src/planner/format.ts +33 -0
  236. package/src/planner/home/DataAndPrivacyCard.tsx +56 -0
  237. package/src/planner/home/GettingStartedPaths.tsx +46 -0
  238. package/src/planner/home/GettingStartedReopener.tsx +32 -0
  239. package/src/planner/home/StartHereLinks.tsx +22 -0
  240. package/src/planner/home/WelcomeHero.tsx +39 -0
  241. package/src/planner/home/YourPlans.tsx +72 -0
  242. package/src/planner/home/importErrorMessage.ts +22 -0
  243. package/src/planner/home/startHereSlugs.ts +7 -0
  244. package/src/planner/home/useHomeData.ts +190 -0
  245. package/src/planner/home/useHomeMode.ts +47 -0
  246. package/src/planner/householdActions.ts +22 -0
  247. package/src/planner/insights/InsightCardView.tsx +340 -0
  248. package/src/planner/insights/InsightsPage.tsx +204 -0
  249. package/src/planner/insights/categoryLabels.ts +11 -0
  250. package/src/planner/learnLinks.ts +85 -0
  251. package/src/planner/marketModelPicker.ts +172 -0
  252. package/src/planner/optimizePageChart.ts +40 -0
  253. package/src/planner/optimizePageClaim.ts +64 -0
  254. package/src/planner/planCompleteness.ts +27 -0
  255. package/src/planner/planContextCore.ts +26 -0
  256. package/src/planner/planner.css +2304 -0
  257. package/src/planner/provenanceLinks.ts +25 -0
  258. package/src/planner/sections/AccountFields.tsx +872 -0
  259. package/src/planner/sections/AccountsSection.tsx +89 -0
  260. package/src/planner/sections/AllocationPanel.tsx +261 -0
  261. package/src/planner/sections/AssumptionsSection.tsx +256 -0
  262. package/src/planner/sections/HouseholdSection.tsx +243 -0
  263. package/src/planner/sections/IncomeFloorSection.tsx +418 -0
  264. package/src/planner/sections/IncomeSection.tsx +170 -0
  265. package/src/planner/sections/InsuranceSection.tsx +362 -0
  266. package/src/planner/sections/SpendingSection.tsx +904 -0
  267. package/src/planner/sections/StrategySection.tsx +349 -0
  268. package/src/planner/sections/UpdateBalancesPanel.tsx +182 -0
  269. package/src/planner/sections/sectionHelpers.ts +48 -0
  270. package/src/planner/sections/shared.tsx +15 -0
  271. package/src/planner/sections.tsx +15 -0
  272. package/src/planner/ssAnalysis.ts +325 -0
  273. package/src/planner/successBand.ts +20 -0
  274. package/src/planner/survivorAnalysis.ts +277 -0
  275. package/src/planner/usStates.ts +19 -0
  276. package/src/planner/useMcSuccessRate.ts +77 -0
  277. package/src/planner/useProjection.ts +63 -0
  278. package/src/relocation/messages.ts +21 -0
  279. package/src/relocation/relocation.worker.ts +18 -0
  280. package/src/relocation/runRelocation.ts +17 -0
  281. package/src/relocation/runner.ts +22 -0
  282. package/src/report/brandingContext.ts +15 -0
  283. package/src/report/downloadReport.ts +34 -0
  284. package/src/report/reportHtml.ts +547 -0
  285. package/src/routes/LearnRoutes.tsx +46 -0
  286. package/src/routes/PlanRoutes.tsx +55 -0
  287. package/src/routes/RouteFallback.tsx +9 -0
  288. package/src/socialSecurity/breakEven.ts +107 -0
  289. package/src/socialSecurity/expectedPv.ts +164 -0
  290. package/src/socialSecurity/explain.ts +92 -0
  291. package/src/socialSecurity/ficaReturn.ts +81 -0
  292. package/src/socialSecurity/persistedSsGuard.ts +138 -0
  293. package/src/socialSecurity/ssFormUtils.ts +48 -0
  294. package/src/socialSecurity/ssaStatementXml.ts +156 -0
  295. package/src/socialSecurity/storage.ts +69 -0
  296. package/src/socialSecurity/survivorSwitching.ts +153 -0
  297. package/src/testSupport/samplePlan.ts +2 -0
  298. package/src/workers/run.ts +45 -0
@@ -0,0 +1,137 @@
1
+ /** Annuity purchases + estate beneficiaries — demonstrates guaranteed income (SPIA/QLAC),
2
+ * purchase funding, exclusion ratio / RMD relief, and per-account beneficiary modeling for
3
+ * estate calculations (spouse rollover vs charity vs non-spouse).
4
+ * Positive case for estate/guaranteed-income depth enhancement.
5
+ */
6
+
7
+ import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
8
+ import { EXAMPLE_FIXED_YEAR, exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
9
+
10
+ const EXAMPLE_ID = 'annuity-purchases-estate'
11
+
12
+ export function buildAnnuityEstate(): Plan {
13
+ const me = exampleEntityId(EXAMPLE_ID, 'me')
14
+ const partner = exampleEntityId(EXAMPLE_ID, 'partner')
15
+ const plan = createEmptyPlan({ name: 'Annuity ladder with estate planning', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
16
+
17
+ plan.household = {
18
+ filingStatus: 'marriedFilingJointly',
19
+ hasQualifyingDependent: false,
20
+ state: 'FL',
21
+ stateMoves: [],
22
+ capitalLossCarryforward: 0,
23
+ people: [
24
+ { id: me, name: 'Jordan', dob: '1961-03-10', sex: 'male', retirementAge: 65, longevity: { planningAge: 90, source: 'manual' } },
25
+ { id: partner, name: 'Taylor', dob: '1963-11-22', sex: 'female', retirementAge: 64, longevity: { planningAge: 93, source: 'manual' } },
26
+ ],
27
+ }
28
+
29
+ // Accounts including annuity purchases funded correctly per rules
30
+ const cashId = exampleEntityId(EXAMPLE_ID, 'cash')
31
+ const tiraId = exampleEntityId(EXAMPLE_ID, 'tira')
32
+ plan.accounts = [
33
+ { type: 'cash', id: cashId, name: 'Emergency cash', ownerPersonId: null, annualReturnPct: 2, balance: 315_000, annualContribution: 0 },
34
+ { type: 'traditional', id: tiraId, name: 'Jordan traditional IRA', ownerPersonId: me, annualReturnPct: null, kind: 'ira', balance: 915_000, annualContribution: 0, estateBeneficiary: { destination: 'spouse' } },
35
+ // SPIA non-qualified funded from cash
36
+ {
37
+ type: 'annuity',
38
+ id: exampleEntityId(EXAMPLE_ID, 'spiA'),
39
+ name: 'SPIA (non-qualified)',
40
+ ownerPersonId: null,
41
+ annualReturnPct: null,
42
+ startAge: 66,
43
+ monthlyAmount: 1450,
44
+ colaPct: 0,
45
+ taxablePct: 35,
46
+ purchase: {
47
+ year: EXAMPLE_FIXED_YEAR + 1,
48
+ premium: 220_000,
49
+ fundingAccountId: cashId,
50
+ taxQualification: 'nonQualified',
51
+ },
52
+ estateBeneficiary: { destination: 'charity', charityPct: 100 },
53
+ },
54
+ // QLAC qualified funded from traditional
55
+ {
56
+ type: 'annuity',
57
+ id: exampleEntityId(EXAMPLE_ID, 'qlac'),
58
+ name: 'QLAC (qualified deferred)',
59
+ ownerPersonId: null,
60
+ annualReturnPct: null,
61
+ startAge: 80,
62
+ monthlyAmount: 920,
63
+ colaPct: 2.5,
64
+ taxablePct: 100,
65
+ purchase: {
66
+ year: EXAMPLE_FIXED_YEAR + 2,
67
+ premium: 135_000,
68
+ fundingAccountId: tiraId,
69
+ taxQualification: 'qualified',
70
+ qlac: true,
71
+ },
72
+ },
73
+ { type: 'traditional', id: exampleEntityId(EXAMPLE_ID, '401k'), name: 'Jordan 401k', ownerPersonId: me, annualReturnPct: null, kind: 'employer', balance: 310_000, annualContribution: 0, estateBeneficiary: { destination: 'nonSpouse' } },
74
+ { type: 'roth', id: exampleEntityId(EXAMPLE_ID, 'roth'), name: 'Roth IRA', ownerPersonId: me, annualReturnPct: null, kind: 'ira', balance: 50_000, annualContribution: 0 },
75
+ ]
76
+
77
+ plan.incomes = [
78
+ { type: 'socialSecurity', id: exampleEntityId(EXAMPLE_ID, 'ss-j'), personId: me, piaMonthly: 2650, earnings: null, claimAge: { years: 70, months: 0 } },
79
+ { type: 'socialSecurity', id: exampleEntityId(EXAMPLE_ID, 'ss-t'), personId: partner, piaMonthly: 1720, earnings: null, claimAge: { years: 67, months: 0 } },
80
+ ]
81
+
82
+ // Pension as account (not income)
83
+ type PensionAccount = Extract<Plan['accounts'][number], { type: 'pension' }>
84
+ const pension: PensionAccount = {
85
+ type: 'pension',
86
+ id: exampleEntityId(EXAMPLE_ID, 'pension'),
87
+ name: 'Pension (Jordan)',
88
+ ownerPersonId: me,
89
+ annualReturnPct: null,
90
+ startAge: 65,
91
+ monthlyAmount: 1500,
92
+ colaPct: 2.0,
93
+ survivorPct: 50,
94
+ }
95
+ plan.accounts.push(pension)
96
+
97
+ plan.expenses = {
98
+ baseAnnual: 78_000,
99
+ phases: [
100
+ { fromAge: 75, multiplier: 0.88 },
101
+ ],
102
+ oneTimeGoals: [],
103
+ healthcare: { pre65MonthlyPremiumPerPerson: 880, applyAcaCredit: false, medicareExtrasMonthlyPerPerson: 210 },
104
+ }
105
+
106
+ plan.strategies = {
107
+ withdrawalOrder: { mode: 'sequential' },
108
+ rothConversion: { mode: 'fillToTarget', target: 'topOfBracket', targetValue: 24, startYear: EXAMPLE_FIXED_YEAR + 1, endYear: EXAMPLE_FIXED_YEAR + 7 },
109
+ qcdAnnual: 5000,
110
+ }
111
+
112
+ plan.assumptions = {
113
+ inflationPct: 2.3,
114
+ healthcareExtraInflationPct: 3,
115
+ defaultReturnPct: 5.2,
116
+ ssCola: { mode: 'matchInflation' },
117
+ ssHaircut: null,
118
+ stateEffectiveTaxPct: 0,
119
+ localIncomeTaxPct: 0,
120
+ recentAnnualMagi: 120_000,
121
+ heirTaxRatePct: 28,
122
+ safeWithdrawalRatePct: 3.5,
123
+ }
124
+
125
+ // Scenario: no Roth conversions (for A-B comparison of annuity effect)
126
+ plan.scenarios = [
127
+ {
128
+ id: exampleEntityId(EXAMPLE_ID, 'no-conversion'),
129
+ name: 'No Roth conversions (manual compare)',
130
+ patch: { strategies: { rothConversion: { mode: 'none' } } },
131
+ },
132
+ ]
133
+
134
+ const parsed = parsePlan(plan)
135
+ if (!parsed.ok) throw new Error(`annuity-purchases-estate invalid: ${parsed.issues.join('; ')}`)
136
+ return parsed.plan
137
+ }
@@ -0,0 +1,115 @@
1
+ import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
2
+ import { exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
3
+
4
+ const EXAMPLE_ID = 'barista-fire'
5
+
6
+ export function buildBaristaFire(): Plan {
7
+ const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
8
+ const plan = createEmptyPlan({ name: 'Barista FIRE', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
9
+ plan.household = {
10
+ filingStatus: 'single',
11
+ hasQualifyingDependent: false,
12
+ state: 'OR',
13
+ stateMoves: [],
14
+ capitalLossCarryforward: 0,
15
+ people: [
16
+ { id: p1, name: 'Robin', dob: '1996-01-01', sex: 'average', retirementAge: 40, longevity: { planningAge: 90, source: 'manual' } },
17
+ ],
18
+ }
19
+
20
+ // Born 1996. Current year is 2026. Age is 30.
21
+ // Turns 40 in 2036. Turns 65 in 2061.
22
+ const startYear = 2026
23
+ const turn40Year = startYear + 10
24
+ const turn65Year = startYear + 35
25
+
26
+ plan.accounts = [
27
+ {
28
+ type: 'traditional',
29
+ id: exampleEntityId(EXAMPLE_ID, 'pretax-401k'),
30
+ name: 'Pre-tax 401(k)',
31
+ ownerPersonId: p1,
32
+ annualReturnPct: 7.5,
33
+ kind: 'employer',
34
+ balance: 120_000,
35
+ annualContribution: 18_000,
36
+ },
37
+ {
38
+ type: 'roth',
39
+ id: exampleEntityId(EXAMPLE_ID, 'roth-ira'),
40
+ name: 'Roth IRA',
41
+ ownerPersonId: p1,
42
+ annualReturnPct: 7.5,
43
+ kind: 'ira',
44
+ balance: 30_000,
45
+ annualContribution: 5_000,
46
+ },
47
+ {
48
+ type: 'taxable',
49
+ id: exampleEntityId(EXAMPLE_ID, 'taxable-brokerage'),
50
+ name: 'Taxable Brokerage',
51
+ ownerPersonId: null,
52
+ annualReturnPct: 7.5,
53
+ balance: 100_000,
54
+ costBasis: 80_000,
55
+ annualContribution: 10_000,
56
+ contributionSchedule: [
57
+ {
58
+ annualAmount: 10_000,
59
+ fromAge: 30,
60
+ toAge: 40,
61
+ escalationPct: 0,
62
+ },
63
+ ],
64
+ },
65
+ ]
66
+ plan.incomes = [
67
+ {
68
+ type: 'wages',
69
+ id: exampleEntityId(EXAMPLE_ID, 'primary-wages'),
70
+ personId: p1,
71
+ annualGross: 95_000,
72
+ endAge: 40,
73
+ realGrowthPct: 3,
74
+ },
75
+ {
76
+ type: 'socialSecurity',
77
+ id: exampleEntityId(EXAMPLE_ID, 'ss'),
78
+ personId: p1,
79
+ piaMonthly: 2_300,
80
+ earnings: null,
81
+ claimAge: { years: 67, months: 0 },
82
+ },
83
+ {
84
+ type: 'recurring',
85
+ id: exampleEntityId(EXAMPLE_ID, 'barista-job'),
86
+ label: 'Barista part-time work',
87
+ annualAmount: 35_000,
88
+ startYear: turn40Year,
89
+ endYear: turn65Year,
90
+ inflationAdjusted: true,
91
+ taxTreatment: 'ordinary',
92
+ },
93
+ ]
94
+ plan.expenses = {
95
+ baseAnnual: 45_000,
96
+ phases: [],
97
+ oneTimeGoals: [],
98
+ healthcare: { pre65MonthlyPremiumPerPerson: 550, applyAcaCredit: true, medicareExtrasMonthlyPerPerson: 200 },
99
+ }
100
+ plan.assumptions = {
101
+ inflationPct: 2.5,
102
+ healthcareExtraInflationPct: 2,
103
+ defaultReturnPct: 6,
104
+ ssCola: { mode: 'matchInflation' },
105
+ ssHaircut: null,
106
+ stateEffectiveTaxPct: 0,
107
+ localIncomeTaxPct: 0,
108
+ recentAnnualMagi: 95_000,
109
+ heirTaxRatePct: 25,
110
+ safeWithdrawalRatePct: 4,
111
+ }
112
+ const parsed = parsePlan(plan)
113
+ if (!parsed.ok) throw new Error(`barista-fire invalid: ${parsed.issues.join('; ')}`)
114
+ return parsed.plan
115
+ }
@@ -0,0 +1,65 @@
1
+ /** Bracket-fill Roth conversions — converting up to a bracket top. */
2
+
3
+ import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
4
+ import { EXAMPLE_FIXED_YEAR, exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
5
+
6
+ const EXAMPLE_ID = 'bracket-fill-roth'
7
+
8
+ export function buildBracketFillRoth(): Plan {
9
+ const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
10
+ const p2 = exampleEntityId(EXAMPLE_ID, 'p2')
11
+ const plan = createEmptyPlan({ name: 'Bracket-fill Roth conversions', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
12
+ plan.household = {
13
+ filingStatus: 'marriedFilingJointly',
14
+ hasQualifyingDependent: false,
15
+ state: 'FL',
16
+ stateMoves: [],
17
+ capitalLossCarryforward: 0,
18
+ people: [
19
+ { id: p1, name: 'Morgan', dob: '1953-01-01', sex: 'male', retirementAge: 65, longevity: { planningAge: 92, source: 'manual' } },
20
+ { id: p2, name: 'Riley', dob: '1955-01-01', sex: 'female', retirementAge: 65, longevity: { planningAge: 94, source: 'manual' } },
21
+ ],
22
+ }
23
+ plan.accounts = [
24
+ { type: 'cash', id: exampleEntityId(EXAMPLE_ID, 'cash'), name: 'Cash reserve', ownerPersonId: null, annualReturnPct: 2, balance: 80_000, annualContribution: 0 },
25
+ { type: 'traditional', id: exampleEntityId(EXAMPLE_ID, 'ira-m'), name: 'Morgan IRA', ownerPersonId: p1, annualReturnPct: null, kind: 'ira', balance: 700_000, annualContribution: 0 },
26
+ { type: 'traditional', id: exampleEntityId(EXAMPLE_ID, 'ira-r'), name: 'Riley IRA', ownerPersonId: p2, annualReturnPct: null, kind: 'ira', balance: 400_000, annualContribution: 0 },
27
+ { type: 'roth', id: exampleEntityId(EXAMPLE_ID, 'roth'), name: 'Morgan Roth IRA', ownerPersonId: p1, annualReturnPct: null, kind: 'ira', balance: 50_000, annualContribution: 0 },
28
+ ]
29
+ plan.incomes = [
30
+ { type: 'socialSecurity', id: exampleEntityId(EXAMPLE_ID, 'ss-m'), personId: p1, piaMonthly: 2_500, earnings: null, claimAge: { years: 67, months: 0 } },
31
+ { type: 'socialSecurity', id: exampleEntityId(EXAMPLE_ID, 'ss-r'), personId: p2, piaMonthly: 1_800, earnings: null, claimAge: { years: 67, months: 0 } },
32
+ ]
33
+ plan.expenses = {
34
+ baseAnnual: 90_000,
35
+ phases: [{ fromAge: 80, multiplier: 0.85 }],
36
+ oneTimeGoals: [],
37
+ healthcare: { pre65MonthlyPremiumPerPerson: 0, applyAcaCredit: false, medicareExtrasMonthlyPerPerson: 250 },
38
+ }
39
+ plan.strategies = {
40
+ withdrawalOrder: { mode: 'sequential' },
41
+ rothConversion: {
42
+ mode: 'fillToTarget',
43
+ target: 'topOfBracket',
44
+ targetValue: 22,
45
+ startYear: EXAMPLE_FIXED_YEAR,
46
+ endYear: EXAMPLE_FIXED_YEAR + 8,
47
+ },
48
+ qcdAnnual: 10_000,
49
+ }
50
+ plan.assumptions = {
51
+ inflationPct: 2.5,
52
+ healthcareExtraInflationPct: 3,
53
+ defaultReturnPct: 5,
54
+ ssCola: { mode: 'matchInflation' },
55
+ ssHaircut: null,
56
+ stateEffectiveTaxPct: 0,
57
+ localIncomeTaxPct: 0,
58
+ recentAnnualMagi: 0,
59
+ heirTaxRatePct: 25,
60
+ safeWithdrawalRatePct: 4,
61
+ }
62
+ const parsed = parsePlan(plan)
63
+ if (!parsed.ok) throw new Error(`bracket-fill roth invalid: ${parsed.issues.join('; ')}`)
64
+ return parsed.plan
65
+ }
@@ -0,0 +1,94 @@
1
+ import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
2
+ import { exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
3
+
4
+ const EXAMPLE_ID = 'bridge-early-retirement'
5
+
6
+ export function buildBridgeEarlyRetirement(): Plan {
7
+ const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
8
+ const plan = createEmptyPlan({ name: 'Bridge to 59½ (SEPP)', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
9
+ plan.household = {
10
+ filingStatus: 'single',
11
+ hasQualifyingDependent: false,
12
+ state: 'CA',
13
+ stateMoves: [],
14
+ capitalLossCarryforward: 0,
15
+ people: [
16
+ { id: p1, name: 'Jordan', dob: '1981-01-01', sex: 'average', retirementAge: 45, longevity: { planningAge: 90, source: 'manual' } },
17
+ ],
18
+ }
19
+ plan.accounts = [
20
+ {
21
+ type: 'traditional',
22
+ id: exampleEntityId(EXAMPLE_ID, 'traditional-401k'),
23
+ name: 'Traditional IRA (SEPP)',
24
+ ownerPersonId: p1,
25
+ annualReturnPct: 7.5,
26
+ kind: 'ira',
27
+ balance: 1_200_000,
28
+ annualContribution: 0,
29
+ sepp: {
30
+ startAge: 45,
31
+ method: 'amortization',
32
+ },
33
+ },
34
+ {
35
+ type: 'roth',
36
+ id: exampleEntityId(EXAMPLE_ID, 'roth-ira'),
37
+ name: 'Roth IRA',
38
+ ownerPersonId: p1,
39
+ annualReturnPct: 7.5,
40
+ kind: 'ira',
41
+ balance: 125_000,
42
+ annualContribution: 0,
43
+ },
44
+ {
45
+ type: 'taxable',
46
+ id: exampleEntityId(EXAMPLE_ID, 'taxable-brokerage'),
47
+ name: 'Taxable Brokerage',
48
+ ownerPersonId: null,
49
+ annualReturnPct: 7,
50
+ balance: 250_000,
51
+ costBasis: 200_000,
52
+ annualContribution: 0,
53
+ },
54
+ ]
55
+ plan.incomes = [
56
+ {
57
+ type: 'wages',
58
+ id: exampleEntityId(EXAMPLE_ID, 'wages'),
59
+ personId: p1,
60
+ annualGross: 140_000,
61
+ endAge: 44,
62
+ realGrowthPct: 4,
63
+ },
64
+ {
65
+ type: 'socialSecurity',
66
+ id: exampleEntityId(EXAMPLE_ID, 'ss'),
67
+ personId: p1,
68
+ piaMonthly: 2_900,
69
+ earnings: null,
70
+ claimAge: { years: 67, months: 0 },
71
+ },
72
+ ]
73
+ plan.expenses = {
74
+ baseAnnual: 50_000,
75
+ phases: [],
76
+ oneTimeGoals: [],
77
+ healthcare: { pre65MonthlyPremiumPerPerson: 600, applyAcaCredit: true, medicareExtrasMonthlyPerPerson: 200 },
78
+ }
79
+ plan.assumptions = {
80
+ inflationPct: 2.5,
81
+ healthcareExtraInflationPct: 2,
82
+ defaultReturnPct: 6,
83
+ ssCola: { mode: 'matchInflation' },
84
+ ssHaircut: null,
85
+ stateEffectiveTaxPct: 0,
86
+ localIncomeTaxPct: 0,
87
+ recentAnnualMagi: 60_000,
88
+ heirTaxRatePct: 25,
89
+ safeWithdrawalRatePct: 4,
90
+ }
91
+ const parsed = parsePlan(plan)
92
+ if (!parsed.ok) throw new Error(`bridge-early-retirement invalid: ${parsed.issues.join('; ')}`)
93
+ return parsed.plan
94
+ }
@@ -0,0 +1,109 @@
1
+ /** Brokerage instead of HSA control (A-B pair for HSA depth).
2
+ * Same person, longevity, expenses, incomes, property sale, traditional IRA (with basis),
3
+ * but the HSA balance + contributions are instead held in a taxable brokerage account.
4
+ * Compare to hsa-property-depth to see the tax-free medical withdrawal + reimburse
5
+ * advantage vs ordinary taxable growth/withdrawals.
6
+ */
7
+
8
+ import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
9
+ import { EXAMPLE_FIXED_YEAR, exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
10
+
11
+ const EXAMPLE_ID = 'brokerage-no-hsa'
12
+
13
+ export function buildBrokerageNoHsa(): Plan {
14
+ const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
15
+ const plan = createEmptyPlan({ name: 'Brokerage instead of HSA', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
16
+
17
+ plan.household = {
18
+ filingStatus: 'single',
19
+ hasQualifyingDependent: false,
20
+ state: 'TX',
21
+ stateMoves: [],
22
+ capitalLossCarryforward: 0,
23
+ people: [
24
+ { id: p1, name: 'Harper', dob: '1964-02-28', sex: 'female', retirementAge: 61, longevity: { planningAge: 89, source: 'manual' } },
25
+ ],
26
+ }
27
+
28
+ // HSA 48k + future contribs moved into taxable brokerage
29
+ // (48k initial + roughly equivalent ongoing contribution capacity)
30
+ plan.accounts = [
31
+ {
32
+ type: 'taxable',
33
+ id: exampleEntityId(EXAMPLE_ID, 'brokerage'),
34
+ name: 'Taxable brokerage (HSA-equivalent money)',
35
+ ownerPersonId: null,
36
+ annualReturnPct: null,
37
+ balance: 48_000,
38
+ costBasis: 48_000,
39
+ annualContribution: 4150, // same ongoing "savings" rate as HSA contrib
40
+ contributionSchedule: [{ annualAmount: 4150, fromAge: 61, toAge: 65, escalationPct: 0 }],
41
+ },
42
+ {
43
+ type: 'traditional',
44
+ id: exampleEntityId(EXAMPLE_ID, 'tira'),
45
+ name: 'Traditional IRA (mixed basis)',
46
+ ownerPersonId: p1,
47
+ annualReturnPct: null,
48
+ kind: 'ira',
49
+ balance: 310_000,
50
+ nondeductibleBasis: 68000,
51
+ annualContribution: 0,
52
+ },
53
+ {
54
+ type: 'property',
55
+ id: exampleEntityId(EXAMPLE_ID, 'home'),
56
+ name: 'Primary residence',
57
+ ownerPersonId: null,
58
+ annualReturnPct: null,
59
+ value: 385_000,
60
+ plannedSaleYear: EXAMPLE_FIXED_YEAR + 7,
61
+ expectedNetProceeds: null,
62
+ costBasis: 172_000,
63
+ sellingCostPct: 6,
64
+ primaryResidence: true,
65
+ depreciationRecapture: 12000,
66
+ propertyTaxAnnual: 4800,
67
+ insuranceAnnual: 2100,
68
+ },
69
+ { type: 'cash', id: exampleEntityId(EXAMPLE_ID, 'cash'), name: 'Cash', ownerPersonId: null, annualReturnPct: 1.8, balance: 62_000, annualContribution: 0 },
70
+ ]
71
+
72
+ plan.careEvents = [
73
+ { id: exampleEntityId(EXAMPLE_ID, 'care'), personId: p1, startAge: 82, durationYears: 2, annualCost: 72000 },
74
+ ]
75
+
76
+ plan.expenses = {
77
+ baseAnnual: 51_000,
78
+ phases: [],
79
+ oneTimeGoals: [],
80
+ healthcare: { pre65MonthlyPremiumPerPerson: 690, applyAcaCredit: true, medicareExtrasMonthlyPerPerson: 165 },
81
+ }
82
+
83
+ plan.incomes = [
84
+ { type: 'socialSecurity', id: exampleEntityId(EXAMPLE_ID, 'ss'), personId: p1, piaMonthly: 1720, earnings: null, claimAge: { years: 67, months: 0 } },
85
+ ]
86
+
87
+ plan.strategies = {
88
+ withdrawalOrder: { mode: 'sequential' },
89
+ rothConversion: { mode: 'fillToTarget', target: 'topOfBracket', targetValue: 24, startYear: EXAMPLE_FIXED_YEAR + 3, endYear: EXAMPLE_FIXED_YEAR + 11 },
90
+ qcdAnnual: 0,
91
+ }
92
+
93
+ plan.assumptions = {
94
+ inflationPct: 2.6,
95
+ healthcareExtraInflationPct: 3.4,
96
+ defaultReturnPct: 4.9,
97
+ ssCola: { mode: 'matchInflation' },
98
+ ssHaircut: null,
99
+ stateEffectiveTaxPct: 0,
100
+ localIncomeTaxPct: 0,
101
+ recentAnnualMagi: 42000,
102
+ heirTaxRatePct: 22,
103
+ safeWithdrawalRatePct: 3.6,
104
+ }
105
+
106
+ const parsed = parsePlan(plan)
107
+ if (!parsed.ok) throw new Error(`brokerage-no-hsa invalid: ${parsed.issues.join('; ')}`)
108
+ return parsed.plan
109
+ }
@@ -0,0 +1,88 @@
1
+ import { createEmptyPlan, parsePlan, type Plan } from '@retiregolden/engine/model/plan'
2
+ import { exampleEntityId, exampleFixedNow, exampleIdFactory } from './buildContext'
3
+
4
+ const EXAMPLE_ID = 'coast-fire'
5
+
6
+ export function buildCoastFire(): Plan {
7
+ const p1 = exampleEntityId(EXAMPLE_ID, 'p1')
8
+ const plan = createEmptyPlan({ name: 'Coast FIRE', now: exampleFixedNow, newId: exampleIdFactory(EXAMPLE_ID) })
9
+ plan.household = {
10
+ filingStatus: 'single',
11
+ hasQualifyingDependent: false,
12
+ state: 'CO',
13
+ stateMoves: [],
14
+ capitalLossCarryforward: 0,
15
+ people: [
16
+ { id: p1, name: 'Morgan', dob: '1996-01-01', sex: 'average', retirementAge: 60, longevity: { planningAge: 90, source: 'manual' } },
17
+ ],
18
+ }
19
+ plan.accounts = [
20
+ {
21
+ type: 'traditional',
22
+ id: exampleEntityId(EXAMPLE_ID, 'ira'),
23
+ name: 'Traditional IRA',
24
+ ownerPersonId: p1,
25
+ annualReturnPct: 7.5,
26
+ kind: 'ira',
27
+ balance: 150_000,
28
+ annualContribution: 0,
29
+ contributionSchedule: [
30
+ {
31
+ annualAmount: 25_000,
32
+ fromAge: 30,
33
+ toAge: 40,
34
+ escalationPct: 0,
35
+ },
36
+ ],
37
+ },
38
+ {
39
+ type: 'roth',
40
+ id: exampleEntityId(EXAMPLE_ID, 'roth-ira'),
41
+ name: 'Roth IRA',
42
+ ownerPersonId: p1,
43
+ annualReturnPct: 7.5,
44
+ kind: 'ira',
45
+ balance: 50_000,
46
+ annualContribution: 0,
47
+ },
48
+ ]
49
+ plan.incomes = [
50
+ {
51
+ type: 'wages',
52
+ id: exampleEntityId(EXAMPLE_ID, 'wages'),
53
+ personId: p1,
54
+ annualGross: 90_000,
55
+ endAge: null,
56
+ realGrowthPct: 2,
57
+ },
58
+ {
59
+ type: 'socialSecurity',
60
+ id: exampleEntityId(EXAMPLE_ID, 'ss'),
61
+ personId: p1,
62
+ piaMonthly: 2_500,
63
+ earnings: null,
64
+ claimAge: { years: 67, months: 0 },
65
+ },
66
+ ]
67
+ plan.expenses = {
68
+ baseAnnual: 50_000,
69
+ phases: [],
70
+ oneTimeGoals: [],
71
+ healthcare: { pre65MonthlyPremiumPerPerson: 400, applyAcaCredit: true, medicareExtrasMonthlyPerPerson: 150 },
72
+ }
73
+ plan.assumptions = {
74
+ inflationPct: 2.5,
75
+ healthcareExtraInflationPct: 2,
76
+ defaultReturnPct: 6,
77
+ ssCola: { mode: 'matchInflation' },
78
+ ssHaircut: null,
79
+ stateEffectiveTaxPct: 0,
80
+ localIncomeTaxPct: 0,
81
+ recentAnnualMagi: 90_000,
82
+ heirTaxRatePct: 25,
83
+ safeWithdrawalRatePct: 4,
84
+ }
85
+ const parsed = parsePlan(plan)
86
+ if (!parsed.ok) throw new Error(`coast-fire invalid: ${parsed.issues.join('; ')}`)
87
+ return parsed.plan
88
+ }
@@ -0,0 +1,20 @@
1
+ /** Fixed clock and deterministic entity ids so example golden tests stay stable. */
2
+
3
+ export const EXAMPLE_FIXED_NOW_ISO = '2026-06-29T12:00:00.000Z'
4
+
5
+ export function exampleFixedNow(): Date {
6
+ return new Date(EXAMPLE_FIXED_NOW_ISO)
7
+ }
8
+
9
+ export const EXAMPLE_FIXED_YEAR = 2026
10
+
11
+ /** Stable ids within an example plan (not the IndexedDB plan id). */
12
+ export function exampleEntityId(exampleId: string, suffix: string): string {
13
+ return `${exampleId}--${suffix}`
14
+ }
15
+
16
+ /** Deterministic `newId` for createEmptyPlan — resets on each build() call. */
17
+ export function exampleIdFactory(exampleId: string): () => string {
18
+ let index = 0
19
+ return () => exampleEntityId(exampleId, `seq-${index++}`)
20
+ }