Skip to main content

Developer Resource Center

Blueprint writing guide

A guide to every section of a Blueprint file, with examples you can adapt.

Developer Resource Center

This guide covers every section and attribute of a Blueprint written in ThriveScript. Most people never need it, because the guided questions in ThriveFI.app write the Blueprint for you. Read on if you want full control.

Keep two other pages open as you read. The grammar lists exactly what is allowed. The variable reference lists every variable you can use in conditions and formulas.

ThriveFI.app is a planning tool. Results are estimates from simulations of historical market data and your assumptions. They are not predictions or advice.

1. What a Blueprint can describe

A Blueprint describes, in one document, everything a simulation needs: how much you have, how you spend, where income comes from, and what rules decide how much you take from your savings each year.

Instead of picking from a menu of fixed strategies such as “4% a year”, you build your own from parts: conditions, formulas, cash flows, transfer rules and guardrails. ThriveFI.app runs those rules against real market history across many simulated futures and shows how often the money lasts.

Real retirements are messy, and a Blueprint can describe that:

  • Social Security starts at a different age for each partner.
  • Pensions pay a survivor benefit that changes household income.
  • A bridge fund covers the years before Social Security starts.
  • Guardrails respond to market conditions but respect a spending floor.
  • Accounts hold different investments.
  • A one-time cost, such as a new roof, may or may not happen.

Common patterns include a simple fixed withdrawal, Guyton-Klinger style guardrails, a bridge to Social Security, ordered draws from named accounts, annual transfers between accounts, and stress tests that start in specific historical years such as 1929, 1973, 2000 or 2008.

2. Document structure

A Blueprint is a plain text file. Indentation shows how parts nest. It has ten top-level sections. Seven are required and three are optional.

job:                    # Simulation settings and asset classes
custom_variables:       # Your own constants and formulas
retiree_profile:        # People, ages, income, spending target
strategies:             # Named investment mixes
accounts:               # Named accounts with type, balance and strategy
portfolio_scope:        # Optional: accounts counted in portfolio_value
cash_flows:             # Money in and out over time
transfer_strategies:    # Optional: named source lists for transfers
transfer_rules:         # Optional: end-of-year moves between accounts
withdrawal_rules:       # Rules that decide each year's withdrawal

job, custom_variables, retiree_profile, strategies, accounts, cash_flows and withdrawal_rules are required. cash_flows can be an empty list. Unknown top-level keys are ignored.

3. job

The job section sets the simulation settings.

Attribute Required Type Range Description
simulation_count yes integer 1 to 10,000 Number of simulated futures. If every asset class uses historical, the count is capped at the number of available historical windows (see below).
time_horizon yes integer 1 to 100 Years to simulate.
asset_classes yes map One or more asset class definitions.
return_timing yes text beginning_of_year or end_of_year. Sets when market returns apply relative to withdrawals.
follow_on_years no integer 1 to time_horizon Length of each block of consecutive years for monte_carlo assets. Default 10.
mode no text random, deterministic random (default) ignores seed. deterministic requires seed and makes the draws repeatable.
seed no integer or null 0 to 4,294,967,295 Random seed. Default null.
sampling_strategy no text block, exhaustive, exhaustive_repeat How year sequences are drawn from history. Default block. Forced to exhaustive when every asset class is historical.
variance_seed no integer or null 0 to 4,294,967,295 Seed for range-form variance draws. Independent of seed.
start_dates no list of years 4-digit years Limit simulations to specific starting years.
include_date_range no map Limit the history used to a range. Needs start_year and end_year.
exclude_dates no list of maps Remove year ranges from the history used. Each entry needs start_year and end_year.
debug no true or false When true, results include a snapshot of every variable each year. Useful for seeing why a rule fired.

asset_classes

You name your own asset classes. Each has a return_source that says where its yearly returns come from.

Attribute Required Type Description
return_source yes text monte_carlo, historical, linear, parametric, or the name of another asset class (an alias).
projection if linear map Required when the resolved source is linear.
aum_fee no decimal, 0.0 to 1.0 Annual fee subtracted from this asset class’s return. Default 0.0.
return_variance no map Adds or subtracts percentage points from this class’s return.
inflation_variance no map Adds or subtracts percentage points from plan inflation. It only takes effect on the first monte_carlo, historical or parametric class in your list.

Return sources:

Source Number of simulations Random?
monte_carlo Exactly simulation_count Yes. Blocks of real consecutive years are stitched together.
historical The smaller of simulation_count and the available windows No. Each simulation replays one real stretch of years.
linear with volatility 0 Exactly simulation_count, all identical No
linear with volatility above 0 Exactly simulation_count Yes. Each gets normally distributed noise.
parametric Exactly simulation_count Yes. Returns come from a fitted distribution.

historical

With return_source: historical, each simulation starts in a different real year and plays forward time_horizon consecutive years. The number of simulations is capped at the number of available windows. It is not repeated or expanded.

available_windows = (last_year - first_year + 1) - time_horizon + 1

For example, with data from 1872 to 2025 (154 years) and a 30-year horizon, there are 154 - 30 + 1 = 125 windows. Setting simulation_count to 1000 runs 125 simulations. Setting it to 1 runs only the earliest window. To cover every window, set simulation_count to any value at or above the window count, such as 10000.

Date filters shrink the pool and so reduce the window count. To repeat windows, use sampling_strategy: exhaustive_repeat.

linear

Returns come from a fixed projection instead of history.

asset_classes:
  fixed_income:
    return_source: linear
    projection:
      annual_return: 0.04
      annual_inflation: 0.025
      dividend_yield: 0.03
      volatility: 0.0
Attribute Required Type Description
annual_return yes decimal Expected annual return. 0.05 means 5%.
annual_inflation yes decimal Inflation assumption.
dividend_yield yes decimal Dividend yield.
volatility yes decimal, 0 or more 0 means no noise. Above 0 adds normally distributed noise each year.

parametric

A parametric asset class draws each year’s return from a fitted statistical distribution, instead of replaying history. It mixes freely with the other return sources in one document. You do not need to type any numbers. Pick a preset, or leave the parametric block out to use historical_baseline.

asset_classes:
  us_stocks:
    return_source: parametric
  us_bonds:
    return_source: parametric

Optional parametric block inside an asset class:

Attribute Required Type Description
preset no text historical_baseline (default), conservative, optimistic, low_return or custom.
expected_return if custom decimal Expected annual return.
volatility if custom decimal, 0 or more Annual standard deviation of returns.
mean_type no text geometric (default) or arithmetic. Which kind of average expected_return is.
distribution no text normal or lognormal. Defaults to the preset’s choice.
dividend_yield no decimal, 0 or more Dividend yield.

Optional parametric block directly under job, for settings that apply to every parametric asset class:

Attribute Required Type Description
volatility_lever no text low (times 0.70), historical (times 1.00, the default) or high (times 1.40).
inflation_mean no decimal Mean annual inflation.
inflation_volatility no decimal, 0 or more Standard deviation of annual inflation.
inflation_min no decimal or null Floor on one year’s inflation. Default 0.0.
inflation_max no decimal or null Cap on one year’s inflation. Default 0.10.
correlations no map Pairwise correlations between asset classes, written as "us_stocks:us_bonds": 0.15. Each between -1 and 1.

Presets, compared with the baseline calibrated from historical data:

Preset Effect
historical_baseline Calibrated from the historical data. Normal distribution.
conservative Return down 0.5 points, volatility times 1.25, assets move together more, lognormal.
optimistic Return up 0.5 points, volatility times 0.80, assets move together less.
low_return Return down 2 points. Volatility and correlation unchanged.
custom You supply expected_return and volatility.

The preset sets the average return. The volatility lever sets how widely returns spread around that average. It multiplies volatility only, so it does not change the expected return, the correlation or the distribution, and it does not lower the long-run growth rate. The two settings stack: conservative with high gives stocks about 31% volatility, against about 18% in history, and optimistic with low gives about 10%. Treat those corners as stress tests and favorable cases. Only conservative changes the shape: it uses a lognormal distribution and moves stocks and bonds closer together, so bonds cushion less in a crash. Neither setting changes inflation. Every combination uses a 2.28% average, with each year kept between 0% and 10%.

Every preset and lever combination for us_stocks and us_bonds, with no overrides. Returns are long-run compound (geometric) nominal returns per year, calibrated from the 1872 to 2025 data.

Preset Lever Stocks return Stocks volatility Bonds return Bonds volatility Stock-bond correlation Distribution
Conservative Low 8.75% 15.6% 3.75% 5.3% 0.28 lognormal
Conservative Historical 8.75% 22.3% 3.75% 7.6% 0.28 lognormal
Conservative High 8.75% 31.2% 3.75% 10.6% 0.28 lognormal
Historical Baseline Low 9.25% 12.5% 4.25% 4.2% 0.05 normal
Historical Baseline Historical 9.25% 17.8% 4.25% 6.1% 0.05 normal
Historical Baseline High 9.25% 24.9% 4.25% 8.5% 0.05 normal
Optimistic Low 9.75% 10.0% 4.75% 3.4% 0.04 normal
Optimistic Historical 9.75% 14.3% 4.75% 4.9% 0.04 normal
Optimistic High 9.75% 20.0% 4.75% 6.8% 0.04 normal
Low Return Low 7.25% 12.5% 2.25% 4.2% 0.05 normal
Low Return Historical 7.25% 17.8% 2.25% 6.1% 0.05 normal
Low Return High 7.25% 24.9% 2.25% 8.5% 0.05 normal

With mode: deterministic and a seed, the same settings give the same draws every time. Heavier-tailed distributions and correlation between inflation and bond returns are not available yet.

aum_fee

A fee written as a decimal, so 0.01 is 1% a year. It is subtracted from the asset class’s return, so an asset adds weight x (return - fee) to an account’s growth. It follows return_timing: with beginning_of_year it reduces the balance before the withdrawal, and with end_of_year after.

asset_classes:
  us_stocks:
    return_source: monte_carlo
    aum_fee: 0.01

Fees attach to asset classes only, never to accounts. A value outside 0.0 to 1.0 is rejected.

Variance modifiers

return_variance and inflation_variance add percentage points to a base rate: effective rate = base rate + modifier. Use them for what-if tests such as “returns are 2 points lower for the first ten years”.

A flat modifier applies the same amount every active year:

return_variance:
  value: -0.02
  from_year: 1
  to_year: 10

A range modifier redraws a value between a minimum and a maximum each active year:

inflation_variance:
  range: [-0.01, 0.01]
  from_year: 5
  to_year: null
Attribute Required Description
value flat form Percentage-point change. Between -100.0 and 100.0. Cannot be combined with range.
range range form A pair [min, max], each between -100.0 and 100.0, with min no greater than max.
from_year no First active year. Default 1.
to_year no Last active year, inclusive. Null or omitted means through the end.

from_year and to_year count simulation years starting at 1. They are not calendar years, unlike cash flow start_year and end_year. A bare number such as return_variance: -0.02 is shorthand for a flat modifier.

Your plan has one inflation rate. It comes from the first asset class in your list whose return_source is monte_carlo, historical or parametric, which is usually us_stocks. inflation_variance only changes plan inflation when it is set on that class. On any other class it is accepted and has no effect. There is no plan-wide inflation_variance under job. Written there, it is ignored.

Range draws are repeatable when variance_seed is set, and do not depend on seed. If only seed is set, they follow seed. If neither is set, they change on every run.

Aliasing

An asset class can name another asset class as its return_source. The alias reuses the other class’s return, inflation and dividend series but keeps its own fee and variance modifiers. Use this to compare the same investment at different costs:

asset_classes:
  us_stocks:
    return_source: monte_carlo
    aum_fee: 0.0004
  us_stocks_managed:
    return_source: us_stocks
    aum_fee: 0.0075

The name must lead, through any chain of aliases, to a built-in source. An unknown name or a loop (A to B to A) is rejected.

Date filters

Date filters choose which historical years are available. They apply to monte_carlo and historical sources.

job:
  simulation_count: 3
  time_horizon: 30
  asset_classes:
    us_stocks:
      return_source: historical
  return_timing: beginning_of_year
  include_date_range:
    start_year: 1950
    end_year: 2020
  exclude_dates:
    - start_year: 2008
      end_year: 2009
  start_dates: [1973, 2000, 2010]
  1. include_date_range limits the pool to 1950 through 2020.
  2. exclude_dates removes 2008 and 2009. Sequences skip over them and continue with the next available year.
  3. start_dates picks three starting years from what is left. Each needs enough consecutive years in the pool.

return_timing

  • beginning_of_year: returns apply to the full portfolio first, then the withdrawal comes out of the grown or shrunk balance.
  • end_of_year: the withdrawal comes out first, then returns apply to what is left.

Both modes use the same return data. Either way, withdrawal rules see the previous year’s return in previous_portfolio_return, because a retiree would not know the current year’s return when deciding what to withdraw.

4. custom_variables

Your own variables, used in conditions and formulas.

static

Calculated once, at the start. Values can be numbers, true or false, or text.

static:
  guardrail_upper_multiplier: 1.20
  minimum_annual_withdrawal: 36000
  skip_inflation_on_loss: true

A static can also be computed. Statics are resolved in dependency order, and a loop is rejected. They can use built-in variables such as simulation_start_year and initial_portfolio_value.

A person’s age, turned into a calendar year (birth year plus age):

static:
  john_ss_start: { person: "John", age: 70 }

A formula:

static:
  john_years_to_ss:
    formula:
      - variable: "john_ss_start"
      - operator: "-"
      - variable: "simulation_start_year"

A multi-step calculation, where the step named result is the final value:

static:
  bridge_fund:
    steps:
      john_bridge:
        formula:
          - variable: "john_ss_amount"
          - operator: "*"
          - variable: "john_years_to_ss"
      result:
        formula:
          - variable: "john_bridge"

dynamic

Recalculated every simulation year, after returns and before withdrawal rules. A dynamic variable can use built-in variables, statics and earlier dynamics (they run top to bottom).

dynamic:
  current_withdrawal_rate:
    formula:
      - variable: "previous_withdrawal"
      - operator: "/"
      - variable: "portfolio_value_start"

For guardrail rates, divide by portfolio_value_start, the portfolio value at the start of the year. portfolio_value changes during the year as returns and income arrive, so it would inflate the denominator.

Multi-step form:

dynamic:
  discretionary_withdrawal_rate:
    steps:
      net_withdrawal:
        formula:
          - variable: "previous_withdrawal"
          - operator: "-"
          - variable: "other_payments"
      result:
        formula:
          - variable: "net_withdrawal"
          - operator: "/"
          - variable: "portfolio_value"

Formula elements

Element Meaning Example
variable: "name" A variable variable: "portfolio_value"
value: 123.45 A number value: 0.04
operator: "op" One of +, -, *, /, ^ operator: "*"

Formulas run left to right with no operator precedence. For anything complex, use steps.

5. retiree_profile

The people in the simulation and the spending target.

Attribute Required Type Description
simulation_start_year yes year Calendar year the simulation begins.
standard_of_living yes number above 0 Annual spending target in today’s dollars. It grows with inflation.
minimum_standard_of_living no number, 0 or more Floor on total annual spending in today’s dollars, counting all income. Adjusted for inflation. 0 or omitted turns it off.
maximum_standard_of_living no number, 0 or more Ceiling on total annual spending in today’s dollars. Must be above the minimum when both are set.
people yes list One or more people.

Spending floor and ceiling

The floor and ceiling apply to total spending, which includes portfolio withdrawals, Social Security, pensions and earned income. They are enforced after the withdrawal rules run. If spending would fall below the floor, the withdrawal goes up. If it would exceed the ceiling, the withdrawal is trimmed. Both grow with inflation.

Do not write withdrawal rules to enforce a floor or ceiling. These two settings do it for you.

retiree_profile:
  simulation_start_year: 2029
  standard_of_living: 80000
  minimum_standard_of_living: 60000
  maximum_standard_of_living: 120000

The floor stops guardrail cuts from taking your lifestyle below a level you choose. The ceiling stops raises from pushing spending higher than you want.

People

Attribute Required Type Description
name yes text Unique name. Used in variables such as age["John"].
birth_year yes year Used to work out age each year.
retirement_year yes year Year the person stops working.
income_contribution yes number Yearly income while working. Use 0 for none.
retiree_profile:
  simulation_start_year: 2029
  standard_of_living: 100000
  people:
    - name: "John"
      birth_year: 1964
      retirement_year: 2029
      income_contribution: 150000
    - name: "Jane"
      birth_year: 1967
      retirement_year: 2032
      income_contribution: 120000

6. strategies

Named investment mixes. Each strategy has either a fixed allocation or a glide_path that changes over time. It cannot have both or neither. Accounts refer to strategies by name.

strategies:
  growth:
    allocation:
      us_stocks: 0.70
      us_bonds: 0.30
  conservative:
    allocation:
      us_stocks: 0.40
      us_bonds: 0.60

Rules:

  • Every key in allocation must be an asset class from job.asset_classes.
  • Weights must add up to 1.0, give or take 0.001.
  • Leaving an asset class out counts as a weight of 0.
  • Strategy names must be unique.

Glide paths

A glide path moves an allocation over time, for example to grow more conservative with age.

strategies:
  age_based_glide:
    glide_path:
      keyframes:
        - at: { person: Alice, age: 65 }
          allocation: { us_stocks: 0.70, us_bonds: 0.30 }
        - at: { cycle_year: 20 }
          allocation: { us_stocks: 0.40, us_bonds: 0.60 }

Each keyframe has an allocation and a point in time, written one of three ways:

  • at: { person: <name>, age: <n> } becomes a simulation year using the person’s birth year.
  • at: { cycle_year: <n> } is a simulation year counted from 1.
  • cycle_year: <n> next to allocation is shorthand for the line above.

Keyframes can be listed in any order. Two keyframes landing on the same year is an error. Between two keyframes, each asset class’s weight moves in a straight line. Before the first and after the last, the nearest keyframe is held. Glide paths use no random numbers.

How strategies work

Each account grows at its strategy’s weighted return:

account_return = sum(allocation[asset_class] * asset_class_return)
account_balance = account_balance * (1 + account_return)

This is the same as rebalancing every year. There is no drift to track.

7. accounts

Named accounts. Each has a type, a starting balance, a strategy and sometimes an owner.

accounts:
  - name: "John's 401k"
    type: tax_deferred
    owner: "John"
    balance: 500000
    strategy: growth
  - name: "Joint Roth"
    type: tax_exempt
    balance: 150000
    strategy: growth
  - name: "Taxable Brokerage"
    type: taxable
    balance: 200000
    strategy: conservative
  - name: "Bridge Fund"
    type: custom
    balance: { variable: "bridge_fund" }
    strategy: bridge_growth
portfolio_scope:
  - "John's 401k"
  - "Joint Roth"
  - "Taxable Brokerage"
Attribute Required Type Description
name yes text Unique name. Used in rules, transfers, cash flows and variables.
type yes text tax_deferred, tax_exempt, taxable or custom.
owner for tax_deferred text A name from retiree_profile.people. Optional for other types.
balance yes number or variable A number, or { variable: "name" } pointing to a static variable.
strategy yes text A key from strategies.

ThriveFI.app does not model taxes. The type records what kind of account it is. It does not change how the balance grows. Account types:

Type Meaning
tax_deferred Traditional 401(k) or IRA. Needs an owner.
tax_exempt Roth 401(k) or Roth IRA.
taxable Brokerage account.
custom Your own, such as a bridge fund.

A variable balance is resolved after computed statics, so it must point to a static variable.

portfolio_scope

Chooses which accounts add up to portfolio_value, the number guardrails and withdrawal rates use. If you leave it out, all accounts count. total_portfolio_value always includes every account.

Use it to keep a bridge fund out of the portfolio that guardrails watch:

accounts:
  - name: "Main Portfolio"
    type: taxable
    balance: 1000000
    strategy: growth
  - name: "Bridge Fund"
    type: custom
    balance: { variable: "bridge_fund" }
    strategy: bridge_growth
portfolio_scope:
  - "Main Portfolio"

Account balance variables

Every account’s balance is available as a variable. Two forms work and mean the same thing:

account_balance["John's 401k"]
account_balance_john's_401k

The flat form is the account name in lowercase with spaces turned into underscores.

8. cash_flows

Cash flows are money moving in and out of your accounts. They are processed before withdrawal rules each year.

They fall into three groups:

Group Types How it counts toward spending Effect on accounts
Income streams social_security, pension, income (with direction: contribution), survivor benefits Fund spending first. The part used counts as income. Only the surplus, the part not needed for spending, is deposited.
Savings contributions recurring and one_time with direction: contribution Never counted as income or spending. The full amount is deposited into target.
Bridge withdrawals bridge_withdrawal Counted once as income. Withdrawn from source_account.

Entry attributes

