Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/xcoder-es/governance-layer/llms.txt

Use this file to discover all available pages before exploring further.

The Neural Parliament is the core deliberation engine of the Governance Layer. Rather than representing an agent as a monolithic optimizer with a single utility function, it models the agent as a society of semi-independent evaluators — each with its own value function, proposal mechanism, veto threshold, and procedural weight — that negotiate over competing courses of action through a structured, non-differentiable protocol. The output is not an action; it is a governance decision that constrains which actions the optimizer may even consider.
The Speaker has no value function and no proposal function. It does not prefer any outcome. Its sole role is procedural: agenda enforcement, round management, veto oversight, and default fallback. This is the architectural guarantee that governance is not merely another optimization problem in disguise.

Architecture

A Neural Parliament is a four-tuple P = ⟨M, S, Π, V⟩ where M is the set of members, S is the Speaker, Π is the deliberation protocol, and V is the voting rule set. Each member mᵢ is itself a tuple of a value function Vᵢ(s, a), a proposal function πᵢ(s), a veto threshold τᵢ, and a procedural weight wᵢ. The critical distinction: wᵢ is not a scalarization weight. It does not appear in any objective function. It determines parliamentary privilege — how many votes a member has, whether it can call emergency sessions, which motions it can propose.

The Seven Parliament Members

Reward

Maximizes expected cumulative reward under the current objective. No veto power — always defers to others on safety matters.
  • veto_threshold: 0.0
  • weight: 1.0
  • budget: 3 proposals/cycle
  • Evaluates: metadata["expected_reward"]

Safety

Minimizes worst-case outcomes. Double voting power; can call emergency sessions. The primary check on reward-seeking behavior.
  • veto_threshold: 0.5
  • weight: 2.0
  • budget: 5 proposals/cycle
  • Evaluates: 1.0 - metadata["risk"]

Integrity

Evaluates consistency with identity commitments and detects procedural violations. Highest voting weight; near-absolute veto on identity violations.
  • veto_threshold: 0.8
  • weight: 3.0
  • budget: 5 proposals/cycle
  • Evaluates: metadata["identity_coherence"]

Planning

Evaluates long-term consequences of proposals. Higher weight for long-horizon reasoning; moderate veto authority.
  • veto_threshold: 0.3
  • weight: 1.5
  • budget: 3 proposals/cycle
  • Evaluates: metadata["long_term_value"]

Curiosity

Proposes exploratory actions for information gain. Lower weight — exploration defers to exploitation under most conditions.
  • veto_threshold: 0.2
  • weight: 0.8
  • budget: 4 proposals/cycle
  • Evaluates: metadata["novelty"]

Social

Evaluates impact on other agents and human values. Moderate veto authority to block socially unacceptable actions.
  • veto_threshold: 0.4
  • weight: 1.2
  • budget: 3 proposals/cycle
  • Evaluates: metadata["social_acceptability"]

Memory

Surfaces relevant precedents and past outcomes. Provides historical consistency checks with modest veto power.
  • veto_threshold: 0.1
  • weight: 0.7
  • budget: 2 proposals/cycle
  • Evaluates: metadata["historical_consistency"]

Priority Tags

Every proposal carries a self-declared PriorityTag from a fixed enumerated set. The Speaker sorts the agenda by tag priority (lower integer = higher urgency), then by timestamp within each tier. This sort is a pure deterministic function — no loss function, no gradient, no neural inference.
class PriorityTag:
    CRITICAL_SAFETY  = 0   # Highest urgency — always first on the agenda
    HIGH_IMPACT      = 1   # Significant decisions with broad consequences
    ROUTINE          = 2   # Standard operational proposals
    EXPLORATORY      = 3   # Information-gathering proposals
    INFORMATIONAL    = 4   # Lowest urgency — advisory only
Tag falsification is self-defeating. A member that mislabels a routine proposal as CRITICAL_SAFETY may gain agenda priority, but the Safety Committee will score it low (it is not actually safety-critical), and the Integrity Committee penalizes the procedural violation. Persistent false tagging triggers the falsification counter mechanism.

Governance Cycle

