macromod for any ai — and any coder
Connect it. Or code it.
Hook MacroMod up to Claude or ChatGPT and score reforms from your prompts — or skip the middleman and drive the Python API yourself. Free and open source. No account, no sign-in.
coming soon — not live yet
The MCP server isn't running yet, so these steps are a preview of the flow. Want to score a reform today? Use the Python API below.
Copy the MacroMod URL
Click the copy button — you'll paste it in the next step.
https://mcp.macromod.dev/mcpOpen Settings → Connectors
In Claude, add a custom connector, name it MacroMod, and paste the URL.
Connect and ask
Click Add → Connect, then ask Claude to score a 1p basic-rate rise.
Copy the MacroMod URL
Click the copy button — you'll paste it in the next step.
https://mcp.macromod.dev/mcpOpen Settings → Connectors
In ChatGPT, enable Developer mode under Connectors, then Create a connector named MacroMod and paste the URL.
Connect and ask
Save it, then ask ChatGPT to score a 1p basic-rate rise.
coming soon — not on PyPI yet
The macromod CLI isn't published yet, so these steps are a preview. Want to score a reform today? Use the Python API below.
Install
Python 3.11+. One package pulls the OLG engine and calibration data.
pip install macromodAsk Claude Code
Claude Code runs the CLI from its terminal — just describe the reform, or run it yourself:
macromod score \
--param gov.hmrc.income_tax.rates.uk[0].rate=0.21 \
--from 2026 --mode ssRead the results
GDP, consumption, investment, revenue, and debt in £bn — printed as a table or exported with --json.
Install
Python 3.11+. One package pulls the OLG engine and calibration data.
pip install macromodAsk Codex
Codex runs the CLI from its terminal — just describe the reform, or run it yourself:
macromod score \
--param gov.hmrc.income_tax.rates.uk[0].rate=0.21 \
--from 2026 --mode ssRead the results
GDP, consumption, investment, revenue, and debt in £bn — printed as a table or exported with --json.
coding agents with a terminal can use the CLI directly — no MCP needed.
using a coding agent with a terminal? the CLI or the code below is the better fit.
The Python API, in one screen.
No connector, no CLI — just Python. Pick a model: score a reform with the OLG or OBR engine in a handful of lines, or read the economy's current shocks and forecast it with the structural VAR.
Install straight from GitHub, no clone needed (Python 3.11–3.13). The whole scoring loop is four moves:
pip install git+https://github.com/PSLmodels/OG-UK
from datetime import datetime
from policyengine.core import ParameterValue, Policy
from policyengine.tax_benefit_models.uk import uk_latest
from oguk import solve_steady_state, map_to_real_world
# 01 BUILD — a reform is real statute: a PolicyEngine parameter + a new value.
# Here: basic rate of income tax 20% → 21% from 2026.
param = uk_latest.get_parameter("gov.hmrc.income_tax.rates.uk[0].rate")
reform = Policy(name="Basic rate 21%", parameter_values=[
ParameterValue(parameter=param, value=0.21,
start_date=datetime(2026, 1, 1))])
# 02 SOLVE — two general-equilibrium solves (~5-15 min each).
# No policy argument = current law. Same call + policy = the reform.
baseline = solve_steady_state(start_year=2026)
reform_ss = solve_steady_state(start_year=2026, policy=reform)
# 03 MAP — model units → current-price £bn, anchored to ONS/OBR data.
impact = map_to_real_world(baseline, reform_ss)
# 04 READ — level, change, and % change for each aggregate.
print(f"GDP: {impact.gdp_change:+.1f}bn ({impact.gdp_pct:+.3f}%)")
print(f"Revenue: {impact.tax_revenue_change:+.1f}bn")
print(f"Debt: {impact.debt_change:+.1f}bn")
GDP: +2.9bn (+0.041%)
Revenue: +6.4bn
Debt: −3.1bn
Under the hood: PolicyEngine runs the reform through the actual UK tax-benefit rules on representative microdata, OG-UK estimates tax functions from that, and the OLG model solves for how 80 age cohorts and firms re-optimise — giving you the new equilibrium wages, interest rate, and aggregates.
Swap solve_steady_state for run_transition_path
and you get the whole profile, year by year — and every series the model
tracks. Here is the same basic-rate reform, actually solved:
Reform impact over the transition path
£bn change from baseline · fiscal years 2026–2055
Sector output, long-run
% change vs baseline · 8-sector model, 2055
Higher income tax pulls labor and capital out of the market sectors; the public & other sector expands relative to them.
Real output from OG-UK's transition-path solver for a +1p basic-rate
rise — the same charts the model exports to
tpi_charts.html. Revenue rises then settles; GDP dips as
higher labor taxes trim work and saving over the long run.
solve_steady_state() for the long-run answer; run_transition_path() for the year-by-year fiscal profile (slower, runs on Dask).
"pooled" (default, fastest) → "brackets" → "each" for finer age-specific tax functions.
Structural shocks that aren't statute: {"cit_rate": [[0.25]]} for corporation tax, {"Z": [[1.004]]} for TFP.
Full guide — parameter paths, every option, transition paths, and outputs → the OG-UK model page
The OBR emulator ships its equation listing and forecast data with the code, so this one installs from a checkout, then a reform is a single shock to an exogenous variable:
git clone https://github.com/PolicyEngine/obr-macroeconomic-model
cd obr-macroeconomic-model && uv sync
from obr_macro import run_reform
# A £5bn government spending shock: £1.25bn per quarter over 4 quarters.
# CGG is the OBR's exogenous government-consumption variable.
results = run_reform(
name="Fiscal Stimulus",
var="CGG",
shock=1250,
periods=4,
)
# Deviation from baseline, quarter by quarter — the fiscal multiplier.
print(results[["period", "delta_gdp_bn", "pct_gdp"]])
period delta_gdp_bn pct_gdp
1 1.31 0.05
2 1.72 0.06
3 1.94 0.07
4 2.05 0.07
Under the hood: the OBR's 372 published equations are transpiled to Python and solved simultaneously by Gauss–Seidel each quarter. For a shock the closure swaps — inventories absorb the residual and GDP becomes endogenous — so output responds to the policy instead of being held fixed.
The exogenous lever to shock: "CGG" (gov. consumption), "CGIPS" (public investment), "TCPRO" (corporation tax rate).
How many quarters to solve — the multiplier builds over the first few quarters and settles.
Set True to switch on the investment channel for tax-rate shocks like a corporation-tax change.
Full guide — the solver, every lever, forecasting, and calibration → the OBR model page
The structural VAR doesn't score reforms (yet) — it reads the economy. Install the package from GitHub, grab a checkout for the runner scripts, and the pipeline is four moves:
pip install git+https://github.com/PolicyEngine/boe-var-model
git clone https://github.com/PolicyEngine/boe-var-model && cd boe-var-model
# assemble the public data (ONS, Bank of England database, FRED)
python scripts/download_data.py
# the paper's core outputs: IRFs, FEVDs, shocks, historical decompositions
python scripts/run_replication.py
# forecasting: fan charts, latest-quarter shock signs, forecast-revision decomposition
python scripts/run_forecast_revision.py
FEVD at 1-year horizon (median shares)
UK GDP identified global 40.9% domestic 38.0%
UK CPI identified global 50.1% domestic 35.4%
Under the hood: an 8-variable Bayesian VAR (1992Q1–2023Q2, Covid
dummies) is sampled from its normal-inverse-Wishart posterior, and each
draw is rotated per Arias–Rubio-Ramírez–Waggoner (2018) until the zero
and sign restrictions name six structural shocks. Figures and summary
tables land in results/.
The paper's Figures 2–6: IRFs, variance decompositions, estimated shocks, and historical decompositions of UK GDP and inflation.
The forecasting toolkit: fan charts, P(sign) of the latest quarter's shocks, composite IRFs, and the Section-5 forecast-revision split.
The library underneath: load_data(), the BVAR class, identify(), and the IRF/FEVD/decomposition analysis functions.
Full guide — the model, identification, validation against the paper → the SVAR model page