Attribute Required Type Description
name yes text A label.
type yes text recurring, one_time, social_security, pension, income or bridge_withdrawal.
direction varies text contribution (money in) or withdrawal (money out). Implied as contribution for social_security and pension. Required for recurring, one_time and income.
target yes, except bridge_withdrawal text The account to deposit into, or draw from for a withdrawal. For an income stream, it receives only the surplus.
owner no text A person’s name.
amount yes number or variable Dollars per occurrence. Use a positive number.
inflation_adjusted varies true or false Whether the amount grows with inflation. Default false. Always true for social_security.
inflation_modifier no decimal Percentage points added to the escalation rate. Needs inflation_adjusted: true. Cannot be combined with absolute_inflation_rate.
absolute_inflation_rate no decimal A fixed yearly escalation rate that ignores inflation. Needs inflation_adjusted: true. Cannot be combined with inflation_modifier.
person varies text A name from retiree_profile.people. Required for social_security, pension and bridge_withdrawal.
survivor_benefit_start no map Survivor benefit settings.
timing yes map When the cash flow is active.
occurrence_probability stochastic only number, 0.0 to 1.0 Chance that a one_time flow happens. Needs window.
window stochastic only map Years in which a stochastic one_time flow can happen. Needs occurrence_probability.

Types in brief:

Type direction Inflation adjusted Notes
recurring required default false A general repeating flow.
one_time required default false Happens once, in a given year.
social_security implied always true The survivor gets the greater of the two amounts.
pension implied default false The survivor gets both amounts added together by default.
income required default false An income stream. Only the surplus is deposited.
bridge_withdrawal not needed default false Draws from a named source account.

How income streams are counted

Each year, bridge withdrawals, withdrawal-direction flows and savings contributions go first. Income streams then fill the remaining spending need, in the order you list them:

spending_need     = max(0, standard_of_living * inflation_so_far - active_income)
remaining_need    = max(0, spending_need - bridge_income - earlier_streams)
counted_as_income = min(stream_amount, remaining_need)
surplus           = stream_amount - counted_as_income

The surplus goes into the stream’s target account.

For example, suppose spending need is 100,000, Social Security pays 40,000 and a pension pays 70,000, with no bridge. Social Security fills 40,000 of the need. The pension fills the remaining 60,000 and deposits a 10,000 surplus.

Stochastic one-time expenses

A one_time flow is normally fixed in one year. Add occurrence_probability and window and it becomes a chance event. It happens zero or one times per simulation, in a year picked from the window.

cash_flows:
  - name: "new_roof"
    type: "one_time"
    direction: "withdrawal"
    target: "Taxable Brokerage"
    amount: 30000
    occurrence_probability: 0.4
    window:
      start: { person: Alice, age: 70 }
      end:   { person: Alice, age: 85 }

You must set both fields together. Each bound of window uses the same year formats as one-time timing (see below), and the end must not be before the start.

How inflation applies to a cash flow

A flow that is inflation adjusted escalates by one of three paths:

Path Fields Escalates at
Shared neither The plan’s cumulative inflation.
Relative to inflation inflation_modifier Each year’s inflation plus the modifier, compounded for each active year.
Decoupled from inflation absolute_inflation_rate A fixed rate each active year, whatever inflation does.

Healthcare is a typical use of inflation_modifier, because it has often risen faster than general prices. A fixed annuity with a stated yearly step-up suits absolute_inflation_rate.

cash_flows:
  - name: "Healthcare"
    type: recurring
    direction: withdrawal
    target: "Taxable Brokerage"
    amount: 15000
    inflation_adjusted: true
    inflation_modifier: 0.03
  - name: "Fixed Annuity"
    type: recurring
    direction: contribution
    target: "Taxable Brokerage"
    amount: 24000
    inflation_adjusted: true
    absolute_inflation_rate: 0.02

Both fields only work when inflation_adjusted is true. They compound once per active year, so a flow that pauses and resumes picks up where it left off. absolute_inflation_rate must be above -1.0 and no more than 100.0. An escalation rate that would drop below -100% in a year stops that simulation.

bridge_withdrawal

A bridge withdrawal draws from a named source account, usually a separate fund, and counts the money as income. This models the years between leaving work and the first Social Security payment.

Attribute Required Description
type yes "bridge_withdrawal"
source_account yes The account to draw from.
person yes The person the bridge stands in for.
amount yes Dollars, or { variable: "name" }.
inflation_adjusted no Default false.
timing yes A timing block with start_year and end_year.

A bridge withdrawal needs no target or direction. It cannot take more than the account holds. If the account runs dry, the withdrawal drops to zero.

cash_flows:
  - name: "Bridge income - John"
    type: "bridge_withdrawal"
    source_account: "Bridge Fund"
    person: "John"
    amount: { variable: "john_ss_amount" }
    inflation_adjusted: true
    timing:
      start_year: "simulation_start_year"
      end_year: { variable: "john_ss_start", offset: -1 }
  - name: "Social Security - John"
    type: "social_security"
    person: "John"
    amount: { variable: "john_ss_amount" }
    target: "Taxable Brokerage"
    timing:
      start_year: { variable: "john_ss_start" }
      end_year: null

timing

For a recurring flow:

Attribute Required Type Description
phase no text accumulation or drawdown. accumulation has no effect unless person is also set.
person no text Ties phase: accumulation to this person’s retirement year. Write it inside timing.
start_year no year value First active year, inclusive.
end_year no year value Last active year, inclusive.

For a one-time flow, year is required and says when it happens.

A year value can be written in these ways:

Format Example Meaning
Literal year 2027 A fixed calendar year.
By age { person: "John", age: 67 } Birth year plus age.
Variable name "john_ss_start" A variable’s value.
Variable reference { variable: "john_ss_start" } A variable’s value.
Variable and offset { variable: "john_ss_start", offset: -1 } The variable plus the offset. Offset also works with { person, age }.
Null null No bound.

