Skip to content

feat(engine): onshore/offshore tax model (v0.6.0)#5

Merged
fall-development-rob merged 1 commit into
mainfrom
feat/v0.6-tax
Apr 17, 2026
Merged

feat(engine): onshore/offshore tax model (v0.6.0)#5
fall-development-rob merged 1 commit into
mainfrom
feat/v0.6-tax

Conversation

@fall-development-rob
Copy link
Copy Markdown
Contributor

Summary

  • Implement per-wrapper tax computation with residence x domicile x wrapper matrix per ADR-037 / CONTRACT-020
  • Add TaxLotTracker class for FIFO/HIFO cost-basis lot accounting and CGT computation
  • Add computeWrapperTax for 11 wrapper types: Taxable, US-Traditional-401k/IRA, US-Roth-401k/IRA, UK-SIPP, UK-ISA, UK-Onshore/Offshore-Bond, Offshore-Trust, Cayman-Exempt-Company
  • Add computeRMD with IRS Uniform Lifetime Table (ages 72-120)
  • Add WITHHOLDING_TREATY_TABLE for dividend withholding with override support
  • Add UK non-dom remittance basis with £30k charge
  • Integrate wrapper tax into runAdvancedProjection with tax_breakdown and rmd_amount on TimelineRow
  • Extend Scenario with tax_residence, tax_domicile, remittance_basis_charge, cgt_method, withholding_overrides, fatca_reporting, crs_reporting
  • Extend FinancialItem with wrapper and cost_basis
  • All new fields optional with defaults; v0.5 scenarios produce byte-identical output
  • Version bump 0.5.0 -> 0.6.0
  • 200 tests pass (59 new assertions across 20 new test cases)

Test plan

  • computeRMD returns correct divisor at ages 73, 80, 90
  • computeWrapperTax for Taxable: CGT > 0 when gain exists
  • computeWrapperTax for US-Roth: tax-free when qualified
  • computeWrapperTax for US-Roth: income tax when non-qualified
  • computeWrapperTax for UK-SIPP: 25% tax-free lump applied
  • computeWrapperTax for UK-ISA: zero tax
  • TaxLotTracker FIFO ordering correct
  • TaxLotTracker HIFO ordering correct
  • Backwards compat: v0.5 scenario (no wrappers) produces identical output
  • Build + lint clean

🤖 Generated with claude-flow

Add per-wrapper tax computation with residence x domicile x wrapper
matrix (ADR-037 / CONTRACT-020). Implements tax-lot accounting (FIFO/HIFO),
RMD enforcement for US-Traditional wrappers, dividend withholding treaty
table, UK non-dom remittance basis, and per-wrapper rules for Taxable,
US-Traditional, US-Roth, UK-SIPP, UK-ISA, UK-Onshore/Offshore-Bond,
Offshore-Trust, and Cayman-Exempt-Company. All new fields are optional
with defaults; v0.5 scenarios produce identical output.

Co-Authored-By: claude-flow <ruv@ruv.net>
@fall-development-rob fall-development-rob merged commit f6d00e2 into main Apr 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant