Status: done (2026-11-11)
Priority: 3
Size: S
Design ref: none (code structure). docs/architecture/target-v2.md, sections 3.1 and 3.2; VB-176.
Goal: VB-176’s check enforces the load order: no lookup into a later module but issue. The target’s rule is by layer (target-v2 3.1): calls go downward, reads are free, and influence goes upward only by a command, an event or a declared hook. Give each module its layer and report the calls that break the rule, against a baseline that only falls, so new code cannot add one.
Acceptance criteria:
src/manifest.json names its layer (kernel and world, material and land, social, agency, derived; composition roots apart: sim/clock, sim/saves, sim/scenarios, sim), in the manifest or its @sys line; a module without one fails npm test.tools/dependencies.js reports every import and lookup from a lower layer to a higher one, by file and line, leaving out issue, rule contributions and, once VB-229 has landed, emit.tests/dependencies.js holds the count to a baseline file that only falls (--update lowers it, as tests/lint.js does). The review of 9 November counted 29 of 250 with its own placement; record the placement used and the count found.docs/architecture/modules.md gains the layer of each module; ownership.md, section 4, the upward calls by group.src/ changes but the layer names; golden unchanged; npm run verify’s hard checks pass, its targets reported with their residuals.
Notes:gen/*, gen, sim/rules, sim/registry, sim/rng, sim/hex, sim/names, sim/routes, sim/paths, sim/layout, sim/forest, sim/people, sim/records, sim/commands; material and land: sim/stores, sim/hunger, sim/fields, sim/meadows, sim/byre, sim/herds, sim/ownership, sim/claims, sim/stakes, sim/territory, sim/expansion; social: culture, sim/relations, sim/society, sim/deaths, sim/births, sim/heirs, sim/membership, sim/cottage, sim/settle, sim/farmclaims, sim/service; agency: sim/agents, sim/jobs, sim/kinds, sim/exchange, sim/help, sim/lifecycle. Several are arguable (sim/agents is movement and activity; sim/records holds membership caches): say what was changed and why.Implementation notes (11 Nov 2026):
src/layers.json (the manifest is a bare list, so a new file beside it): layer names, composition roots, and each layer’s modules. tools/dependencies.js gained loadLayers, missingLayers and upward; run without arguments it lists each upward edge by file and line. tests/dependencies.js fails a module with no layer and holds upward calls, by pair of modules, to tests/layers-baseline.json (--update writes it only when no count rises).sim/fish kernel (a river’s stock, no actors); sim/matching and sim/occasions social; sim/eligibility and sim/plans agency; sim/notable and sim/opportunities derived (read-only views); vb kernel. No module of the review’s list was moved.ownership.md section 4. emit is not yet excluded (VB-229 not landed); issue is.src/*.js changed; index.html is unchanged.Validation: tests/dependencies.js passes; golden and the whole of npm test run once after the last edit (see the commit).
Orchestrator’s decisions for Kim to overturn:
src/layers.json, not a field in the manifest or an @sys line: it avoids editing 57 source files that other tasks are editing.sim/commands stays in the kernel although its verbs reach agency (4 of the 25); a composition root would hide them.tests/layers-baseline.json), not by line, so edits that move lines do not trip it.