Repository navigation
Conversation
This is ADR 0006 step 7, and the point the whole ADR was written for. Until now a shift handed the worker food out of nothing: `farm.go` gave +5 a tick, the tavern +3, and both files said in a comment that it was conjured. The economy ran alongside that, decorative — money moved but nothing depended on it. Now the loop closes. Work pays a wage, the farm sells meals, and a hungry pip walks to a shop and buys one. A pip that cannot afford food starves, which is the first death in this simulation caused by economics rather than by a missing building. The behaviour lives in the core because every rule about how pips behave does: the browser predicts with this same code, so a decision taken anywhere else would make the client and the server disagree about what happens next. Concretely a pip gains an *errand* — somewhere it is going of its own accord, which outranks the commute. That is the first thing in this simulation a pip decides for itself; everything else about it was decided by a service or by the world. Deliberately not a plan or a queue of goals. A pip is hungry or it is not, and it re-decides every tick, so a shop that raises its price or a wage that arrives late changes its mind with nothing to invalidate. Prices reach the core the way capacity already does (ADR 0004): the workplace owns the number, the gateway carries it on the registration intent, the core enforces it. A pip deciding inside a tick whether it can afford lunch cannot make a network call to ask. `need_deltas` is deprecated rather than reserved. Step 7 asked for reserved and that turns out to be impossible: `buf breaking` refuses the deletion, and that rule is load-bearing, so the field stays on the wire and dies by disuse. Nothing populates it. The farm and the tavern no longer have any opinion about hunger — which is what makes the tavern's old food_per_tick = -1 bug unrepresentable rather than merely fixed. Covered by a test that runs 4,000 ticks of the full loop: a pip is hired, paid in batches the way the gateway pays it, decides for itself when to stop working and eat, and is still alive at the end with money in the bank and the supply still closed.
7 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ADR 0006 step 7 — the point the whole ADR was written for. Stacked on #8.
What changes
Until now a shift handed the worker food out of nothing.
farm.gogave+5a tick, the tavern+3, and both files said in a comment that it was conjured. The economy from #4 and #8 ran alongside that, decorative: money moved, but nothing depended on it.Now the loop closes:
A pip that cannot afford food starves. That is the first death in this simulation caused by economics rather than by a missing building.
The interesting part: a pip decides something
A pip gains an errand — somewhere it is going of its own accord, which outranks the commute. It is the first thing in this simulation a pip decides for itself; everything else about it was decided by a service or by the world.
Two choices worth reviewing:
It lives in the core. Same reason
wanderdoes: the browser predicts with this identical code, so a decision taken in a driver or a client would make prediction and truth disagree about what happens next.It is not a plan. No goal queue, no stored intention. A pip is hungry or it is not, and it re-decides every tick — so a shop that raises its price, or a wage that arrives late, changes its mind with nothing to invalidate. A plan would need to be cancelled; a standing preference does not.
An errand also has to be physical, per invariant 5: the pip walks there, goes inside (taking a place, briefly), buys, and leaves in the same tick.
Prices reach the core the way capacity already does (ADR 0004) — the workplace owns the number, the gateway carries it on the registration intent, the core enforces it. A pip deciding inside a tick whether it can afford lunch cannot make a network call to ask.
The proof
One test runs 4,000 ticks of the whole loop: a pip is hired, paid in batches the way the gateway pays it, decides for itself when to stop working and eat, and is alive at the end with money left and
total_money == 0throughout. Two more pin the other side — a penniless pip starves standing next to food it cannot afford, and hunger outranks the commute while employment survives the errand.need_deltasis deprecated, not reservedStep 7 asked for
reserved. That turns out to be impossible, and the ADR is wrong about it:make proto-lintrunsbuf breaking, and that rule is load-bearing — a topic with a week's retention holds messages that must still decode. So the field stays on the wire, marked deprecated, and dies by disuse. Nothing populates it.The farm and the tavern no longer have any opinion about hunger. That is what makes the tavern's old
food_per_tick = -1— the number that starved everyone it employed — unrepresentable rather than merely fixed.Test plan
cargo test -p sim— 32 pass, 3 new (survival over 4,000 ticks, starving next to unaffordable food, errand outranks commute)mix testintavern— 32 pass; its shift test now asserts a shift reports only what it produced and paidgo test ./...infarm,conformance,bank,world-gateway— pass; farm and conformance re-pinned onto wage and producecargo clippy --all-targets -- -D warningsclean,cargo fmt --checkcleanbuf lint/buf breakingclean —WorkplaceOffer,RegisterWorkplaceIntent.sells,Workplace.sellsall additivemake genregenerated for Go, TS and ElixirBalance, and what to watch
A meal restores 200 food; a working pip burns 2 a tick, so one meal buys ~100 ticks of work — 600 in wages against 50 at the till. Employment is comfortably survivable on purpose: if it were marginal, the only failure anyone would ever see is "everyone dies", and the interesting ones (a wage that cannot cover food, a shop nobody can reach) would be invisible underneath it.
Unemployment is now fatal, since nothing else feeds a pip. That is the intended scarcity, but it makes hiring throughput a survival mechanism rather than an optimisation — worth watching on the first live run.
🤖 Generated with Claude Code