Status: done (2026-11-11) Priority: 2 Size: M Arch: year Phase: implement Design ref: Work: opportunities, plans and tasks (design.md, section 7); docs/review-work.md, sections 2 and 4 Goal: Every holder is reviewed every working hour. Most of that is polling for work that falls due at a known hour or cannot have changed. Open the time-bound kinds from a due-queue, and review each plan on its holder’s planning day. Acceptance criteria:
st, plain data with one writer (sim/plans), opens each at its hour (Rules for cost, 4). No task of these kinds waits for a review.traits in SYSTEMS, src/sim/rng.js; the thirds of its range give the three cadences), offset by the holder’s id so reviews spread over days and over the hours of the working day (rule 5).sim/stores sets one dirty flag per holder and sim/plans reads and clears it, at most one such review per holder a day. No other call from stores to plans.Opportunities.forPawn), so a ripe field found between reviews is not left.oppAsk a living pawn-day falls at least fivefold; “jobs refresh and matching” (tools/bench.js) at medium-ref and small-y40, before and after. Invariants for the due-queue (sorted, no entry for a dissolved household). npm run verify’s hard checks pass, its targets reported with their residuals.medium-ref (tools/bench.js, whole year), judged by its share of the whole step in paired, alternated runs beside the ms; VB-227 left it at about 33 ms (residual about +3). The residual is reported.
Cost: households × 25 calls × 1 / cadence a day for reviews (14 to 42 times fewer than today), plus about 5 due-queue entries a household a day.
Notes:QUESTION_ARCHIVE.md, “VB-164: the household’s year”): written. Edits src/sim/jobs.js and its neighbours, so the slice’s tasks run one at a time, and not beside VB-227, VB-241 or VB-247.sim/plans keeps the due-queue st.plans.due ([hour, household, kind], sorted, one entry per live household
and time-bound kind; its only writer) and the planning days (nextReview by cadence: the head’s pawn.diligence, drawn once from the
new stream traits, thirds give every 3rd day, every 2nd, daily; a village daily; day and hour of the working day offset by id). Kinds with
a window (sim/kinds): haul, water, thresh, fodder from 5:00, milk from 6:00, cook from 14:00. Each entry asks its kind for its
household at its hour, takes down that kind’s stale tasks, and is asked again the next hour while it gives work and work goes on, else at
the next opening. refreshJobs (still each review hour) pops the queue, reviews only the holders due (reviewWhy: planning day; a closing
window, the last sowing day, the day after it and autumn’s last two days; a store’s flag, at most one a day), sweeps only the reviewed
holder’s tasks, and asks the island (plots, restorations) hourly as before, where a land project’s task whose project ended is also
taken down at once. The land step and the fields wanted now run at every review instead of at 6:00. sim/stores sets plan.dirty when
the grain above the seed reserve runs out or comes back and when sheaves come into an empty barn (the one call to plans).
lookForWork (sim/jobs, called from the clock’s step): a member that matching left without a task asks its household’s fields and
farm kinds (but the time-bound ones), at most once a household a day (plan.looked), posts what they report and is matched again.Validation (populous small, 3 years; farmers’ share of work hours with no task, by season; fields sown by the end of the sowing window;
crops lost to the frost; hungry household-days, all households, and the worst household’s; oppAsk a living pawn-day). Before -> after:
| Seed | Idle sp/su/au/wi % | Sown in window | Lost to frost | Hungry hh-days | Worst hh | oppAsk |
|---|---|---|---|---|---|---|
| 3 | 37.7/35.3/54.4/65.9 -> 40.3/37.0/55.3/65.6 | 695/696 -> 685/686 | 0 -> 0 | 71 -> 39 | 20 -> 10 | 39.14 -> 7.04 |
| 7 | 36.1/29.9/52.9/68.3 -> 38.4/31.5/52.3/66.4 | 613/614 -> 610/613 | 0 -> 0 | 0 -> 0 | 0 -> 0 | 36.08 -> 6.54 |
| 11 | 35.7/31.5/52.4/66.4 -> 36.9/32.4/51.2/63.9 | 722/727 -> 723/727 | 0 -> 0 | 12 -> 12 | 7 -> 7 | 39.69 -> 7.45 |
| 42 | 35.6/28.1/53.3/70.1 -> 37.8/29.3/53.1/68.4 | 655/661 -> 655/661 | 0 -> 0 | 22 -> 22 | 17 -> 17 | 35.22 -> 6.61 |
No seed’s hungry household-days rise (seed 3 falls by almost half, its worst household from 20 days to 10); spring and summer idle rise 1
to 3 points (tasks stand between reviews and a field’s next step waits for a review or a member’s look), autumn and winter fall a little.
oppAsk falls 5.3 to 5.6 times (counters test, 30 days: 39.1 -> 7.76; small-y40 one year: 40.4 -> 7.70); planReview 3.44 -> 0.21.
The probe was a scratch script (hourly steps, sampling farmers in work hours); tools/sim.js --report idle gives the idle share too.
tools/perf.js now also times lookForWork in it), on a machine shared by five agents, so timings vary
by a third: medium-ref paired runs (1 + 1, twice): share 21.0% -> 20.8%, then 20.7% -> 24.2% (with lookForWork counted), i.e. about 61
-> 57 ms a game day at those runs’ 291 and 275 ms; small-y40, --report perf: 28.3 -> 33.6 ms and 50.0 -> 57.3 ms in two pairs (whole
days 186 -> 225 ms in the second, so load). A CPU profile of a year at small-y40 puts refreshJobs at 815 -> 654 ms inclusive: its asks
halve (the island’s hourly asks remain), and what is left is the land step’s search for land (110 ms) and the review’s fields wanted
(100 ms); matching is unchanged and is now most of the line. Target (30 ms a game day at medium-ref): out, residual about +27 ms on
this loaded machine; by share it has not moved from VB-227’s (about 33 ms, +3), and this task is not its cause either way.node tests/run.js verify --verbose): every hard check passes but the golden file, whose 12 runs all change (founders and heirs at
seeds 7 and 42, years 1 to 3: jobs, jobSeq, agents, pawns, households, farmsteads, record, rng (the new stream), villages, cenv, talks and
the rest that follow), as expected; the orchestrator re-records it. Counters pass against their ceilings (oppAsk 7.76, planReview 0.249 a
living pawn-day; to re-record). 7 targets out: history routeExpand, routeRefresh, roundPairs, heirRank, recordFold, roundRank, and
scaling.roundPairs (not compared against main here). tests/record.js’s hash of the lives at heirs 7 re-recorded (the lives changed).tests/plans.js (the queue opens water at 5:00 with no review, takes it down once drawn, next at tomorrow’s 5:00, leaves with a
dropped plan; cadence by diligence, the planning slot, the store’s flag once a day, the closing days; a member looks once a household a
day); invariants for the queue (sorted, one entry per live household and kind, none of a dissolved household), the plans’ review record
and diligence. tests/stakes.js and tests/farmclaims.js follow the land step now taken at any review hour.Orchestrator’s decisions for Kim to overturn:
sim/stores (its writes are in kinds and the clock), so it is caught by reviews and members’ looks, not by the flag.plan.counted) is noted at the first review on or after the count day, not only on it.