A recurring flow is active in a year only when both the phase check and the year bounds pass:

timing Active when
phase: "accumulation" with a person The calendar year is before that person’s retirement year.
phase: "accumulation" with no person Always. The phase does nothing without a person.
phase: "drawdown" The calendar year is the latest retirement year of everyone, or later.
start_year: S The calendar year is S or later.
end_year: E The calendar year is E or earlier.

Common mistakes:

  • phase: accumulation without person does nothing and gives no error.
  • owner is not person. owner only picks which account is credited. Timing reads only the timing block.
  • timing.person must be someone in retiree_profile.people.
  • Write person inside timing. A person at the top of the cash flow is ignored for timing.

Two equal ways to stop contributing when someone retires:

timing:
  phase: accumulation
  person: John
timing:
  end_year: 2024

The second form assumes John’s retirement year is 2025, because end_year is inclusive.

survivor_benefit_start

Sets how paired income streams, such as Social Security or pensions, change when one partner dies.

Attribute Required Type Description
type yes text random, fixed or none.
year_range if random two years Inclusive range the transition year is drawn from, such as [2040, 2055].
year if fixed year The transition year.
group unless none text Pairs cash flows together.
benefit no text greater_of (survivor gets the larger amount, for Social Security) or combined (survivor gets both, for pensions).
expose_as no text Saves the transition year under a variable name.

With type: random, one year is drawn per group per simulation. expose_as lets rules use it:

survivor_benefit_start:
  type: "random"
  year_range: [2040, 2055]
  group: "social_security"
  expose_as: "ss_survivor_benefit_start_year"

9. transfer_rules

Transfer rules move money between accounts at the end of each year, after withdrawals. Use them to refill a spending account from growth accounts, for example.

A transfer needs two parts: transfer_strategies (where the money can come from) and transfer_rules (when and how much).

Transfer strategies

A transfer strategy is a list of source tiers. Each tier has primary accounts, an optional fallback list and a weight that says how to share the draw across the primary accounts.

  1. Start at tier 1 and try to draw the full amount from its primary accounts.
  2. If they run short, try the tier’s fallback accounts one after another.
  3. If the tier is used up, move to tier 2 for what is left, and so on.
transfer_strategies:
  refill_from_growth:
    sources:
      - accounts: ["Taxable Brokerage", "Joint Roth"]
        fallback: ["John's 401k", "Jane's 401k"]
        weight: proportional
      - accounts: ["John's 401k", "Jane's 401k"]
        weight: equal
  refill_from_tax_deferred:
    sources:
      - accounts: ["John's 401k", "Jane's 401k"]
        weight: sequential
Weight Behavior
proportional Shares the draw in proportion to current balances.
equal Splits the draw evenly. If one account cannot cover its share, the others make up the difference.
sequential Empties the accounts in list order.

Transfer rule attributes

Attribute Required Description
name yes A label.
condition yes When the rule applies. Same condition syntax as withdrawal rules.
target yes The account to deposit into.
amount yes A formula for the amount.
source_strategy yes A list of condition and use pairs. The first match wins. It must include an entry with condition: "default".
transfer_rules:
  - name: "Refill Spending Account"
    condition:
      variable: "account_balance_spending_account"
      operator: "<"
      compare_to: 50000
    target: "Spending Account"
    amount:
      - value: 100000
      - operator: "-"
      - variable: "account_balance_spending_account"
    source_strategy:
      - condition:
          variable: "portfolio_value"
          operator: ">"
          compare_to: 1000000
        use: "refill_from_growth"
      - condition: "default"
        use: "refill_from_tax_deferred"

This rule fires when the spending account drops below 50,000. It tops the account back up to 100,000. If the portfolio is above 1,000,000 it uses refill_from_growth. Otherwise it uses refill_from_tax_deferred.

For each rule, in order: check the condition, compute the amount (skip if 0 or less), pick the first matching source strategy, draw tier by tier, then deposit the total into the target.

Pattern: a funded spending account

Withdrawal rules use a simple chain of one account and a fallback list. If you want weighted, tiered sourcing, keep the sourcing in transfer rules and keep the withdrawal rule simple:

  1. Create a spending account.
  2. Define transfer strategies with your tiered sourcing.
  3. Add a transfer rule that refills the spending account when it runs low.
  4. Write withdrawal rules that draw only from the spending account.
withdrawal_rules:
  - name: "Standard Withdrawal"
    condition: "default"
    action:
      withdrawal_amount:
        formula:
          - variable: "required_portfolio_withdrawal"
    source:
      account: "Spending Account"
      fallback: []
    continue: false

Because transfers run at the end of the year, the spending account is full before the next year’s decisions. Use this pattern for proportional draws across accounts or for sourcing that changes with market conditions. If a simple ordered chain is enough, use source with fallback instead.

10. withdrawal_rules

Rules that decide the withdrawal each year. They are checked top to bottom, and only once everyone has retired. They are skipped while anyone is still working.

Rule attributes

Attribute Required Type Description
name yes text A label.
description no text A note about the rule’s purpose.
start_year no year value The rule applies from this year on.
end_year no year value The rule applies until this year.
condition yes condition When the rule fires.
action yes action What to withdraw. Must produce a withdrawal_amount with a formula.
source yes map The account to draw from, with an optional fallback list.
continue no true or false true runs the rule and keeps checking the next ones. false (default) runs it and stops.

