Institution Reference
Technical reference for the Institution Base Model (Feature 040). Covers entity models, supporting models, event types, pure functions, graph queries, enums, graph integration, and configuration.
Import:
from babylon.models.entities.institution import (
Institution,
InternalBalanceOfForces,
ReproductionMechanism,
SpawningBlueprint,
InstitutionOrgRelation,
FactionShiftEvent,
ReproductionEvent,
BonapartistModeEvent,
)
from babylon.institution import (
structural_selectivity,
update_internal_balance,
hegemonic_fraction_effect,
community_embeddedness,
)
Entity Models
Institution
Third-layer entity between substrate (SocialClass, Territory, Community)
and agents (Organizations). Frozen (immutable). Graph node type:
_node_type="institution".
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
Unique institution identifier (min length 1). |
|
|
|
Human-readable name (min length 1). |
|
|
|
Althusserian classification (RSA, ISA, or Economic). |
|
|
|
Population need served by this institution. |
|
|
|
BOURGEOIS |
Which class the institution serves. |
|
|
Factional weight distribution. |
|
|
|
|
Override structural selectivity modifiers (ActionType -> multiplier). |
|
|
0.0 |
Available resources (>= 0). |
|
|
|
Territories with fixed infrastructure. |
|
|
|
Legal powers held (e.g. “arrest”, “tax”, “legislate”). |
|
|
0 |
Maximum personnel count (>= 0). |
|
|
0.5 |
Degree of bureaucratic formalization [0, 1]. |
|
|
0.5 |
Resistance to rapid change [0, 1]. |
|
|
0.5 |
Public perceived legitimacy [0, 1]. |
|
|
|
Organization IDs housed within this institution. |
|
|
|
Territories where institution operates. |
|
|
|
Jurisdiction scope. Only valid for |
|
|
|
D-P-D’ lifecycle phase assignment. |
|
|
Self-perpetuation mechanisms. |
|
|
|
|
Templates for replacement Organizations. |
Validators:
jurisdictionmust beNonefor non-RSA apparatus types.All
action_modifiersvalues must be > 0.0.internal_balancefaction weights must sum to 1.0 (tolerance +/- 0.01).
Supporting Models
InternalBalanceOfForces
Factional weight distribution within an institution. Three ruling-class fractions compete for hegemony. Weights always sum to 1.0.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
Weight of Liberal-Technocratic faction [0, 1]. |
|
|
|
Weight of Revanchist-Fascist faction [0, 1]. |
|
|
|
Weight of Institutionalist-Bonapartist faction [0, 1]. |
|
|
|
0.0 |
How actively factional warfare is occurring [0, 1]. |
Computed fields:
hegemonic_fraction(RulingClassFraction): Faction with highest weight.
Validators:
Faction weights must sum to 1.0 (tolerance:
0.99 <= total <= 1.01).
ReproductionMechanism
Self-perpetuation capacity of an institution. Tracks formal mechanisms for institutional reproduction.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Has formal member intake process. |
|
|
|
Has formal training/socialization. |
|
|
|
Has leadership succession plan. |
|
|
0.0 |
Fraction of budget from own sources [0, 1]. |
|
|
|
Has legal mandate to exist. |
Computed fields:
reproduction_capacity(float): Composite score. Formula:(sum(bools) / 4) * 0.7 + budget_independence * 0.3. The four boolean mechanisms contribute 70%, budget independence 30%.
SpawningBlueprint
Template for replacement Organization creation. Stored on institutions to define how replacements are created when housed Organizations are destroyed.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
Organization category to spawn. |
|
|
|
Initial class character for spawned org. |
|
|
|
|
Additional attributes for spawned org. |
InstitutionOrgRelation
Relationship between institution and housed Organization. Tracks material and political dimensions of housing.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
Parent institution ID (min length 1). |
|
|
|
Housed organization ID (min length 1). |
|
|
|
0.0 |
Fraction of institution resources provided [0, 1]. |
|
|
|
Whether institution provides legal protection. |
|
|
0.0 |
How much institutional legitimacy transfers [0, 1]. |
|
|
0.0 |
How much institution constrains org actions [0, 1]. |
|
|
|
Which ruling-class faction the org aligns with. |
Event Types
Three event types are returned by institution functions. These are data objects, not emitted directly – callers decide when and how to emit them via the EventBus.
FactionShiftEvent
Returned by update_internal_balance() when the hegemonic fraction changes.
Maps to EventType.INSTITUTION_FACTION_SHIFT.
Field |
Type |
Description |
|---|---|---|
|
|
Institution whose hegemonic fraction changed. |
|
|
Previous hegemonic fraction. |
|
|
New hegemonic fraction. |
|
|
Updated faction weights. |
ReproductionEvent
Returned when an institution spawns a replacement Organization.
Maps to EventType.INSTITUTION_REPRODUCTION.
Field |
Type |
Description |
|---|---|---|
|
|
Institution that spawned the org. |
|
|
Type of organization spawned. |
|
|
Blueprint used for spawning. |
BonapartistModeEvent
Returned by update_internal_balance() when the BONAPARTIST weight
crosses the threshold while other fractions are below the exclusion
threshold. Maps to EventType.INSTITUTION_BONAPARTIST_MODE.
Field |
Type |
Description |
|---|---|---|
|
|
Institution entering Bonapartist mode. |
|
|
Current BONAPARTIST faction weight [0, 1]. |
Pure Functions
All four functions are stateless. They take data in and return data out. No EventBus dependency.
Import:
from babylon.institution import (
structural_selectivity,
update_internal_balance,
hegemonic_fraction_effect,
community_embeddedness,
)
structural_selectivity
def structural_selectivity(
institution: Institution,
action_type: ActionType,
defaults: dict[str, dict[str, float]],
) -> float: ...
Computes the cost modifier for an action within an institution. Lookup order:
institution.action_modifiers[action_type.value]– institution-level override.defaults[apparatus_type.value][action_type.value]– apparatus-type defaults.1.0– no modifier (fallback).
Returns a multiplier: < 1.0 means cheaper, > 1.0 means more expensive.
The defaults argument is typically InstitutionDefines.default_action_modifiers.
update_internal_balance
def update_internal_balance(
balance: InternalBalanceOfForces,
crisis_intensity: float,
legitimacy: float,
external_threat: float,
alpha: float = 0.05,
bonapartist_threshold: float = 0.4,
bonapartist_exclusion_threshold: float = 0.35,
institution_id: str = "unknown",
) -> tuple[InternalBalanceOfForces, list[FactionShiftEvent | BonapartistModeEvent]]: ...
Alpha-smoothed factional balance shift:
Rising
crisis_intensitydrives REVANCHIST weight up (repression impulse).Falling
legitimacyweakens LIBERAL weight (consent breaks down).Rising
external_threatdrives BONAPARTIST weight up (self-preservation).
Deltas:
revanchist_delta = alpha * crisis_intensity
liberal_delta = -alpha * (1.0 - legitimacy)
bonapartist_delta = alpha * external_threat
After applying deltas, weights are clamped to [0, 1] and renormalized to
sum to 1.0. Contestation is computed as min(1.0, 1.0 - max_weight + 0.1).
Returns a tuple of (new balance, events). Events may include:
FactionShiftEventif the hegemonic fraction changed.BonapartistModeEventif BONAPARTIST weight exceedsbonapartist_thresholdand both other fractions are belowbonapartist_exclusion_threshold.
hegemonic_fraction_effect
def hegemonic_fraction_effect(
fraction: RulingClassFraction,
) -> dict[str, Any]: ...
Returns OODA modifier hints based on the hegemonic fraction:
Fraction |
Preferred Actions |
Escalation Reluctance |
Strategy |
|---|---|---|---|
LIBERAL_TECHNOCRATIC |
|
0.7 |
Consent-based rule |
REVANCHIST_FASCIST |
|
0.2 |
Naked repression |
INSTITUTIONALIST_BONAPARTIST |
|
0.5 |
Self-preservation |
Raises ValueError if fraction is not a valid RulingClassFraction.
community_embeddedness
def community_embeddedness(
institution: Institution,
graph: GraphProtocol,
) -> dict[str, float]: ...
Computes institution’s embeddedness in community hyperedges. For each
territory the institution occupies, finds community nodes with matching
territory_id and computes overlap ratio per CommunityType.
Returns dict mapping CommunityType string to embeddedness score [0, 1].
Returns empty dict if institution has no territory presence.
Enums
Enum |
Values |
|---|---|
|
RSA: |
|
|
|
|
|
|
|
|
Edge types (added to EdgeType):
Type |
Direction |
Description |
|---|---|---|
|
Institution -> Organization |
Institution houses and shapes an Organization. |
Event types (added to EventType):
Type |
Description |
|---|---|
|
Hegemonic fraction changed within an institution. |
|
Institution spawned a replacement Organization. |
|
Bonapartist threshold crossed. |
Graph Integration
Institutions are stored on WorldState and participate in the
to_graph()/from_graph() round-trip:
from babylon.models.world_state import WorldState
world = WorldState(
tick=0,
institutions={"doj": department_of_justice},
institution_relations=[doj_fbi_relation],
)
graph = world.to_graph()
# graph.nodes["doj"]["_node_type"] == "institution"
reconstructed = WorldState.from_graph(graph, tick=0)
assert isinstance(reconstructed.institutions["doj"], Institution)
to_graph() creates HOUSES edges from each institution to its
housed_org_ids.
frozenset handling: model_dump() converts frozenset to list.
from_graph() converts back to frozenset for legal_authorities
and jurisdiction fields.
InstitutionDefines
Tunable parameters in GameDefines.institution:
Parameter |
Default |
Description |
|---|---|---|
|
0.05 |
[S] Per-call smoothing rate for factional balance shifts. |
|
0.4 |
[S] BONAPARTIST weight above which Bonapartist mode triggers. |
|
0.35 |
[S] Other fractions must be below this for Bonapartist mode. |
|
(see below) |
[S] Default action cost modifiers per ApparatusType. |
Default action modifiers:
Apparatus Type |
Modifiers (ActionType -> multiplier) |
|---|---|
|
propagandize: 0.5, repress: 0.8, educate: 1.5 |
|
repress: 0.6, surveil: 0.7, educate: 2.0 |
|
surveil: 0.5, repress: 1.2 |
|
repress: 0.4, attack_infrastructure: 0.5 |
|
repress: 0.5, educate: 2.5 |
|
educate: 0.7, recruit: 0.8, repress: 2.0 |
|
educate: 0.8, recruit: 0.7, repress: 2.5 |
|
educate: 0.9, recruit: 1.5 |
|
propagandize: 0.5, agitate: 0.6, repress: 2.0 |
|
educate: 0.8, propagandize: 0.7, repress: 2.0 |
|
(none) |
|
(none) |
|
employ: 0.5, fundraise: 0.7, repress: 1.5 |
|
fundraise: 0.4, employ: 0.8 |
|
fundraise: 0.5, attack_infrastructure: 0.8 |
Deprecation Notes
The Organization.is_institution and Organization.institutional_persistence
fields (Feature 031) are deprecated. Use Institution.formalization_level
and Institution.institutional_inertia instead. Constructing an Organization
with these fields set emits DeprecationWarning.
The legacy JSON Schema at src/babylon/schemas/entities/institution.schema.json
is superseded by the Pydantic Institution model and will be removed in a
future version.
See Also
The Institution Model – Why institutions exist as a separate layer
Organization Reference – Organization Base Model reference
Data Models Reference – SocialClass, Territory, and graph structure
State Apparatus AI (Feature 039) – State Apparatus AI reference
OODA Loop System Reference – OODA Loop System reference
babylon.institution– Pure function source codebabylon.models.entities.institution– Entity model source code