Status: done (2026-11-08)
Priority: 1
Size: M
Arch: kin-help
Phase: implement
Design ref: Exchange, goodwill and obligations (Goodwill, Booking: Decided 3 Nov; The gift: Unit and decay, Who books, Allowance, Agreed 8 Nov); docs/architecture/target-v2.md, section 4.4 (Relations: goodwill); docs/roadmap.md, section 5.3 (rules 1 to 3); VB-182’s plan.
Goal: Goodwill becomes state: a kin gift books its customary worth between the two holders, and the balance decays in closed form, is capped, pruned, and half of it passes at a handover. Nothing reads it yet but the panel (VB-218) and allowance’s goodwill term, which is 0 until slice 4 (VB-220), so the golden file changes for the booking only.
Acceptance criteria (revised 8 Nov 2026 with Kim’s decisions while building it: QUESTION_ARCHIVE.md, “VB-217”):
sim/relations owns pawn.goodwill (src/owners.json, an @state line), made at a pawn’s first booking, so pawns that never dealt
are unchanged, and gone at its death.{v, t}, v > 0
meaning the other owes this pawn, read as v * 0.5 ** ((st.t - t) / halfLife) with halfLife in years (GOODWILL.halfLife, 4,
tunable from 2 to 20); the other pawn holds {v: -v, t}. No step decays it (Kim: decay when read), so no loop walks the balances.GOODWILL.forget (1 ration) reads as 0, and is dropped when either of its pawns next
books, when a pawn reaches the cap of 32 (the smallest goes to make room), or at a death. Work at each is at most the two pawns’ maps,
bounded by the cap, so no work counter is needed (AGENTS.md: counters are for loops over growing collections); goodwillWalk goes.balance, book, addGoodwill (signed), passGoodwill, endGoodwill, goodwillOf ([{other, balance}], for the panel,
VB-218 adds it to Sim).sim/exchange’s settleGift books a gift between two holders: the giver is owed its worth (grain 1 a ration). The village store, its
filling and a household without a holder book nothing (Who books).sim/heirs): at a retirement and at a holder’s death (transfer with reason retirement or death, and a widow’s
succession), half of the old holder’s balances pass to the new holder; other handovers pass nothing. In killPawn the balances end
after succession, so the share passes first.goodwill term, contributed by sim/exchange for sim/relations, 0 while GOODWILL.acts is false (VB-220 switches it on).checkState): each balance is mirrored exactly (-v, the same t); none with the dead or oneself; v finite and
non-zero; t <= st.t; at most cap. Saves keep them.tests/goodwill.js (in npm test): booking, decay halving in 2, 4 and 20 years and a loss proportional to size, netting, the cap,
forgetting when touched, a save, a retirement and a death.00a7229, the dumps differ only by added goodwill lines. tools/sim.js (founders 7 small,
10 years; populous 7 small, 8 years) prints the same yearly lines; tools/balance.js the same numbers.tests/history.js passes with no new exception in tests/cost-baseline.json.sim/relations writes pawn.goodwill; sim/exchange and sim/heirs call its operations;
nothing in the simulation reads a balance while GOODWILL.acts is false. npm run verify passes.
Notes:QUESTION_ARCHIVE.md, “VB-217”): goodwill is one decaying number a pair, decaying toward zero
in proportion to its size; dealings are for stories. Built first as {v, t, since, why} read in closed form with a seasonal pass to
forget, then as one number decayed by a seasonal step (287768a); that step failed tests/history.js (6 times the work per living
pawn-day at small-y40 as at small-y5, limit 1.25, though 179 visits in 30 days), so Kim chose decay when read, {v, t}, with no
step. Help in hunger becomes a seasonal ask (VB-222), and the save line is restated (the Flag below).medium-y60, was counted from one year’s pairs, but balances
accumulate: a typical one takes about 18 years to fall under a ration at a 4-year half-life. Measured at populous 7 small, year 40:
456 pairs, 90 KB of JSON (16 KB gzipped alone), about 0.25% of the save; medium-y60, with three times the gifts, would hold about
270 KB, 0.2% of its 136 MB. Kim chose to restate the line, not the design (8 Nov): under 0.5% of the late save, about 300 KB at
medium-y60, measured on fresh fixtures by the wrap-up (VB-219). The roadmap’s line (section 3.1) and VB-219’s are restated with it.opinionOf does not read goodwill here.cc2a919, 2aff406, e7c7ca5, bea1b10, 741d373 (the first version, {v, t, since, why} with a seasonal pass to forget),
287768a (one number, a seasonal decay step), 9be5464 (Kim’s decisions in the documents), c8636fe (decay when read, {v, t}).QUESTION_ARCHIVE.md, “VB-217”): the first kept when a balance opened and why, for
the age-based curves; Kim asked for the core, one decaying number, and accepted a seasonal step; that step failed the cost-growth check
(tests/history.js: 6 times the work per living pawn-day at small-y40 as at small-y5, limit 1.25, though only 179 visits in 30 days,
because balances live about 20 years and more gifts come late in a run), so Kim chose decay when read. Now nothing walks the balances:
forgetting happens at a booking, at the cap and at a death, each bounded by the cap, and the goodwillWalk counter went with the step.passGoodwill for the interface’s transfer (sim/heirs has a transfer); addGoodwill is the signed form under book; the
decayed value is goodwillNow. A first name, valueOf, crashed tools/writes.js, which looks names up in a plain object, so any name of
an Object.prototype property would do the same: a latent bug in the tool, noted here, not fixed.Sim API is left alone, so the golden file’s apiKeys hash holds; VB-218 adds the page’s reads.goodwill term is contributed by sim/exchange for sim/relations (its limit needs dailyNeed, in sim/hunger, which
loads after sim/relations), summed as slack, goodwill, reserve; an exact 0 while GOODWILL.acts is false.killPawn the balances end after succession, so a dead holder’s share passes first; the dead keep no map.tests/counters.json showed ruleValue had risen by one read in 900 pawn-days with VB-216, within the 10% tolerance;
VB-216’s note is corrected.npm run verify: 91 scripts passed in 213.9 s; tests/history.js passes with no new exception. npm test: 78 scripts.cenv and pawns of heirs at seeds 7 and 42, years 1 to 3, changed (cenv.people holds the same pawn objects).
Dumped at 00a7229 and now, they differ by 208 added goodwill lines and nothing else. Founders made no gift between holders in 3 years.tools/sim.js for populous 7 small, 8 years, are identical to 00a7229’s; with the first version, founders
7 small (10 years), one year from small-y40 and tools/balance.js --scenario populous --seeds 7,42 --map small --years 8 --json were
identical too, byte for byte, and nothing that reads them has changed since.medium-y60, with three times the gifts, would hold about 150 KB, under the restated line of 0.5%.small-y40 and 490 at medium-y60: well under 0.01 ms a game day.