The SpeakerStateMachine.run_governance_cycle() processes proposals through seven immutable procedural phases. These phases are listed in immutable_procedures and cannot be reordered or skipped.
1

Budget Enforcement

Each member is allocated exactly budget proposal slots per cycle. The Speaker truncates submissions that exceed the per-member cap before any other processing occurs. This is the primary SDoS resistance mechanism — a fast-learning member cannot flood the agenda by submitting semantically identical proposals.
2

Agenda Sorting

Filtered proposals are sorted by (tag, timestamp). CRITICAL_SAFETY proposals (tag=0) are always considered before ROUTINE proposals (tag=2), which are always considered before EXPLORATORY proposals (tag=3).
3

Scoring Phase

For each proposal on the agenda, every member’s evaluate_proposal(state, proposal) is called. This builds a score matrix where each cell represents one member’s assessment of one proposal.
4

Tag Compliance Check

The Integrity Committee’s scores are examined against TAG_COMPLIANCE_THRESHOLD = 0.4. A proposal whose integrity score falls below this threshold is flagged as a potential tag falsification. The _falsification_counts counter for that member increments.
5

Veto Phase

For each member, if the proposal’s score falls below that member’s veto_threshold, the member is added to the vetoed list. Any single veto causes the proposal to be skipped — it is not eliminated from future rounds, but it will not advance to a vote in the current round.
6

Voting Phase

Surviving (non-vetoed) proposals are resolved by weighted vote. Each member’s weight wᵢ multiplies its score. The weighted average is compared to the decision class threshold. The first proposal to pass becomes the GovernanceDecision.
7

Default Fallback

If no proposal achieves consensus after max_rounds (default: 3), the Speaker returns the pre-configured default_action wrapped in a GovernanceDecision with is_default=True.

Decision Classes

The decision_class parameter passed to run_governance_cycle() selects the voting threshold:
Decision ClassThresholdApplies To
"routine"majority ≥ 0.5Reversible, low-impact decisions
"high_impact"supermajority ≥ 0.66Irreversible or high-consequence decisions
"identity"unanimity = 1.0Identity-altering or Ulysses Contract proposals

SDoS Resistance

