babylon.engine.systems

Simulation systems for the Babylon engine.

Phase 2.1: Dialectical Refactor - modular system architecture. Agency Layer: StruggleSystem for political agency of oppressed classes.

class babylon.engine.systems.System(*args, **kwargs)[source]

Bases: Protocol

Protocol defining a historical materialist system.

__init__(*args, **kwargs)
property name: str

The identifier of the system.

step(graph, services, context)[source]

Apply system logic to the world graph.

Parameters:
  • graph – Mutable NetworkX graph representing WorldState.

  • services – ServiceContainer with config, formulas, event_bus, database.

  • context – TickContext or dict with ‘tick’ (int) and optional metadata. TickContext is the preferred type; dict is supported for backward compatibility with existing tests.

Return type:

None

class babylon.engine.systems.ImperialRentSystem[source]

Bases: object

Imperial Circuit Economic System - 5-phase value extraction with pool tracking.

Sprint 3.4.4: Dynamic Balance - The Gas Tank and Driver.

Implements the MLM-TW model of value flow with finite resources: - Phase 1: Extraction (P_w -> P_c via EXPLOITATION) - Phase 2: Tribute (P_c -> C_b via TRIBUTE, minus comprador cut) -> FEEDS POOL - Phase 3: Wages (C_b -> C_w via WAGES, dynamic rate) -> DRAINS POOL - Phase 4: Subsidy (C_b -> P_c via CLIENT_STATE, stabilization) -> DRAINS POOL - Phase 5: Decision (Bourgeoisie heuristics adjust wage_rate/repression)

The imperial_rent_pool in GlobalEconomy tracks available resources: - Inflow: Tribute received by Core Bourgeoisie (post-comprador cut) - Outflow: Wages paid + Subsidies paid - When pool depletes, bourgeoisie must choose between austerity or repression

name = 'Imperial Rent'
step(graph, services, context)[source]

Apply the 5-phase Imperial Circuit to the graph.

Phases execute in sequence, as each depends on the previous: 1. Extraction must happen before tribute (P_c needs wealth to send) 2. Tribute must happen before wages (C_b needs wealth to pay) - FEEDS POOL 3. Wages capped at available pool - DRAINS POOL 4. Subsidy capped at available pool after wages - DRAINS POOL 5. Decision phase: Bourgeoisie heuristics update economy for next tick

The economy state is read from graph.graph[“economy”] and written back after all phases complete.

Parameters:
Return type:

None

class babylon.engine.systems.ConsciousnessSystem[source]

Bases: object

Phase 2: Consciousness Drift based on material conditions.

Sprint 3.4.3 (George Jackson Refactor): Uses multi-dimensional IdeologicalProfile. - class_consciousness: Relationship to Capital [0=False, 1=Revolutionary] - national_identity: Relationship to State/Tribe [0=Internationalist, 1=Fascist] - agitation: Raw political energy from crisis (falling wages)

Extended with Fascist Bifurcation mechanic: - Reads incoming SOLIDARITY edges to calculate solidarity_pressure - Tracks wage changes between ticks to detect crisis conditions - Routes agitation to either class_consciousness or national_identity

name = 'Consciousness Drift'
step(graph, services, context)[source]

Apply consciousness drift to all entities with bifurcation routing.

Parameters:
Return type:

None

class babylon.engine.systems.SurvivalSystem[source]

Bases: object

Phase 3: Survival Calculus (P(S|A) vs P(S|R)).

Bug Fix (Sprint 3.4.2): Organization is now DYNAMIC. organization = base_organization + solidarity_bonus

Where solidarity_bonus = sum of incoming SOLIDARITY edge weights. This ensures that High Solidarity scenarios produce higher P(S|R).

name = 'Survival Calculus'
step(graph, services, _context)[source]

Update P(S|A) and P(S|R) for all entities.

Organization is calculated as:

effective_org = base_org + solidarity_bonus

Where solidarity_bonus = sum(solidarity_strength for incoming SOLIDARITY edges)

Parameters:
Return type:

None

class babylon.engine.systems.StruggleSystem[source]

