Organization Reference
Technical reference for the Organization Base Model (Feature 031). Covers entity models, discriminated union dispatch, composition calculators, consciousness effect formula, topology classification, key figure analysis, and legacy migration.
Import:
from babylon.models.entities.organization import (
Organization,
StateApparatus,
Business,
PoliticalFaction,
CivilSocietyOrg,
OrganizationType,
IntelMethodology,
KeyFigure,
)
Entity Models
Organization (Base)
All four subtypes inherit these 15 fields. Frozen (immutable).
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
Unique organization identifier (min length 1). |
|
|
|
Human-readable name (min length 1). |
|
|
|
Discriminator for subtype dispatch. |
|
|
|
Which class this org serves (BOURGEOIS, PROLETARIAN, CONTESTED). |
|
|
|
0.1 |
Internal unity [0=atomized, 1=unified]. |
|
|
0.0 |
Leadership quality [0=none, 1=elite]. |
|
|
0.0 |
Available resources. |
|
|
REGISTERED |
Legal status (SOVEREIGN, CHARTERED, REGISTERED, INFORMAL, UNDERGROUND). |
|
|
LIBERAL |
Ideological tendency pushed on communities. |
|
|
|
Territories where org operates. |
|
|
|
Primary location. Must be in |
|
|
0.0 |
State attention level [0=invisible, 1=targeted]. |
|
|
|
Deprecated (Feature 040). Use |
|
|
|
Deprecated (Feature 040). Use |
|
|
|
Key figure and cadre node IDs. |
Validators:
headquarters_idmust be interritory_idsif set.institutional_persistencemust beNonewhenis_institutionisFalse.
StateApparatus
Wields state violence and surveillance. Default legal_standing is SOVEREIGN.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
Fixed discriminator. |
|
|
|
SOVEREIGN |
Overrides base default. |
|
|
Scope of authority (MUNICIPAL, STATE, NATIONAL, FEDERAL). |
|
|
|
0.0 |
Capacity for coercive force [0, 1]. |
|
|
0.0 |
Capacity for surveillance [0, 1]. |
|
|
|
Specific authorities wielded (e.g. “arrest”, “search_warrant”). |
|
|
(default) |
Intelligence capabilities (Sparrow-grounded). |
Business
Accumulates capital and employs labor.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
Fixed discriminator. |
|
|
|
NAICS sector description (min length 1). |
|
|
|
0 |
Number of employees (>= 0). |
|
|
0.0 |
Rate of surplus value extraction [0, 1]. |
|
|
0.0 |
Annual revenue. |
PoliticalFaction
Contests political power. The player’s faction is marked with is_player.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
Fixed discriminator. |
|
|
|
Ideological label (min length 1). E.g. “Marxism-Leninism”. |
|
|
|
|
Whether this is the player’s faction. |
|
|
“neutral” |
Relationship state. |
CivilSocietyOrg
Non-state, non-business collective providing community services.
legitimacy doubles as the credibility factor in the consciousness
effect formula.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
Fixed discriminator. |
|
|
|
Domain of service (RELIGIOUS, EDUCATIONAL, MEDIA, LABOR). |
|
|
|
0.5 |
Community trust/credibility [0, 1]. |
Discriminated Union
OrganizationType dispatches on the org_type field for automatic
Pydantic deserialization:
from pydantic import TypeAdapter
from babylon.models.entities.organization import OrganizationType
adapter = TypeAdapter(OrganizationType)
org = adapter.validate_python({
"org_type": "state_apparatus",
"id": "sa-1",
"name": "Detroit PD",
})
# Returns StateApparatus instance
Supporting Models
IntelMethodology
Intelligence methodology capabilities (Sparrow-grounded). Defines which social network analysis techniques an intelligence agency can employ.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Can identify hub nodes and bridges. |
|
|
|
Can find structurally equivalent positions (Sparrow 1993). |
|
|
|
Can match against known org templates. |
|
|
|
Can detect activation pattern changes over time. |
|
|
0.2 |
Max fraction of true topology observable [0, 1]. |
Presets:
Preset |
Centrality |
Equivalence |
Template |
Temporal |
Ceiling |
|---|---|---|---|---|---|
|
Yes |
No |
No |
No |
0.2 |
|
Yes |
No |
No |
Yes |
0.5 |
|
Yes |
Yes |
Yes |
Yes |
0.4 |
Each preset accepts an optional defines: OrganizationDefines parameter
to override ceiling values from tunable configuration.
KeyFigure
Individual node within organizational topology. Stored as a separate graph
node with _node_type="key_figure". COMMAND edges connect KeyFigure nodes
within the same organization.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
Unique key figure identifier. |
|
|
|
Name. |
|
|
|
Parent organization ID. |
|
|
|
Position title/function. |
|
|
|
0.5 |
Topological criticality [0, 1]. |
|
|
|
No structural equivalent (Sparrow). |
Enums
Enum |
Values |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Edge types (added to EdgeType):
Type |
Direction |
Description |
|---|---|---|
|
Organization -> SocialClass |
Weighted population membership. |
|
Organization -> SocialClass |
Active recruitment pipeline. |
|
Business -> SocialClass |
Employer relationship. |
|
KeyFigure -> KeyFigure |
Internal hierarchy edge. |
|
Organization -> Territory |
Operational footprint. |
Computed Types
Frozen Pydantic models produced by calculators. Not stored on entities.
Import:
from babylon.organizations.types import (
ConsciousnessDelta,
AggregatedEffect,
CompositionResult,
TopologyClassification,
)
ConsciousnessDelta
Result of a single organization’s consciousness effect.
collective_identity_delta: float– Change to CI.tendency_pressure: ConsciousnessTendency– Direction.tendency_magnitude: float– Strength (>= 0).source_org_id: str– Which org caused this.
AggregatedEffect
Result of aggregating multiple deltas.
total_ci_delta: float– Sum of all CI deltas.dominant_tendency: ConsciousnessTendency | None– Strongest.tendency_weights: dict[ConsciousnessTendency, float]– Per-tendency magnitudes.new_ci: float– Clamped [0, 1] result.
CompositionResult
Result of membership composition analysis.
distribution: dict[str, float]– Proportional breakdown.total_members: float– Total membership count.axis: str– “class”, “community”, or “lifecycle”.
TopologyClassification
Result of COMMAND subgraph classification.
topology_type: TopologyType | None– STAR, HIERARCHY, MESH, CELL, or None.articulation_points: list[str]– Structurally critical node IDs.component_count: int– Connected components (>= 0).is_connected: bool– Whether the subgraph is connected.
Composition Calculators
Import:
from babylon.organizations.composition import (
class_composition,
community_composition,
lifecycle_composition,
effective_capacity,
)
class_composition
def class_composition(org_id: str, G: nx.DiGraph) -> CompositionResult: ...
Computes proportional class breakdown via MEMBERSHIP edges. Groups members
by their role attribute. Returns axis="class".
community_composition
def community_composition(org_id: str, G: nx.DiGraph) -> CompositionResult: ...
Computes community breakdown via MEMBERSHIP edges. Groups members by their
community attribute. Returns axis="community".
lifecycle_composition
def lifecycle_composition(org_id: str, G: nx.DiGraph) -> CompositionResult: ...
Computes D/P/D’ lifecycle phase distribution via MEMBERSHIP edges.
Groups members by lifecycle_phase. Returns axis="lifecycle".
effective_capacity
def effective_capacity(
lifecycle: CompositionResult,
elder_capacity_factor: float,
) -> float: ...
Computes lifecycle-weighted capacity. Youth contribute 0.0, adults 1.0,
elders elder_capacity_factor (default 0.2 from OrganizationDefines).
Returns a value in [0, 1].
Consciousness Effect Formula
Import:
from babylon.organizations.consciousness import (
consciousness_effect,
derive_credibility,
aggregate_consciousness_effects,
)
derive_credibility
def derive_credibility(
org: Organization,
defines: OrganizationDefines,
community_workforce: int | None = None,
) -> float: ...
Returns credibility factor by subtype:
Subtype |
Credibility |
|---|---|
|
|
|
|
|
SOVEREIGN: |
|
|
consciousness_effect
def consciousness_effect(
org: Organization,
defines: OrganizationDefines,
community_workforce: int | None = None,
) -> ConsciousnessDelta: ...
Five-factor product formula:
consciousness_delta = tendency_modifier x cadre_level x cohesion x credibility
Tendency modifiers (from OrganizationDefines):
Tendency |
Default |
CI Behavior |
|---|---|---|
REVOLUTIONARY |
+0.15 |
Positive CI delta (raises consciousness). |
LIBERAL |
-0.05 |
Negative CI delta (suppresses consciousness). |
FASCIST |
+0.10 |
Zero CI delta. Non-zero tendency pressure only. |
aggregate_consciousness_effects
def aggregate_consciousness_effects(
deltas: list[ConsciousnessDelta],
current_ci: float,
) -> AggregatedEffect: ...
Sums CI deltas. Dominant tendency is the one with highest total magnitude weight. Result CI clamped to [0, 1].
Topology Classification
Import:
from babylon.organizations.topology import (
classify_topology,
identify_key_figures,
cohesion_loss_on_removal,
)
classify_topology
def classify_topology(
org_id: str,
member_node_ids: list[str],
G: nx.DiGraph,
) -> TopologyClassification: ...
Extracts the undirected COMMAND subgraph and classifies it. Priority order:
MESH: density > 0.6, requires 3+ nodes.
STAR: hub with degree >= N-1, requires 3+ nodes.
CELL: articulation points present, has cycles (edges > N-1).
HIERARCHY: connected tree or sparse connected graph.
None: disconnected or fewer than 2 nodes.
identify_key_figures
def identify_key_figures(
org_id: str,
member_node_ids: list[str],
G: nx.DiGraph,
) -> list[KeyFigure]: ...
Returns a KeyFigure for each articulation point in the COMMAND subgraph.
structural_importance = (components_after_removal - 1) / (n - 1)normalized to [0, 1].is_singleton = Truewhen no other node shares the same degree and neighborhood structure.
cohesion_loss_on_removal
def cohesion_loss_on_removal(
current_cohesion: float,
removed_count: int,
defines: OrganizationDefines,
) -> float: ...
Returns max(cohesion - count * loss, floor) where
loss = defines.cohesion_loss_per_key_figure and
floor = defines.min_cohesion_threshold.
Default loss is 0.2 per key figure, floor is 0.05.
Legacy Migration
Import:
from babylon.organizations.migration import (
migrate_faction,
migrate_institution,
migrate_all,
)
One-time migration of factions.json (4 factions) and institutions.json
(7 institutions) into typed Organization subtypes.
migrate_faction
def migrate_faction(faction_data: dict) -> PoliticalFaction: ...
Maps ideology to ConsciousnessTendency:
Ideology |
Tendency |
|---|---|
Fascism |
FASCIST |
Liberal Democracy |
LIBERAL |
Marxism-Leninism |
REVOLUTIONARY |
Marxism-Leninism-Maoism |
REVOLUTIONARY |
migrate_institution
def migrate_institution(inst_data: dict) -> OrganizationType | None: ...
Dispatches by institution type:
Type |
Target |
Notes |
|---|---|---|
State, Legal |
|
State -> NATIONAL, Legal -> STATE jurisdiction. |
Cultural |
|
service_type=MEDIA |
Economic |
|
service_type=LABOR |
Religious |
|
service_type=RELIGIOUS |
Educational |
|
service_type=EDUCATIONAL |
Returns None for “Systemic Racism” (social relation, not organization
per Constitution I.16).
migrate_all
def migrate_all(
factions_path: Path,
institutions_path: Path,
) -> dict[str, OrganizationType]: ...
Batch migration. Returns dict keyed by organization ID. Expected: 4 factions + 6 institutions (1 dropped) = 10 organizations.
Graph Integration
Organizations and key figures 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,
organizations={"org_1": detroit_pd, "org_2": ford},
key_figures={"kf_1": pastor},
)
graph = world.to_graph()
# graph.nodes["org_1"]["_node_type"] == "organization"
# graph.nodes["kf_1"]["_node_type"] == "key_figure"
reconstructed = WorldState.from_graph(graph, tick=0)
assert isinstance(reconstructed.organizations["org_1"], StateApparatus)
to_graph() also creates PRESENCE edges from each organization
to its territory_ids.
OrganizationDefines
Tunable parameters in GameDefines.organization:
Parameter |
Default |
Description |
|---|---|---|
|
0.2 |
BLS 65+ LFPR: D’-phase capacity scalar. |
|
0.15 |
CI delta for REVOLUTIONARY tendency. |
|
-0.05 |
CI delta for LIBERAL tendency. |
|
0.10 |
Tendency pressure for FASCIST. |
|
0.2 |
Sparrow: Local PD observation ceiling. |
|
0.5 |
Sparrow: Fusion center ceiling. |
|
0.4 |
Sparrow: FBI ceiling. |
|
0.2 |
Cohesion drop per key figure removal. |
|
0.05 |
Floor cohesion (never reaches zero). |
|
0.5 |
Default PoliticalFaction credibility. |
|
0.8 |
SOVEREIGN standing credibility. |
|
0.6 |
CHARTERED standing credibility. |
|
0.5 |
StateApparatus fallthrough credibility. |
|
0.5 |
Default violence capacity. |
|
0.3 |
Default surveillance capacity. |
See Also
The Organization Model – Why the model is structured this way
Institution Reference – Institution Base Model reference (Feature 040)
Data Models Reference – SocialClass and Territory models
Formulas Reference – Consciousness drift and solidarity formulas
babylon.organizations– Source codebabylon.models.entities.organization– Entity source code