Overview
Step 7 is the most complex step in the ESOP projection engine, handling the full lifecycle of repurchase obligations from termination through final distribution.Why This Matters
When employees terminate, the ESOP must:- Calculate what they’re owed (vested shares + cash)
- Create a payment schedule (deferred installments or lump sum)
- Execute repurchases using available cash
- Apply the company’s chosen repurchase strategy
Processing Phases
Step 7 executes in strict sequential order:1
Phase 1: QDRO Processing
Handle divorce settlements and court orders
2
Phase 2: Forfeiture Recording
Track non-vested share and cash forfeitures
3
Phase 3: Distribution Schedule Creation
Build payment timelines for new terminations
4
Phase 4: RMD Enforcement
Force distributions for participants age 73+
5
Phase 5: Execute Due Payments
Process scheduled distributions for current year
6
Phase 6: Distribution Form Conversion
Convert stock to cash if required by plan rules
7
Phase 7: (Deprecated) Segregation Policy
Removed in v0.3 to focus on core ESOP mechanics
8
Phase 8: Execute Repurchase Strategy
Apply recycle/redeem/releverage strategy
9
Phase 9: Funding Reconciliation
Reconcile TrustCashLedger draws and balances
Detailed Phase Breakdown
Phase 1: QDRO Processing
QDRO = Qualified Domestic Relations Order (divorce/separation settlements)What Happens
What Happens
When a divorce decree requires splitting an ESOP account:
- Apply Split Percentage (typically 50%)
- Respect Vesting - Only vested amounts are split
- Pro-Rata Across Securities - In multi-class mode, split proportionally
- Reduce Participant Balance - Deduct from employee account
- Create Immediate Repurchase - Alternate payee is paid immediately
- Mark as Processed - Prevent reprocessing in future years
Multi-Class Behavior
Multi-Class Behavior
In multi-class mode, QDROs split proportionally across all securities:Example:
- Employee holds: 100 Class A shares, 200 Class B shares
- Vesting: 80%
- QDRO: 50% split
- Class A vested: 100 * 0.80 = 80 shares
- Class A split: 80 * 0.50 = 40 shares → to alternate payee
- Class B vested: 200 * 0.80 = 160 shares
- Class B split: 160 * 0.50 = 80 shares → to alternate payee
Compliance Logging
Compliance Logging
Every QDRO generates compliance events:
Phase 2: Forfeiture Recording
When participants terminate before fully vested, non-vested amounts are forfeited.- Forfeiture Policies
- Calculation Example
- Cash Forfeitures
Two policy options:
-
reallocate_next_year(Most Common)- Add forfeitures to next year’s share pool
- Used to fund next year’s allocations
- Reduces company cash contribution need
-
reallocate_on_payout(Less Common)- Hold forfeitures until employee fully paid out
- Then reallocate to remaining participants
- Used when plan wants to delay forfeiture recognition
Phase 3: Distribution Schedule Creation
When an employee terminates, the engine creates a multi-year payment schedule.- Schedule Parameters
- Timing Rules
- Special Cases
- Example Schedule
From
DistributionRule matched to termination trigger:Phase 4: RMD Enforcement
RMD = Required Minimum Distribution (IRS tax rule)- How It Works
- RMD Scenarios
- Compliance Logging
Phase 5: Execute Due Payments
Process all distribution schedules wherecurrent_year >= start_year.
- Payment Calculation
- Multi-Class Distribution
- TrustCashLedger Draws
Phase 6: Distribution Form Conversion
If the plan requires cash-only distributions, convert remaining stock to cash.- Distribution Forms
- Multi-Class Conversion
Three options per plan rules:
stock- Distribute shares as sharescash- Convert all shares to cash at current pricestock_with_mandatory_put- Distribute shares with put option (treated as cash in modeling)
Phase 7: (Deprecated) Segregation Policy
Segregation is removed in v0.3 to focus on core, high-fidelity ESOP mechanics. The model no longer documents or enforces
segregation_policy.Phase 8: Execute Repurchase Strategy
The company’s strategic choice for handling repurchased shares.- Three Strategies
- Strategy Configuration
- Execution Logic
- Multi-Class Execution
- Example Scenarios
Recycle
Keep shares in the plan
- Add to next year’s allocation pool
- Shares remain outstanding
- Use OIA cash if available
- Most cash-efficient
Redeem
Retire shares permanently
- Reduce outstanding shares
- Increases ownership % for remaining participants
- Shares cannot be reissued
Releverage
Create new ESOP loan
- Borrow to fund repurchase
- Default term: 10 years
- Shares held in suspense
- Released as loan paid down
Phase 9: Funding Reconciliation
Final accounting for the year’s cash flows.- Ledger Reconciliation
- Loan Payment Reconciliation
- Funding Summary Event
Reconcile TrustCashLedger movements for the year (no investment earnings in v0.3):
Multi-Class Security Support
New in v0.2: Full multi-class security support with per-security tracking.
multi_class_mode=True and securities exist:
Key Differences
| Aspect | Single-Class | Multi-Class |
|---|---|---|
| Share Tracking | Aggregate total | Per-security holdings |
| Pricing | Single price | Security-specific prices |
| Pro-Rata Logic | N/A | Weighted by holdings |
| Repurchase | Single queue | Per-security queues |
| Recycled Pool | Single pool | Per-security pools |
| Releverage Loans | Generic loan | Security-tagged loans |
Example: Pro-Rata Distribution
Security-Specific Repurchase
Configuration Reference
Key configuration parameters used in Step 7:Regulatory Limits
Regulatory Limits
Distribution Timing Rules
Distribution Timing Rules
Default Loan Terms
Default Loan Terms
Default Rates
Default Rates
Calculation Precision
Calculation Precision
Account Thresholds
Account Thresholds
The Funding Waterfall
See Simulation Core for complete waterfall explanation. Quick Summary:Common Scenarios
Scenario 1: Simple Retirement
Scenario 1: Simple Retirement
Setup:
- Employee retires, age 65, 15 years service
- Vested: 2,000 shares at 1M
- Distribution rule: 5-year installment, 1-year defer
- Repurchase strategy: 100% recycle
- Phase 3: Create schedule starting 2026, 5 annual payments of 400 shares each
- Phase 5: In 2026, pay first installment of 400 shares
- Phase 8: Recycle 400 shares → added to 2027 allocation pool
- Employee receives 400 shares in 2026 (valued at current price)
- Trust repurchases and recycles shares
- Company has 400 shares for next year’s allocation
Scenario 2: Divorce QDRO
Scenario 2: Divorce QDRO
Setup:
- Active employee, age 42, divorce decree
- QDRO: 50% split to ex-spouse
- Account: 1,500 vested shares, $25K cash
- Repurchase strategy: 100% redeem
- Phase 1: Process QDRO
- Split: 750 shares + $12,500 to ex-spouse
- Employee retains: 750 shares + $12,500
- Immediate payout to ex-spouse
- Phase 8: Redeem 750 shares
- Outstanding shares reduced by 750
- Ex-spouse paid immediately
- Employee continues with reduced account
- Company ownership percentages recalculated
Scenario 3: RMD Override
Scenario 3: RMD Override
Setup:
- Employee terminated at age 68 in 2020
- Distribution deferred to 2025 (5-year max)
- Employee reaches age 73 in 2023
- Vested balance: 1,200 shares
- Phase 4: In 2023, RMD check triggers
- Age 73 reached, no active distribution
- Create immediate RMD schedule
- Phase 5: Force distribution in 2023 (overrides 2025 deferral)
- Distribution starts in 2023 instead of 2025
- Ensures IRS compliance
- Prevents tax penalties
Scenario 4: Weighted Repurchase
Scenario 4: Weighted Repurchase
Setup:
- Total repurchase: 3,000 shares
- Strategy: 60% recycle, 30% redeem, 10% releverage
- Share price: $500
- Phase 8: Apply weighted strategy
- Recycle: 3,000 × 60% = 1,800 shares
- Redeem: 3,000 × 30% = 900 shares
- Releverage: 3,000 × 10% = 300 shares
- Add 1,800 shares to next year’s pool
- Use OIA: $900K if available
- Reduce outstanding shares by 900
- Create loan: 500)
- Term: 10 years
- Annual release: 30 shares/year
- Mixed strategy provides flexibility
- 1,800 shares available for reallocation
- 900 shares permanently retired
- 300 shares financed via new loan
Scenario 5: Multi-Class Distribution
Scenario 5: Multi-Class Distribution
Setup:
- Employee holds: 500 Class A (400/share)
- Payment due: 300 shares total
- Strategy: 100% recycle
- Phase 5: Pro-rata distribution
- Total shares: 1,500
- Class A weight: 500 / 1,500 = 33.3%
- Class B weight: 1,000 / 1,500 = 66.7% Payment:
- Class A: 300 × 33.3% = 100 shares → value $60K
- Class B: 300 × 66.7% = 200 shares → value $80K
- Total value: $140K
- Phase 8: Security-specific recycle
- Class A: Add 100 to recycled_shares_by_security[“CLASS_A”]
- Class B: Add 200 to recycled_shares_by_security[“CLASS_B”]
- Each security maintains separate recycled pools
- Next year’s allocation can draw from both pools
- Preserves security mix in the plan
Data Dependencies
Inputs Required
- Employee Data
- Company State
- Plan Rules
- Policies
Outputs Generated
- Employee Updates
- Company Updates
- Carry-Over State
- Compliance Events
Performance Considerations
Optimization Strategies:-
Index by Termination Status
- Pre-filter terminated employees
- Avoid scanning full census each phase
-
Cache Vesting Calculations
- Vesting percentages calculated multiple times
- Cache lookups by service year
-
Precision Rounding
- Apply rounding at calculation boundaries
- Use
Decimalfor financial amounts - Avoid floating-point arithmetic
-
Multi-Class Overhead
- Pro-rata calculations scale with # securities
- Consider performance impact with 5+ securities
Testing Scenarios
Fromtests/engine/test_engine_step7.py:
- Basic Scenarios
- Multi-Year Scenarios
- Edge Cases
-
Recycle accumulates recycled shares
- Strategy:
"recycle" - Verify:
carry_over_state.recycled_shares > 0
- Strategy:
-
Redeem reduces outstanding shares
- Strategy:
"redeem" - Verify:
total_outstanding_sharesdecreased
- Strategy:
-
Cash forfeitures tracked
- Service: 1 year (20% vested)
- Opening cash: $1,000
- Verify: 80% forfeited to carryover
-
Reallocate on payout defers forfeiture
- Policy:
"reallocate_on_payout" - Verify: Forfeitures held until payout complete
- Policy:
Related Documentation
TrustCashLedger
Ledger structure and cash flow management
Design Principles
Why Step 7 is structured this way
Simulation Core
How Step 7 fits into the annual cycle
ESOP Loan Model
Releverage loan creation and tracking
Summary
Step 7 is the most complex and critical step in the ESOP projection engine: Key Responsibilities:- ✅ QDRO processing (divorce settlements)
- ✅ Forfeiture tracking (non-vested amounts)
- ✅ Distribution schedule creation (multi-year installments)
- ✅ RMD enforcement (age 73+ compliance)
- ✅ Payment execution (scheduled distributions)
- ✅ Distribution form conversion (stock → cash)
- ❌ Segregation policy (removed in v0.3)
- ✅ Repurchase strategy execution (recycle/redeem/releverage)
- ✅ Funding reconciliation (TrustCashLedger balances)
- 9 sequential phases
- Multi-class security support
- Pro-rata calculations across securities
- Regulatory compliance checks
- Multi-year distribution schedules
- Weighted strategy execution
- Comprehensive event logging
- Most expensive step (1,130 lines of code)
- Multiple passes over employee list
- Pro-rata calculations scale with # securities
- Precision rounding for financial accuracy
For Developers: Step 7 processes are highly interdependent. Changing one phase may affect downstream phases. Always run full test suite after modifications.
.png?fit=max&auto=format&n=_b1oFDtC7brS6c3Z&q=85&s=d3ec56559a51e770e67aa19d77e1da67)
.png?fit=max&auto=format&n=AWN49C5ILGJ2VJNX&q=85&s=9e43d95342e1c0ca7d9eadaa6d3acb0d)