Malsimulation · internals · dated technical articles

Deep dives

These articles audit specific delivered work at their own source commits. The Overview remains a separately dated, whole-world snapshot.

The spec 164 article retains its 2026-10-07 horizon; its closing “what comes next” predates spec 165’s delivery.

Deep dive · AGT-12 delivery A · spec 164

Who belongs, and what is owed

The population already records people, homes and their past. Agency turns those facts into minds, groups, responsibilities and ties that a player can inspect. The difficult part is preserving exactly which facts are known, who owns the answer, and which identities mean the same thing.

Source audit: 2026-10-07 · merged implementation 70265fd
A dated supplement to the older full-page snapshot. Measurements below are spec 164’s recorded witnesses, not a new run for this page.

01 · One direction through the system

Records in; answers out

The agency layer introduces a vocabulary, not a second population store. Its four projections use durable record IDs, content defaults and current production facts. They never infer a fact from a convenient but unrelated field.

Records → derived views → the facadeAll four projections read the same existing authorities and validated content. The facade exposes temporary cards, owned pages, catalog rows and statistics. There is no write arrow back. Existing authorities Person • birth / death / profile Household • member IDs Residence • home / care Home + title shares Parents + partnerships Production stock + receipts agency.zon • validated defaults Mind 12 weights + their contributions Memberships + collectives Roles, custom, holdings, interests Duties Actual debtor + home/person receiver Relationships Four seeded ties; per-column maxima sim.facade Whole detail cards Collective identity links Household pages Explorer catalog rows Headless agency totals A read can allocate an answer; it cannot advance the world. No random draws, event writes, minted IDs, revisions, saved agency fields or persistent cache.
Every agency reader takes *const Sim. The output is derived when asked; this delivery adds no goal selection, learning or agent decision loop. Diagrams scroll horizontally on narrow screens.

Two kinds of identity

CollectiveRef is a tagged household, village or faction reference. Households and villages use population IDs; factions use a people-faction content index. Discovery keeps retained empty households, unique recorded settlements and people factions.

One separate content digest

agency.zon validates all twelve motives, stage/carer shifts, roles, the one shipped custom and four tie seeds. Its SHA256 digest is excluded from population content, effective config and save identity. Changing a motive default changes the inspection answer.

Authorities: reader entry points · view vocabulary · validated agency content.

02 · A mind is a decomposition

Twelve weights, one signed sum, one clamp

Each column is clamp(default + stage shift + carer shift, 0, 200). The shipped default is 100 for every motive. The numerical shifts are labelled assumptions; they are not measurements of personality, and they do not choose actions.

Motive workbench

Choose a known life stage and care state. The example starts as a young adult with a current recorded carer role. Change the illustrative default to see how clamping can preserve a known final weight even when its care contribution is unknown.

Young adult + current carer · all 12 final weights known · default 100

All twelve motives in contract order; shipped stage and care shifts, and the illustrative final weight
MotiveChildYoungAdultElderCare shiftApplied careWeight
sustenance000000100
safety+2000+15+10+10110
rest000000100
kin and care+30−1000+25+25115
belonging000+1000100
standing−20+100000110
wealth−3000000100
mastery000000100
curiosity0+250−15−10−10115
autonomy−30+250−1000125
duty and honour−2000000100
faith000+1500100

Rows are grouped as body (3), people (3), doing (4), meaning (2). The selected stage column is shaded. Care applies once for any number of dependants. This calculator changes only this document; it writes nothing to a world.

Age is compared exactly

(at − birth) × den ≥ reference years × ticks/year × num, in a wide integer. The biological profile supplies num/den: human 1, dwarf 3/2, elf 3, goblin 2/3. Faction does not rescale biology.

Actual-year thresholds for the three life-stage transitions
ProfileYoung adultAdultElder
Human183055
Dwarf274582½
Elf5490165
Goblin122036⅔

