Status: done (2026-11-12) Priority: 2 Size: M Arch: year Phase: implement Design ref: Animals; docs/review-animals.md (review of 31 October 2026); answers in QUESTION_ARCHIVE.md under “VB-047: animals review”. Goal: Herds graze the outfield by day with a herder, children’s work from 8 (Agreed); grazing keeps land open (Decided). Grazing pressure is counted where herds actually graze (review, G6). Acceptance criteria:
herding (child 8, daughter 6, son 5, retired 4, farmhand 3, farmer 2; Kim, 31 Oct, as P); kinds may set minAge (herding 8).herd at 6:00: the herder walks its herds to a pasture tile within 8 steps (open land or wood, not a field or an unmown meadow, not another household’s; best grass, least grazed, nearest) and stays 9 hours, then brings them home; the herds follow the herder on the map. herd is the game’s first background kind (VB-251, done: attention background, at rate of the herder’s hours, within reach steps of the pasture; src/sim/kinds.js), so the herder may take other work within reach meanwhile.w.graze (@state documented): each grazing hour adds 1 a cow (0.25 a sheep) on the pasture tile and a quarter of that on its neighbours; it halves each game year, decayed lazily (Rules for cost, 3): stored with the game hour it was last written, or against a shared scale renormalised once a year, and read in closed form; no daily pass over the tiles (not faded with w.wear in fadeWear, src/sim/paths.js). A herd on the move adds a quarter crossing a head to the tiles it crosses, so cattle lanes wear in.docs/roadmap.md, section 3.3; the slices Decided by Kim): moved to slice 3, arch year (from animals). blocked until the slice’s plan (VB-164) confirms, rewrites or closes it.w.graze daily as w.wear, a second pass over every tile each day against Rules for cost 3; it now decays lazily. Herding is background work as the 10 Nov note has it (VB-251 is done), now in the criteria.src/sim/grazing.js (layer material, before sim/herds): the pressure w.graze (owner, @state), the day’s
pasture, the herds out with the herder, unherded, and the herd kind’s record (as sim/dig’s KIND). It reads herds, households,
meadows, st.owner, st.used; writes w.graze and two new herd fields, herder (pawn or null) and herded (day, -1 never). New
coupling: sim/agents asks sim/grazing which herds a walking pawn drives (path wear) and clears them on arrival home; sim/byre reads
unherded (milk, strays) and calls sim/fields trample; sim/byre emits cattleInCrop, which sim/relations remembers. No clock change.src/sim/rules.js): type herding in ROLES (child 8, daughter 6, son 5, retired 4, farmhand 3, farmer 2), HERD.herding,
HERD.stray, GRAZE {keepsOpen 20, thins 200} for VB-091, the memory crop (“Cattle in our crop”, -0.1, cap -0.3, 2 years), urgency
herd 1.5; stalled moved here from sim/herds (re-exported there) so sim/grazing can sit below sim/herds.reach 3, rate 1, minAge 8 (read by sim/jobs score and fit), window from 6:00, posted until 10:00 on a
grazing day for a household with animals; its pasture is drawn when first posted (bfs of 8 steps: grass by biome less pressure/100 less
0.05 a step; own aftermath meadows allowed). held drives the herds out; worked adds the load (1 a head of cattle, 0.25 a sheep) an
hour on the tile and a quarter on its neighbours. Path wear: a pawn driving herds treads 1 + 0.25 a head (tread(w, i, n)).w.graze is stored against the year’s scale 2^((t - year start)/YEAR) and halved once a year at the year’s first step
(grazingDay, called by herdsDay); read in closed form by grazeOf. Saved in WORLD; invariants for it and the herd fields.src/sim/agents.js: a pawn with no task in hand may take a background task out of reach and sets
out for it (kept, unworked, while its path ends within reach); a background task counts hours (rate), not work rate; it is let go
outside working hours and by goHome; its work done, a pawn with nothing in hand goes home with the herds; pawns holding a side task are
stepped while they hold it (awake); the matcher offers a herder full tasks within reach; an idle herder waits by its pasture
(idleAbout). Fixed a VB-251 bug the herders showed: freeHands let go of a side task while iterating j.claims, skipping the next
worker, whose job then lost it (an invariant failure in heirs 7 on day 6).src/sim/byre.js stray, in byreDay): for each cattle herd unherded on the day before, a broken stretch of its village’s fence
beside a standing crop (sown, growing, ripe) of the village lets it in with chance 0.2: the crop nearest the herd’s spot gets
fd.trampled (each takes 10% at the reaping), the event cattleInCrop is logged, and the field’s holder remembers the keeper’s holder.
Milk: half for a herd unherded on the day before (HERD.herding.milk).src/page/animate.js). Screenshot: docs/img/vb136-herding-at.jpg (populous small, seed 7, summer day 3, a herd on its pasture).tests/herding.js (new, in npm test); tests/attention.js (a full task in reach is now offered; the set-out case), tests/milk.js
(half milk; the year’s bound allows for unherded days), tests/children.js (child herd 8), tests/record.js (heirs 7 lives re-recorded:
49 events from 66 on the final tree: gifts 21 to 7, close friends 7 to 4, the same births, deaths and marriages).tools/sim.js --report idle), mean of the seeds, before -> after:
farmer spring 23.3 -> 21.1, summer 16.7 -> 14.2, autumn 29.9 -> 26.6, winter 53.3 -> 52.2; wife 29.2/28.0/37.6/57.2 -> 27.7/24.1/33.3/56.9;
son 30.0/31.0/38.4/62.9 -> 34.7/37.1/41.3/62.7; daughter 50.4/49.1/51.7/70.0 -> 51.7/53.5/53.8/70.3; farmhand 20.6/18.7/26.4/56.3 ->
28.4/22.2/28.7/51.2 (children are not in the report; they do most of the herding). Year 3 population, births, deaths and hungry days
unchanged at seeds 7, 3, 11; seed 42: 374 -> 371 living, hungry days 0 -> 0, marriages 4 -> 10.tests/herding.js).pastureTiles counter added (about 4,900 tiles a day at populous small, one search a household a grazing day); route searches +35%,
matching bids +13%, walk points +7% (populous small, seed 7, year 1). CPU time on this shared machine: populous small year 1 about 20%
more than before (93-102 -> 111-135 ms a day over three alternating runs); the same build with the herd kind switched off measured within
noise of it switched on, so part of the rise is noise or behaviour (half milk), not herding’s own work. Not measured on a late save:
to bench on the merged wave.node tests/counters.js, the tiny probe, per living pawn-day; targets, none re-recorded): the new pastureTiles (37.5)
added to tests/counters.json as its baseline; 7 counters out against their baselines, all from herders walking to a new pasture each
day (new routes) and the herd kind’s asks and bids: routeSearch +130%, routeExpand +295%, routeRefresh +317%, matchBid +48%, walkPoint +26%,
oppAsk +24%, walkStep +13%. Follow-up proposed: keep a herd on its pasture for some days (or choose among a few near ones) so its routes
are cached; to be weighed with the route cache’s bound.*/seed / herds entries (the new fields herder, herded; nothing else at the seed), and from year 1
every scenario’s agents, cenv, farmsteads, herds, households, idlers, jobs, jobSeq, pathCache, pathDirty, pawns, record, regrow, rng,
talks, villages, wear, and biomeDirty, used, owner, landDirty, headSeq, claims, claimSeq, recordFold where they differ (236 entries):
herders change who works where from the first grazing day.node tests/golden.js matches after the update; npm test once at the end.CALENDAR in src/sim/clock.js (after the autumn count): strays
(sim/byre, daily: cattle left unherded yesterday may stray), herdsBack (sim/grazing, daily: every herd back by its farm for the night),
halveGraze (sim/grazing, yearly, day 0: the pressure halves). ORDER in tests/clock.js re-recorded with the three. The herd kind’s
hours (6:00 to 10:00) stay in its available. w.graze has its line in QUANTITIES of tools/stocks.js; household.pasture is in
NOT_STOCKS (land and its records).household.pasture (@state, owner sim/grazing, invariants; saved with the household): absent until the herds first go out, then
{tile, since}. Each grazing day the herder takes the herds back to it (todaysPasture, the kind’s draw) while it may still be grazed
(grazable: not a field, a meadow to be mown, another’s, a green; within 8 steps of the house) and until it is grazed down
(HERD.herding.downAt 300, about a middling herd’s week on it, above the 90th percentile of the pressure) with at least keepDays 7 days
since it was chosen; only then is a new one searched. The “grass below the best alternative by a clear margin” test was left out: it
would need the daily search the rule removes.tests/counters.js (per living pawn-day; baseline from claude/backlog-orchestration-t73ngj, which has no
herding), base -> before this step -> after: routeSearch 0.328 -> 0.753 -> 0.467 (still +29%, out); routeExpand 1.498 -> 5.919 -> 2.156
(+44%, out); routeRefresh 0.837 -> 3.488 -> 3.294 (+294%, out); matchBid 7.25 -> 10.71 -> 10.81 (+49%, out); pastureTiles (new) 37.5 -> 4.08.
Residuals and causes: the herder’s walk out and home each day is new activity (route searches and expansions follow it); routeRefresh
counts the cached routes tested each day, and the herders’ routes now stay in the cache to be reused, so there are more of them to test
(bounded by the cache’s cap); matchBid: each household with animals has one more job its idle members weigh, and a herder at the pasture
weighs the jobs within reach when its pause ends.--report perf, ms a game day, this shared machine): base 83.7 and, rerun, 62.6; before this step
106.9; after 72.4 (+16% on the base’s rerun, against +28% before). By system, after against the base’s rerun: jobs refresh and matching
25.8 against 24.2, agents walking and working 18.2 against 10.4 (the herders’ walks and their side work).herded / grazing days by household): 10/54, 4/54, 16/54, 0/27, 0/27
and 6/54, 22/54, 3/54, 0/27. No founder household has a child of 8; the wives and the maid have no herding priority (Kim’s table: the
mistress and the maid 0), so only the farmer (2, a poor fit, who bids only once the job has waited two hours, at 8:00) or a farmhand
(3) can take it, and by 8:00 they are at other work: on unherded days at 9:30 the farmers were cutting wood (40 and 37 times), mowing
(31, 35), fishing (28, 24), haymaking, quarrying, weeding and breaking ground. The lone farmers herd none. The cost is half the milk
(7.3 rations a cow in milk in year 1, was 13.5); the households are not hungrier for it (above), so no question is added to
QUESTIONS.md. If Kim wants the founders to herd, the lever is the mistress’s and the maid’s herding priority (0 now).tests/counters.js; targets): 6 out, routeSearch, routeExpand, routeRefresh and matchBid as above, and
oppAsk 11.97 against a ceiling of 10.60 (+13%: the due-queue asks the herd kind of each household each hour from 6:00 to 10:00) and
lookUpJob 6.27 against 6.24 (+0.5% over the ceiling: one more job, the herd, among a household’s jobs a working pawn weighs). Earlier
walkStep and walkPoint, out before step 2, are now in.*/seed / herds entries differ from 2003881’s golden (the herd fields
herder, herded); from year 1, 219 entries of the founders and heirs runs (agents, cenv, farmsteads, herds, households, idlers, jobs,
jobSeq, pathCache, pathDirty, pawns, record, regrow, rng, talks, villages, wear, and where they differ biomeDirty, used, owner,
landDirty, headSeq, claims, claimSeq, recordFold): 223 entries.