How rules are processed:

  1. Drop rules whose start_year and end_year do not include this year.
  2. Check the rest from top to bottom.
  3. If a condition matches, run its action.
  4. With continue: true, add the amount to a running total and check the next rule. With continue: false, add it and stop.
  5. The year’s withdrawal is the sum of all rules that fired.

At least one rule must have condition: "default" and say continue: false explicitly. A document without one is rejected.

Put floor checks before guardrail rules. Because continue: false stops the checking, a cut that fires first would otherwise push the withdrawal below your minimum.

Conditions

A simple comparison:

condition:
  variable: "calendar_year"
  operator: ">="
  compare_to: 2040

Compared with another variable, or with an expression of the form variable times a number:

condition:
  variable: "withdrawal_rate"
  operator: ">"
  compare_to: "initial_withdrawal_rate * 1.20"

All must be true (and):

condition:
  all_of:
    - variable: "calendar_year"
      operator: ">="
      compare_to: 2040
    - variable: "portfolio_value"
      operator: ">"
      compare_to: 500000

At least one must be true (or):

condition:
  any_of:
    - variable: "calendar_year"
      operator: ">="
      compare_to: 2040
    - variable: "portfolio_drawdown"
      operator: ">"
      compare_to: 0.50

Always matches (the fallback rule):

condition: "default"

Operators are <, <=, >, >=, = and !=.

compare_to can be a number such as 0.04, true or false, the name of a variable in quotes, or an expression in quotes.

Numbers are numbers and quoted text is a variable name. There is no conversion between them. compare_to: 0 is the number zero. compare_to: "0" looks for a variable named 0, finds none, and stops the simulation with an error. A quoted text is read as an expression only when it contains an operator with spaces around it, such as *.

# Wrong: "0" is read as a variable name
condition: { variable: 'account_balance["ira"]', operator: ">", compare_to: "0" }
# Right: 0 is the number zero
condition: { variable: 'account_balance["ira"]', operator: ">", compare_to: 0 }

This applies everywhere compare_to appears, including transfer rules and source_strategy.

Actions

An action produces a withdrawal_amount. You can add named steps before it, calculated top to bottom.

A variable:

action:
  withdrawal_amount:
    formula:
      - variable: "required_portfolio_withdrawal"

A percentage of the portfolio:

action:
  withdrawal_amount:
    formula:
      - variable: "portfolio_value"
      - operator: "*"
      - value: 0.04

Several steps:

action:
  base_withdrawal:
    formula:
      - variable: "portfolio_value"
      - operator: "*"
      - value: 0.04
  ceiling:
    formula:
      - variable: "previous_withdrawal"
      - operator: "*"
      - value: 1.05
  withdrawal_amount:
    formula:
      - variable: "base_withdrawal"

source

Says which account the money comes from. Every withdrawal rule needs one. Names must match accounts you defined.

Attribute Required Type Description
account yes text The account to draw from first.
fallback no list Accounts to try, in order, if the first is empty.
source:
  account: "Taxable Brokerage"
  fallback: ["John's 401k", "Jane's 401k", "Joint Roth"]

The simulator draws the full amount from account. If that is not enough, it moves down the fallback list, emptying each account as needed.

Running out of money

If a rule asks for an amount and every source account is empty, the portfolio has run out. All balances go to zero and that simulation ends.

Pattern: ordered draws

Draw from accounts in a set order with source and fallback:

- name: "Standard Withdrawal"
  condition: "default"
  action:
    withdrawal_amount:
      formula:
        - variable: "required_portfolio_withdrawal"
  source:
    account: "Taxable Brokerage"
    fallback: ["John's 401k", "Jane's 401k", "Joint Roth"]
  continue: false

To change the order over time, give rules different start_year and end_year values.

Pattern: guardrails

These rules follow the Guyton-Klinger approach. They compare current_withdrawal_rate with guardrail_lower and guardrail_upper, which you define as custom variables. Define current_withdrawal_rate as previous_withdrawal / portfolio_value_start.

- name: "Prosperity Raise"
  condition:
    variable: "current_withdrawal_rate"
    operator: "<"
    compare_to: "guardrail_lower"
  action:
    withdrawal_amount:
      formula:
        - variable: "previous_withdrawal"
        - operator: "*"
        - value: 1.10
  source:
    account: "Taxable Brokerage"
    fallback: ["John's 401k", "Joint Roth"]
- name: "Preservation Cut"
  condition:
    variable: "current_withdrawal_rate"
    operator: ">"
    compare_to: "guardrail_upper"
  action:
    withdrawal_amount:
      formula:
        - variable: "previous_withdrawal"
        - operator: "*"
        - value: 0.90
  source:
    account: "Taxable Brokerage"
    fallback: ["John's 401k", "Joint Roth"]
- name: "Standard Withdrawal"
  condition: "default"
  action:
    withdrawal_amount:
      formula:
        - variable: "required_portfolio_withdrawal"
  source:
    account: "Taxable Brokerage"
    fallback: ["John's 401k", "Jane's 401k", "Joint Roth"]
  continue: false

The “Standard Withdrawal” rule above takes required_portfolio_withdrawal, which is your original spending target grown by inflation. It does not use last year’s withdrawal. So a raise or a cut lasts only while the rate stays outside its band. In the first year the rate is back inside the band, spending returns to the original target. To keep raises and cuts from year to year, see the next pattern, Guardrails that keep raises and cuts.

