Keyboard shortcuts

Press ← or → to navigate between chapters

Press ? to show this help

Press Esc to hide this help

Spawners, population, reservations, coordination, work, offline, encounters and breadth

Worlds fill themselves with creatures under provable caps, never in any player’s view, and agents claim what they are about to use so two of them never fetch the same drop. Creatures that fight hold threat tables a tank can manage, take turns through token pools, and act as squads with roles, styles and barks. Smart objects advertise what they offer and own slots agents claim, and workers pull jobs from a chore board. The design and its rationale are in Talos E (docs/superpowers/specs/2026-09-27-talos-e-coordination-population-design.md) §4–§6, §8–§11, §13; this page is the current contract for what phase E1 built (the “hunt and fetch” slice: one spawner region with caps and the Ambient policy, and the minimal reservation the pet uses), what E2 added (combat coordination: threat, tokens, squads, herds, and Points spawners under the Encounter policy) and what E4 added (work: smart objects, the chore board and workers, and the Persistent policy and promotion) and what E5 added (offline: agents whose place is not loaded become compact records, workers’ stations are caught up by events, and agents come back where nobody sees them appear), and what E3 added (encounters: typed I/O wiring between logic archetypes and coordinators, directors with pacing, waves, a budget and the wipe, encounter templates checked at load, the boss arena pattern and the encounter ceiling as a game rule), and what E6 added (breadth: natural spawning around every player, group-scale influence layers, party NPCs’ considerations and engagement rings, vendors with trade tables over the Items exchange seam, space events that cross spaces, and background spaces).

Source: manifold_ai::coord (crates/manifold-ai/src/coord/) (wasm-safe logic: registries, components, caps, the rate-limit queue, despawn bands, traces, the reservation table, the spawn, squad and station atoms, threat tables and parts, token pools, squads and roles, smart objects and their index, the chore board’s ranking, commitment and rules, offline models, records and catch-up; E3’s I/O signatures, links, queue and delivery ring, the logic components, directors, wave tables and encounter templates; E6’s influence layers, space events and trade tables; D’s part of an Offline record is manifold_ai::offline (crates/manifold-ai/src/offline.rs)) and the server wiring in manifold_server_state::coord (crates/manifold-server-state/src/coord/) (the systems, visibility, persistence metadata, console commands; E5’s coord::offline; E3’s coord::io, coord::director, coord::encounter; E6’s coord::influence, coord::party, coord::vendor, coord::space_events). Tests: the unit tests in manifold-ai, crates/manifold-ai/tests/determinism_guard.rs, D’s crates/manifold-ai/tests/selection.rs (E’s inputs, AcquireToken, the evade filter), the coord::tests, coord::tests_e2, coord::tests_e3, coord::tests_e4, coord::tests_e5, coord::tests_e6 and ai::work_tests modules of manifold-server-state, archetypes::tests::offline_collapse_releases_server_anim_and_restore_reattaches_it and game/flagship/tests/spawn_content.rs.

Data

Server-side registries (the data stage):

RegistryDirectoryEntry
manifold-ai:spawn-categoryspawn_categories/SpawnCategory(id, per_player, per_region, counts_toward_hard_cap)
manifold-ai:spawn-rulespawn_rules/SpawnRule(id, archetype, category, weight, conditions, density: (per_region, category_per_region), distance: (min, max), persistence, herd: (size: (min, max), squad))
manifold-ai:spawnerspawners/a content-placed spawner: Spawner(id, shape: Region(min, max) | Points([(x, y, z), …]) | PlayerAnchored, source: Rules([...]) | Archetype("<key>") | Pool("<wave table>"), policy, max_alive, cadence, attempts_per_eval, respawn: (delay, catch_up_max), leash, enabled)
manifold-ai:threat-profilethreat_profiles/ThreatProfile(id, max_entries, aggro_radius, initial_threat, heal_factor, block_threat, positional, decay, switch, leash, evade) (threat)
manifold-ai:token-pooltoken_pools/TokenPoolDef(id, capacity, lease_secs, grant_spacing_secs, steal, on_scope) (tokens)
manifold-ai:roleroles/RoleDef(id, max_per_group, bias, requirements, grant_tags, release_after_idle_secs)
manifold-ai:squadsquads/SquadDef(id, styles, initial_style, transitions, fixed_slots, barks, bark_cooldown_secs, dissolve_when_empty)
manifold-ai:smart-objectsmart_objects/SmartObjectDef(id, tags, slots: [(id, offset, yaw, tags, accepts, behaviour, timeout)], advertisements: [(activity, slot_tags, score, requires)], player_usable, query_radius) (smart objects)
manifold-ai:job-categoryjob_categories/JobCategory(id)
manifold-ai:stationstations/StationDef(id, smart_object, category, posts: Continuous(max_open_jobs), slot_tags, work: (cycle_secs, output, quality, yield_mult), blocked_when, offline) (the chore board)
manifold-ai:offline-modeloffline_models/OfflineModel(id, kind: StationWork(efficiency, max_cycles), max_credit_hours) (offline)
manifold-ai:io-signatureio_signatures/IoSignature(id, component, outputs: [(name, type)], inputs: [(name, type, handler)]) (I/O wiring)
manifold-ai:wave-tablewave_tables/WaveTable(id, entries: [(archetype, weight, cost)], size) (directors)
manifold-ai:director-defdirectors/DirectorDef(id, intensity, pacing, population, budget, spawn, wipe, flow) (directors)
manifold-ai:encounter-templateencounter_templates/EncounterTemplate(id, entities: {name: (archetype, at, yaw, parent, member_of, extra)}, links) (templates)
manifold-ai:trade-tabletrade_tables/TradeTable(id, currency, offers: [(sells | buys, price, stock, rotation, tag, requires)]) (vendors)

References (archetype, category, the rules, squads, roles, cues, tags) are checked with file and line. Durations are ticks (160) or seconds ("4s"). conditions is a gameplay condition in the spawn context set. An Archetype or Pool source (a wave table’s archetypes by weight, at manifold-ai:spawn.wave) needs the Encounter or Persistent policy; the PlayerAnchored shape needs the Ambient policy and a Rules source (natural spawning). E also declares entries in B’s registries: the tag manifold:threat.redirect_owner, the stat manifold:threat_mult (base 1), and E6’s tag manifold:notable and stat manifold:threat_weight (base 1).

Spawn atoms. A condition atom sees only its evaluation context, so the spawner measures the cell first and passes what it measured as set-by-caller values (SpawnFacts on A’s SpawnParams and SpawnContext); archetype variant conditions read the same facts. Registered through gameplay_extensions():

AtomArgumentsHolds when
manifold:sky_lightat_leastthe cell’s sky light is at least that (15 under open sky, 0 under an opaque block within 64 blocks: the server keeps no light maps)
manifold:surface_blockblockthe block under the creature’s feet has that key (checked against the world’s blocks at load)

Spawners

A spawner is an entity with manifold-ai:spawner (Spawner) and manifold-ai:spawner-state (SpawnerState: pending respawns as absolute ticks, and a Points spawner’s killed points with their respawn ticks; codec version 2), both server-only and persisted, with Persistence::Saved. The first spawner pass after boot (after restore) creates one entity per content placement that has none; Spawner.placement remembers the key, so a restored spawner is never made twice.

