Status: done (2026-11-09)
Priority: 1
Size: S
Arch: kin-help
Phase: wrap-up
Design ref: Exchange, goodwill and obligations (The gift); Goods, production and animals (Help in hunger); docs/roadmap.md, sections 3.1 (done when) and 5.2; VB-182’s plan.
Goal: Check slice 1 as a whole: help in hunger works as before, goodwill is booked and shown, the golden file changed for the booking only, and the slice stays within its cost line. Probe the balances before slice 4 lets them act (VB-220), and close the arch.
Acceptance criteria:
tools/balance.js --scenario populous --seeds 3,7,11,42 --map small --years 15 and the yearly lines of tools/sim.js (founders 7 small, 10 years; populous 7 small, 15 years), each difference explained.small-y40 and the late reference (medium-ref once VB-202 has made it, else medium-y60, as stress): the number of balances, counterparts per pawn (the largest against the cap of 32), the sizes (median, 90th percentile, largest) in rations and in days of the debtor household’s need, balances by kinship (parents and children against siblings), the share passed at handovers and the share forgotten by decay over a year. Say whether the 30 days of limitDays and the curves’ scale of 20 rations look right for VB-220, with the numbers.node tools/sim.js --load ... --years 1 --report perf and --report counts, and node tests/history.js; docs/bench/budget.md gains the slice’s line.tools/balance.js
and a single Sim.advance differ), against VB-222’s before numbers; say whether the 17% more hungry household-days VB-222 saw holds up.design.md, section 9) checked against the code, with differences raised as questions or tasks (Flags in BACKLOG.md).node tools/backlog.js close-arch kin-help once no task is open in it.npm run verify passes.
Notes:SYSTEM_BUDGETS is taken from the 8 ms kept back (now 7.9), a line this task does not
own: QUESTIONS.md, “VB-219”, question 1.QUESTIONS.md, “VB-219”, question 2.aa93ffd, the commit before VB-216, in a scratch git worktree with the meal fix of 15f58af applied
(without it, populous 3 crashes in year 15 when stepped a year at a time; VB-222’s notes); “after” is 6e22341 and this task’s commits,
which change no simulation code. Between them, behaviour changes only by VB-222’s seasonal ask: VB-217’s balances are read by nothing
but the panel, and VB-216, VB-204, VB-205, VB-218 and VB-224 left the golden file unchanged or changed it for ledger lines and apiKeys
only. So “before” is also VB-222’s before (cc5546b, rebased as 497e417): its single-advance totals below match VB-222’s to the day.
The counts are from scratch scripts (not kept) that load src/ as tools/perf.js does and wrap, read-only, feedHousehold (each
hungry day, with the household’s members at that meal), Stores.put (each gift received, kin or store by its giver’s name), and
book, passGoodwill, endGoodwill and shareFood (the probe). Timings ran while other agents’ tests ran on the same 4 cores (load
average 9 to 14), so they are medians of alternating runs, with ranges.tools/balance.js --scenario populous --seeds 3,7,11,42 --map small --years 15 (years 2 to 15; 4,894 household-years before, 4,844
after), by household size in adult-equivalents of need:
| Size | Household-years | Made / need | Hungry % of household-years | Hungry days a household-year |
|---|---|---|---|---|
| 1 | 295 → 304 | 2.47 → 2.15 | 22 → 17 | 0.9 → 0.7 |
| 2 | 773 → 692 | 1.67 → 1.89 | 9 → 11 | 0.5 → 0.3 |
| 3 | 1,199 → 1,161 | 1.51 → 1.46 | 3 → 7 | 0.2 → 0.1 |
| 4 | 818 → 882 | 1.56 → 1.55 | 2 → 5 | 0.2 → 0.2 |
| 5 | 790 → 803 | 1.54 → 1.58 | 4 → 3 | 0.3 → 0.2 |
| 6 | 643 → 613 | 1.40 → 1.41 | 5 → 3 | 0.5 → 0.2 |
| 7 | 248 → 278 | 1.34 → 1.33 | 6 → 4 | 0.6 → 0.3 |
| 8 | 104 → 91 | 1.27 → 1.43 | 6 → 2 | 0.4 → 0.3 |
| 9 | 24 → 20 | 1.22 → 1.24 | 4 → 10 | 0.7 → 0.8 |
The same runs (stepped as tools/balance.js steps): kin gifts 2,543 → 1,759 (-31%) for 52,200 → 50,736 rations (-3%), so the mean
kin gift grew from 20.5 to 28.8 rations; store gifts 1,466 → 1,250 for 41,131 → 43,644 rations; households helped 355 → 360; hungry
household-days 2,160 → 1,468. Fewer, larger gifts for about the same grain is the seasonal ask’s intent (Lumps and occasions). More
households of 2 to 4 are touched by some hunger (a shortfall now waits for the next season), and as many or fewer days are hungry at every
size but 9 (20 household-years).
tools/sim.js, populous 7 small, 15 years: year 1 is the same (352 living, 3 births, 2 deaths of illness, 26 hungry days; mean grain
263.2 → 264.1, since the first winter’s asks are larger). From year 2 the runs diverge (19 marriages against 18): each gift raises
the two holders’ tie, so fewer gifts change who knows whom and so who marries, moves and inherits, and every stream is drawn in another
order. Over 15 years: hungry household-days 176 → 245, deaths from hunger and starvation 1 (year 15) → 0, 459 → 465 living, mean
grain 246.9 → 236.6 at year 15. Founders 7 small, 10 years: hungry days 47 → 47, but one death of starvation in year 2 (none
before), and 21 → 18 living at year 10. Traced: the village store, the only giver among the founders, held about 80 rations for
two hungry households; asking for 12 days at a time, each got 36 in the first winter and household 4 the last 7.7 in spring; asking
once a season, each got 29 in winter and household 4 the last 21.8 in spring, and household 5’s one member starved that autumn
(QUESTIONS.md, “VB-219”, question 3). The other differences follow from it.
The probe of the balances. Populous 7 and 42 at the end of year 15 (stepped a year at a time, the 15th year measured), and a year
on from small-y40 (year 40) and medium-ref (year 12). Days are the balance over the debtor household’s daily need; kinship is
between the two pawns of a balance (“through a spouse”: one’s spouse is the other’s parent, child or sibling, or one’s spouse’s
spouse is; “other”: none of these, not traced further: balances passed to an heir, or kin through a member who is not the holder).
| Populous 7, y15 | Populous 42, y15 | small-y40 + 1 |
medium-ref + 1 |
|
|---|---|---|---|---|
| Living | 465 | 457 | 712 | 1,040 |
| Balances (not forgotten) | 160 | 167 | 431 | 262 |
| Pawns with a balance | 112 | 113 | 200 | 222 |
| Counterparts a pawn: median, 90th pct, largest (cap 32) | 2, 5, 9 | 3, 6, 8 | 4, 8, 12 | 2, 4, 8 |
| Size, rations: median, 90th pct, largest | 19.4, 81.4, 406 | 21.9, 83.2, 230 | 11.6, 70.5, 270 | 23.0, 95.8, 385 |
| Size, days of the debtor’s need: median, 90th pct, largest | 5.9, 30.8, 56 | 6.8, 25.5, 77 | 3.7, 19.5, 69 | 7.7, 29.8, 114 |
Over 30 days (limitDays) |
16 (10%) | 11 (7%) | 19 (4%) | 26 (10%) |
| Parents and children: balances, median rations | 33, 26.1 | 37, 17.1 | 49, 18.7 | 59, 24.1 |
| Siblings | 18, 23.1 | 26, 11.7 | 77, 14.7 | 40, 14.1 |
| Through a spouse | 66, 26.3 | 86, 27.8 | 150, 18.1 | 123, 26.9 |
| Other | 43, 9.6 | 18, 16.8 | 155, 6.1 | 40, 18.0 |
| The year: stock at its start, rations (balances) | 5,208 (149) | 4,908 (151) | 11,146 (412) | 8,334 (218) |
| Booked (gifts between holders) | 1,798 (63) | 1,573 (51) | 2,340 (86) | 4,111 (132) |
| Decayed (of the stock at the start) | 936 (18%) | 868 (18%) | 1,902 (17%) | 1,614 (19%) |
| Passed at handovers (handovers with balances) | 155, 3.0% (2) | 195, 4.0% (3) | 329, 3.0% (5) | 70, 0.8% (2) |
| Ended at deaths (deaths with balances) | 155, 3.0% (2) | 252, 5.1% (4) | 331, 3.0% (6) | 106, 1.3% (3) |
| Stock at the year’s end | 5,686 | 5,294 | 10,993 | 10,471 |
| Of the year’s first balances: held, forgotten, ended by a death | 141, 0, 8 | 145, 1, 5 | 392, 7, 13 | 210, 1, 7 |
| Balances’ JSON in the save (share) | 18.6 KB of 12.5 MB (0.15%) | 19.6 KB (0.15%) | 49.4 KB of 33.0 MB (0.15%) | 32.0 KB of 27.8 MB (0.11%) |
limitDays of 30 days of the debtor’s need lies near one full ask (12 to 36 days) and above 90 to 96% of balances, so
the term would cut a giver’s allowance only toward households already helped through more than one lean season: it looks right.
The scale of 20 rations lies at the median balance (12 to 23), so gratitude is +0.055 to +0.080 at the median and about +0.12 at
the 90th percentile, still telling one gift from several: it looks right. No change proposed.medium-ref; balances under 0.5% of the save):
tools/perf.js names the slice’s system, kin help and goodwill: the gift’s check (assessGift, with the allowance and its goodwill
term) and goodwill’s book, passGoodwill and endGoodwill. Help’s daily ask (shareFood) and the gift’s moves and events
(settleGift, help’s gift until VB-216) stay in hunger and meals, where VB-203 measured and shared them.node tools/sim.js --load tests/fixtures/medium-ref.gz --years 1 --report perf, six runs alternating with small-y40: 0.06, 0.07,
0.11, 0.06, 0.07 and 0.13 ms a game day, median 0.07 (514 calls a year, about 6 µs each); the whole simulation 221 to 383 ms a game
day in the same runs, so the spread is the shared machine. small-y40: 0.26, 0.07, 0.06, 0.06, 0.08, 0.06, median 0.065 (402 calls).
Within the line. Split by function at medium-ref (three runs): help’s daily ask 0.42 to 0.54 ms a game day, settleGift 0.07,
book 0.03 to 0.04, assessGift 0.02, the yearly filling 0.01, handovers and ends 0.01.--report counts (a year from medium-ref, 1,040 living): ruleValue 1,038 a day (death.hazard one per living pawn, so about 7
reads of allowance a day); storeWalk 458 a day; goodwill has no counter, since each operation touches at most two maps of at most
32 entries (VB-217).node tests/history.js: passes, 19 counters, ruleValue 1.00 and storeWalk 0.99 of small-y5’s work per living pawn-day.medium-ref’s a year on, and 0.15% at the other three states, under 0.5%.docs/bench/budget.md gains the line: SYSTEM_BUDGETS gives kin help and goodwill 0.1 ms from the 8 kept back (question 1), and
the generated table now lists every share, so the new line (and VB-205’s two agents lines) reads “unavailable” until the nightly
bench measures them; regenerated with node tools/bench.js --budget from the last run in history.jsonl (9f130e6), which is
not changed.Hunger under the seasonal ask: 16 runs a side, seeds 3, 7, 11 and 42, populous small, 15 years, each stepped four ways: one
Sim.advance (stepping a week or a season at a time gives the same run), a year at a time from the seed’s hour (year), a year at a
time an hour later, as tools/balance.js steps (balance), and a day at a time.
| Stepping | Hungry household-days | Households ever hungry | Deaths from hunger and starvation | Households with such a death |
|---|---|---|---|---|
| one advance | 1,785 → 2,082 (+17%) | 202 → 216 | 13 → 8 | 6 → 7 |
| a year at a time | 1,773 → 2,242 (+26%) | 199 → 209 | 4 → 13 | 2 → 11 |
as tools/balance.js |
2,160 → 1,468 (-32%) | 220 → 216 | 8 → 11 | 6 → 8 |
| a day at a time | 1,829 → 1,856 (+1%) | 196 → 222 | 7 → 11 | 6 → 6 |
| all 16 runs | 7,547 → 7,648 (+1%) | 817 → 863 (+6%) | 32 → 43 | 20 → 32 |
Per run, after over before: seed 3, 1.13, 1.65, 0.53, 0.68; seed 7, 1.16, 1.39, 1.61, 1.30; seed 11, 1.04, 1.18, 0.93, 1.46; seed 42, 1.25, 1.09, 0.63, 1.11 (12 of 16 above 1). By household size (members at each meal, the 16 runs summed):
| Members | Household-days | Hungry household-days | Hungry a 1,000 household-days | Households hungry at that size (summed) | Deaths |
|---|---|---|---|---|---|
| 1 | 97,152 → 98,380 | 2,351 → 2,481 | 24.2 → 25.2 | 676 → 653 | 0 → 14 |
| 2 | 127,341 → 134,141 | 1,019 → 1,256 | 8.0 → 9.4 | 94 → 181 | 12 → 8 |
| 3 or 4 | 258,348 → 256,070 | 787 → 922 | 3.0 → 3.6 | 86 → 222 | 10 → 10 |
| 5 or 6 | 243,545 → 246,691 | 1,519 → 1,327 | 6.2 → 5.4 | 66 → 107 | 7 → 6 |
| 7 or more | 260,105 → 253,320 | 1,871 → 1,662 | 7.2 → 6.6 | 71 → 80 | 3 → 5 |
QUESTIONS.md, “VB-219”, question 2.design.md, section 9), row by row, and the rows of section 9 and of Help in hunger that the slice built:
household.askedIn), for enough to reach the harvest (askDaysAt); amounts are
not yet whole quanta, which the row leaves to slice 4. Matches.pawn.goodwill, {v, t} mirrored on both pawns, read as v * 0.5 ** (age / halfLife). Matches.give and sim/exchange, the grain through sim/stores, and the worth (grain 1 a ration)
is booked to the giver’s credit. A household without a holder gives too (actor {household}, keeping 60 days), which Who books
implies. Matches.assessGift needs the floor kept and n within the allowance (to 1e-9); a village store has neither, and gives what it
holds, which the design does not say but nothing contradicts. Matches. With goodwill’s term off, help proposes exactly the allowance,
so no gift of help is refused today.floorOf, the seed reserve and HELP.floorDays (20) days of need. Matches.slack (grain above the floor, at least 0), reserve (minus the holder’s buffer beyond 20 days, 0 to 40 days of need),
goodwill (0 while GOODWILL.acts is false; written as the row says, against 30 days of the receiving household’s need), clamped at 0.
Matches.player passes the floor and the allowance in assessGift; the page’s side is VB-221. Matches.fair (slice 4) and VB-221 in life (slice 2), so this task was the last open one of kin-help.Sim reads (VB-218, apiKeys.Sim), as the restated “done when” of the roadmap (3.1) says.npm test 78 scripts pass after each commit; npm run verify 91 scripts passed in 339 s (on the shared machine);
tests/golden.json and tests/counters.json unchanged. Commits: f583d68 (the system and its line), 788e4a8 (VB-220, VB-221 and
the questions), and the wrap-up’s notes.