Devlog  /  sim build 0.0.1

The Whipsaw

A stock-flow-consistent economy simulation, written in Rust. This is the build log: what broke, what the numbers actually said, and which of my own instruments turned out to be lying.

Flow matrix: no leak, and the units

Five structural causes fixed and the slide was still there. Rather than go hunting for a sixth I built the Godley & Lavoie flow matrix properly, with both invariants: row sums to zero, that’s flow type, and column sums to zero, that’s sector.

The column one is what was missing. assert_world_balance was checking stocks, and a balance sum of 0 is perfectly happy with an economy draining neatly into deposits.

First run answered it:

money supply:       916 526.62 at tick 0 and at tick 400, flat
net saving:         ±a few thousand, sign changing, nobody accumulates
consumption / GDP:  225 591 / 126 719, they buy twice what they produce

Nothing leaking into a stock. The slide is parametric.

It’s units. propensity_wealth = 0.03 per tick, and a tick is a week (§3.1). Godley & Lavoie give that coefficient per year, 0.05–0.2. So 0.03 a week is 77% of wealth a year. Households were emptying the stocks faster than the economy could refill them. It’s 0.002 per tick now, 9% a year.

The lesson, and it’s a clean one: a structural bug and a wrong coefficient produce exactly the same symptom. The flow matrix is the only thing that tells them apart. Which is why it’s a permanent fixture with a test on it now, instead of a debug session I did once. Every stage after this adds flows, interest, taxes, investment, and the column condition catches the same class of error for free.