Exact actual-year boundaries corresponding to reference ages 18, 30 and 55. At a boundary the new stage applies.

A dead mind is derived, not frozen

The stage uses the known death instant. Current residence or biological parenthood cannot prove a carer assignment at death. The current implementation therefore leaves every deceased nonzero configured care shift null; zero shifts remain known.

Compare clamp(base) with clamp(base + care). If equal, the final weight is known; otherwise it is null. With shipped defaults, three dead-person weights are unknown and nine remain exact.

No valid birth date, or a deceased person without a valid death date, means no derived mind. Unknown is data, not a fabricated zero contribution.

Exact definitions: shipped assumptions · rational age comparison · nullable decomposition.

03 · Membership does not grant a home

Residence, presence and title answer different questions

Household membership comes from living household members. Village membership follows the legal residence’s settlement even while away. Faction membership follows the person. A title names a beneficiary; it does not identify everyone currently consuming food there.

Membership, consumption and ownership can divergeSchematic traveller P17 belongs to H7 and legally resides at Home42 in Village3. An unrelated title share benefits H11. Travel changes presence without automatically changing legal residence or title. Person P17 A living member of H7 Currently travelling Legal home: Home 42 Settlement: Village 3 Village membership follows this Memberships stay current Household H7 + Village 3 Faction from the person Present somewhere else Presence affects food consumers Departure alone is no admission Home 42 pantry Provision receiver: this home Not a household or title owner A separate title share Another owner holds the share Beneficiary household: H11 ADDRESSTITLE Three facts, three authorities H7 can be the resident group while H11 is the title beneficiary. Neither is automatically the duty receiver.
A schematic example, not a measured household. Home cards retain independent resident and beneficiary links, deduplicated within each section. Admission can change the legal address; ownership follows title intervals.

Roles are sets, succession is a read

Households have head, adult, dependant and carer roles; villages have elder and resident; factions have member. The one shipped custom is eldest_adult: living reference-age ≥18, earliest actual birth tick, then lower person ID. No eligible adult means no head or elder.

Village elder is an office, not the elder life stage. A goblin from 12 to under 15 actual years can be both an eligible adult and a care-required dependant.

Provenance is not a joining history

Founder/calendar opening, born/birth and arrived/arrival describe recorded origin. Unknown origin/date stays unknown. These fields do not reconstruct when a person later joined each collective.

Dead people have no current memberships. Heroes currently have faction membership only. Village faction uses the first resident on record, including dead residents; it is not a majority vote.

Holdings and interests by collective
CollectiveHoldings authorityLimits
HouseholdCurrent nonzero title shares benefiting that household; unique homes and their pantriesSeparate from residence. Existing title interval and standing rules decide eligibility.
VillageSettlement homes, real common store, standing owned farm/mine/workshop placesFull play only. Missing or razed stores do not become fictional inventories.
FactionVillages with that attributed people factionNo invented faction leader, treasury or agenda.
InterestsPositive current village-store shortfalls against production wantsFood in grams; pelts and ore in item units. No store means no fabricated interest amounts.

Derivation: memberships and roles · holdings and interests · separate home-card link sections.

04 · Responsibility without invented outcomes

Follow the debtor, then the actual receiver

Care projects the current residence record. Provisioning shares the production pass’s const candidate projection. Neither reader adds a duty merely because two people are kin or a household owns a share.

A duty has an actual debtor and receiverCare is person-to-person or absent-debtor-to-person. Provision is village-to-home. Consumer households index the home duty without changing its receiver or multiplying its count. Care debtor: Person 9 Recorded assigned / overloaded by = person Care receiver: Person 8 Living, care required to = party.person Status: kept Raw care state remains visible Not a capacity/quality guarantee No eligible carer by = null No fictional household debtor The same dependant The duty is still represented to = party.person Status: no one able Responsibility is absent Receiver is still known Provision debtor: Village 3 Full play + production enabled A real live common store Provision receiver: Home 42 Positive target + real pantry to = home Present consumer households An index to this one duty Not extra debtors or receivers INDEX Target = 7 × sum of daily food need for living present legal residents Current target satisfaction and today’s positive receipts are independent facts.
Party remains person-or-collective. ObligationReceiver adds a home arm; by can be null. All duties currently use role-duty origin, strength 100 and no sanction: inspection metadata, not a punishment mechanism.