Each creature carries SpawnedBy(spawner) (manifold-ai:spawned-by: exclusive, Remove on delete, Keep on unload, persisted as a link), whose reverse index is the spawner’s alive count; SpawnOrigin (policy, rule, category, the attributed player, spawn tick, the fixed point it holds; saved only with a Persistent creature, in its archetype patch); and Home (anchor cell, the spawner’s leash or the shape’s extent, 16 around a single point; persisted, and patchable, so archetypes may author it). A creature is placed at its foot cell’s centre plus its class’s footprint_offset (0.5 m for walker_large, whose foot cell is its footprint’s low corner, C issue 43).

SpawnerSystem runs in the AI block (after ResolveActionHandles, before navigation) every tick:

  1. content placements become spawner entities (once);
  2. deaths in last tick’s CombatEvents.died schedule now + delay on their spawner, or kill their fixed point until then (a creature-to-spawner map covers corpses despawned in the same tick);
  3. every enabled spawner whose shape a client subscribes to asks navigation to build around it (ServerNav.focus_requests);
  4. each due spawner (its cadence, staggered by durable id) evaluates: the allowance (max_alive minus the living, the queued and respawns not yet due, at most catch_up_max); nothing if no client subscribes to the shape; a rule by weight (DerivedRandom, site manifold-ai:spawn.rule); C’s find_spawn_cells over the box, at least distance.min from every player and hidden from every subscribed player; then per cell, in order, the rule’s conditions and the caps (an Encounter spawn checks only the space’s encounter ceiling); a herd adds its members beside the accepted cell; accepted cells join the queue. A Points spawner instead fills each free point that is not waiting for its respawn and is standable and hidden; a PlayerAnchored spawner evaluates a ring around each player (natural spawning);
  5. the queue drains at each space’s rate limit through spawn_archetype_batch, in request order (tick, spawner id, ordinal); a herd drains whole, and its squad entity is created in the same command before its members, who join it.

Spawns are placed at the tick phase’s flush, so an archetype’s anim-setup hook gives the creature its ServerAnim in the flush that creates it.

Never in view. The eyes are every player whose client subscribes to the shape’s interest regions, however far (entity scope is a cube of 64-block regions reaching about 192 blocks). A viewer sees a point inside its 110° view cone (from its yaw and pitch) that one voxel ray from its eye reaches. ViewerSight is C’s LineOfSight over the world’s blocks until D’s line-of-sight service exists; /ai population shows the rays cast this tick. A queued spawn that waited re-checks that its cell is still standable and hidden, and is dropped otherwise (the next evaluation places again).

Caps and the rate limit

CapScopeDefault
Localcreatures of a category in the 27 regions around a player; a candidate passes if any player that can draw it is undercategory per_player (10)
Regioncreatures of a rule, and of its category, in the candidate’s regionrule density, category per_region
AmbientAmbient creatures in the space256 (PopulationConfig)
Fair shareabove 80 % of the ambient cap, the attributed player (the nearest subscriber) keeps at most cap × 0.8 / players
Encounter ceilingEncounter creatures and queued encounter spawns in the space1,000 (the manifold:encounter-ceiling game rule)

The census counts living ambient and encounter creatures and queued spawns when a spawner is due. PopulationConfig holds each space’s settings: the ambient cap, the spawn rate limit (16 per tick) and the space’s difficulty key (token capacities, default normal). The encounter ceiling, which directors’ waves spend, is the game rule manifold:encounter-ceiling (Int, 0 to 100,000, default 1,000), read per space; its default is provisional until Pygmalion E5 brings the per-character server animation cost within its targets and the horde scenario confirms it on a quiet machine (E issue 12).

Two game rules gate spawning per space, read through GameRules at the space’s scope (game rules): manifold:do-ambient-spawning for Ambient spawners and manifold:do-encounter-spawning for Encounter spawners, both default true. With its rule off a due spawner records skipped: GameRule and queues nothing, and its queued spawns are dropped at the drain; Persistent spawners are gated by neither.

Despawning

DespawnSystem checks each Ambient creature once a second (staggered by durable id); corpses are B’s.

SituationRule
no client subscribes to its region (whether or not its chunk is resident)despawn now
within 32 blocks of a playernever
engaged: a non-empty Targets or threat table, OwnedBy or a held reservationnever
idle less than 30 snot yet
visible to a subscribed player (the placement test)not while seen
otherwise2.5 % per check (DerivedRandom, site manifold-ai:despawn)

Ambient creatures are Persistence::Session: after a restart they are gone, and the saved spawner spawns afresh by its rules. For the same reason every band despawns as DespawnReason::Destroyed, including the one for a chunk that is no longer resident: the creature never returns under its id, so it is not Unloaded (entity core (docs/architecture/entity-core.md)).

Reservations

ReservationTable (a resource) holds claims keyed by target, slot (Whole, Slot, Job, Cell) and layer. A task posts ReservationRequests::claim(ClaimRequest::whole(holder, target)), renew or release; ReservationSystem resolves them every tick in one batch: releases, renewals, expiry (default 30 s unless renewed), then claims, the best score winning each target and ties going to the lower durable id. At most four claims per holder per tick (Throttled); a lost contest backs off 2 s, doubling to 16 s. A target’s capacity is its Reservable component, else 1. Outcomes (Granted, Renewed, Released, Denied(..), Lost(Expired | TargetGone | HolderGone)) are in ReservationOutcomes after the pass. The holder’s HeldReservations mirrors the table; its remove hook releases everything when the holder despawns, and the pass ends claims whose target despawned or whose holder died. Reservations are not saved.

Herds

A rule’s herd: (size: (1, 3), squad: Some("<squad>")) spawns that many members (a draw at manifold-ai:spawn.herd, within what the spawner may still start) on standable, hidden cells beside the first accepted cell, each counted by the caps. With a squad, the drain creates the squad entity (Squad at the definition’s initial style, a GroupBlackboard, a session identity) in the members’ spawning command; every member holds MemberOf(squad) (A’s relationship: non-exclusive, up to eight groups, Remove on delete, Keep on unload, saved as links) and the first leads.

Encounter spawners

policy: Encounter spawns creatures that are never saved (Persistence::Session) and never despawn by distance; the spawner’s state is saved. A Points spawner holds at most one creature per point (SpawnOrigin.point): a death kills the point until now + delay, a refill of due points is capped at catch_up_max per evaluation, and after a restart the spawner restores every point not waiting, at full health. Encounter spawns count toward the space’s encounter ceiling, not the ambient caps.

Threat

A creature that can hold aggro carries manifold-ai:threat-table, authored as (profile: "<threat profile>") and stored as Tracked<ThreatTable> (server-only, never saved): up to max_entries (at most 16) entries of milli-threat, the state (Idle, Engaged, Evading), the current target and a taunt pin. Every amount and ratio is an integer or per mille, so tables decide alike on both hosts.

ThreatProfile(
    id: "flagship-game:threat/standard",
    max_entries: 12, aggro_radius: 12.0, initial_threat: 1000,
    heal_factor: 0.5, block_threat: 400,
    positional: (front_arc_deg: 90, radius: 3.0, rate_per_sec: 250),
    decay: (per_sec_fraction: 0.02, after_secs_without_event: 8),
    switch: (melee_ratio: 1.10, ranged_ratio: 1.30, melee_range: 4.0),
    leash: (radius: 48, max_secs_unreachable: 6),
    evade: (return_speed_mult: 1.5, immune_tag: "manifold:state.invulnerable", heal_on_return: true),
)

ThreatIngestSystem runs inside B’s block, after its death pass and before its settle pass, over this tick’s combat events:

SourceRule
DamageAppliedround(amount × 1000) × manifold:threat_mult to the target’s table for the attacker; an attacker tagged manifold:threat.redirect_owner credits its OwnedBy root
HealAppliedamount × heal_factor, split evenly across every table that holds the healed entity, for the healer
DamageCancelled at pre_apply (block, parry, shields)block_threat for the defender in the attacker’s table
E’s effect partsbelow

ThreatTargetSystem runs first in the AI block, 4 Hz per creature (staggered by durable id). It drops dead and despawned subjects. An idle creature adds initial_threat once for each hostile its brain perceives now within aggro_radius (the pull). An engaged one adds positional threat to entries in its front arc within radius while it attacks (an active B ability), decays entries quiet for after_secs_without_event, drops entries C calls unreachable for max_secs_unreachable, and evades when it leaves leash.radius of Home.anchor or its table empties (a creature without Home returns to Idle instead). Evading clears the table and the target, grants the profile’s immune_tag through B, ignores new threat, and ends within 2.5 blocks of home (or after 20 s), healing through B when heal_on_return is set. The target is the taunter while a taunt pins it, else the highest reachable entry, switching from the current target only above 110 % within melee_range or 130 % beyond. E writes A’s Targets for these creatures (a value replacement; D does not write it for them) and keeps manifold-ai:threat-summary (ThreatSummary: the target and the top five at whole percent of the top) at the same 4 Hz.

E registers five native effect parts on B’s GameplayExtensions (Part(id: .., args: (..)) in an effect). On a holder with a table they act for the effect’s source; on a holder without one, on the holder’s own entries in every table (a rogue’s fade):

PartArgumentsDoes
manifold:threat_tauntset_to_top_plus (milli), force_target_secsthe source to the top plus the value, pinned as the target
manifold:threat_addamount (milli, × stacks; also each period)adds
manifold:threat_multiplyfactorscales
manifold:threat_fadefractionremoves that share
manifold:threat_clearnoneclears the holder’s table, or the holder from every table

manifold_server_state::coord::threat::evade_all evades a list of creatures at once (a director’s wipe, E3).

Tokens

A TokenPoolDef limits how many act against one scope at once:

TokenPoolDef(
    id: "flagship-game:tokens/melee",
    capacity: ByDifficulty({ "story": 1, "normal": 2, "hard": 3 }),   // or a number
    lease_secs: 4.0,
    grant_spacing_secs: 0.4,
    steal: (enabled: true, margin: 250, min_hold_secs: 1.0),
    on_scope: Player,   // the attacked target; Group: the requester's squad;
                        // Encounter: the requester's director (E3)
)

The scope’s manifold-ai:token-pools (TokenPools, server-only) is inserted the first time a request names it and removed after 30 s without one. D’s AcquireToken task posts a request (with its activity’s utility as the score) each tick it waits; TokenSystem resolves last tick’s requests before D’s think, per scope in durable order: expiries (an unused lease after lease_secs, a gone or dead holder), releases (starting the spacing), the gate, grants by score then durable id within capacity and spacing, then steals of the lowest unused lease older than min_hold_secs by a request that beats it by margin. A committed ability (UseAbility seeing it active) marks the holder’s leases used; they then last until released, which the task’s scope exit does. coord::tokens::gate(world, scope, reason, secs, pools, revoke) closes a gate. Outcomes are traced on the scope.

Squads, roles and barks

A squad is an entity with manifold-ai:squad (Squad: definition, style, order, leader, dissolve_when_empty; persisted) and manifold-ai:group-blackboard (GroupBlackboard; transient). Members hold MemberOf(squad).

SquadDef(
    id: "flagship-game:squad/boar_herd",
    styles: {
        "calm":       (roles: {"flagship-game:role/watcher": 1}, style: Some("flagship-game:style/herd_calm")),
        "aggressive": (roles: {"flagship-game:role/charger": 1}, style: Some("flagship-game:style/herd_attack")),
    },
    initial_style: "calm",
    transitions: [(from: "calm", to: "aggressive",
                   when: Ext(atom: "manifold:group_alert", args: (level: "Combat")))],
    barks: { "style.aggressive": "flagship-game:cue.boar.rally" },
)

GroupSystem runs each squad at 2 Hz, before D’s think:

  1. members (the living, in durable order); members gone since the last pass are casualties (member.died bark); an empty squad dissolves;
  2. the blackboard: every member’s targets at Suspicious or above, most recent sighting first (at most eight), the alert level (Engaged is Combat) and the last combat tick; members that do not know a shared Alert or Engaged target learn it second hand (an Alert entry, as from an ally call);
  3. the first style transition from the current style whose condition holds (B conditions in the squad set over E’s atoms: manifold:group_alert(level), manifold:casualty_fraction(at_least), manifold:time_since_combat(secs) and manifold:members_with_role(role, at_least)), with a style.<name> bark;
  4. the style’s D StyleDef on every member (None clears it);
  5. roles: a holder keeps its role while the style (or a fixed slot) lists it, it asked within release_after_idle_secs (fixed slots need no asking) and it meets requirements; free slots, up to the style’s count and the role’s max_per_group (a number over the set-by-caller group_size), go to requesters by score, then durable id, and fixed slots are filled from members without a role, by health. A grant sets manifold-ai:role (Role { role, granted_tick }, the role’s dense id plus one; public, Critical, server-stamped, so binding tables may read it), grants the role’s tags through B and barks role.<key>;
  6. the leader: the first living member when the old one is gone.

D’s RequestRole(role, score) task asks for a role; a held role multiplies matching activities’ utility by its bias. Barks (style.<name>, role.<key>, member.died, target.lost) play the definition’s cue on the leader or the member concerned, through B’s cue outbox inside B’s block, at most one per group per bark_cooldown_secs (3 s) and one per cue per second across groups.

D’s side

E answers D’s AgentEnv through the AiCoordination port: the Threat input (the target’s share of the agent’s own table), TokenAvailable(pool), GroupKnows, the AcquireToken and RequestRole tasks, role bias, and the evade (only activities tagged ai.activity.return run, and an archetype brain runs only its ReturnHome behaviour, at return_speed_mult, until it is within 2.5 blocks of home); and E4’s SmartObjects(..) and Chores(..) candidates, AdScore, the station conditions, BrainOverrides from workers’ rules, and the ClaimSlot, UseSlot, PullJob and Work tasks. See brains.

Significance inputs

E keeps no animation level of detail (§11.9). The flags Talos F derives for Pygmalion F’s allocator read E’s state: Targets (E’s writer for threat tables), ThreatSummary (engaged with the viewer or their party), a party member’s Role, and content’s boss tag. F owns the flag components.

Persistent spawners and promotion

policy: Persistent spawns creatures with Persistence::Saved: they are saved as archetype plus patch, and their Home and SpawnOrigin ride in the patch (both are patchable), so a restart restores them exactly, with SpawnedBy relinked. They count only against their spawner’s max_alive (through the saved link; a Points spawner matches a restored creature to its point by its Home anchor), never the local, region or ambient caps, and never despawn by distance.

manifold_server_state::coord::promote(world, creature) (E’s promote op; /ai promote <ref>) makes a spawned creature Persistent: its identity becomes Saved, it loses SpawnedBy and SpawnOrigin (so its spawner fills its place again) and its old spawner records Promoted. Taming and naming use it. Owner agent limits (entity.max-agents) wait for G’s valued limits.

Smart objects

