VB-1474: Refactor: split sim/away: the stays and lodging, the journeys and their kinds, the guest’s bed
Status: done (2026-11-22)
Priority: 3
Size: M
Design ref: none (code structure). AGENTS.md, Conventions (length, VB-413); backlog/VB-1409.md, VB-1151.md, VB-422.md
Goal: sim/away went over the line of 700 formatted lines (730) when main’s guest in a host’s house (VB-1151) met the table of journey kinds (VB-1409). It holds three responsibilities: the stays’ record and a lodger’s stay (open, close, the pack and meals, the verbs lodge and comeHome, the day away); the journeys (setting out, legs, arrival, the change of home, and JOURNEYS, what each kind does); and where a guest sleeps (askBed, hostWhy, leaveHost). The record and lodging stay; the journeys belong with the journeys’ part of VB-422’s split of sim/agents (legs); the guest’s bed with the visit (sim/visits) or with hosting.
Acceptance criteria:
Each responsibility is in the module where it belongs by target-v2 section 4 and src/layers.json, found before any move; each new module has its @sys line, its place in src/manifest.json and its owners in src/owners.json.
node tools/same.js --base REF prints same for each move; its line is in the PR.
The module is under the lint’s line and width, and the baselines fall with it.
Notes / questions:
21 Nov 2026: opened at the merge of PR #202 with main, as AGENTS.md asks of the change that takes a module over the line.
22 Nov 2026 (done): three modules. sim/away (330 lines, 13 exports) keeps the stays’ record, packs, meals and lodging; sim/journeys (439, 7) after it, the journey’s course and JOURNEYS; sim/hosting (43, 3) before it, hostWhy and askBed (before sim/away, since lodgeWhy reads hostWhy; sim/visits loads after). leaveHost went to sim/journeys, its only caller.
Not sim/legs: it loads before sim/away and holds a walk’s leg, not the stay; a journey needs the stay’s record and pack, so it follows sim/away.
Ownership: st.away keeps one owner; the journey’s own parts of a stay (why, to, from, gift, village, stay, guest) are sim/journeys’ by the per-part owners of VB-1479. Its writes on the shared parts (bed, roof, host, back, the id) go through sim/away’s nextStay, bedAt, turn and unlodge (a commit of its own, same).
AWAY.asks became HOSTING.asks (3), with the rule that reads it. lodge, comeHome and comeHomeWhy are no longer exported (read only by their verbs).
same.js: same at founders, heirs seeds 7, 42 tiny 2 years, and populous, founders seeds 3, 11 small 3 years, against 3982be1.
Agent usage (tools/agent-usage.js, to the PR): 50 model calls in about 10 minutes before the PR, no sub-agents; context 84.8k at the first call, 172.1k at its peak; fresh input 95, cache writes 108.4k, cache reads 6.91M, output 26.3k tokens; weighted cost 958.3k.