The proposal budget system provides Semantic Denial-of-Service (SDoS) resistance without requiring the Speaker to understand the semantic content of proposals. The budget vector b = ⟨b_reward, b_safety, b_curiosity, b_planning, b_memory, b_social, b_integrity⟩ is part of the Speaker’s immutable configuration. When a member accumulates FALSIFICATION_BUDGET_CUTOFF = 3 tag violations, the Speaker automatically halves that member’s future budget (floored at 1):
if count >= self.FALSIFICATION_BUDGET_CUTOFF:
    member.budget = max(1, member.budget // 2)
This creates a self-correcting incentive: systematic mislabeling shrinks a member’s voice in the parliament over time.

Code Example

import time
from governance import (
    SpeakerStateMachine,
    ExampleRewardMember,
    ExampleSafetyMember,
    ExampleIntegrityMember,
    ExamplePlanningMember,
    ExampleCuriosityMember,
    ExampleSocialMember,
    ExampleMemoryMember,
    Proposal,
    PriorityTag,
)

# 1. Instantiate all seven parliament members
members = {
    "reward":    ExampleRewardMember(),
    "safety":    ExampleSafetyMember(),
    "integrity": ExampleIntegrityMember(),
    "planning":  ExamplePlanningMember(),
    "curiosity": ExampleCuriosityMember(),
    "social":    ExampleSocialMember(),
    "memory":    ExampleMemoryMember(),
}

# 2. Construct the SpeakerStateMachine with members and a default action
speaker = SpeakerStateMachine(
    members=members,
    default_action="emergency_shutdown",
    majority_threshold=0.5,
    supermajority_threshold=0.66,
    max_rounds=3,
)

# 3. Build proposals — each member declares a PriorityTag and metadata
proposals = [
    Proposal(
        member_id="reward",
        action="high_reward_gamble",
        tag=PriorityTag.ROUTINE,
        timestamp=time.time(),
        metadata={"expected_reward": 0.9, "risk": 0.8, "identity_coherence": 0.2},
    ),
    Proposal(
        member_id="safety",
        action="safe_middle_road",
        tag=PriorityTag.CRITICAL_SAFETY,
        timestamp=time.time(),
        metadata={"expected_reward": 0.5, "risk": 0.1, "identity_coherence": 0.9},
    ),
    Proposal(
        member_id="integrity",
        action="principled_action",
        tag=PriorityTag.HIGH_IMPACT,
        timestamp=time.time(),
        metadata={"expected_reward": 0.4, "risk": 0.2, "identity_coherence": 1.0},
    ),
]

# 4. Run the governance cycle
decision = speaker.run_governance_cycle(
    state="normal",
    raw_proposals=proposals,
    decision_class="routine",
)

print(f"Action:   {decision.action}")
print(f"Default:  {decision.is_default}")
print(f"Scores:   {decision.scores}")
print(f"Meta:     {decision.governance_meta}")
In this example, "high_reward_gamble" will be vetoed by the Safety Committee (risk=0.8 → score=0.2, below the veto threshold of 0.5). "safe_middle_road" is a CRITICAL_SAFETY proposal processed first on the agenda. "principled_action" carries full identity coherence (1.0), which satisfies the Integrity Committee’s demanding veto threshold of 0.8.

Implementing a Custom Member

All parliament members extend ParliamentMember from governance.committee.base:
from governance import ParliamentMember, Proposal, PriorityTag
import time

class EthicsReviewMember(ParliamentMember):
    def __init__(self):
        super().__init__(
            member_id="ethics",
            veto_threshold=0.6,
            weight=2.5,
            budget=4,
        )

    def evaluate_proposal(self, state, proposal: Proposal) -> float:
        # Return a score in [-1, 1]; higher means more aligned with this member's values
        ethical_score = proposal.metadata.get("ethical_alignment", 0.5)
        return ethical_score

    def propose(self, state) -> Proposal:
        return Proposal(
            member_id=self.member_id,
            action="defer_to_ethics_board",
            tag=PriorityTag.HIGH_IMPACT,
            timestamp=time.time(),
            metadata={"ethical_alignment": 0.95},
        )
evaluate_proposal() must return a scalar in [-1.0, 1.0]. Scores outside this range will distort the weighted voting calculation. Returning 1.0 unconditionally makes your member a rubber stamp; returning values below veto_threshold on every proposal makes your member a permanent blocker.

Gradient Barrier

The governance cycle is non-differentiable by construction. The veto check (score < veto_threshold) and the vote resolution (avg_score >= threshold) are discrete comparisons. Gradients from the final GovernanceDecision back to any member’s proposal function are zero through these operations:
∂g / ∂πᵢ = 0   for all i ∈ M
This is not an implementation detail — it is the architectural guarantee that governance cannot be reduced to a deeper optimization layer. For a Reward Committee member to learn how to “game” the parliament, it would need to solve a black-box optimization problem treating the Speaker as an unobservable oracle, which is strictly harder than gradient-based alignment.

API Reference

members
Dict[str, ParliamentMember]
required
Dictionary mapping member IDs (e.g., "safety", "integrity") to ParliamentMember instances. All seven standard member types are defined in governance.committee.members.
default_action
Any
required
The action returned when no proposal achieves consensus after max_rounds. Wrapped in a GovernanceDecision with is_default=True.
majority_threshold
float
default:"0.5"
Weighted-average score threshold for "routine" decision class.
supermajority_threshold
float
default:"0.66"
Weighted-average score threshold for "high_impact" decision class.
max_rounds
int
default:"3"
Maximum deliberation rounds before falling back to default_action. Configurable within the Identity Layer’s parameter envelope [1, 10].
state
Any
required
The current environment state passed to each member’s evaluate_proposal() and propose() methods.
raw_proposals
List[Proposal]
required
List of proposals submitted by members. The Speaker applies budget enforcement and priority sorting before any scoring occurs.
decision_class
str
default:"\"routine\""
One of "routine", "high_impact", or "identity". Selects the voting threshold applied in the voting phase.

Build docs developers (and LLMs) love