Axis A · Is the target satisfied now?

A provision duty needs a positive target, real pantry, valid settlement and live store. Living legal residents who are away do not add to its target.

Status is fulfilled if the target is met or its remaining deficit is below one whole unit of the matching food. Otherwise it is unmet, with a reason such as capacity, wrong food or empty stock. A full pantry does not prove a transfer happened today.

Axis B · What positive transfers happened today?

Read matching pantry + settlement receipts in [day_start, now]. Sum positive mass; select the latest receipt by tick, then sequence.

A receipt can exist while the pantry is now short. No receipt can mean already satisfied, absent consumers or no supply. Missing receipts never establish a failed past pass.

Association is not aggregation. A household’s ledger indexes provision duties through its present consumers. It does not turn all members’ personal care duties into household duties. Global totals count each duty once.

Ledger: care and party queries · the shared provision projection · today’s positive receipt evidence.

05 · A small graph, directly supported by records

Seed four ties; merge three columns

There are no inferred friendships or learned opinions. Direct biological edges, partnerships and current living household pairs produce an initial graph. Each edge keeps all supported tie labels.

Overlapping ties take maxima, not sumsThe partnership and living-housemate seeds overlap for one canonical pair. Their affection, trust and familiarity merge separately using maximum, producing 80, 70, 70. Standing partnership affection 80 • trust 70 familiarity 70 Living household mates affection 0 • trust 0 familiarity 60 Merge each column max(80, 0) • max(70, 0) max(70, 60) One pair, two tie labels 80 / 70 / 70 Not 80 / 70 / 130 key = (min(PersonId A, B), max(PersonId A, B)) • one unordered pair in global totals
Housemate means membership of the same current household, not physical co-location. A traveller may retain that tie. Parent/child and death-ended partnership ties can survive death; living-housemate ties cannot.
The four shipped relationship seeds
Source tieAffectionTrustFamiliarityPersistence
Standing partner807070Current partnership; a known future end is still current.
Death-ended partner606060Death and both-died endings retain this seed; separation does not.
Biological parent/child706060Retained when either person dies. No sibling/cousin seed is added.
Living household mate0060Both living, same current household; presence is not required.

Whole-number strengths 0–100 are model assumptions. Parent/child + household mate stays 70/60/60, not an added score.

Global discovery visits actual parent and partnership edges, then the pairs within each household. Household pairing costs O(m²), matching its possible output size. Person queries select their actual local ties instead of first building every global pair. Final global pairs sort by canonical person IDs; a person’s rows sort by other person ID.

Graph construction: canonical keys and maxima · one unordered pair per count.

06 · A stable link crosses a short lifetime

Copy the identity before dropping the answer

The app follows value links, not pointers into old card text. Ordinary views have caller-allocated arrays and may borrow names. Population pages explicitly become independent owned snapshots.

Identity survives; card text is replacedThe app copies the selected value link before resetting the card arena and rebuilding. General query views can borrow names, whereas household pages deeply clone their data. 1 · Read Build card in caller arena 2 · Select Button returns a selected line index 3 · Resolve + copy Keep the selected tag + ID / index 4 · Reset Discard previous card-owned output 5 · Rebuild New card replaces old text and links Ordinary query views Derived arrays use the caller allocator. Some names borrow content/entity strings. Owned household pages Clone names, members, holdings and interests. Page.deinit frees nested ownership + records. Do not keep old card text across reset; the copied identity is the bridge to the next read.
No persistent agency cache is needed. Household-page allocation failure unwinds partial and completed records. Missing collective identities produce an unavailable card; repeated reads rebuild from current records.