A smart object is an entity with manifold-ai:smart-object (SmartObject { def }, authored (def: "<key>"), stored as Tracked<SmartObject>, persisted by key). Its definition advertises activities and owns slots:

SmartObjectDef(
    id: "mymod:so/bench",
    tags: ["seat", "seat.bench"],
    slots: [
        (id: 0, offset: (1.0, 0.0, 0.0), yaw: 90.0, tags: ["slot.sit"],
         accepts: Tags(of: This, query: (all: ["mymod:villager"])),
         behaviour: Tasks([Face(target: Slot), PlayAnimation(play: "sit_down"), Wait(seconds: 8.0)]),
         timeout: "20s"),
    ],
    advertisements: [(activity: "mymod:rest", slot_tags: ["slot.sit"], score: 200,
                      requires: Ext(atom: "manifold:station_staffed", args: ()))],
)

Tags are dotted strings; a query tag matches itself and its descendants. A slot’s offset turns with the object’s yaw; yaw (degrees) is the way the occupant faces. accepts, requires and score are B conditions and numbers in the smart_object set (This the agent, Target the object; a station’s facts are set, so E’s station atoms work). A slot’s behaviour is a D state tree by key (StateTree("<tree>")) or a task list in D’s task syntax (Tasks([..])), which becomes a sequence keyed <object>#<slot>; neither may use UseSlot. The library compiles every behaviour for each brain whose trees use UseSlot (a behaviour naming a memory the brain lacks is left out with a warning).

SmartObjectIndexSystem runs before D’s think: objects added and removed since the last pass (the component’s hooks), and each object’s position refreshed once a second, staggered. The index buckets objects by 32-block chunk column and space. A query returns, best first, each advertisement naming the activity on an object within the radius whose tags match, whose requires holds, and that has a slot with its tags that is free for the agent (or its own) and accepts it, scored by score × r / (r + d) (r the object’s query_radius, the distance at which the score halves).

Claiming and using (§9.2). D’s ClaimSlot posts a claim on the first free accepting slot of the activity’s advertisement, SlotKey::Slot(id) with the slot’s timeout (default 60 s); the reservation pass resolves it with every other claim. When a slot claim is granted, E resolves each play the slot’s behaviour names against the occupant’s graph (CompiledGraph::play_id) and keeps the ids with the claim (SlotPlays); a play the graph lacks (or an occupant with no graph) is a SlotPlayMissing warning on the object’s and the occupant’s traces, and the task that plays it fails NoAnimation, so the behaviour fails and the scope’s exit releases the slot. UseSlot runs the behaviour as a nested tree on the claimed object (Claimed is the object, Slot the slot’s position; Face(Slot) at the slot turns to its yaw).

The chore board and workers

A chore board is an entity with manifold-ai:chore-board (ChoreBoard; the board persists, its jobs do not). Its stations and workers are MemberOf(board). A station is a smart object with manifold-ai:station (Station { def, priority: 1..=9, enabled, state_tags }, authored (def: "<station>", priority: 5), persisted by key); state_tags are content’s (station.state.full). A worker has manifold-ai:worker-profile (WorkerProfile { category_priority, scope, last_switch_tick, last_station, rules }, persisted; unlisted categories rank 3, 0 disables) and, with scope: Assigned, takes jobs only at stations it is AssignedTo (manifold-ai:assigned-to: non-exclusive, at most four, Remove, Keep, persisted).

StationDef(
    id: "mymod:station/farm_plot",
    smart_object: "mymod:so/farm_plot",
    category: "mymod:job/farming",
    posts: Continuous(max_open_jobs: 1),
    work: (cycle_secs: "60 / q.stat('this', 'mymod:worker_speed')",
           output: "mymod:work/farm_cycle",
           quality: "q.stat('this', 'mymod:worker_quality')"),
    blocked_when: Ext(atom: "manifold:station_has_tag", args: (tag: "station.state.full")),
)

ChoreBoardSystem runs after the reservation pass:

  1. held jobs whose worker no longer holds the slot (D’s scope exit, an expiry, the worker gone) open again; jobs of stations that left the board go;
  2. once a second per board (staggered): stations that are disabled or whose blocked_when holds withdraw their jobs (a held one is lost); the others keep max_open_jobs jobs at their priority, each on a slot with the job’s tags; a held job is preempted when a job the worker may take is two priority tiers higher in a category it ranks at least as high; workers’ rules compile into D’s BrainOverrides;
  3. every tick, the pull batch: each worker that pulled and holds no job ranks the jobs it may take (open, a free slot that accepts it, in its scope, a category it has not disabled, not held back by the 30 s dwell after its last switch of station) by (category priority, job priority, distance in whole blocks, age, job id) and brings its best four; the pairs are assigned greedily in rank order, ties by worker, so the result does not depend on posting order. A winner’s slot is claimed at once, it gains manifold-ai:current-job (CurrentJob, transient) and its profile records a switch of station;
  4. work reports: each tick D’s Work task reports, the slot claim is renewed and the cycle advances; a cycle of cycle_secs (over the worker’s stats) emits WorkCompleted { worker, station, job, cycle, output, quality, yield_mult, seed } into WorkQueue.completed (the seed is DerivedRandom at manifold-ai:work.cycle). Content turns it into items; E never touches inventories.

Outcomes (Assigned, Denied, Lost { Withdrawn | Preempted | Released }) are in WorkQueue.outcomes for D’s tasks next tick.

Station atoms (§10.5), B atoms over facts the board sets: manifold:station_has_tag(tag), manifold:station_staffed() (a worker is assigned to it), manifold:station_blocked() and manifold:board_has_open_jobs(category). D has the same as conditions over the candidate station (StationHasTag, StationBlocked, StationCategory, BoardHasOpenJobs).

Player rules (§10.5): WorkerProfile.rules holds up to eight WorkRule { on: Option<category>, when: Option<RuleCond>, then: Exclude | Prefer(n) }. “If the farm plot is full, move to mining” is (on: Some("mymod:job/farming"), when: Some(StationHasTag("station.state.full")), then: Exclude) plus (on: Some("mymod:job/mining"), then: Prefer(1)). They compile into D’s BrainOverrides: an Exclude is an invariant that fails on the candidates it matches, a Prefer a rank bias (±2). A worker moves only by pulling a different assigned station’s job, subject to commitment and the dwell; nothing rewrites its assignments.

Offline

An agent whose place nobody has loaded stops being an entity and becomes a record (§13). Neither it nor its record holds animation state.

Going Offline. OfflineSystem runs last in the AI block. Once a second per agent (staggered by durable id) it checks every Saved agent (a brain; not a player, dead, carrying or carried): when its chunk is not resident and no client subscribes to its interest region for 30 s, E writes its OfflineRecord into the space’s OfflineRegistry and A unloads the entity (entity_persistence::unload_in), so its ServerAnim (graph state and input history), brain, reservations and job go with it. Ambient and Encounter creatures are never saved, so never Offline.

Record fieldWhat
anchorwhere it returns: Home.anchor, else the cell it stood in
modelthe offline model (a worker’s: its station’s)
workeach assigned station (durable id) with the cycle, quality and yield its work gave the worker
assignment, progress, dwell_left_ms, switchedthe station it works, its progress into the cycle, the dwell left
priorities, rulesthe worker’s category priorities and player rules
aiD’s part (manifold_ai::offline::AiOfflinePart): the brain’s key, the running activity as a hint, the persist: true memories alive, with their remaining lifetime

