Status: done (2026-11-16)
Priority: 2
Size: M
Arch: talk
Phase: implement
Design ref: design.md, People, households and family records (Pawn interactions: “mood modifiers such as talked with a friend +5”, Decided 30 Oct; Traits, talk and stories: Where pawns meet, Mood); backlog/VB-186.md. Kim, 2026-10-30: the pawn info screen shows active modifiers, for example “mood +5, recently talked to a friend”.
Goal: Give each pawn a mood built from modifiers with a value and a label, so what happens in a pawn’s life shows as feelings. In this first version mood has no effect on behaviour; it is shown, and later tasks may read it. Confirmed and rewritten by slice 7’s plan (VB-186, 15 Nov) so that nothing is written per talk and nothing walks the pawns: a modifier for a state is read from the state, one for an event is written at the event, and “talked with a friend” is read from what talk already keeps.
Acceptance criteria:
Mood.of(st, pawn) (a module sim/mood, @sys, src/manifest.json) gives { mood, mods: [{ key, label, value }] }, the mood being 50 plus the sum of the values, within 0 to 100. It is computed when asked and stored nowhere; nothing in the simulation calls it (a lint line or a test holds that, until a later task means to).MOOD in src/sim/rules.js, each value a starting value with its meaning): hungry, -20 × h while the pawn’s hunger h is over 0.1; cold, -20 × hh.cold (VB-327); without water, -10 while hh.dry (VB-331; left out with a line here if that task has not landed); weak, -10 while health is under 50.pawn.mods: a list of { key, until } written by a subscriber to the event (sim/events) or at the act that makes the life event: newly married, +10 for 12 days; a child born, +5 for 12 days, both parents; grieving, -15 for 12 days at the death of a spouse, child or parent. An entry past its until is ignored where it is read and dropped when the list is next written; no daily pass (Rules for cost, 3 and 4). @state, src/owners.json, the save, an invariant (known keys, until finite, at most one entry a key).agent.talk, which talk writes already: with whom and when), when the pawn’s opinion of that pawn is at the page’s friend line (0.25) or above. If the latest talk hides an earlier one with a friend too often to be seen (say how often, populous small, seed 7, a year), agent.talk gains one field, the hour of its last talk with a friend, written where talk already checks the pair’s band: no new read of opinion a talk.Sim API. node tests/smoke.js and the tests/browser*.js touched; a screenshot under docs/img/.node tools/same.js --base REF prints same but for the new field pawn.mods; its line in the task file.src/sim/mood.js (sim/mood, social layer, after sim/relations): of(st, id) gives { mood, mods } for a living pawn (null for the dead), each value rounded to a whole number, mood MOOD.base (50) plus their sum within 0 to 100; word(m) the four words; feel(st, id, key) writes an event modifier. Sim.moodOf, Sim.moodWord for the page. MOOD in src/sim/rules.js, the starting values of the criteria. tests/mood.js (fast tier) holds that no other module of src/sim names sim/mood or pawn.mods in its code.pawn.mods, owner sim/mood, absent until a pawn’s first): three new events of sim/events, each a line where the act is: wed (sim/lifecycle wed), born (sim/births giveBirth: both parents) and died (sim/lifecycle killPawn, before the union ends: the spouse, the children and the parents grieve). One entry a key: a second grief, or a second child within 12 days, renews the entry. Expired entries are skipped at the read and dropped when the list is next written. Saved as the pawn is (plain data). Invariant checkMods (known keys, at most once, until finite and no further than its days ahead).-20 × hunger over 0.1; cold -20 × hh.cold (the 12 days’ mean, VB-327); without water a flat -10 while hh.dry (its 12 days’ mean) is above 0, so it lasts while a dry day is in the household’s last 12; weak -10 under health 50.agent.talk gained friendAt, the hour of the pawn’s last talk with one it held at SOCIAL.friend (0.25) or above: talk now grows the two ties itself (grow’s two lines) and keeps the opinions the two band checks (touch, which now returns the opinion it read) already compute; no new opinion read. With it, none is hidden. Invariant: friendAt finite and no later than now and a talk’s bubble (two talks in one hour may be shown in either order).src/page/words.js pawnStats, so also the played pawn’s sheet): mood as a stat on the one meter (VB-664), marked at the cut points 25, 45 and 65, the number and its word; under it each modifier in force as an icon and its signed value, the label its title and its screen reader’s text (icons: hunger, cold, water and health for the states; new ones for mood, married, a child, grieving and a friend in src/page/icons.js). Screenshot: docs/img/vb-062-mood.png (populous tiny, seed 7, after 90 hours).node tools/same.js --base 1f91fab (founders and heirs, seeds 7 and 42, tiny, 2 years): differs in 232 leaves, every one under pawns[i].mods (and its alias cenv.people[i].mods) or agents[i].talk.friendAt (checked with --keep and a diff): no decision changed.tests/mood.js: each state modifier on its trigger and gone with it; the friend modifier from friendAt, gone after 2 days, and talk writing it over two days of the probe; a birth (both parents), a child’s death (both parents, not a sibling), a renewed grief, a husband’s death (the widow, and the expired entry dropped as the list is written), a wedding (both); gone at 12 days; a save and load keeps pawn.mods and the mood; held at 0; the invariant sees a bad list. node tests/smoke.js and node tests/browser-mobile.js (the card) pass.tests/counters.js passes).friendAt judged by the opinion when the talk was held (as the band check read it), not when the card is read: the talk’s own reading, and no opinion read at display. A friend who has fallen out within the two days still shows.sim/lifecycle goes over the lint’s 700 lines (700 on the run’s branch, 703 with the two emits and their import): VB-876, “Refactor: split sim/lifecycle by concern”, is opened for it, as the lint asks, rather than placing the death’s emit elsewhere to make room. The lint is red on this branch until VB-876 is in backlog/.node tools/backlog.js set VB-062 status=ready): the task needs nothing of the slice’s other tasks.p.mood is not stored, and addMod is only for events. The values are the task’s of 30 October, unchanged; cold weighs as hunger does (Kim, 10 Nov), a day without water half as much (the plan’s starting value).talk (src/sim/relations.js), when the pawn’s opinion of the other (opinionOf) is at least 0.5. Becoming friends and falling out are life events already (VB-060) and could be modifiers too.docs/slices.md, section 3.7; the slices Decided by Kim): moved to slice 7, arch talk (from social). blocked until the slice’s plan (VB-186) confirms, rewrites or closes it.hh.cold, 0 to 1, over the last 12 days); this task reads it as it reads hunger, with a modifier of the same weight as hunger’s until Kim sets one.hh.dry).p.mods: a list of { key, label, value, until } (until in game hours, or null while a condition lasts); p.mood = 50 + the sum of the values, clamped to 0..100. @state documented. [ ] addMod(st, p, key, value, days, label) adds or refreshes a modifier with the same key; an expired modifier is ignored where it is read (until against st.t) and pruned when the list is next written: no daily pass over pawns (Rules for cost, 3 and 4). [ ] Starting modifiers (values to tune later): talked with a friend +5 for 2 days (VB-061); newly married +10 for 12 days; a child born +5 for 12 days (both parents); grieving −15 for 12 days when a spouse, child or parent dies; hungry −20 × h while hunger h > 0.1; weak −10 while health is below 50 (once VB-050 is done). [ ] The pawn panel shows mood (a number and a word: miserable, low, content, happy) and each active modifier with its sign, value and label. [ ] Mood has no effect on any decision in this task. [ ] A test: each starting modifier appears on its trigger and expires on time. [ ] Numbers before and after at the seeds and maps named, in the task file and the PR (Working rules).AGENTS.md, Deciding without Kim, 15): presentation by icons and meters before text, and like shown alike. Waits for VB-664: mood is shown on VB-664’s meter and each modifier by an icon with its signed value, the label as its title; mood’s scale is among those VB-665 reviews.