Bases: object

Agency Layer - The Struggle System (“George Floyd Dynamic”).

This system runs AFTER SurvivalSystem (needs P values) and BEFORE ContradictionSystem. It gives agency to oppressed classes through the Stochastic Riot mechanic:

  1. Calculate EXCESSIVE_FORCE probability: spark_prob = repression * spark_scale

  2. Roll for spark occurrence

  3. Check uprising condition: (Spark OR P(S|R) > P(S|A)) AND agitation > threshold

  4. Execute uprising:

    • Economic damage: wealth *= (1 - destruction_rate)

    • Solidarity gain: Increase solidarity_strength on incoming SOLIDARITY edges

    • Class consciousness gain: All nodes in uprising gain consciousness

  5. Emit events for narrative layer

The solidarity built in Tick N enables SolidaritySystem transmission in Tick N+1.

name = 'Struggle'
step(graph, services, context)[source]

Apply struggle dynamics to all eligible entities.

Processes PERIPHERY_PROLETARIAT and LUMPENPROLETARIAT nodes, checking for spark events and uprising conditions.

Parameters:
Return type:

None

class babylon.engine.systems.ContradictionSystem[source]

Bases: object

Phase 4: Accumulation of Tension and Ruptures.

name = 'Contradiction Tension'
step(graph, services, context)[source]

Update tension on edges based on wealth gaps.

Parameters:
Return type:

None

class babylon.engine.systems.SolidaritySystem[source]

Bases: object

Proletarian Internationalism - Consciousness Transmission System.

Implements consciousness transmission via SOLIDARITY edges: - Unidirectional flow (Periphery -> Core) - solidarity_strength stored on edge (key for Fascist Bifurcation) - Emits CONSCIOUSNESS_TRANSMISSION and MASS_AWAKENING events

Sprint 3.4.3: Updated to work with IdeologicalProfile, affecting only the class_consciousness dimension.

name = 'Solidarity'
step(graph, services, context)[source]

Apply solidarity transmission to all SOLIDARITY edges.

For each SOLIDARITY edge: 1. Check if source consciousness > activation_threshold 2. Check if solidarity_strength > 0 3. Calculate transmission delta 4. Apply delta to target class_consciousness 5. Emit events for narrative layer

Parameters:
Return type:

None

class babylon.engine.systems.TerritorySystem[source]

Bases: object

Territory Dynamic System - Layer 0 spatial dynamics.

Implements the territorial substrate mechanics: - Heat dynamics based on operational profile - Eviction pipeline when heat exceeds threshold - Heat spillover between adjacent territories - Necropolitics for sink nodes (Sprint 3.7)

“Legibility over Stealth” - The State knows where you are. The game is about staying below the repression threshold.

Sprint 3.7 additions: - Population transfers to sink nodes during eviction - CONCENTRATION_CAMP population decay (elimination) - PENAL_COLONY organization suppression (atomization)

name = 'Territory'
step(graph, services, context)[source]

Apply territorial dynamics to the graph.

Phases execute in sequence: 1. Heat dynamics (profile-based accumulation/decay) 2. Eviction pipeline (triggered at threshold, routes to sinks) 3. Heat spillover (via adjacency edges) 4. Necropolitics (sink node effects)

Sprint 3.7.1: Context can contain ‘displacement_mode’ to override the default EXTRACTION mode for sink node routing.

Parameters:
Return type:

None

Modules

contradiction

Contradiction systems for the Babylon simulation - The Rupture.

economic

Economic systems for the Babylon simulation - The Base.

event_template

Event Template System - Data-Driven Event Evaluation.

ideology

Ideology systems for the Babylon simulation - The Superstructure.

metabolism

MetabolismSystem - The Metabolic Rift.

protocol

Protocol definition for simulation systems.

solidarity

Solidarity system for the Babylon simulation - Proletarian Internationalism.

struggle

Struggle system for the Babylon simulation - The Agency Layer.

survival

Survival systems for the Babylon simulation - The Calculus of Living.

territory

Territory systems for the Babylon simulation - Layer 0.