Architecture Boundary
CONSTITUTION.md v4.2.0 governs the architecture. NORTH_STAR.md gives
the game direction and gate order. This page describes the live boundary after
the one-way PostgreSQL authority cutover.
System Boundary
Babylon has these primary boundaries:
A pure Rust engine judges one four-week tick.
Live Rust BSL rules control causal changes and finite material kernels.
Recognizers and events remain deterministic.
Executable shocks and player actions do not exist yet.
babylon-persistenceowns authoritative game-managed PostgreSQL schema, writes, restart, and durability.Python builds reference data and supplies current repository and operator tools. The frozen simulation and its mutable SQLite runtime are retired.
Bevy remains an administrative viewer with no player action.
One tick judges one fixed 28-day interval and produces one durable commit.
There are 13 periods in a modeled year; this is a 364-day simulation calendar,
not variable-length Gregorian months. V5 Michigan campaigns bind the interval
in their canonical content. Their authored TOML defines the work schedule,
recipes, workforce, stocks, orders, throughput, route durations, and a stop
horizon of 1 through 16 periods. The supplied values yield 160 Designed labor
hours per person per period and 16 periods (64 weeks). New reads the selected
file and stores its canonical values in the foundation. Open uses those saved
values. Older weekly campaigns are refused; their stored data is retained.
The interval contract is contracts/simulation_interval_v1.yaml.
The current Michigan material campaign admits an empty BSL rule set. Its
production, freight, and staffing run through the typed material transition.
The built-in production.bsl annual labor calibration remains a conformance
reference; it does not parameterize this campaign. Observed annual QCEW facts
and source weekly wages retain their original units.
Ordinary BSL rules derive and write world data through governed causal operations. External shocks must not write downstream results directly. AI can parse, retrieve, and narrate. AI does not judge a game rule.
Live Rust Path
The shipping engine path is:
babylon-kernelDeterministic types and contracts.
babylon-graphNative relations, hyperedges, and canonical hashes.
babylon-bslThe BSL lexer, parser, checker, typed finite-kernel analysis, exact forecasting, loader, and evaluator.
babylon-tickThe four-week tick, replay identity, material state, and atomic publication.
babylon-material-circuitPhysical production, routed freight, and conserved staffing transitions.
babylon-persistenceRust-owned PostgreSQL activation, campaign foundation, checkpoint restart, typed semantic rows, commit markers, and Archive dirty receipts.
babylon-clientThe Bevy administrative viewer.
Each four-week tick runs on detached state and buffers its events. The tick becomes
observable only after all rule, hash, and persistence boundaries succeed.
GraphStateHash identifies graph bytes only. NominalWorldHash also binds
completed time, allocator cursors, and the governed phase-schedule digest.
TickContentHashV1 binds the identified replay result.
ReplayTickSession publishes TickContentHashV1 atomically. Replay
identity and campaign durability identity are separate typed inputs.
A finite kernel distributes exact Mass over one enum-ordered family of
bounded material effect bundles. It consumes one replay-keyed integer ticket
draw and applies only the selected bundle. The choice produces a separate
ChoiceReceiptV1 even when the selected bundle changes no material state.
Deterministic mechanics are the one-outcome case. Events own no authored
probability. The language assumes no independence between choices.
H3 Reader Boundary
Epoch 7 captured and proved the legacy H3 reader parity corpus. Epoch 9 has no Python game-state reader edge and no compatibility projection. Rust installs the exact reference cohort and Michigan dynamic foundation, then reads typed relations directly.
Reference Data and Operator Tools
PER-48 is decided. The one-way cutover is complete. Rust owns authoritative game-managed Postgres. Python continues only in the roles declared below.
The retired Python simulation is available at p27-python-freeze. BSL
citations read that tag; Rust owns the executable schedule, mechanics, replay
and persistence contracts. Python builds reference artifacts and supports
current repository and operator commands. Those tools do not adjudicate ticks
or read authoritative transition rows.
Client and Archive Boundary
The Bevy client still reads an administrative world view and displays the nominal world hash. It does not submit a player intent.
Each committed tick emits an Archive dirty receipt. The Rust Archive worker binds each receipt to an exact dirty batch, worker contract, and pinned knowledge-grant snapshot. It publishes immutable county and place dossiers with validated content and known citations. The scoped reader admits the requested committed period, retained publication, and disclosed links together. Global Archive progress cannot certify a selected page.
The runtime owns one Archive listener and worker. Empty Postgres notifications signal committed tick markers and campaign enrollment. The listener registers before reading durable work at startup and after reconnect. It drains retained work through the existing worker. An idle notification timeout performs no maintenance query. Notifications carry no world state or player intent.
One coordinator owns the V3 session control pipe and tick acknowledgements.
It flushes Committed before handling the resulting Archive progress. Bevy accepts
progress only for its acknowledged campaign and durable period, then refreshes
its scoped read. It does not poll for Archive maintenance.
Shutdown requests cooperative cancellation and observes actual worker completion. A database connection that stays open beyond the existing process deadline cannot claim successful shutdown. ADR254 records this scheduling boundary. G5 adds player actions separately.
Event payloads contain observed or derived material facts, never probability.
Committed event metadata records the emitting rule and can carry an
automatically derived reference to the ChoiceReceiptV1 that a finite
projection observed. Removing an event sink cannot change a material
trajectory.
Flow
This flow shows the current Michigan material campaign. Solid arrows are live. Dashed arrows are later gate work.
flowchart LR
REF["babylon_ref"] --> TICK["Rust material tick"]
DEFINES["Saved authored parameters"] --> TICK
MATERIAL["Production, freight, staffing"] --> TICK
EMPTY["Exact empty action batch"] --> TICK
TICK --> IDENTIFIED["IdentifiedMaterialTickV3"]
IDENTIFIED --> RUNTIME["DurableMaterialRuntimeV3"]
RUNTIME --> STATE["babylon_state typed rows"]
STATE --> RECEIPT["ChoiceReceiptV1 rows"]
STATE --> MARKER["tick_commit"]
STATE --> DIRTY["archive_dirty_receipt_v1"]
MARKER --> VIEW["Bevy administrative viewer"]
PY["Reference builders"] --> DATA["SQLite and Parquet artifacts"]
DATA --> REF
DIRTY --> ARCHIVE["Semantic Archive worker"]
ARCHIVE -.-> CHOICE["Player decision"]
Invariants
- Tick identity
Equal inputs produce equal graph, nominal-world, replay-tick, envelope, and typed semantic row bytes. Equal kernel instances produce equal allocation, draw, selection, and receipt bytes. Only the marker establishes durability.
- Pure judgment
Relation, BSL, and tick crates have no database dependency. Storage begins only after detached judgment succeeds.
- Single authority
No compatibility view, adapter, fallback, dual writer, dual storage, or runnable midpoint exists.
- Native topology
Hyperedges remain first-class public elements. Incidence data is an internal storage method.
- Source honesty
Each substantive value is
Observed,Derived,Calibrated, orDesigned.- Finite contingency
Kernels select bounded material effects. Recognizers deterministically observe post-state. Exact event likelihood sums the branches that make the recognizer emit that event. Events never own probability.
- Player relevance
An administrative display cannot pass a game milestone. The persistence cutover is necessary infrastructure, not the playable decision loop.