Skip to content

CLAUDE CODE GENERATED: Add age-conditional senior personal exemption parameters#2989

Draft
martinholmer wants to merge 2 commits intoPSLmodels:masterfrom
martinholmer:epe3
Draft

CLAUDE CODE GENERATED: Add age-conditional senior personal exemption parameters#2989
martinholmer wants to merge 2 commits intoPSLmodels:masterfrom
martinholmer:epe3

Conversation

@martinholmer
Copy link
Collaborator

This commit adds two new policy parameters to enable simulation of age-conditional personal exemptions for seniors:

  • II_em_senior: Senior personal exemption amount per qualifying taxpayer/spouse (default $0, inflation-indexed)
  • II_em_senior_age: Age threshold for eligibility (default 65, configurable range 55-75)

The senior exemption is calculated in the AGI() function and applies to taxpayers and spouses meeting the age threshold who are not claimed as dependents. The exemption is not subject to high-income phase-out, unlike the regular personal exemption.

Changes include:

  • Added II_em_senior and II_em_senior_age to policy_current_law.json
  • Modified AGI() function in calcfunctions.py to calculate and apply senior exemption
  • Updated test_calcfunctions.py with new parameters
  • Updated expected output files for interface tests

All tests pass (cstest, pytest-all, idtest, brtest).

This commit adds two new policy parameters to enable simulation of
age-conditional personal exemptions for seniors:

- II_em_senior: Senior personal exemption amount per qualifying
  taxpayer/spouse (default $0, inflation-indexed)
- II_em_senior_age: Age threshold for eligibility (default 65,
  configurable range 55-75)

The senior exemption is calculated in the AGI() function and applies
to taxpayers and spouses meeting the age threshold who are not claimed
as dependents. The exemption is not subject to high-income phase-out,
unlike the regular personal exemption.

Changes include:
- Added II_em_senior and II_em_senior_age to policy_current_law.json
- Modified AGI() function in calcfunctions.py to calculate and apply
  senior exemption
- Updated test_calcfunctions.py with new parameters
- Updated expected output files for interface tests

All tests pass (cstest, pytest-all, idtest, brtest).

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@martinholmer martinholmer marked this pull request as draft January 9, 2026 22:12
@martinholmer martinholmer changed the title CLUDE CODE GENERATED: Add age-conditional senior personal exemption parameters CLAUDE CODE GENERATED: Add age-conditional senior personal exemption parameters Jan 9, 2026
@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b8b247a) to head (15f8f7f).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #2989   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines         2719      2719           
=========================================
  Hits          2719      2719           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@martinholmer
Copy link
Collaborator Author

MRH COMMENTS ON HOW PR #2989 WAS GENERATED:

Started Claude Code (2.1.2 version using Sonnet 4.5) in the ~/Tax-Calculator-LLM/evaluations folder using the Tax-Calculator Assistant , a conversational interface to Tax-Calculator that is currently being developed.

MY FIRST PROMPT:
❯ Estimate the change in 2026 income tax revenue caused by a reform,
beginning in 2026, that gives each taxpayer age 57+ and each spouse
age 57+ a $1000 personal exemption that has the same eligibility
conditions as the existing personal exemption and is not phased out at
high incomes.

ASSISTANT RESPONSE:
⏺ I'll help you analyze this reform. Let me start by searching for
Tax-Calculator parameters that could model an age-conditional personal
exemption for taxpayers and spouses age 57+.

---[SNIP]---

⏺ Based on my search of Tax-Calculator's parameters, this reform
cannot be directly modeled with the current Tax-Calculator
capabilities.

Here's what I found:

The Challenge

You're asking for an age-conditional personal exemption (age 57+)
with a $1,000 value. Tax-Calculator's personal exemption parameter
(II_em) applies uniformly to all taxpayers and dependents - it
cannot be made conditional on age. In 2026, the current-law value of
II_em is $0 (TCJA elimination continues).

Potential Alternative: SeniorDed Parameter

Tax-Calculator does have a senior deduction feature with these parameters:

  • SeniorDed_c: Amount per elderly head/spouse (currently $6,000 in 2026)
  • SeniorDed_ps: Phaseout start by filing status ($75K-$150K)
  • SeniorDed_prt: Phaseout rate (6%)

However, this approach has significant limitations:

  1. Unknown age threshold: The age at which taxpayers qualify as
    "elderly" for SeniorDed appears to be hardcoded in Tax-Calculator
    (likely 65+, not 57+). I found no parameter to adjust this threshold
    to 57.
  2. Different mechanism: This is a deduction, not a personal
    exemption. While both reduce taxable income, they may have different
    eligibility conditions than what you specified.
  3. Existing phaseout: The reform you described has "no phaseout at
    high incomes," but SeniorDed currently phases out starting at
    $75K-$150K.

Recommended Approaches

  1. Structural Enhancement: Tax-Calculator would need a code
    enhancement to support age-conditional personal exemptions with a
    configurable age threshold. This would involve modifying the source
    code to add new parameters.

  2. Approximation with SeniorDed: If you're willing to accept that
    the age threshold might be 65+ instead of 57+, and if the
    eligibility conditions are similar enough, I could attempt to use
    SeniorDed by setting it to $1,000 and eliminating the
    phaseout. However, this would be an approximation, not an exact
    implementation of your reform.

  3. Web Search: Search for similar analyses of age-based tax benefits
    to see how other researchers have handled this.

Would you like me to:

  • Attempt an approximation using SeniorDed (acknowledging the limitations)?
  • Help you understand what structural enhancement would be needed?
  • Search for similar reform analyses?

MY SECOND PROMPT:
❯ Create a git branch (called epe3 in the repo located in the
~/Tax-Calculator folder following the workflow described in the
structural_enhancement.md file) that enables Tax-Calculator to
simulate the above reform and other reforms where the 57 age
is specified to be in the 55-75 range.

ASSISTANT RESPONSE:
⏺ I'll help you create a git branch and implement this structural
enhancement. Let me first read the structural_enhancement.md file to
understand the workflow.

---[SNIP]---

⏺ Perfect! All changes have been successfully committed to the epe3 branch.

Commit Summary

Commit ID: bb6c5fd

Branch: epe3 (created from master)

Files Changed: 9 files, 91 insertions(+), 4 deletions(-)

What Was Implemented

The epe3 branch now contains a complete structural enhancement that
enables Tax-Calculator to simulate age-conditional personal
exemptions for seniors. Specifically:

New Parameters:

  1. II_em_senior: Senior personal exemption amount (default $0,
    inflation-indexed, range 0 to 9e+99)
  2. II_em_senior_age: Age threshold for eligibility (default 65, range 55-75)

Key Features:

  • Applies to each taxpayer and spouse meeting the age threshold
  • Not subject to high-income phase-out
  • Respects dependent status (DSI) - no exemption if claimed as dependent
  • Works with both exact and smoothed calculations

Testing:

All four required test suites passed:

  • ✅ Code style (cstest)
  • ✅ Unit tests (pytest-all: 383 passed)
  • ✅ Interface definitions (idtest)
  • ✅ Behavioral responses (brtest)

Usage Example

To simulate your original reform (age 57+, $1,000 exemption starting
in 2026), you would create a policy JSON file like:

{
"II_em_senior_age": {"2026": 57},
"II_em_senior": {"2026": 1000}
}

The branch is ready for testing, merging, or creating a pull request
as needed!

MRH NOTES:

  • The complete Claude session is in the claude-session-2026-01-09.txt file in this PR.
  • The structural_enhancement.md file is also in this PR in the top-level folder.

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