Pattern: guardrails that keep raises and cuts

The standard guardrail rule forgets last year, so raises and cuts do not stick. This pattern shows why, how to make them stick, how to cap spending, and how to size a Social Security bridge. It is for hand-written ThriveScript Blueprint files.

The problem with the standard rule

A guardrail script has four rules. It cuts spending 10% when the withdrawal rate is above the upper guardrail. It raises spending 10% when the rate is below the lower guardrail. It holds spending flat after a losing year. Otherwise it takes the required withdrawal.

That last rule usually uses required_portfolio_withdrawal. That variable is your original spending target grown by inflation. It does not use last year’s withdrawal. So a cut or a raise lasts only while the rate stays outside its band. In the first year the rate is back inside the band, spending returns to the original target and the earlier decision is lost.

Two effects follow:

  • Cuts do not add up. A plan can fire many cuts over a run and still spend back at the target in between.
  • Nothing caps a run of raises. A long good run can keep raising spending.

The guardrail arithmetic is correct. The default rule is what forgets last year.

The fix: make the default rule remember last year

Make the default rule take last year’s withdrawal, grown by last year’s inflation. On January 1 you know last year’s inflation, not this year’s, so this uses nothing from the future.

custom_variables:
  static:
    guardrail_upper_multiplier: 1.2
    guardrail_lower_multiplier: 0.8
  dynamic:
    current_withdrawal_rate:
      formula:
        - variable: previous_withdrawal
        - operator: /
        - variable: portfolio_value_start
    guardrail_upper:
      formula:
        - variable: initial_withdrawal_rate
        - operator: '*'
        - variable: guardrail_upper_multiplier
    guardrail_lower:
      formula:
        - variable: initial_withdrawal_rate
        - operator: '*'
        - variable: guardrail_lower_multiplier
    inflation_factor:
      formula:
        - value: 1.0
        - operator: '+'
        - variable: previous_inflation
    ratchet_withdrawal:
      formula:
        - variable: previous_withdrawal
        - operator: '*'
        - variable: inflation_factor

withdrawal_rules:
  - name: "Standard Withdrawal"
    description: "Otherwise take last year's withdrawal grown by last year's inflation."
    condition: default
    action:
      withdrawal_amount:
        formula:
          - variable: ratchet_withdrawal
    source:
      account: "Retirement"
    continue: false

Declare inflation_factor before ratchet_withdrawal. Dynamic variables are worked out in the order you list them.

Notes:

  • In the first year previous_inflation is 0, and previous_withdrawal starts at the first drawdown year’s withdrawal, so the first retirement year starts neutral.
  • Raises and cuts now carry forward, because every later year starts from last year’s amount.
  • Your other rules, such as the prosperity raise, the preservation cut and a hold after a losing year, stay as they are.
  • This rule does not pick up income changes. required_portfolio_withdrawal subtracted income as it changed, such as a pension starting. The ratchet does not. The raise and cut rules still respond over time, but nothing steps spending down on the day the income starts. If income starts or stops in your plan and you have no bridge, check the results.

Cap spending with a ceiling

The ratchet keeps raises, so a long good run keeps raising. Set a ceiling on total spending in today’s dollars:

retiree_profile:
  standard_of_living: 300000
  maximum_standard_of_living: 450000

The ceiling applies to total spending, which is the portfolio withdrawal plus income. It grows with inflation. It is applied before money leaves an account, so a raise cannot push spending past it. Choose the ratio yourself. This example is 1.5 times the target. A minimum_standard_of_living floor is optional and independent of this.

Social Security and the bridge

Income that starts mid-retirement lowers the portfolio withdrawal. The withdrawal rate then falls under the lower guardrail, and raises fire year after year while cuts almost never fire. A bridge reduces this. A bridge fund pays the amount Social Security will pay until the real benefit starts. portfolio_scope lists every account except the bridge fund, so the guardrails do not see it.

Two things to get right:

  • Size the bridge from the inflation-adjusted need. If you add up the years of payments with no allowance for inflation, and have no refill rule, the bridge can run short before benefits begin.
  • A bridge reduces the problem but does not remove it, and it does not cap spending. Raises can still add up and the default rule can still reset spending. Use a spending ceiling and the ratchet above.

What changes for your results

With the ratchet, cuts stick. Fewer simulations run out of money, because spending is cut instead. The cost is that more simulations spend long periods below the target. Anything that reports a success rate or years below your lifestyle changes meaning when you make this change, so read it with that in mind.

ThriveFI.app does not model taxes. Results are estimates from simulations. They are not predictions or advice.

11. What happens each year

Knowing the order helps you write rules that behave as you expect. Each simulated year runs these steps:

  1. Update time variables such as the year and each person’s age.
  2. Apply returns to each account.
  3. Process cash flows.
  4. Work out the required portfolio withdrawal.
  5. Work out any required minimum distribution variables.
  6. Recalculate dynamic custom variables.
  7. Check withdrawal rules.
  8. Take the withdrawal out of the accounts.
  9. Apply the spending floor and ceiling.
  10. Run transfer rules.
  11. Update the values that rules read from the previous year.
  12. Record the year’s results.

With return_timing: end_of_year, the order of returns and withdrawals is reversed, as described in section 3.

Where to go next

Results are estimates from simulations, not predictions. They are not investment, tax or legal advice.

Early access is coming soon.