Bounded discovery, explicit page status

Traverse actual rows, never a sparse ID’s high-water range. Household subject and discovery pages are complete, including retained empty households, with existing cursor/revision semantics. Occupation and settlement-year pages remain explicitly partial.

Identity is not a spatial capability

Household/faction catalog kinds append after the prior 20. A collective Details link does not manufacture an entity, place or map extent. A household can have a real focus; a faction has none. Unlocated rows sort after located rows by distance.

Capabilities of new collective Explorer rows
ActionLocated householdUnlocated household / factionAuthority
DetailsYesYesTagged identity
FlyYesNoReal, in-bounds recorded-home focus
Follow / orbitNoNoNeither new kind has an entity/place handle
Per-row HighlightNoNoNo manufactured extent
Show matches on mapA point at its focusNo pointActual extent or real focus; never field zero as a substitute

Lifetimes: copy → reset → rebuild · deep page ownership · actual match fields.

07 · Recorded evidence, with its scale attached

A complete card fits inside the 4 ms budget

These are spec 164’s recorded ReleaseFast construction timings on macOS arm64/Metal, not render-frame timings. Seed 42’s default opening has 540 households, 18 villages, six people factions and 14,775 unordered pairs. Discover the actual maximum subjects, then time 41 full detailByLink builds per subject with a fresh arena.

Person 4090 · 63 pairs
0.557 ms
Household 364 · 50
0.293 ms
Village 13 · 112
0.387 ms
0 ms4 ms acceptance bound
Exact recorded complete-card measurements
Maximum subjectCard linesMedian msWorst ms
Person · 63 relationships1040.3734160.556542
Household · 50 living members610.2580840.292625
Village · 112 living members1710.3615410.387250

Opening tick 3616704000000. Median is the 21st sorted sample; worst includes the first cold build. Allocation and all card sections are timed; teardown follows the clock stop. This is a measured recipe/platform, not a larger-world guarantee.

The week-end ledger is a different instant

At tick 3616764480000, seven days later:

540 / 69households / with heads
18 / 14villages / with elders
162 / 71care / provision duties
14,426unordered relationship pairs

Six factions. Actual headless counts match an independent raw-record oracle. The smaller relationship count does not conflict with the opening measurement.

Inspection leaves the future alone

The recorded full default-world sweep read 4,643 people, 564 collectives, 6,875 cards and 18,468 pages; a history-preview sweep covered its corresponding readers too.

Population/config/replay, RNG, events/frontier, counters, arena usage and actual save bytes stayed equal. The inspected world and untouched twin then matched through the same next hour, including 6,042 traced events.

A real content mutation changed a motive default 100 → 101 and the agency digest/view, while generation, save identity and continuation remained equal.

The validation boundary. Recorded native offscreen ImGui events follow person → household → village → faction and home → household. Of 160 original captures, 159 match exactly; the Explorer total changes 20 → 22 in 53 pixels. Physical-window input was inconclusive; Linux/Windows rendering and interaction remain unverified. No tests or simulation runs were performed for this documentation addition.

What comes next is still separate work. This delivered system describes minds, duties and ties. Stored goals/projects, decisions that use them, sanctions and evolving relationships belong to specs 165/166 and later work. They are not active behavior in this snapshot.

Deep dive · AGT-12 delivery B · spec 165

Choosing, and keeping to it

A decision is a point in time, not a new heartbeat. Providers offer bounded possibilities; knowledge removes what the decider cannot reach or know; integer scores and one private draw select a choice. Durable work then survives ordinary action boundaries. The same machinery can run in live play and the generated past.

Source audit: 2026-10-08 · merged implementation ac4e574 · final source rereview ac38288.
The core has fixture-owned providers only. No normal person or collective uses it yet; spec 166 is the first planned adoption. The numbers below are the final spec 165 cohort, not a new measurement for this page.