The registry is manifold-ai:offline-registry on one persistent carrier entity per world space, and A’s retained record of an unloaded entity is marked manifold:unloaded, so both survive a save and a restart on either host and the agent is not spawned at boot.

Offline models and stock. A station names its model:

OfflineModel(id: "mymod:offline/station_cycle",
             kind: StationWork(efficiency: 1.0, max_cycles: None),   // ≤ 1.0 of online
             max_credit_hours: 72)
StationDef(.., offline: "mymod:offline/station_cycle")

The cycle and output are the station’s own work numbers. Content keeps a station’s manifold-ai:station-stock (StationStock { room, input }, in cycles, None unbounded; authored in archetypes, persisted); catch-up spends it and sets station.state.full or station.state.no_input when a side runs out, so output stops when storage fills, as online.

Catch-up (manifold_ai::coord::offline::catch_up) is event-driven: each round workers choose stations against the simulated state (the current one while it is enabled, unblocked (blocked_when over the simulated tags), within its window, has stock and is not excluded by a rule; otherwise, once the 30 s dwell has run out, the best eligible assigned station by rule bias, category priority, station priority, lower id), time jumps to the next change (a station’s stock or credit window running out, a waiting worker’s dwell ending) and every worker is credited its whole cycles, in integer milliseconds at the model’s per mille. Each worker and station gets one WorkCompleted { cycles, .. } in WorkQueue.completed (online events carry cycles: 1); its seed is derived at ordinal 0 and content rolls cycle i at ordinal i.

  • Space start. The first OfflineSystem pass after boot reads OfflineClock (the host’s clock and the save’s last_played_at, read once at boot) and credits min(now − last, the widest window), each station stopping at its own window, to every station with a model and every worker assigned to one, live or Offline. A fresh world, a clock that went back and a second start with no time passed credit nothing. Spawners’ due ticks move back by the elapsed ticks. The result is a CatchUp record on the registry.
  • Coarse stepping. Once a second per record, the tick’s due records work their live stations for the time since their last step, as one catch-up, with no credit window. The registry indexes its records by stepping phase (id % 40), so a tick visits only its slice, and by anchor chunk, so the restore check visits only chunks that are loaded or that a client’s interest region touches; the index is derived, never saved, and rebuilt after a load.

Restore. Every 4 ticks, a record whose anchor chunk is resident or whose region a client subscribes to comes back if nobody can see it appear: its region is unwatched, it has just come into a client’s scope (the region arrives with it), every player is 48 blocks or more from the anchor, or the anchor is hidden from every subscribed viewer. Otherwise it waits (Restored { held } counts the checks). A spawns it again with its old id through the archetype spawn, so the anim-setup hook gives it ServerAnim at its graph’s entry state in the same flush; E puts it at its anchor and sets its profile’s station and dwell; D writes its memories back and leaves the activity hint, which gives that activity the commitment bonus in its first selection. It comes back awake; D’s LOD demotes it as usual.

I/O wiring

Source’s outputs and inputs, typed (§12). An entity fires a named output; every link on it delivers a named input to its target after a delay, with the output’s value or a constant, at most fire_limit times. A link is an entity with manifold-ai:io-link (IoLink { output, target, input, param, delay_ticks, fire_limit, fired }), ChildOf its source (deleting the source deletes its links) and naming its target with manifold-ai:io-targets (exclusive, Remove, Keep, saved as a link): a link whose target is gone is inert and shows as broken. target is Named (its IoTargets), Members (every MemberOf that group, in durable order), SelfEntity or Activator (who caused the output).

Outputs and inputs are declared per component kind in the manifold-ai:io-signature registry, each with a type (None, Bool, Int, Fixed in thousandths, Entity, Tag, Text of at most 64 bytes):

IoSignature(
    id: "mymod:io/door",
    component: "mymod:door",
    outputs: [("OnOpened", None)],
    inputs: [
        ("Open", None, SetTag(tag: "mymod:door.open", value: true)),
        ("Close", None, SetTag(tag: "mymod:door.open", value: false)),
        ("Slam", None, Effect("mymod:effect/slam")),
        ("Toggle", None, Output("OnOpened")),
    ],
)

Content handlers grant or revoke a B tag on the target, apply a B effect from the activator, or fire one of the target’s own outputs; Native is E’s own components’; Ability and Hook wait for Talos G. E declares its signatures in code (manifold:io/…): every entity has User (FireUser1..4 → OnUser1..4); the logic components below; the director (below); the spawner (SpawnAll, Enable, Disable, Reset; OnSpawned(Entity), OnAllDead, OnMemberDied(Entity)); token pools (Gate(Fixed) seconds, Ungate); the squad (SetStyle(Tag); OnAllDead, OnMemberDied(Entity)); and the stat watcher. A link is checked when its template loads, and a runtime link (/ai io link) when it is made: the output exists on the source’s components, the input on the target’s, and the value converts (Int → Fixed, Entity → Bool, anything to a None input); errors cite file and line.

Dispatch. fire(world, source, output, value, activator) queues an output; IoDispatchSystem, last in the AI block, expands each into one event per link (counting the link’s fired) and delivers every event due by (due tick, sequence). A zero-delay event fired while dispatching is delivered in the same pass. Loop guard: a chain may take 64 zero-delay hops a tick and the space 2,048 deliveries; the rest waits for the next tick, is recorded Deferred and warned about once per link, so a relay loop runs as a visible, rate-limited loop. A delivery to an inert link, a dead or gone target, a disabled entity, a missing input or a value that does not convert is dropped and counted. The queue is saved: each space’s pending events sit on a persistent carrier entity (manifold-ai:io-queue) written whenever they change, and events name entities by durable id, so a door due to open in 10 s still opens after a restart. Every delivery is an IoFireRecord (tick, link, ends, output, input, value, result and the ends’ positions) in a ring of the last 256 per space: /ai io trace prints it, and the io layer of /ai overlay (admins) draws it in the one debug-line collector as arcs from source to target that fade over 5 s, labelled with output, input and value, with broken links in red.

Logic archetypes

Engine data under manifold:logic/, each a saved entity with a position and one component whose state rides in its archetype patch:

ArchetypeComponentInputsOutputs
relaymanifold-ai:logic-relayTrigger, Enable, DisableOnTrigger (the value)
countermanifold-ai:counter (value, min 0, max)Add(Int), Subtract(Int), Set(Int), Reset (to min)OnChanged(Int), then OnHitMax or OnHitMin on landing on a bound
timermanifold-ai:timer (interval_ticks, default 40)Start, Stop, SetInterval(Fixed) secondsOnTimer
trigger_volumemanifold-ai:trigger-volume (size: (x, y, z), centred on its feet horizontally and rising; filter: Players | HasTag(tag))Enable, Disable, Reset (re-arms OnFirstEnter)OnEnter(Entity), OnExit(Entity), OnFirstEnter(Entity), OnEmpty
branchmanifold-ai:branchSet(Bool), Toggle, TestOnTrue, OnFalse
spawner_pointsmanifold-ai:spawner and its statethe spawner’sthe spawner’s

Volumes are evaluated at 10 Hz (staggered by durable id) over the players’ bodies or the spatial index, in durable-id order; timers and stat watchers every tick. SpawnAll fills a spawner up to max_alive at its next pass, whether or not it is enabled, without respawn waits.

Stat watchers (manifold-ai:stat-watch): B defines none yet, so E carries up to four thresholds, (stat, of: Some(<stat>), below: Some(0.66), above: None), checked every tick over B’s final values (the ratio when of is set); threshold n fires OnStatBelowN or OnStatAboveN with the value in thousandths once per crossing, re-armed when the value is back across.

