Status: done (2026-11-10)
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, 4 and 5 (task 1)
Goal: refreshJobs (src/sim/jobs.js) runs over every occupied farm and village 14 times a game day and posts what each kind’s available reports; no one holds a plan. Give each household and village a standing plan whose review is that same pass, so that later tasks can change what a review chooses and when it runs, with nothing changed yet.
Acceptance criteria:
sim/plans, the one writer of st.plans (src/owners.json, the WORLD list of src/sim/saves.js, @sys and @state lines, the manifest after every module it reads; under 400 lines): one standing plan per occupied household and per village, plain data: {holder, kind: 'standing', nextReview} and no more until a later task needs it. A plan is made when its household or village is, and dropped with it (no plan of a dissolved household stays: Rules for cost, 1).refreshJobs becomes the review of each holder’s standing plan, called every hour for every holder as today; st.jobs keeps its name, its keys and its posting order.oppAsk (calls of an available rule) and planReview in VB.COUNTERS; node tools/sim.js --years 1 --report counts shows them, and the PR gives the split of “jobs refresh and matching” between refresh and matching at populous small, seed 7, 2 years (10.2 ms a game day together on 10 November) and at medium-ref.tests/lib/invariants.js: every occupied household and every village has exactly one standing plan, and no plan names a dissolved household. tests/saves.js and tests/plaindata.js pass.tests/golden.json is unchanged; tests/counters.json changes only by the two new counters (listed in the PR). npm run verify passes.sim/plans reads households and villages and writes only st.plans; the one new call is from the hourly refresh.
Cost: one record per holder; no new loop (the review is today’s pass).
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.
Impact note: sim/plans (new, before sim/jobs in the manifest; reads st.liveHouseholds, st.villages and WORK) is the one writer of
st.plans. Its plans are made by foundHousehold (sim/membership), the new village of sim/settle and seeding (seedPlans, in
makeState), dropped by extinct (sim/heirs), and made for every live holder when a save from before plans is loaded (sim/saves). The one
new call in the step is from the hourly refresh: refreshJobs marks each holder’s plan reviewed (nextReview, the next review hour) before
it asks the kinds. The review hours (reviewHour) moved from sim/clock into sim/plans. No new coupling between systems; no new loop.Implementation (10 Nov 2026).
st.plans is {households: Map, villages: Map} of id to {holder: {type, id}, kind: 'standing', nextReview}: two maps by number,
so the hourly lookup allocates nothing, and a dissolved household’s entry is deleted (Rules for cost, 1).st.plans is saved with the state like st.jobs; the WORLD list of src/sim/saves.js holds only the world’s tile arrays, so it is
not listed there (the criterion’s wording); the load builds plans for older saves instead.tests/golden.js leaves plans out of the fingerprint (its DERIVED list): it holds nothing yet but one plan per live holder and the
next review hour, both functions of the hashed state; the task that gives a plan a choice should hash it. tests/golden.json unchanged.oppAsk (calls of a kind’s available rule by the review; sim/opportunities’ own asks for the page are not counted) and
planReview. tests/counters.json gains only these two: oppAsk 38.79 and planReview 3.73 per living pawn-day. (The other entries
were already off HEAD’s runs by up to 10%, inside the tolerance, and are left as they were; HEAD and this branch give identical
values for all of them.)Numbers (tools/sim.js --report perf, with the group split locally into refreshJobs and callCooks + lookUp + planRound; noisy machine):
medium-ref (year 12 to 13): refresh 14.11 ms a game day, matching 17.23 (HEAD: 14.74 and 17.39). Counts: oppAsk 39.1 and
planReview 3.30 per living pawn-day (39,611 and 3,348 a game day).
So the refresh, the plans’ review, is about 45% of “jobs refresh and matching” at both; the plans themselves add nothing measurable.
No behaviour changes: households are exactly as before (golden and every other counter identical).tests/history.js now measures the two counters, and both exceed the 1.25 limit from small-y5 to small-y40 (oppAsk
1.354, planReview 1.342 per living pawn-day): the review is per live holder, and households per living pawn grow over history (smaller
households). The work is today’s pass, not new; it is recorded as two ceilings in the history section of tests/cost-baseline.json
(which may only fall). Kim: the refresh’s cost per pawn-day grows with the number of households, a line for the planning-day task.Validation (10 Nov 2026): npm test (86 scripts) and node tests/golden.js pass; npm run verify passes but for tests/history.js,
which fails on the local fixtures (stale, made at 498a87a) at HEAD too, on routeExpand, routeRefresh, walkTies, roundPairs, heirRank and
roundRank; this branch adds no failure to it. By a script not kept: from small-y40, two years with checkState daily keep one plan per
live household and village through 22 dissolutions, 40 new households and 2 new villages; a save from before plans loads with plans for
every holder, and a save and load of the new state keeps them.