01 · One bounded decision

Possible → known → scored → chosen

A registered provider has a play face, an annual face, or both. It offers at most eight keyed options. A target must pass capabilities and either reachable land within six travel hours or the decider’s collective knowledge. The surviving options sort by provider ID and key, so collection order cannot change the draw.

A decision’s read and publication pathProviders produce offers. Knowledge and capabilities filter them. Checked integer scoring applies a strict commitment gate. One integer draw selects a canonical offer. Preparation then publishes one batch of durable changes or leaves the store unchanged on failure. Providers≤ 8 eachkeyed offers Admissionknowledge+ capability Integer scorestrict commitmentgate One drawinteger tablecanonical order One publicationrevision checkedall or nothing Only actual decision points enter the pipeline: plan end, step outcome, interrupt, opportunity, goal or agenda review. No production provider is installed yet, so ordinary worlds leave this route dormant.
Text equivalent: offer, filter, score, draw, then prepare and publish. Failure before publication leaves every agency table unchanged.

A strict margin before chance

The ordinary score adds 12 motive weight × satisfaction terms, then subtracts cost and applies goals, duty, consequences and collective terms where relevant. A viable active step blocks a rival unless the rival’s ordinary score is greater than the active ordinary score plus commitment. Only then does the active step receive the commitment bonus in the draw.

With the labelled default bonus of 100, active ordinary 500 and rival 600 cannot switch; rival 601 passes the gate. This is an integer rule illustration, not a calibrated behavioral prediction.

Mostly best, never float scoring

The draw uses a 129-entry integer weight table for deficits from the best, interpolates in integers, and drops offers more than 8τ behind. A singleton takes no draw. The default τ is 100; it and commitment await spec 166 measurement. Choices use an owner-and-point ordinal in a private agency-v1 stream. No simulation RNG or population mint stream is spent.

Even when a provider re-offers saved work, its old score is not frozen: today’s mind and feasibility are read again.

Audit: bounded canonical offers · knowledge gate · score, margin and draw.

02 · Work outlives the action stack

Keep the step, even when the plan is cleared

An authored blueprint has at most eight steps. Its durable undertaking remembers owner, step and state; the current step is the intention, with no second intention row. Step kinds compile to existing walk, work or wait actions, then read actual world state at the next plan end. A completed action is not proof that a walk arrived or food was acquired.

One durable undertaking has two recovery pathsAn active step interrupted by a threat is suspended outside the cleared plan stack, then can be reconsidered and recompiled. A failed step becomes the one most-recent failed candidate. It is reconsidered with the same identity and step, rather than restarted. A newer failure replaces that candidate. Active step 2durable undertaking threat Suspended step 2outside cleared stack selected Recompile step 2after feasibility check failed outcome Newest failed candidatesame key + unfinished step reconsider Resume if viablenot step zero One active · up to four suspended (newest first) · one failed candidate · up to three goals.
Text equivalent: interruption stores the current step outside the plan; failure retains one candidate. Both paths recheck current feasibility before selection.

Outcomes are factual

walk_to checks arrival, seek_food checks carried food, and rest checks elapsed time and fatigue. ask carries the exact authored request and source step into the delivered debt. A lost but valid unload home applies no goods or marker effect; the ordinary boundary reads the step as blocked. Structural errors still surface.

Goals make work matter

A provider may offer a goal at a goal review. It records its motive and adoption reason, and raises matching future work by that motive’s weight. Existing goals are disposed before new offers; duplicate or over-capacity goals are removed before scoring and drawing. There is no built-in goal library in this delivery.

Audit: step state and resumption · compile and outcome · goal admission.

03 · A collective choice meets individual answers

A decree becomes work only through its members

Monitors, events, members or another collective can raise a matter. Custom chooses the first eligible canonical option without a draw. Decree scores as the actual head or elder, with collective interest and the role-holder’s own household stake; absent role-holder falls back to custom. Each selected matter starts a linked collective undertaking, then assigns attributed obligations to members in bounded batches.