Directors

A director (manifold-ai:director, authored (def: "<director def>"), saved in its archetype patch) owns an encounter (§7). Its spawners are its children (ChildOf); its creatures are MemberOf it with manifold-ai:wave-member (WaveMember { director, wave }, transient).

WaveTable(id: "mymod:waves/crypt", size: 6,
          entries: [(archetype: "mymod:skeleton", weight: 3, cost: 1),
                    (archetype: "mymod:skeleton_archer", weight: 1, cost: 2)])

DirectorDef(
    id: "mymod:director/crypt_floor",
    intensity: (
        sources: [(event: DamageTaken, gain: PerFractionOfMaxHealth(8000)),
                  (event: Downed, gain: Fixed(10000)),
                  (event: EnemyDiedNear(8.0), gain: Fixed(600)),
                  (event: Tagged("mymod:event/trap_sprung"), gain: Fixed(2500))],
        decay_per_sec: 400, decay_only_when: NoEngagedEnemies,
        peak_threshold: 8500, fade_threshold: 5000,
    ),
    pacing: (sustain_peak_secs: (3, 5), relax_secs: (30, 45),
             relax_ends_on_progress: Some("mymod:tag/next_room_reached")),
    population: (
        build_up: (target_alive: PerParticipant(4), wave_table: Some("mymod:waves/crypt")),
        peak:     (target_alive: PerParticipant(4)),
        fade:     (target_alive: PerParticipant(1)),
        relax:    (target_alive: Fixed(0), close_pools: ["mymod:tokens/ranged"]),
    ),
    budget: (initial: 40, refill_per_sec: 1.5, max: 60),
    spawn: (min_distance: 16, prefer_behind: true, active_radius: 64),
    wipe: (when: AllParticipantsDownOrGone),
)

DirectorSystem runs after the chore board and before the spawners:

  1. every tick, intensity from last tick’s combat events (ten-thousandths per participant): damage to a participant, scaled by its manifold:max_health; a participant’s death (it is down); a member’s death near a participant; Event(tag) adds the Tagged gains;
  2. once every 10 ticks per director (4 Hz, staggered): participants that left the world or its space are down (OnParticipantDowned); decay (unless a member is engaged, by default); the budget refills; the pacing machine over the maximum intensity plus SetIntensityBias: build-up → sustain peak at peak_threshold → peak fade after the drawn sustain → relax below fade_threshold → build-up after the drawn relaxation or the progress tag, durations drawn at manifold-ai:director.pace; each change fires OnPhase(tag) (build_up, sustain_peak, peak_fade, relax); relaxation closes its close_pools on the director for its length;
  3. waves cleared (OnWaveCleared(Int)), the last member gone (OnAllDead), and the wipe (OnWipe, OnFail; the state becomes Failed);
  4. population: while active, the phase’s target_alive (over living participants) less the living and queued members asks a child spawner for a wave from the phase’s table, as many as the budget affords: the spawner within active_radius of a participant that lies furthest behind the party’s direction of travel (with prefer_behind), then nearest;
  5. the wave’s flow field: one shared field toward the party’s centroid (nav::request_flow, Near within 4 blocks, for the members’ locomotion profile), requested again when the centroid moves 8 blocks and released when the encounter has no members or stops. Every tick, members that are not engaged (no Targets, threat not Engaged) and are more than 6 blocks from the centroid follow it (E writes their MoveIntent after D’s think); engaged members chase as D decides, and C promotes their shared chases to fields of their own.

A spawner given a wave places it as it places anything: C’s hidden, standable cells at least the def’s min_distance from every player (a Points spawner fills its free points), each creature’s archetype by weight, the encounter ceiling, then the spawn rate limit. Each spawn costs the director its entry’s cost in points (a wave stops when the budget cannot pay); a spawner’s own max_alive does not bound a wave.

Inputs: Start (active, at build-up and the initial budget; OnStart), Stop, Reset, Complete (OnComplete), SetPhase(Tag) (a scripted phase: pacing is content’s, the budget and the wipe stay the director’s), Resume, TriggerWave(Tag) (the table’s size now, within the budget), AddParticipant(Entity), RemoveParticipant(Entity), SetIntensityBias(Int), Event(Tag), and Gate(Fixed)/Ungate on the encounter’s token pools. A token pool with on_scope: Encounter is held by the requester’s director. Wipe reset is wiring: link OnWipe to the director’s own Reset (and to content’s doors and a return effect); Reset despawns the members, resets each child spawner (its state, its queue and its Encounter creatures), drops queued waves, resets the fire counts of the links on the director and its children, releases the field and opens the gate.

Encounter templates

EncounterTemplate(
    id: "mymod:enc/crypt_room_2",
    entities: {
        "door":  (archetype: "mymod:crypt_door", at: (12, 0, 4)),
        "room":  (archetype: "manifold:logic/trigger_volume", at: (0, 0, 0),
                  extra: { "manifold-ai:trigger-volume": (size: (16, 6, 16)) }),
        "pack":  (archetype: "manifold:logic/spawner_points", at: (6, 0, 8),
                  extra: { "manifold-ai:spawner": (source: Pool("mymod:waves/crypt_skeletons"),
                                                   max_alive: 4) }),
        "count": (archetype: "manifold:logic/counter", extra: { "manifold-ai:counter": (max: 1) }),
    },
    links: [
        ("room", "OnFirstEnter", "door",  "Close",    Pass,   0),
        ("room", "OnFirstEnter", "pack",  "SpawnAll", None,   10),
        ("pack", "OnAllDead",    "door",  "Open",     None,   "1s"),
        ("pack", "OnAllDead",    "count", "Add",      Int(1), 0),
        (from: "room", output: "OnEnter", to: "pack", input: "Enable", once: true),
    ],
)

Entities are archetypes at offsets from the template’s origin (yaw in degrees); extra sets E’s components (spawner, counter, timer, trigger volume, branch, relay, stat watcher, director), which patch the archetype or add to it; parent makes an entity ChildOf another (a director’s spawners) and member_of MemberOf another. A spawner’s points and box are template-local, and one without a shape holds a point at its own cell; a template’s spawner defaults to Encounter, one creature and disabled. Links take the six-field form (from, output, to, input, parameter, delay in ticks or "Ns") or the struct form with target and once / fire_limit. coord::instantiate(world, key, origin, space) places one now, instantiate_deferred from a system, and /ai encounter spawn from the console.

Boss arenas

The pattern of §7.7, all data: an arena director (a scripted phase, its wipe), the boss (its archetype, Encounter at a point), a stat watcher on the boss, and links:

("boss", "OnStatBelow1", "arena", "SetPhase", Tag("mymod:phase/enrage"), 0),
("boss", "OnStatBelow1", "arena", "Gate", Fixed(3.0), 0),
("boss", "OnStatBelow1", "door", "Close", None, 0),
(from: "arena", output: "OnWipe", target: SelfEntity, input: "Reset"),

Nothing in the engine is called Boss.

Natural spawning

A spawner with shape: PlayerAnchored (E6) spawns around every player in its space, as Minecraft’s natural spawning does: one spawner entity (a content placement, created once like any other), evaluated per player in durable order.

Spawner(
    id: "mymod:spawner/natural",
    shape: PlayerAnchored,
    source: Rules(["mymod:spawn/boar_meadow", "mymod:spawn/wolf_forest"]),
    max_alive: 4,          // per player
    cadence: "4s",
    respawn: (catch_up_max: 2),
)

