Status: done (2026-11-03)
Priority: 2
Size: M
Arch: ownership
Phase: plan
Design ref: none (code structure). Architecture review of 3 November 2026 (docs/review-architecture.md); the assessment asked for in docs/architecture/prompt.md, section 2, against the rules of docs/architecture/target-architecture.md, section 8.
Goal: The architecture review asks for an assessment before any refactor, and for Kim to review it before the first. A spot check (docs/review-architecture.md, section 1) found one module writing tile owners, five writing household membership and nine writing household food, and a dependency cycle hidden by a lookup inside a function (sim/heirs and sim/farmclaims). Map it all, so Kim can choose which boundaries to firm up, and in which order. No refactor in this task.
Acceptance criteria:
docs/architecture/ownership.md, the project’s own map (the three other files in docs/architecture/ are the external proposal), holding:
@state field (the top-level keys of st and w, and the fields of pawns, households, farmsteads, villages, herds, jobs and agents), the module that should own it, every module that writes it (file and line), and the modules that read it; fields written by more than one module are marked;src/sim modules (a Mermaid diagram, or a table where the graph is too dense), with the imports at the top of each module and every lookup inside a function that calls a module loaded later; cycles named;tools/writes.js), so it can be rerun after each refactor: it finds assignments, compound assignments and push, splice, set, delete and filter-and-assign on state fields per module. The document holds its output and the judgements.// @state hh.grain (owner sim/stores): ..., or an owners table in one file).QUESTIONS.md, each with a proposed answer: which boundaries first and in which order; whether a new module may own household food, or an existing one; what the first refactor leaves unchanged (proposed: behaviour, so the golden file is unchanged).BACKLOG.md), its wrap-up (which reviews docs/architecture/stress-tests.md against the code), and VB-173’s list of owners; VB-173 set ready.BACKLOG.md) this plan may run: it writes no simulation code.docs/architecture/ownership.md, from tools/writes.js). The questions this task waits for are in QUESTIONS.md under “VB-172: the ownership map”, each with a proposed answer; once answered, the last criterion writes the arch’s refactor tasks and VB-173’s owners.QUESTION_ARCHIVE.md, “VB-172: the ownership map”): the proposals, except that the food task records every movement at once (answer 3), so VB-174 changes behaviour on purpose and is not titled “Refactor:”. Tasks written: VB-174 (food, sim/stores), VB-175 (membership and founding), VB-176 (the dependency rule and its check), VB-177 (a pawn’s movement), VB-178 (ties and attitudes), VB-179 (the crop’s life), VB-180 (wrap-up, blocked); VB-173 rewritten for src/owners.json with its first owners, and set ready.