A collective decision waits for real member outcomesA raised matter resolves by custom or decree, publishes a collective undertaking, assigns members exact step obligations, and waits for their individual comply, delay or refuse choices. Only actual outcomes for the current step determine advance: all kept succeeds, any broken fails, and pending, delayed, blocked or no assignments remain running. Open mattercalendar or event Custom / decreeexact matter scope Collective stepassigned to members Own answerscomply / delay / refuse Read exact current-step debtsall kept → next · any broken → fail Pending, delayed, blocked or zero assignments cannot imply success. No unrelated open matter is needed to progress.
Text equivalent: a collective selects one matter; each member answers at their own decision point. The collective advances only from the actual results of its assigned current step.

Delay is a real intermediate state

Delay preserves its count; later compliance atomically restores a debt to pending while work begins. Only actual task success marks kept. Refusal records a broken debt and directional consequence. A terminal accepted debt cannot settle a second time after failed work is reconsidered.

Provenance has two owners

The answer provider is reserved for the comply/delay/refuse choice, while the resulting undertaking retains its original execution provider and exact authored step parameters. This distinction lets annual execution call the actual provider once, and lets the reasons record explain whose request was answered.

Audit: agenda review and member outcomes · answers and settlement · durable attribution.

04 · Two speeds, one store

Play waits for boundaries; history retains a cursor

Live play enters at ordinary plan ends. A person’s birthday and life-event goal reviews are lazy there; an agenda with an open due item joins one collective population event, ordered after mobility. The yearly history stage sits after care and before finish-year, moving through existing agency rows by bounded retained steps. It snapshots work active at entry, so work accepted this year is not also resolved as if it had run all year.

Decision driver comparison
BoundaryLive playGenerated past
EntryExisting plan end, receipt, opportunity or due agendaAnnual agency stage after care
Work outcomeRead actual world at next plan boundaryOne authored yearly outcome per retained step; no fictional action event
CollectivesWeekly household, 28-day village or event; one event per due tickExisting agenda rows reviewed in canonical order, with resumable member batches
At TFirst ordinary zero-time advance compiles stored current step onceUnresolved or newly accepted work crosses with an opening marker, not a success claim

Audit: play boundary and T · retained annual cursor.

05 · Sparse records, explainable choices

One transaction across six tables

The population store keeps sorted sparse minds, undertakings, obligations, relationship changes, agendas and reasons. A choice prepares edits with expected revisions, validates references, reserves capacity, then publishes serially. Allocation, invalid references, stale revisions or work-limit failure before publication leave all six tables, ordinals and reasons intact. Annual meter charges include conservative copy and shift bounds; a failed attempt can consume work budget without publishing state.

Empty worlds retain identity

Each table has its own gated digest block only when nonempty. No person or household field, ID namespace, receipt, life fact or save format was added. Empty ordinary worlds keep their old world, trace, RNG, packet and save identities. Private per-owner, per-point stream ordinals advance only for committed choices.

The reason is a record, not a replay

Significant goal, undertaking, obligation, request and decree decisions record the decider, tick, chosen and runner-up keys, margin and up to three motive contributions. Routine activity choices only increment counters. Inspection reads the latest reason as a value; it never decides or backfills. The deliberations: line exposes points, offers, draws, significant choices and reviews.

Audit: prepare and commit · canonical sparse tables · latest reason read.

06 · Final recorded witnesses and limits

The core is measured where it runs

The final ReleaseFast fixture cohort times 10,000 operations after 1,000 warmups on Apple M5/macOS arm64. Each decision case has two offers and one draw; the agenda case also raises, marks due, reviews and assigns members. Full-cycle times include bounded fixture reset. These are initial budgets for spec 166, not a forecast for an adopted world.