For each player the spawner draws a rule by weight (its own draw: the spawner’s and the player’s ids mixed, at manifold-ai:spawn.rule), asks C for hidden standable cells in a ring between that rule’s distance.min and distance.max around the player’s feet, and applies the rule’s conditions and the caps as a region spawner does. Every spawn is attributed to its player, so the local cap, fair share and max_alive (per player, counting that player’s living and queued spawns from this spawner) keep one player’s farm from starving another. A ring waits for no respawns (§11.7 is the region’s and the points’), and catch_up_max caps each player’s evaluation. Its creatures’ Home radius is the leash, else 32. Navigation builds around every player of the space. The policy must be Ambient and the source Rules.

manifold:do-natural-spawning (Bool, default true, per space) gates PlayerAnchored spawners on top of manifold:do-ambient-spawning, so a server may keep its region spawners and stop spawning around players.

Influence layers

Group-scale spatial answers (§4.6), one cell per 32³ chunk per space (InfluenceLayers, a server resource, never saved: rebuilt within a second of a restart):

LayerWritten fromEach update
threatbodies with a B faction (agents and players), weighted by manifold:threat_weight (100 per 1.0), kept per faction; read as the sum over the factions hostile to the readerdecays (1 s half-life), then adds: a standing body settles at about 3.4× its weight
crowdingAI agents (100 each)replaced
dangerdamage taken (B’s DamageApplied, 10 per point) since the last updatedecays (3 s half-life), then adds
territorymanifold-ai:territory holders (Territory { radius, strength }, authored (radius: 48, strength: 100), saved in the archetype patch) for their B faction, over the cells their radius touchesreplaced

InfluenceSystem runs before D’s think: every tick it notes last tick’s damage; at 2 Hz it steps each space with awake agents or values. Cells exist only within 64 blocks (the cube of cells) of an agent that is not Dormant; values are saturating i16 hundredths, decayed in integer per mille, sources applied in durable order. D reads them through Influence(layer) at the agent (brains), and manifold_server_state::coord::influence_at(world, e, layer) answers for any entity; /ai influence [<ref>] prints a cell.

Party NPCs

A dungeon party (§14) is a squad with fixed role slots (fixed_slots: { "mymod:role/tank": 1, .. }); the player is a member and party NPCs join it. E2’s group pass fills the slots, so a party NPC knows its job from its Role. E6 adds what companions’ brains read (brains):

NeedD’s side
A tank holds aggroTargetTargetsRole("mymod:role/tank") through an inverted curve: an enemy on anyone but the tank scores the taunt
A DPS does not pullThreatShare: its threat in the enemy’s own table as a share of the top (suppress high-threat abilities above 0.9)
A healer picks targetstargets: Party(max: 4) (living squad mates in durable order) with TargetStatRatio("manifold:health"), TargetHasRole (tank first) and distance
Not standing in fireInfluence("danger")

Engagement slots (§14.2) spread melee members around a large enemy and leave the player’s side free: the enemy is a smart object whose definition has an engagement ring,

SmartObjectDef(
    id: "mymod:so/ogre",
    tags: ["enemy.large"],
    engagement: Some((count: 6, radius: 3.0, tags: ["slot.engage"],
                      behaviour: StateTree("mymod:tree/melee_from_slot"), timeout: "10s")),
    advertisements: [(activity: "mymod:melee", slot_tags: ["slot.engage"], score: 100)],
)

which E expands at load into count slots evenly on a ring of radius blocks (the first in front of the enemy, each facing its centre, ids after the object’s own, tag slot.engage unless the ring names its own; at most 16 slots in all). Content sizes the ring by body size. Members claim them through ClaimSlot and the reservation table like any slot; a held slot’s position follows the enemy (the index refreshes its position once a second, so a query’s distance may lag that much).

manifold_server_state::coord::party::is_party_npc(world, e) (not a player; a squad member holding a role from its definition’s fixed slots) is the fact Talos F’s “party NPC” significance flag will carry for Pygmalion F’s allocator (a party NPC ranks at least Mid); neither the flag nor the allocator exists yet.

Vendors

A vendor is a counter entity with manifold-ai:vendor (Vendor { table, requires_attendant, stock, rotations }, authored (table: "<trade table>", requires_attendant: true), saved in the archetype patch), a smart object whose slot.vendor slot its NPC occupies; it sits on the counter, not the NPC, so the shop works while the NPC is away.

TradeTable(
    id: "mymod:trade/general_store",
    currency: Some("mymod:coin"),
    offers: [
        (sells: Item(kind: "mymod:bread"), price: Coins(8), stock: Unlimited),
        (buys: Item(kind: "mymod:wheat"), price: Coins(2), stock: Unlimited, tag: Some("price_floor")),
        (sells: Item(kind: "mymod:rare_seed"), price: Coins(250),
         stock: PerPlayer(limit: 2, restock: "86400s")),
        (sells: FromLoot("mymod:loot/rotation"), price: Coins(Uniform(40, 60)),
         stock: Shared(limit: 5, restock: "3600s"), rotation: Some((slots: 3, reroll: "86400s")),
         requires: Some(Tags(of: This, query: (all: ["mymod:rank.member"])))),
    ],
)

Items are Item(kind: "<item kind>", count: 1, patch: { .. }) (or Item("<item kind>")); a price is Coins(n) (the table’s currency), an item or a list of up to four; counts are whole numbers, Fixed(n) or Uniform(a, b), drawn once per rotation period (or once, without a rotation) at manifold-ai:trade.offer. requires is a B condition in the trade set (This the buyer, Target the counter).

StockRule
Unlimitedalways
Shared(limit, restock)the vendor holds limit per slot, refilled restock after the first sale from full; per shard by design
PerPlayer(limit, restock)each player trades limit per window that starts at their first trade in it, kept in E’s ledger

A rotating offer (FromLoot) rolls its B loot table once per slot when its period ends (lazily, at the next trade or listing), with the vendor’s durable id, the period’s start tick, the site manifold-ai:trade.offer and the offer and slot as the ordinal; the first stack of each roll is the slot’s goods, so every player sees the same rotation.

Trading. A request (coord::request_trade(world, TradeRequest { vendor, buyer, offer, slot, times }), from content’s shop panel or /ai vendor <counter> buy ..) is resolved by TradeSystem at the tick’s flush, in request order: the vendor is brought up to now (restocks, rotations), then the offer, the attendant (requires_attendant: a slot.vendor slot held in the reservation table), requires, the stock and the buyer’s limit are checked, and a Quote is priced on the server: on a sell offer the buyer pays the price (ItemSpecs) and receives the goods (ItemOutputs); on a buy offer the reverse. The installed VendorExchanges moves everything or refuses; only then is stock spent and the limit counted. Outcomes (Ok(Quote) or TradeDenied) are in VendorRuntime.outcomes; every trade is a Trade record on the vendor.

The Items seam. Item and coin moves belong to Items’ Exchange op, which takes this quote shape (Quote { pay, receive, counterparty: Infinite { source, sink }, vendor }, agreed with Items on 2026-10-01). Until Items lands the server installs EquipmentExchange: a buyer pays with item kinds in its equipment slots (one per slot, slot key order) and receives into its empty slots, all or nothing, through B’s set-equipment; patches are refused. Items replaces the resource; E is unchanged.

