Status: done (2026-11-18)
Priority: 1
Size: M
Design ref: none (code structure). docs/architecture/target-v2.md, sections 3.2 and 4.1 (commands).
Goal: sim/commands holds every verb’s body, so it imports sim/agents, sim/kinds, sim/exchange and culture at load and looks up nine later modules through later(), at 17 call sites. Those 16 edges are why 27 modules form one cycle (docs/architecture/ownership.md, section 4). Each domain should register its verbs at load, as it registers rules, so the kernel’s command module knows no domain.
Acceptance criteria:
sim/commands gains register(verb, {check, run}), at load only and sealed with the rules registry at the first seed or load; a duplicate verb throws. issue is unchanged: check, then run, or nothing.check and run move, verbatim, to the module that carries it out (marry to sim/lifecycle, serve to sim/service, give to sim/exchange, and so on); a verb that only wraps an act of sim/agents moves there.sim/commands imports no domain module and has no later(); it loads before every module that registers a verb. tests/dependencies.js drops the dispatcher’s exemption and still allows issue from any module.tools/writes.js reports no strongly connected component through sim/commands; ownership.md, section 4, is updated with its output, and says which cycles remain.tests/commands.js still holds that only a verb calls the act it wraps, now reading the verbs from their modules.BACKLOG.md: behaviour unchanged, node tools/same.js --base REF prints same, tests/counters.json unchanged, npm run verify’s hard checks pass, its targets reported with their residuals.sim/commands is under 700 lines and within its export baseline, and the baselines fall with it.
Notes:sim/occasions added) at 17 call sites; the order note with VB-229 and VB-169 dropped, both done. The goal’s “16 edges” and its list of four imports are from 10 Nov: today sim/commands imports eight modules at load (agents, kinds, eligibility, culture, records, rules, relations, exchange); the task recounts the edges it removes against docs/architecture/ownership.md, section 4.later() dispatcher and its test exemption. Say in the PR what fell.sim/commands by concern), closed; renamed to name sim/commands, so the lint finds it as the module’s split task. Counted on this day: 39 later() lookups in sim/commands. With the verbs’ bodies at home, what is left is the dispatcher and the player’s queue (commands.js, from “the player (VB-169)”, about 220 lines): the PR says whether the queue stays (one concern left) or goes to a module of its own, by target-v2 section 4.7. VB-431 (sim/plans) waits for this task: the head’s plan verbs (target, tile, order, project, routines) move there.sim/commands: VB-231 (customs), VB-422 (sim/agents) and VB-431 (sim/plans) wait for it, since it moves verbs into those modules. One at a time with VB-418 (both add code to sim/farmclaims and sim/expansion), VB-313 (the answer verb, sim/lifecycle) and VB-310 (finishCottage, sim/cottage): whichever lands second rebases.docs/agents/worker.md).setTarget is to go, and verbs for an action given to a member (assign or so; Kim, 18 Nov), replaced, removed or ordered, and a chore handed over, are to come. They register where their domain lives, as this refactor has it.docs/plans/VB-228.md (section 8 holds the decisions). REF is cf270f9.
What was built. sim/commands is register, issue and the table (33 lines, 3 exports; 922 and 18 before); it imports sim/registry
alone and loads third, after the registry and the events. The 43 verbs register in the 19 modules that carry them out, each body moved
as it was but for later('sim/x').f becoming f (and the three local aliases of a looked-up module, P, S, X, dropped). The player
is sim/player (204 lines, 14 exports, owner of st.player). New sim/gifts (62 lines) holds give and deliver.
Decisions, with Kim. (1) Criterion 2 names sim/exchange for give and sim/lifecycle for marry: marry is in sim/marriage,
where wed lives since that split; give and deliver are in sim/gifts, since settling needs the carrying (sim/away) and the
carrying books through sim/exchange, so neither can hold them without an upward call. (2) The guards are lookups where their subject
lives: living, home, settlement in sim/records, free in sim/agents; so raiseBooth registers in sim/away (VB-1172 makes the
booth a project). (3) The customs’ verbs are in sim/society, the wiring between culture and the state; decide still writes
practice directly, noted for VB-231. (4) A home is the module of the act, and where a body calls several, the highest in load order.
Decided without Kim (close calls). commanded and unplanned are in sim/records, not sim/player: sim/occasions reads
unplanned from below. sim/occasions is moved from the social layer to agency in src/layers.json, as target-v2 4.5 has it: its verb
attend walks the pawn, the edge sim/commands used to carry. trustOf was a second copy of sim/ownership’s; sim/trust uses the
one it already imported. sim/help keeps its late lookup of issue, which tools/store-flows.js replaces to cap the yearly filling.
The two changes of behaviour, both Kim’s of this day, both for the played pawn only. The talk’s halt no longer asks whether the
pawn is on the player’s command (principle 16); and a talk does not cut a walk on an errand (agent.errand, set by the verb walkTo to
a place, cleared by the next walk or a release), so the played pawn’s queued walk goes on, as any pawn’s would. Invariant and tests added.
Validation. node tools/same.js --base cf270f9: same: the world and the state at seeding and each year's end, founders, heirs at
seeds 7, 42, tiny, 2 years. npm run verify: 192/192. tests/counters.json unchanged, 0 counters out. Targets: 9 out, the same nine
with the same values on cf270f9 (the scaling.* family); none moved.
What fell. The later() dispatcher and its 74 lookups of 22 modules; the ten load-time imports of sim/commands; its exemption in
tools/dependencies.js and tests/dependencies.js; every cycle of the module graph (a strongly connected component of 21 modules on
7 November: tools/writes.js now reports none, and the test asserts it); upward calls by layer 19 to 13; five late lookups of issue
(sim/relations, sim/exchange, sim/expansion, sim/farmclaims, sim/away: imports at load now); one duplicated rule (trustOf);
sim/commands out of the width baseline and of the lint’s registries. Lines of src: 971 in, 937 out.
What rose, and the tasks for it. The receivers: sim/agents 1,202 to 1,273 and sim/plans 1,079 to 1,227 (VB-422, VB-431 open);
sim/away 674 to 708 and sim/heirs 645 to 710, over the line by the verbs coming home: VB-1173 (the gift’s carrying to sim/gifts)
and VB-1174 (split sim/heirs) opened. sim/agents’ counted exports 38 to 47: sim/commands was a registry whose reads the width
lint left out, and the acts are now read by the modules whose verbs call them. sim/records 785 to 809 (VB-372).
Opened: VB-1172 (the booth is a project of the pawn who raises it), VB-1173, VB-1174.
For Kim (surfacing). Candidate: “a guard is a lookup, and lives where its subject does” (three decisions of one kind: free,
living and home, commanded). Candidate: “a talk ends a stroll, never an errand” generalises to “nothing breaks off what a pawn
chose to do but the pawn”. Found, not changed: heirFarm and plotToVillage only emit an event because the dispatcher loaded below
sim/expansion; in sim/aims they could call the act, a follow-up for VB-431 or VB-1174. sim/jobs, sim/occasions and the clock
ask unplanned: the played pawn is skipped by rules no other pawn can invoke (principle 16), a task for the arch acts when plan mode
(VB-1123) lands.