Final spec 165 fixture timing cohort, nanoseconds per operation
Fixture operationCore ns/opFull cycle ns/opAnnual meter / op
Play decision1,9032,607—
Annual decision2,2072,936106
Play agenda5,7406,936—
Annual agenda6,5147,767379

Final final_fix_wave.fixture_cost records exact nanoseconds, counts and method. The historical top-level evidence cohort predates the final corrections and is superseded for current-source costs.

Ordinary world stays dormant

Five paired seed-42 seven-day ReleaseFast runs had median wall times 41.228 s base and 41.093 s final, with one slower final pair. The deliberations: counters were all zero. The measured world, week trace, legacy save and population literals remained equal to the frozen base. Timing spread prevents a stronger performance claim.

What the gate actually covered

The final normal gate passed 46/46 build steps with 1,672 executed tests and seven cached module selections; the focused spec 165 gate passed 101 selected tests. The boundary guard passed. Joined fixture cases covered failed routes, delayed compliance, real annual outcomes, member progression, goal capacity, attribution and transaction failure. No new whole-world e2e, year-long, cross-platform or renderer check belongs to this final cohort.

Current boundary. There are no production providers, goal catalogue, vote, quorum, member-death, partial-success or cancellation policy. Only the most recent failed candidate is retained. The annual meter deliberately uses conservative bounds. Spec 166 will decide what the first ordinary daily loop asks this core to do.

Deep dive · specs 191 and 213 · demand routes

From a missing tool to raw ore

A village's demand picture says what it is short of. Routes are the stage that turns "we are short of a finished thing" into "so we need these inputs, this much work and these batches". This article follows one missing Tool through the recipe graph, then shows when the plan is reused and when it is worked out again.