Limits live in manifold-ai:vendor-ledger (VendorLedger), keyed by (player uuid, vendor durable id, offer, slot; a buyer that is not a player by its durable id), on one persistent carrier entity per world, written whenever it changes and pruned of ended windows once a minute; never Enki B’s world-player blob scope. A space start shifts vendors’ pending restocks and rerolls back by the elapsed time (offline), so they mean wall time. coord::restock(world, counter) (/ai vendor <counter> restock) is E’s vendor-restock op.

Space events

No population or coordination state crosses spaces synchronously (§13.7). What does cross is a few records (SpaceEvent): EncounterCompleted and EncounterFailed (a director’s Complete input and its wipe: the director definition’s key, its participants’ stable ids, the tick), CreatureKilled (a creature tagged manifold:notable, or a descendant, died: its archetype, the deepest such tag, the killing player) and Custom { tag, payload } (content’s, through coord::emit_space_event, at most 64 bytes).

Each space’s records go to the SpaceEventOutbox with a per-space sequence; SpaceEventSystem, last in E’s block, hands the tick’s records to the installed transport (SpaceEventLink) and delivers what arrived into each space’s SpaceEventInbox (the last 256, numbered so a reader resumes with since). A record is addressed to one space or broadcast to every other; it never returns to its source and never arrives in the tick that produced it. Consumers must tolerate delay, duplication and loss: records are views, not authority, and are not saved. No space-to-space transport exists, so the server installs LoopbackTransport (the spaces of one server, next tick); an orchestrator replaces it. /ai events prints the inboxes.

Background spaces

A space whose manifold:background-space game rule is true (§13.6; Bool, default false) is a background simulator: an NPC town that keeps living with nobody there. Its Saved agents go Offline at their next check whenever no client has their region in scope, without the 30 s grace and whatever its chunks’ residency, are stepped at 1 Hz like any Offline record, and come back only where a client’s scope reaches. Its vendors’ stock restocks by its own timers. Keeping a space running with no players is the host’s decision; E has no space lifecycle.

Traces and console

CoordTraces keeps the last 32 records per spawner (directors’ waves included, named by their table) (attempts with the rule weights, each rejected cell and why, queue waits, spawns, despawns with their band), per reservation holder, per token scope and per squad (role passes with winners and losers, style changes, barks), per board and worker (job events with the winning rank), per station (work cycles), per smart object and occupant (missing slot plays), per spawner (promotions), per agent (Collapsed, Restored, and one CatchUp that consecutive coarse steps accumulate into), per offline registry (the space start’s CatchUp), per vendor (Trade, Rotation) and per space event’s source (SpaceEvent). Admin commands:

CommandShows or does
/entity spawner listevery spawner, its shape, rules, alive count and queue
/entity spawner info <#id or key>its state and recent trace
/entity spawner eval <spawner>evaluates it now
/entity spawner reset <spawner>clears pending respawns and its queue
/ai reservations [#id]claims, optionally of one holder or target, with its trace
/ai populationper space: ambient count and cap, category counts, queue, rate limit, rays
/ai squad <ref>a squad (or a member’s squad): style, order, leader, blackboard, members and roles, records
/ai threat <ref>a creature’s full table, state, target, taunt and summary
/ai tokens <scope>a scope’s pools, leases, spacing and gate, with records
/ai chores <ref>a board (or a station’s or worker’s board): jobs and holders, stations, workers, records
/ai worker <ref> [assign|unassign <station> | priority <category> <0-5> | scope assigned|board | rules clear]a worker’s profile, stations and job, or a change to them
/ai objects [<ref>]smart objects within 48 blocks (or one): definition, slots and holders, advertisements
/ai promote <ref>promote a spawned creature to Persistent
/ai offlineevery Offline agent: space, anchor, model, station, memories kept, records
/ai offline catchup <hours>simulate that much time away as a space start would (with the credit window)
/ai offline collapse <ref>, /ai offline restore <#id>force an agent Offline, or back
/ai io links <ref>, /ai io tracean entity’s I/O components and links (broken ones marked); the last deliveries with results
/ai io link <source> <output> <target|self|activator> <input> [value] [delay <ticks>] [once], /ai io unlink <#link>, /ai io fire <ref> <input> [value]a runtime link, checked as data is; remove one; deliver an input now
/ai director <ref> [start|stop|reset|complete|resume|phase <tag>|intensity <bias>|wave <table>|add <ref>]a director (or a member’s): state, phase, budget, waves, participants with intensity, field; or one of its inputs
/ai encounter list, /ai encounter spawn <template> [x y z]templates; place one (at the caller by default)
/ai vendor <counter> [buy <offer>[.<slot>] [n] [for <ref>] | restock]a vendor’s offers with stock and records; a trade now through the installed exchange; refill its shared stock
/ai eventseach space’s received space events and what waits to be sent
/ai influence [<ref>]the influence cell where you (or the reference) stand, and each layer as it reads it

Limits

  • Villagers’ schedules (anchor-to-anchor movement) and the Accumulate offline model are not built; background spaces step station work only.
  • Vendors trade through EquipmentExchange until Items’ Exchange op lands (one item per equipment slot, no patches); ItemSpec is narrowed to a kind (Items’ patterns by tag or predicate come with Items). Shop state is not replicated: content’s panel reads vendor_offers. The ledger is per world, so per-player limits cross shards only once an orchestrator carries them.
  • Space events cross only the spaces of one server (the loopback); a cross-server transport waits for orchestration.
  • Influence layers feed D’s Influence(layer) at the agent only: D has no position queries yet, AreaOfOperation.prefer is unread, B’s area effects do not write danger, and territory comes only from manifold-ai:territory holders (spawners and settlements carry no faction).
  • Party NPCs: no D input for a member’s recent damage rate, no positional threat for standing between enemy and party, no aimed-heal position query and no revive slot (B has no downed state); followers are moved by their own brains (squad orders are unused). The party-NPC significance flag waits for Talos F and Pygmalion F’s allocator; the three checks of §14.3 wait for the first dungeon prototype.
  • I/O: Ability and Hook handlers, the ai:io-input and ai:director-tick hook points and G’s ops (io-link, io-fire, director-input) wait for Talos G; links and these commands are admin-only until G’s ai.io.edit, ai.io.fire and ai.director.control nodes land. Signatures match a component by its native type, so a guest’s dynamic component has none yet. EncounterCompleted cross-space records are E6. B has no stat watchers; E’s stand in.
  • A wave’s cells are found for its table’s first archetype’s locomotion class, and each member is checked standable for its own.
  • A restore held because a player can see the anchor waits; it does not look for a nearby hidden cell. The elapsed time is in the catch-up’s coordinator record, not yet a replay journal entry.
  • Station and WorkerProfile stay on the server until Talos F’s owner audience exists; advertisements’ requires_seen and player_usable slots held for a player’s session wait for D’s knowledge of objects and G’s player-occupancy op; the ai:chore-score and ai:spawn-filter hook points wait for G.
  • A job’s path cost is the straight distance, not C’s chunk-graph estimate; a pull brings each worker’s best four jobs.
  • ThreatSummary and Role carry no audience filter yet: Role goes to every client in scope (its declared audience), and ThreatSummary stays on the server until Talos F’s Party audience and replicated entity references exist.
  • Squad orders (SquadOrder) are data only: a director’s wave is moved by its flow field instead. Group-scale influence layers are E6.
  • Visibility rays are counted but not charged to D’s AI budget, and the traces are always-on rings until D’s decision trace sink exists.
  • No biome atom: the server has no biome source.