Status: done (2026-11-10)
Priority: 2
Size: M
Arch: yardstick
Phase: implement
Design ref: Customs and culture (How attitudes move). docs/roadmap.md, sections 5.2 (no step over 60 ms, Decided, Kim, 3 November; revised 6 November) and 5.3 (rules 1, 3 and 5).
Goal: Outside the moving round, the steps over 50 ms are all at midnight, when the day’s work runs in one 6-minute step. Measured on 3 November, populous small at seed 7, 30 game days from a save:
dailyLife took 39 ms a game day: Culture.dailyStep 17 ms, which walks every person and every tie, and its daily decay of every tie about 18 ms;endOfDay took 7 ms a game day, refreshRoutes 3 ms of it.
VB-195 (indexes of the living) and VB-127 (ties on a shared decay scale, at most 150 a pawn) remove part of this. Measure what is left, then spread or defer it, so no midnight goes over 60 ms. Blocked until VB-195 and VB-127 are done.
At the late reference, medium-ref (VB-203, 9 November, a whole game year from the save, three runs), 11 to 14 steps a year go over 60 ms, all of them midnights: the year’s turn (96 to 103 ms on its first midnight, 72 to 83 on its second), the moving round’s day (63 to 101 ms at its midnight; the round’s own call 51 to 56 ms) and several late-autumn and winter midnights (63 to 87 ms). On small-y40 none went over in a whole year (55 ms at most). Daily life and births costs 41 ms a game day at medium-ref against its share of 35 (docs/bench/closure.md); VB-127 takes the daily decay of every tie out of it first.
Acceptance criteria:medium-y60 is dropped).medium-ref and small-y40 (tools/bench.js does it on medium-ref), without excluding spikes.0bc77a3 (Kim, 10 November: whole phases meet the criterion; the village order within the marriages waits until that phase alone nears 60 ms, and gets a task then). No saved progress: the step of the day says what is due, and tests/spread.js checks each phase runs exactly once with uneven advances and with saves between phases and mid-night. Command validation and the order of each stream’s draws within a phase are kept.tools/marriage-demography.js: the means over the seeds of marriages a year, mean first-marriage age each within 5%, and the share of living women 45 to 54 never married within 2 percentage points of the mean before (Kim, 10 November, second answer: 1 woman in 50, in absolute terms). Each seed’s never-married count is reported; seeds 7 and 42 are reported and do not gate. Only after this passes, re-record the golden file and list the changed entries; ratchet tests/counters.json and list the changed counters (walkDaily, heirRank, roundRank).small-y40 and medium-ref, a whole game year from each: the midnight step’s time, and its parts by a CPU profile (node --cpu-prof), reported in the PR.Culture.dailyStep per settlement;newYear’s pass over every household’s ledger, VB-174’s ledger) is spread over the year’s first days.small-y40 and medium-ref in a whole game year, the round’s day included (timed as tools/bench.js times steps).medium-ref (tools/bench.js), or what VB-127 left of the gap named in the PR with a task for it.npm run calibrate), each within the calibration’s bands.npm run verify passes.
Notes:3 Nov 2026 (VB-181, the plan of slice 0): written after timing every 6-minute step of 30 game days from saves at years 5 and 40, and profiling them. The budget’s step line fails at midnight as well as at the moving round (VB-196).
6 Nov 2026 (user decision): the single-step budget is now 60 ms (previously 50 ms); historical timing counts above retain their original threshold.
docs/review-vb196.md for baselines and scheduler hazards.medium-ref (VB-202), and may end the temporary allowance by making medium-y60 a stress line that is reported but never gating; rewrite this task’s fixtures and numbers then. On 7 November the longest step at medium-y5 was 87 ms, over 60 ms with no allowance. The meetings’ step (autumn day 10) is VB-206, not this task.medium-y60 is now a stress state, reported against twice the reference’s lines and never gating, and the 60 ms limit holds on medium-ref and small-y40. Until VB-203 rewrites this task, read its medium-y60 as medium-ref; the first criterion’s removal from design, roadmap and guidance is done, and the benchmark’s column is left to VB-203.medium-ref and a whole game year, with the year’s turn and the round’s day as the steps to bring under 60 ms and daily life’s share (docs/bench/closure.md). Read medium-y60 in the notes above as history.0bc77a3, reverted in the next commit; the questions are in QUESTIONS.md (VB-201).
Fixtures remade at 4afb1b5 (fresh). Measured with a per-step timer over a whole game year (240 steps a day, no spike excluded), with
the parts of each midnight timed by wrapping its callees (a stage profile, in place of --cpu-prof).
medium-ref: 203 ms a game day, longest step 86.8 ms, 5 steps over 60: the midnights of days 1, 2 and 36 (72 to 87 ms), the
meetings (64, VB-206) and the round (76; its call 68). Daily life and births 26.5 ms a day (within its 35: VB-127 closed that gap).
A midnight’s parts, mean (worst): Culture.dailyStep 19.9 (43.3), refreshRoutes 6.2 (19.1), dailyTies 3.5 (16.1),
fadeRelations 12 on a season’s first day, feeding 2.2; Stores.prune at the year’s turn 2.4. The round’s parts (direct call):
settlement 26, plots 12, ranking reads 10, the rest of the marriages about 15.small-y40: 114 ms a day, longest 65.4 (the year’s first midnight: daily life 48), the meetings 51.Culture.settlementStep drifts one settlement’s people (the living of no settlement on the first) on each 6-minute step after
midnight (nightCulture, steps 1 to 40, wrapping); the moving round runs as four phases on the steps from noon (marriages, kin
pressure and handovers; demand, claims and plots; settlement; service, what is owed and prestige), each with its own ranking view. No
saved state: the step of the day says what is due (tests/spread.js: once each with uneven advances, saves between phases and mid-night).
The year’s turn needed nothing more: with the culture moved, its midnight is 44 to 48 ms (prune 2.4).medium-ref: midnights at most 48.1 ms, round phases 22, 25 and 36 ms; the only step over 60 is the meetings’ (61 to 96 ms over
three runs, VB-206). small-y40: longest 54.1 (the meetings); no other step over 31.tools/marriage-demography.js, 30 years): seed 7 marriages a year 6.367 to 6.067 (-4.7%), first-marriage age 21.58
to 21.56, never married 0/25 to 0/22; seed 42 6.200 to 5.500 (-11.3%, fails), 21.66 to 22.15, 0/16 to 0/15. With the culture’s
spread alone: 6.567 (+3.1%) and 6.000 (-3.2%). Over seeds 1, 2, 4, 5, 6, 8, 9, 10 the mean is 5.863 before, 5.858 after (5.863 with
the culture alone); the round’s phases grouped four ways move one seed’s marriages by about 5%. So the failure is a changed run’s
divergence, not a bias; the gate as written cannot be met without picking a schedule for its seed-42 outcome.npm run calibrate, npm run verify, ratcheting tests/counters.json (walkDaily
5 to 6, the homeless pass; heirRank and roundRank doubled in the tiny probe by phase 1’s fresh ranking view).QUESTION_ARCHIVE.md, “VB-201”): both questions answered as proposed, and the two criteria rewritten. The task is ready: restore the spread of 0bc77a3 (git revert of its revert), run the 12-seed gate, then the golden file, npm run calibrate and npm run verify. The meetings’ step stays VB-206’s.509d45e on top of VB-206’s meeting stages (one loop over the
day’s 6-minute steps drives the night’s culture, steps 1 to 40; the meetings’ stages, noon of autumn day 10; the round’s phases, noon of
the next day; tests/spread.js checks all three, with uneven advances and saves between phases, mid-night and between meeting stages),
then reverted in 613c108: the 12-seed gate fails on its third measure. Golden file, counters, calibrate and verify not run to the end.
sim/clock gains no state, only a call per 6-minute step to
nightCulture and roundPhase; Culture.settlementStep is one settlement’s part of dailyStep (the calibration still drives
dailyStep). Known test re-records it needs: tests/counters.json walkDaily 5 to 6 (the pass for the living of no settlement),
and tests/record.js’s heirs-7 anchor (230 events, hash 79786b701a98b8a7; 219 after), which is behaviour, not the record’s format.
tools/perf.js should also list nightCulture under daily life and births, or the bench moves the culture’s 19 ms a day into
“the rest of Sim.advance” (seen: daily life 24.0 to 5.5, the rest 4.1 to 23.7 ms a day at medium-ref).d196f68 (node tools/fixtures.js make, all four fresh, stamp d196f68), so no step pays the first fold
of a pre-VB-199 save. Timed with a per-step timer (perf.timeAdvance, as tools/bench.js), a whole game year, 11,520 steps, none excluded.medium-ref: 173 to 185 ms a game day (two runs); longest 84.9 ms, the year’s first midnight; 3 steps over 60: the
midnights of the year’s first and second days (84.9, 73.5) and the round’s day (63.4); the round’s call 49.6 (56.1 ms step). A
midnight’s parts (wrapped systems): daily life and births 36 to 55 ms, routes 6 to 17, feeding 3 to 5. CPU profile (inspector,
100 us, the 48 midnights summed, self time): culture drift 851 ms (driftPerson 548, dailyStep 268, gauss 35; 17.7 ms a midnight),
refreshRoutes 228 (4.8), dailyLife itself 138 (2.9, the death roll), feeding 70, dailyTies 26, heirRanking 12.small-y40: 86 to 96 ms a day; longest 72.8 ms (the year’s first midnight: daily life 50, routes 13.5), only step over 60;
next 46.3. Profile over 48 midnights: culture 472 ms (9.8 a midnight), routes 104, dailyLife 64, feeding 33, dailyTies 16.509d45e), medium-ref: 157 to 197 ms a day (the run diverges after the load; other systems vary as much between runs);
no step over 50: longest 37.2 ms (the year’s first midnight), midnights at most 37.2, night steps 1 to 40 at most 15.4, the round’s
phases at most 22.7 ms, the meetings’ stage 21.0. Profile: the culture leaves the midnight (worst midnight 44 ms under the profiler).
small-y40: longest 30.6 ms (the year’s first midnight), no step over 31.Demographic gate, tools/marriage-demography.js, populous small, 30 years (before d196f68 |
after 509d45e): |
| seed | marriages/yr | first age | never married | |||
|---|---|---|---|---|---|---|
| 1 | 6.033 | 5.967 | 21.48 | 21.92 | 0/19 | 0/18 |
| 2 | 6.300 | 6.000 | 21.75 | 21.96 | 1/24 | 0/25 |
| 3 | 5.567 | 6.100 | 21.86 | 21.72 | 0/16 | 0/17 |
| 4 | 6.000 | 5.667 | 21.09 | 20.98 | 0/12 | 0/11 |
| 5 | 5.900 | 6.400 | 21.23 | 20.95 | 1/14 | 0/15 |
| 6 | 6.633 | 6.467 | 21.08 | 20.98 | 0/18 | 0/21 |
| 7 | 5.467 | 5.800 | 21.32 | 21.16 | 0/8 | 0/12 |
| 8 | 6.067 | 5.933 | 21.44 | 21.29 | 2/21 | 3/22 |
| 9 | 6.633 | 6.100 | 21.02 | 21.31 | 0/19 | 0/22 |
| 10 | 5.633 | 6.267 | 21.45 | 21.63 | 3/27 | 3/30 |
| 11 | 6.400 | 6.633 | 21.24 | 21.30 | 1/15 | 0/16 |
| 12 | 6.233 | 6.300 | 21.12 | 21.52 | 0/11 | 0/11 |
| 42 (reported) | 6.567 | 6.600 | 20.85 | 20.65 | 0/6 | 0/11 |
Means over seeds 1 to 12: marriages a year 6.072 to 6.136 (+1.05%, passes); first-marriage age 21.34 to 21.39 (+0.25%, passes); the
never-married share 3.22% to 1.97% (-39%, fails the 5%): 8 of 204 women 45 to 54 before, 6 of 220 after (pooled 3.9% to 2.7%),
a change of two women over 12 seeds, towards fewer never married. At a share this small no change of schedule can meet 5% relative
except by an equal count; the question is in QUESTIONS.md (VB-201).
a5247a6 (git revert of 613c108; only index.html conflicted, rebuilt;
VB-227’s cuts needed nothing). Kim’s answer of 10 November gates the never-married share at 2 points absolute: it moved 3.22% to 1.97%
(-1.25 points), so the gate of the table above passes on all three measures. Its numbers stand: the restored code runs as 509d45e did
(seed 7 with tools/marriage-demography.js: 5.800 marriages a year, first age 21.16, 0/12 never married, the “after” row exactly).
sim/clock calls nightCulture and roundPhase per 6-minute step;
Culture.settlementStep is one settlement’s part of dailyStep). tools/perf.js now counts nightCulture under daily life and births.apiKeys / Culture gains settlementStep.tests/record.js: the heirs-7 anchor 230 events (79786b701a98b8a7) to 219 (fbcf6c158073bd96), a behaviour change.tests/counters.json (per living pawn-day, tiny probe): walkDaily 5.00 to 6.00 (the pass for the living of no settlement), heirRank and
roundRank 0.0133 to 0.0267 (phase 1’s own ranking view); with the changed run, routeSearch 0.398 to 0.364, routeExpand 1.804 to 1.634,
routeHit 5.299 to 5.202, routeRefresh 1.442 to 1.556, talkWeighed 10.748 to 10.764, walkStep 114.28 to 113.72, idleStroll 5.622 to 5.643,
walkPoint 8.478 to 8.479, walkTies 0.0544 to 0.0533, tiePairs 2.880 to 2.902, ruleValue 1.001 to 1.000.d196f68, the same save loaded by a5247a6 and
by this branch; per-step timer as tools/bench.js):
medium-ref, before: 189.1 ms a game day; longest 86.6 ms (the year’s first midnight), then 70.2 (day 34’s), 62.1 (day 1’s): 3 steps
over 60, 6 over 50; the round’s step 58.2 (its call 52.0); daily life and births 24.4 ms a day, its longest call 58.8.
After: 188.2 ms a day; longest 42.3 (a late midnight), 38.3 (the year’s first); none over 50; the round’s phases at most 21.4 ms, the
meetings’ stages 29.5; daily life and births 25.6 ms a day (night steps included), its longest call 26.2.small-y40, before: 94.6 ms a day; longest 67.7 (the year’s first midnight), the round’s step 53.7: 1 over 60, 2 over 50.
After: 96.8 ms a day; longest 34.0 (the year’s first midnight); none over 50; round phases at most 17.8, meetings 18.7.tools/bench.js after (stale fixtures, used as saved): medium-ref 181.6 ms a game day, longest step 38.1 ms, p99 7.5; daily life
and births 23.84 ms a day (share 35); the round 19.2 ms at most a phase, the meetings 19.6. medium-y5: longest 29.3, daily life 17.9.medium-ref and 9.8 at small-y40, routes 4.8 and 2.2, the death roll 2.9 and 1.3; the spread takes the culture out of the midnight.
The year’s turn needed no spreading of its own once the culture left it (prune 2.4 ms); closed-form decay was VB-127’s.npm run calibrate (natural 12 200) prints the same before and after (it drives Culture.dailyStep, unchanged): median first
flips claims 3.7, newLand 3.9, handover 3.4, daughterShare 3.8, heirCount 5.6, ownHeir 4.6, dispute 5.2, feedOrder 5.9 generations,
widow, heirSex and the rest none within 200 years in most runs; the bands of design.md (about 3, 4.6 to 5.7, none) hold as before
(feedOrder’s 5.9 was 5.9 before). Over 20 populous small years (tools/sim.js --report customs), seeds 7 and 42, before and after: one
culture, no custom changed, the same customs in force; mean support of the options in force 0.639 to 0.623 (seed 7; least 0.488 to 0.390)
and 0.636 to 0.640 (seed 42; least 0.428 to 0.497).tests/history.js (not this task’s; seven ratios over baseline before): routeExpand 1.462, routeRefresh 1.856, walkTies 1.436,
roundPairs 10.24, heirRank 1.473 (1.596 before), recordFold 1.558, roundRank 1.414 (1.480 before); walkDaily stays within its baseline.
tests/cost-baseline.json not raised.npm run verify (fixtures of d196f68, stale after the re-record, used as saved): everything passes but tests/history.js, with the
seven ratios above (target 1.25, residuals as listed; not raised, VB-261 to say how such targets are carried). Its criterion stays
unticked for that reason only: a residual of cost from before this task, not a broken test of this change. npm test passes (86 scripts).