Source audit: 2026-11-17 · main 6c7aa23 (simulation source identical to PR #315's merge eb16b84).
This article is not updated with the code. Per-kind incremental pictures (a spec 213 amendment) were being built when it was written, so the redraw described here may already be out of date. Counts quote PR #315's recorded seed-42 one-day profile; worked-example numbers are rounded recipe units.

01 · Where routes sit in a picture redraw

Wants → cover → routes → inputs → reserves

Each village keeps running totals of its stock and wants (the spec 213 ledger). The picture is drawn from those totals. Final wants are covered from stock by priority. What stays uncovered goes to the route planner, whose input rows are covered from what is left. Standing reserves come last.

Stages of a demand picture redrawFinal wants are covered from stock in priority order. Uncovered finals go to the route planner, which adds input rows. Those are covered from the remaining stock. Metal, Ore and Charcoal reserves follow; missing charcoal becomes stacks and wood cut at the woodland. Final wantsfood, garments,tools, spares, seeds,orders, extras Cover from stockprivate → reserved→ running processes→ common Route planneruncovered finals walkthe recipe graph insidework and station budgets Input rows"want 2 Ore,450 Charcoal…", coveredfrom what is left ReservesMetal, Ore, Charcoal;short charcoal → stacks→ wood cut on site
Each stage is part of one redraw. The planner is the only stage that reads work hours, stations and the recipe graph. Diagrams scroll horizontally on narrow screens.

02 · The recipe graph the planner walks

Wood and ore to a Tool

From the recipe data. Arrows point from an input to what it makes. Each recipe needs a station and has a minimum duration. Charcoal feeds three of the four steps, which is why a charcoal shortage stalls metalworking.

The metal recipe graphWood is carbonised into Charcoal in a kiln over at least seven days. Ore and Charcoal are reduced into Bloom in a furnace. Bloom and Charcoal are finished into Metal at the forge. Metal, Wood and Charcoal are forged into a Tool. Woodwoodland Oremine Carbonisekiln · ≥ 7 days2000 Wood → 1000 Charcoal ReduceBloomfurnace · ≥ 1 day1 Ore + 180 Charcoal → 1 Bloom FinishMetalforge · 3 h1 Bloom + 40 Charcoal → 12 Metal ForgeToolforge · 6 h20 Metal, 1 Wood, 10 Ch Tool
Dashed boxes are gathered sources; tinted boxes are goods. Garments have a second chain: Hide or Pelt + Wood → PreparedSkin (treatment, ≥ 2 days) → Garment. Only the skin route that can actually run is kept in the graph.

03 · Worked example

One spare Tool is missing

The planner subtracts the stock already given to final needs and adds output from running processes. Then it walks the graph backwards from the uncovered final, planning only the shortfall at each step.

Planning one missing Tool, in rounded recipe units
StepNeedsIn stockPlanned
Tool10ForgeTool ×1 → 20 Metal, 1 Wood, 10 Charcoal
Metal20515 short → FinishMetal ×2 (makes 24) → 2 Bloom, 80 Charcoal
Bloom20ReduceBloom ×2 → 2 Ore, 360 Charcoal
Ore24covered from stock
Charcoal45030420 short → Carbonise ×1 (makes 1000) → 2000 Wood, cut at the woodland

The real planner works in milligrams from each good's packet mass, not recipe units.

Budgets are the village's real facts

Free work hours (here 6 + 2×3 + 2×9 + 16 h), each station's free time, the batches allowed per recipe, the horizon (the seven-day kiln must finish in time) and store room for the outputs. If the whole amount does not fit, a binary search finds the largest amount that does. If not even one unit fits, the Tool stays unmet.

What comes out

Input rows the village now wants (Metal, Bloom, Ore, Charcoal, Wood), each tagged with the Tool as its cause, plus planned batch counts. The next stage covers those rows from stock. Whatever is still uncovered becomes work: mining, carrying, burning, forging. The plan reserves nothing; actual work and claims are separate.

04 · When routes are replanned

One cached plan per village

The plan's key is a hash of the day plus, for every uncovered final need, its kind, purpose, deadline, cause and missing amount. Same key, same plan: the cached input rows are reused and only covered again against current stock.

Which events replan routes
During one dayUncovered finals change?Routes
A carrier drops 3 Ore in the storeNo: Ore is an input, not a finalreuse; the Ore row is covered more
Wood is burned for cookingNoreuse
A villager's tool breaksYes: missing Tool 1 → 2replan: whole graph walk and budget checks
The smith finishes a ToolYes: missing 2 → 1replan
An uncovered food or garment need growsYes: its missing amount is in the keyreplan, even though nothing about tools changed
MidnightThe day is in the keyreplan

A reused plan keeps how much of each input it wants; only the covering from stock is redone on each redraw.

One changed final replans every route. All finals share one budget in priority order, so a garment route can use work hours a tool route needed. That is correct, but it makes the key sensitive to any uncovered amount, including finals no recipe can make, such as most food. Leaving those out of the key would avoid replans without changing behaviour; how often it happens has not been measured.

05 · Per kind

A change ripples down the graph

Seed 42's one-day profile (PR #315) had 5,361 picture redraws at about 2.0 million instructions each, and 8,714 demand update checks at about 3.2 million including the rest. Each redraw today rebuilds every kind. A per-kind picture redraws only the kinds that changed, but it has to follow the routes.

Ore delivered: the cheap case

Only Ore is dirty. The uncovered finals are unchanged, so the plan is reused and only Ore's rows are covered again.

Tool breaks: a ripple

Tool is dirty, so the uncovered finals change and routes are replanned. The input rows for Metal, Bloom, Ore, Charcoal and Wood change, so those kinds become dirty too. Reserves are covered after route inputs, from what is left, so they ripple the same way.

06 · Limits of this article

What this does not claim

This is a reading of the source at the stamped commit, not a new measurement. Worked-example quantities are illustrative and rounded. The replan triggers are read from the cache key, not counted in a run. Spec 213's per-kind amendment, the late-day cost profile and the backlogged rebuild cadence may change how often any of this runs.

Audit: picture redraw · route cache key · route planner · recipe graph · recipes.