Status: done (2026-11-17) Priority: 2 Size: M Design ref: docs/mocks/supply-doubt.html, docs/mocks/supply-scale.html (the UI review with Kim, 16 November); design.md section 7 (Holders and plans; The estimate); AGENTS.md, Deciding without Kim, 14 and 15 Goal: Every supply is read on one scale, time: will the household make it through the year. The simulation reckons it once, at the head’s review, and the page only reads it. Acceptance criteria:
Sim.supplyOutlook(st, householdId) gives, for each supply (food, fuel, hay), plain data: { own, with, state, parts }. own and with are how long the supply lasts from the start of the season we are in, in seasons, to the frame’s end at 4 (a value of 4 or more is safe): own on the store alone, with with every intake the plan expects within the four seasons, spoilage taken off. state is safe, or the first season (0 to 3) whose need the likeliest outcome does not cover and whether it is short a little or badly (the bound a named tunable). parts holds the numbers behind it, for the page’s i: the store, the need a season, each intake expected and when, what is expected to spoil.sim/hunger); fuel is firewood and peat as one supply, the row being the need and not the good (free fuel as sim/kinds counts it, PEAT.worth a unit of peat), burnt by the season’s use (ECON.woodUse), so a winter season costs several summers; hay is needed in winter only, so its outlook is the share of the coming winter covered (Sim.winterNeed), and its state names winter. A supply needed in one season only says so (seasons: [3]), for the page to draw it as one cell.plan.targets.wood), which the household cuts towards (Kim: connecting firewood to the household plan is sound), bounded by the trips its hands allow before winter, written with its formula. Spoilage is inside the projection (grain by ECON.storeLoss, hay by HERD.hayLoss; firewood does not spoil), and is not a separate figure of the outlook but for parts.plan.outlook: the centre only; the range is VB-669’s), so that it is recomputed when the review already runs: on the planning day, and out of turn when a store crosses its target (the harvest brought in wakes it). The page reads the stored outlook and never computes one. @state, src/owners.json, the save, an invariant (each value finite and at least 0; state a known word), and what a household with no plan, no animals or no farm reads.seasonal), so no pass at the turn of a season.--report perf); nothing a step, nothing a day beyond the reviews that already run. A work counter if it loops over a growing collection.node tools/sim.js --report outlook prints the outlook of each household of a village beside what came of it a year on (the season it did go short in, or none), as a description with no target: how often the plan’s reckoning was right.tests/tiny.js): a household with a year’s food and one with a month’s; fuel that lasts the summer and not the winter; hay for half a winter with meadows still to mow; the outlook made again after a harvest is stacked; a save keeps it.node tools/same.js --base REF prints same but for plan.outlook; its line in the task file.Notes:
docs/mocks/supply-doubt.html and docs/mocks/supply-scale.html). Decided there, by Kim: one scale for supplies, how long they last; four seasons ahead, starting at the season we are in and rolling a season at a time (“will they make it through this year”); every intake within the frame counts; spoilage acts on the projected total and is inside it; fuel is one supply (firewood and peat); firewood’s intake is the plan’s; the outlook is the head’s and is made at its review, which the harvest wakes. The head’s doubt is added later (VB-669).Implementation (17 Nov 2026):
sim/outlook (agency layer, after sim/aims) follows sim/plans’ event planReviewed (whose payload now carries why) and writes one field, plan.outlook (owner sim/outlook in src/owners.json; @state in the module). It reads sim/hunger (dailyNeed, larderOf, seedPer), sim/stores (grain, the seed reserved), sim/pot (fresh food), sim/kinds (fuelFree, now exported), sim/targets (hands), sim/herds (householdHay), sim/meadows (HAY) and plan.targets (wood, hayWinters). No new coupling into the simulation: nothing reads the outlook. Sim.supplyOutlook(st, id) returns a copy of the stored outlook with stale (made in an earlier season) and head (whose estimate it is, principle 14); null with no plan or before a first review. The page only reads it (VB-667 draws it).{own, with, state, season, seasons, parts: {store, need (by season of the frame), intakes ([{what, season, n}]), spoilt}}; hay’s parts add share (of the coming stall covered).own) and once with the intakes (with); the value is where the store first fails the day’s need, in seasons from the frame’s start, capped at 4. Food: grain above the seed (spoiling by ECON.storeLoss’s tiers and the barn’s factor, as spoilGrain does) and the meals, flour, sheaves, larder and fresh food (kept), eaten at dailyNeed; each field’s crop comes in at its sowing day plus the crop’s days to ripe (a field to sow: the first day of its crop’s next window, today inside it), FIELDS.expect × yield less the seed it takes back (stooks: what lies in them, less the seed). Fuel: fuelFree (peat at PEAT.worth) burnt at ECON.woodUse of the day’s season; on the first day of each season of the frame (today, for this one) the household cuts to the season’s goal plan.targets.wood[s], at most hands × OUTLOOK.woodTrips × ECON.woodPerTrip a season (the share left of this one); none with no farm or no wood in its village. Hay: the stall days (HERD.stall, autumn day 8 to spring day 4) at householdHay a day, counted as the winter’s; meadows still in grass give HAY × fert (sim/meadows’ expectedHay, the plan’s reckoning of a meadow) at mid-summer, the mowing stopping at hayWinters winters’ need; hay lying mown comes in a day after its mowing; spoiling by HERD.hayLoss. The value is the winter’s season of the frame plus the share of the coming stall covered, 4 when all of it.OUTLOOK.little 0.5 (a first short season covered at least this share is ‘short’, else ‘bad’); OUTLOOK.woodTrips 6 (firewood trips a hand makes a season towards the goal).state: 'none', own and with 4. Nobody to feed: food ‘none’. No farm: the store alone, no intakes, no seed held back.decision notes): (1) state is a word (safe, short, bad, none) with the first short season in a field of its own, season, so that the invariant’s “a known word” holds; (2) hay on the seasons scale is the winter’s season plus the share of the coming stall covered, the whole stall (with its autumn and spring days) counted as the winter’s; (3) a review for a window closing keeps the outlook it holds in the same season (cost: 1,561 of 5,087 household reviews at populous small seed 7 in two years were such); (4) food’s intakes are the farm’s present fields, not the field a land project will make, and the crop is the plan’s FIELDS.expect of the yield without the field’s fertility and soil (the plan’s own reckoning when it asks how many fields).Validation:
node tests/outlook.js (in npm test): on the probe village, a year’s food lasts the frame and a month’s 1.09 seasons, short badly in the summer; fuel for spring to autumn and 0.55 of the winter reads 3.55, short a little in the winter; the cut each season bounded by the hands; no herds reads ‘none’; two cows with 0.6 of a winter’s hay read between 3 and 3.6, safe with two meadows to mow (60 of hay in the summer), short in the winter without them; no farm, no intakes; made at the review, a copy to the page, made again when sheaves stacked in an empty barn wake the plan; kept by a save; stale in the next season and made anew at its first review; the invariants hold.tests/lib/invariants.js): absent, or made not after now, each supply’s values finite in 0 to 4, its state a known word, its season within the frame where short, its parts at least 0.node tools/same.js --base 125c9d3 --scenario founders,heirs,populous --years 2 differs only in plans, at 12 keys, and all 8,631 differing leaves are under plans.households<id>.outlook (checked with --keep: no other leaf differs).node tools/sim.js --report outlook: founders seed 7 small at year 2, village 0: 4 households, every supply safe and none went short (right 4 of 4 for each); populous seed 7 small at year 2, village 3: food right 6 of 7 (one household expected short in the season it was in, and did not go hungry), fuel 7 of 7, hay 6 of 6. A description, no target.planReview 6,148 in all); one outlook about 50 µs cold and 23 µs warm (the late save small-y40, founders seed 7 small at year 40: 10 households, 486 reviews in its next year), so about 1 ms a game day at populous small year 2, and some 2 to 3 ms at the medium reference’s households; nothing a step or a day beyond the reviews. --report perf at populous small year 2: 464.6 ms a game day in all on the shared machine (the outlook runs inside the jobs refresh’s reviews). No loop over a growing collection (a farm’s fields and meadows are capped), so no work counter. About 650 bytes a household in a save.