Status: done (2026-11-10)
Priority: 2
Size: M
Arch: fair
Phase: implement
Design ref: Exchange, The fair: barter between villages (10 Nov); Goods, Goods of place and side crafts (10 Nov); docs/architecture/target-v2.md, sections 4.3 and 5.2
Goal: Kim, 10 Nov: goods fall into classes, and custom says which exchanges across them are proper; keeping goods are accepted beyond need. The quanta and the worth table are Agreed (10 Nov).
Acceptance criteria:
Culture.norm('worth', good) with fixed rates, in rations as the one unit of account: grain, a sack of 10 rations, 10; salt meat, butter and dried fish, a lot of 10 rations, 15; a barrel of tar 8; a barrel of ale 14; a cow 40, an ox 50, a heifer or steer 20, a sheep 6.Culture.norm('proper', fromClass, toClass): within a class ordinary; food for an animal admired; an animal taken for food while the giver’s household is below 60 days of need is a hard bargain, allowed and booked as one; land is in no deal.Needs.value for these goods (design.md, The fair, Need): food 1 a ration when stores reach the next harvest with the reserve, in a line to 3 at empty stores and 0.5 beyond two years’ need, and 1.2 times for a food the pot lacks, up to a fifth of the need; an animal 1.5 times its worth with none of its kind, 1 otherwise, 0 without hay for the winter; tar its worth when a boat or the house is due; ale its worth with an occasion ahead, half otherwise. It allocates nothing in an inner loop.tools/rules.js lists the new rules and their owners; a test of each class rule; behaviour unchanged until VB-302 uses them (golden unchanged).
Notes:docs/review-markets.md; QUESTIONS.md, “VB-183: the gathering, the fair and goods of place”). Its numbers were settled by Kim’s answers of 10 November (QUESTION_ARCHIVE.md, “VB-183”; design.md, sections 8, 9 and 11).Implementation notes (11 Nov, night run):
src/sim/stores.js (target-v2 4.3 gives Stores the goods): declareGood, goodOf, goods, the GOODS map; each good has
id, kind and subtype, class, unit, quantum and lump (sack, lot, barrel, head), rations a unit, its source in the pot, perish
({keepsDays}, {lossPerYear} or null) and keeping. Declaring checks Rules.atLoad() (newly exported by sim/registry), so goods close
when the rules seal; code only, nothing in st.Culture.norm(key, ...) in src/culture.js, pure, with WORTH, CLASSES (food, wares, land), PROPER (none, hard, ordinary, admired)
and NORMS.hardBelowDays 60, added as non-enumerable properties so the enumerable Culture API is unchanged. Registered as the rules
worth and proper (owner culture) in sim/stores, so tools/rules.js lists and explains them.need (owner sim/hunger, sum), context {hh, good, n, kept}, n in quanta (below 0: the cost of giving them up). Terms:
food (sim/hunger: the closed-form worth of the stock over a line from 3 at empty to 1 at the reach, 1 to two years’ need, 0.5
beyond; 1.2 for the part that fills a source the pot lacks up to a fifth of the need to the next harvest), animal (sim/byre:
1.5 / 1 times worth, 0 when the hay will not carry it through the stall days to come), tar (0: nothing is due yet) and ale
(sim/exchange: half its worth; no occasions yet). sim/exchange gives needValue(st, hh, good, n, kept), which adds the keeping
goods (worth, up to KEEPING.cap 30 rations’ worth held), and propriety(st, hh, give, take). Helpers in sim/hunger: toHarvest(t),
foodHeld, daysOfFood, stockWorth. No module added, no state field, nothing reads them in the simulation yet.Validation notes:
tests/goods.js (in npm test, with --expose-gc): the registry (ids, classes, keeping set, worth table, frozen, closed after seeding,
nothing in a save), each class rule of proper through Culture.norm and the rule, food at empty, halfway, the reach and beyond two
years, giving a sack, the pot’s 1.2, keeping goods within and beyond 30, tar, ale, animals with and without their kind and hay, and
300,000 need values retaining under 0.5 MB.node tools/rules.js lists worth, proper and need with its four terms. node tests/golden.js passes unchanged; nothing in the
simulation calls the new rules, so behaviour and counters are unchanged (no numbers before and after to report).Orchestrator’s decisions for Kim to overturn:
wares (animals, cloth and labour; tar beside them as a made good that keeps). So proper treats
tar given for food in dearth as a hard bargain, like an animal. Ale is in the food class but gives no rations (its need is its own term).proper is read from one side: the side giving from and taking to, with that side’s days of food; VB-302 calls a deal by the worse of
its two sides’ words, and books a hard bargain as one (the word is here; the booking is VB-302’s). “Days of need” counts grain and the larder against the household’s daily need.HELP.bufferDays, the allowance’s reserve), so the
reach is seed + (days to the next harvest + buffer) × daily need; in autumn the next harvest is a season off, as help’s askDaysAt.
The fall to 0.5 beyond two years’ need is a step, not a second line.kept, which
VB-302 must keep), not a mix per quantum.ECON.storeLoss[0] a year (more beyond a year, by sim/hunger).Culture.norm takes no st or place yet (one table everywhere); norms that vary by place and learn (slice 8) will add the context.