Community System Reference
API reference for the hypergraph community layer (Features 022 and 029).
The community system maintains an XGI hypergraph alongside the NetworkX flow graph. Communities are n-ary membership structures (hyperedges); value/solidarity/repression flows remain NetworkX edges. Feature 029 adds a three-category taxonomy, contradiction axes, community consciousness, infiltration resistance, and cross-class bridge detection.
Enums
CommunityType
14 community types organized into three structural categories.
Value |
Category |
Description |
|---|---|---|
|
CONTRADICTION_PAIR |
Settler nation (hegemonic). HOAs, police unions, border militias. |
|
CONTRADICTION_PAIR |
Patriarchal order (hegemonic). Gendered wage systems, family structure. |
|
CONTRADICTION_PAIR |
New Afrikan / Black internal nation (marginalized) |
|
CONTRADICTION_PAIR |
Indigenous / First Nations peoples (marginalized) |
|
CONTRADICTION_PAIR |
Chicano / Mexican-American nation (marginalized) |
|
CONTRADICTION_PAIR |
Women — reproductive labor allocation (marginalized) |
|
CONTRADICTION_PAIR |
Transgender / gender non-conforming (marginalized) |
|
INSTITUTIONAL_EXCLUSION |
Built environment assumes able-bodiedness |
|
INSTITUTIONAL_EXCLUSION |
Institutional heteronormativity |
|
INSTITUTIONAL_EXCLUSION |
Legal exclusion from protections |
|
INSTITUTIONAL_EXCLUSION |
Carceral system, civil death |
|
LIFECYCLE_PHASE |
D phase. Pre-productive, dependent, receives socialization. |
|
LIFECYCLE_PHASE |
P phase. Sells labor-power. Where C-M-C and M-C-M’ operate. |
|
LIFECYCLE_PHASE |
D’ phase. Post-productive. Legitimation bargain. |
Defined in CommunityType.
HyperedgeCategory
Structural category for community hyperedges (Feature 029).
Value |
Description |
|---|---|
|
Both hegemonic and marginalized sides exist as real hyperedges with extraction flows between them. |
|
Only the marginalized side exists. Oppression flows through institutional defaults, not a paired oppressor community. |
|
Universal temporal positions in D-P-D’ intergenerational lifecycle. Defined by relationship to production. |
Defined in HyperedgeCategory.
ConsciousnessTendency
Dominant ideological tendency within a community (Feature 029).
Value |
Description |
|---|---|
|
Seeks inclusion in existing institutions without transforming them. Organizational vehicle: liberal CSOs, Democratic Party. |
|
Collaboration with hegemonic order for individual escape. Strategy: shrink the marginalized definition, exclude the most marginal. |
|
Oppositional collective identity, independent power. The contradiction is material, not a misunderstanding. |
Defined in ConsciousnessTendency.
LegalStatus
One-way escalation ratchet. State action can only escalate; de-escalation requires player political struggle.
Value |
Threat Multiplier |
Description |
|---|---|---|
|
0.1 |
Normal status, minimal state attention |
|
0.5 |
Active monitoring |
|
1.0 |
Formal extremist designation |
|
2.0 |
Formal terrorist designation |
|
3.0 |
Membership itself criminalized |
MembershipRole
Value |
Strength Weight |
Description |
|---|---|---|
|
1.0 |
Infrastructure maintainers, visible leaders |
|
0.7 |
Regular participants |
|
0.4 |
Occasional engagement |
|
0.2 |
Marginal connection |
|
0.1 |
External ally, not legible as member |
Models
CommunityConsciousness (TernaryConsciousness)
CommunityConsciousness is a type alias for
TernaryConsciousness
(Feature 034). The consciousness model is a 2-simplex where
r + l + f = 1.0.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
Probability |
0.3 |
Revolutionary consciousness [0, 1] |
|
Probability |
0.6 |
Liberal consciousness [0, 1] |
|
Probability |
0.1 |
Fascist consciousness [0, 1] |
|
float | None |
None |
Legacy contestation value (None = use Shannon entropy) |
Computed properties (backward-compatible with the old scalar model):
collective_identity— equalsrdominant_tendency— argmax of(r, l, f)(ties favor liberal)ideological_contestation—contestation_storedif set, otherwise normalized Shannon entropy of(r, l, f)assimilation_ratio—f / (l + f)
Supports three construction paths: native (r, l, f), legacy
(collective_identity, dominant_tendency, ideological_contestation),
and default. See Ternary Consciousness Reference for full details.
Defined in babylon.models.entities.consciousness (primary),
aliased in babylon.models.entities.community.
ContradictionAxis
Frozen Pydantic model. Structural axis of contradiction with hegemonic and marginalized sides (Feature 029).
Field |
Type |
Description |
|---|---|---|
|
str |
Short identifier ( |
|
str |
Human-readable axis name |
|
CommunityType |
The hegemonic community type on this axis |
|
list[CommunityType] |
Marginalized community types on this axis |
|
str |
Description of the material extraction |
|
bool |
Whether membership is mutually exclusive |
|
bool |
Whether agents can cross the axis boundary |
Defined in ContradictionAxis.
CommunityState
Frozen Pydantic model. Per-community attributes including Feature 029
additions (category, consciousness, computed properties).
Field |
Type |
Default |
Description |
|---|---|---|---|
|
CommunityType |
required |
Community identity |
|
HyperedgeCategory |
auto-assigned |
Structural category from |
|
Probability |
0.0 |
State attention/surveillance intensity [0, 1] |
|
LegalStatus |
LEGAL |
Current legal designation |
|
Probability |
0.5 |
Internal trust and mutual aid effectiveness [0, 1] |
|
Probability |
0.3 |
Organizational capacity [0, 1] |
|
Probability |
0.5 |
Legibility to state surveillance [0, 1] |
|
float |
1.0 |
Multiplier on V_reproduction for members (>=0) |
|
Coefficient |
1.0 |
Multiplier on imperial rent received [0, 1] |
|
CommunityConsciousness |
(default factory) |
Ideological dimension of the community |
Computed properties:
infiltration_resistance— Community resistance to state infiltration. See Infiltration Resistance.is_cross_class_bridge—TrueifcategoryisINSTITUTIONAL_EXCLUSION, indicating structural potential for bridging contradiction axes.
The category field is auto-assigned via a model validator that reads
COMMUNITY_CATEGORY_MAP[community_type].
Defined in CommunityState.
CommunityMembership
Frozen Pydantic model. Per-agent-per-community relationship.
Field |
Type |
Default |
Description |
|---|---|---|---|
|
str |
required |
Agent identifier |
|
CommunityType |
required |
Which community |
|
MembershipRole |
PARTICIPANT |
Integration level |
|
Coefficient |
0.4 |
Membership weight [0, 1] |
|
Probability |
0.5 |
Base legibility to state [0, 1] |
|
bool |
False |
Publicly identified (overrides visibility to 1.0) |
Computed property: effective_visibility returns 1.0 if overt
is True, otherwise returns the base visibility value.
Constants
Category and Side Mappings
COMMUNITY_CATEGORY_MAP — Maps every CommunityType to exactly one
HyperedgeCategory. Fixed at import time. Exhaustively validated —
missing types raise RuntimeError.
HEGEMONIC_COMMUNITIES — frozenset({SETTLER, PATRIARCHAL})
MARGINALIZED_COMMUNITIES — frozenset({NEW_AFRIKAN, FIRST_NATIONS,
CHICANO, WOMEN, TRANS, DISABLED, QUEER, UNDOCUMENTED, INCARCERATED})
LIFECYCLE_COMMUNITIES — frozenset({YOUTH, ADULT, ELDER})
Contradiction Axes
COLONIAL_AXIS — Hegemonic: SETTLER. Marginalized: NEW_AFRIKAN, FIRST_NATIONS, CHICANO. Extraction: land, imperial rent, carceral labor, property value regimes. Exclusive, not permeable.
PATRIARCHAL_AXIS — Hegemonic: PATRIARCHAL. Marginalized: WOMEN, TRANS. Extraction: unwaged reproductive labor, wage gap, care externalization. Exclusive, not permeable.
CONTRADICTION_AXES — [COLONIAL_AXIS, PATRIARCHAL_AXIS]
Default Consciousness Values
CONSCIOUSNESS_DEFAULTS — Starting ternary (r, l, f) values for
all 14 community types. Synthetic data for Detroit 2010 test case.
Contestation is now derived as Shannon entropy of the distribution.
See CONSCIOUSNESS_DEFAULTS in the Ternary Consciousness Reference for the complete table with all 14 rows.
Infiltration Constants
Constant |
Value |
Purpose |
|---|---|---|
|
0.6 |
Weight of collective identity in resistance formula |
|
0.3 |
Weight of cohesion in resistance formula |
|
0.1 |
Weight of CI * cohesion interaction term |
|
0.7 |
How much max resistance reduces infiltration ceiling |
All constants defined in babylon.models.entities.community.
Infiltration Resistance
Community resistance to state infiltration, computed from collective identity and internal cohesion.
Resistance formula:
The interaction term means collective identity and cohesion reinforce each other. Maximum resistance is 1.0 (when CI = 1.0 and cohesion = 1.0).
Effective ceiling reduction:
Where \(IR_{\max}\) is the highest infiltration resistance across all communities the target belongs to. At maximum resistance, the effective ceiling drops to 30% of base.
Implemented as computed property CommunityState.infiltration_resistance
and standalone function effective_infiltration_ceiling().
Formulas
All formulas registered in FormulaRegistry.
calculate_solidarity_potential
calculate_solidarity_potential(
base_solidarity: float,
shared_count: int,
rent_a: float,
rent_b: float,
overlap_bonus: float = 0.1,
rent_penalty: float = 0.05,
) -> float
Returns base_solidarity + overlap_bonus * shared_count - rent_penalty * |rent_a - rent_b|.
calculate_threat_score
calculate_threat_score(
memberships: list[tuple[float, float, float, float]],
) -> float
Each tuple is (heat, effective_visibility, role_weight, legal_status_multiplier).
Returns the sum of all products.
calculate_infrastructure_decay
calculate_infrastructure_decay(
current: float,
decay_alpha: float,
core_organizer_count: int,
maintenance_factor: float = 0.1,
) -> float
Returns current * (1 - alpha) + min(count * factor, 1.0) * alpha,
clamped to [0, 1].
calculate_solidarity_amplification
calculate_solidarity_amplification(
base_strength: float,
shared_communities: list[tuple[float, float, float, float]],
) -> float
Each tuple is (infrastructure, cohesion, strength_a, strength_b).
Returns base * (1 + sum(infra * cohesion * str_a * str_b)).
compute_community_cost_modifier
compute_community_cost_modifier(
memberships: list[Any],
community_states: dict[Any, Any],
) -> float
Returns the product of reproduction_cost_modifier across all
communities the agent belongs to. Returns 1.0 if no memberships.
CommunitySystem
Registered at position 6 in _DEFAULT_SYSTEMS (between
ReserveArmySystem and SolidaritySystem).
System name: "community"
Step Phases
The step() method executes five phases per tick:
Collect memberships from active
social_classgraph nodesBuild XGI hypergraph from collected memberships
Amplify solidarity on SOLIDARITY edges via community overlap
Compute threat scores per agent from community heat and legal status
Compute cost modifiers per agent from community reproduction modifiers
Apply decay to community state (heat, cohesion, infrastructure)
Graph Mutations
Node/Edge |
Attribute |
Effect |
|---|---|---|
Agent node |
|
Written each tick (cumulative across memberships) |
Agent node |
|
Written each tick (multiplicative product) |
SOLIDARITY edge |
|
Amplified by shared community infrastructure |
Repression Actions
Standalone functions for state AI Repress verb:
legal_status_escalate(state)– Advances legal status one step. No-op at CRIMINALIZED.designate_community(state, heat_increase=0.3)– Escalates + raises heat.infiltrate_community(state, cohesion_reduction=0.2)– Reduces cohesion.disrupt_infrastructure(state, infrastructure_reduction=0.4)– Reduces infrastructure.
All return new CommunityState via model_copy().
Configuration
GameDefines.community provides tuning coefficients:
Parameter |
Default |
Description |
|---|---|---|
|
0.05 |
Rate heat decays toward 0 per tick |
|
0.03 |
Rate cohesion decays without organizing |
|
0.04 |
Rate infrastructure decays without maintenance |
|
0.1 |
Solidarity potential bonus per shared community |
|
0.05 |
Solidarity potential penalty per unit rent gap |
|
0.1 |
Infrastructure maintenance per CORE_ORGANIZER |
Helper Functions
Feature 022 helpers (from babylon.engine.systems.community):
build_community_hypergraph(memberships, community_states)– Builds XGI Hypergraph.shared_communities(H, agent_a, agent_b)– Returns set of shared hyperedge IDs.community_overlap_matrix(H)– Returns(overlap_ndarray, node_index_dict).
Feature 029 helpers (from babylon.models.entities.community):
get_contradiction_axis(community)– Returns theContradictionAxisa community belongs to, orNoneif not a contradiction pair.is_hegemonic(community)–Trueif on the hegemonic side of any axis.is_marginalized(community)–Trueif marginalized (including institutional exclusion).get_opposing_communities(community)– Returns communities on the opposite side of the contradiction axis. Empty list if not a pair.shared_marginalized_communities(agent_a_communities, agent_b_communities)– Returns marginalized communities shared by two agents.effective_infiltration_ceiling(base_ceiling, target_community_states)– Computes effective ceiling reduced by community resistance.
Feature 029 helpers (from babylon.engine.systems.community):
communities_spanning_axis(H, axis)– Finds institutional exclusion communities that bridge a contradiction axis by containing members from both hegemonic and marginalized sides.
See Also
Community Consciousness and Structural Taxonomy – Taxonomy theory and consciousness model
Ternary Consciousness Model – Why consciousness is modeled as a ternary simplex
Ternary Consciousness Reference – Ternary consciousness API reference
Community as Hyperedge – Why hyperedges, not pairwise edges
George Jackson Bifurcation Model – Bifurcation and consciousness tendencies
Formulas Reference – All simulation formulas
Simulation Systems Reference – System execution order