babylon.engine.dialectics.world
World, Morphism, and WorldEvent — the v2 dialectical graph.
Replaces the Embedded Trinity (Ledger / Topology / Archive) with a single coherent structure. The graph isn’t separate from the dialectics — it’s how they’re wired into the tick engine’s data flow.
A morphism feeds(d1, d2) means d2.step() reads from
d1.observe(). A morphism contains(d1, d2) means d1 is one
of d2’s poles (nesting).
See also
babylon.engine.dialectics.base.Dialectic: The fundamental type.
babylon.engine.dialectics.tick: The pure tick function.
Classes
|
A typed relationship between two dialectics. |
|
The complete world state at a given tick. |
|
An event generated during a tick. |
- class babylon.engine.dialectics.world.Morphism(**data)[source]
Bases:
BaseModelA typed relationship between two dialectics.
The five canonical relation types:
feeds: d2.step() reads from d1.observe()constrains: d1 limits d2’s state spacetransforms: d1’s output becomes d2’s input pricescontains: d1 is one of d2’s poles (nesting)antagonizes: d1 and d2 are mutually antagonistic
- Parameters:
- id
Unique identifier for this morphism.
- source_id
UUID of the source dialectic.
- target_id
UUID of the target dialectic.
- relation
Relationship type string.
- weight
Coupling strength.
- metadata
Optional additional data for the relationship.
- tick_created
Tick when this morphism was created.
- tick_destroyed
Tick when this morphism was destroyed (None if live).
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- id: UUID
- source_id: UUID
- target_id: UUID
- relation: str
- weight: float
- metadata: dict[str, Any]
- tick_created: int
- tick_destroyed: int | None
- class babylon.engine.dialectics.world.WorldEvent(**data)[source]
Bases:
BaseModelAn event generated during a tick.
Events include sublations, crises, ruptures, and player actions. The narrative field is populated by the LLM layer (optional).
- Parameters:
- id
Auto-incrementing identifier.
- event_type
Type of event (sublation, crisis, rupture, player_action).
- dialectic_id
UUID of the dialectic that generated this event.
- payload
Arbitrary data associated with the event.
- narrative
LLM-generated prose description (optional).
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- event_type: str
- dialectic_id: UUID | None
- payload: dict[str, Any]
- narrative: str | None
- class babylon.engine.dialectics.world.World(**data)[source]
Bases:
BaseModelThe complete world state at a given tick.
This is the single structure that replaces the Embedded Trinity (Ledger / Topology / Archive). It holds all dialectics, their morphism wiring, and events generated during the current tick.
- Parameters:
- tick
Current simulation tick.
- dialectics
Map of UUID to Dialectic instance.
- morphisms
List of Morphism edges wiring the dialectical graph.
- events
List of WorldEvent records for this tick.
- sublated_ids
Set of dialectic IDs that have been sublated (replaced by successors). These are excluded from live queries.
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- tick: int
- dialectics: dict[UUID, Any]
- morphisms: list[Morphism]
- events: list[WorldEvent]
- sublated_ids: frozenset[UUID]
- get_inputs_for(target_id)[source]
Compute TickInputs for a target dialectic from morphism graph.
Collects
observe()output from all source dialectics that have afeedsmorphism targetingtarget_id.- Parameters:
target_id (
UUID) – UUID of the dialectic receiving inputs.- Return type:
- Returns:
TickInputs with upstream observations populated.
- get_one_or_none(type_tag)[source]
Return a single dialectic matching the given type_tag, or None.
This is the defensive accessor for cyclical composition. When a dialectic needs to read state from a peer that may or may not exist (e.g. ConsumptionDialectic reading ProductionDialectic), it uses
get_one_or_noneinstead of assuming the peer is present.If multiple dialectics of the same type exist, returns the first found (iteration order).