TheDocumentation 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.
models module defines the shared vocabulary that every layer of the Governance Layer framework reads and writes. All parliament members produce Proposal objects, the SpeakerStateMachine emits GovernanceDecision objects, and the broader system is threaded together through GovernanceContext. Understanding these five types is a prerequisite for working with any other part of the framework.
PriorityTag
PriorityTag is a plain class that acts as an ordered enumeration of proposal priorities. Lower integer values carry higher urgency and are sorted to the front of the governance agenda. All five constants are class-level integers; there are no instances.
Class constants
Highest urgency. Reserved for proposals that address immediate safety concerns. The
SpeakerStateMachine sorts these to the very front of every agenda.Proposals with significant but non-emergency consequences, such as those that alter long-term strategy or resource allocation.
Standard governance proposals that cover normal operational decisions. This is the default tag on every new
Proposal.Proposals for experimental or novel actions where the outcome is uncertain. Sorted after routine items.
Lowest urgency. Used for proposals that convey information or suggest bookkeeping changes with no immediate operational impact.
Methods
PriorityTag.name(tag)
Returns the human-readable name for a numeric tag constant. Returns "UNKNOWN" for any integer not in the registered set.
The integer priority constant to look up. Must be one of
0–4 to receive a named result.The string name of the tag, e.g.
"CRITICAL_SAFETY", or "UNKNOWN" if the value is not registered.Action
Action is a frozen dataclass that represents a discrete, immutable action a parliament member may propose or that the system may execute. Because it is frozen, Action instances are hashable and safe to use as dictionary keys or set members.
Fields
A stable integer identifier for this action within the action space. Must be unique across all actions your system defines.
An optional mapping of named scalar properties associated with this action — for example
{"cost": 1.5, "duration": 0.3}. Defaults to an empty dict. Because Action is frozen, the dict reference itself is fixed at construction time.An optional opaque string that can be used to tie this action to a specific runtime artifact, commit hash, or content-addressable record. When
None, no hash verification is performed.Proposal
Proposal is a mutable dataclass produced by a ParliamentMember and consumed by the SpeakerStateMachine. It carries the identity of the proposing member, the action being proposed, a priority tag, a submission timestamp, and an open-ended metadata dict that member-specific scoring logic reads at evaluation time.
Fields
The string identifier of the
ParliamentMember that is submitting this proposal. Must match a key in the SpeakerStateMachine.members dict for the proposal to pass budget enforcement.The action being proposed. Can be any Python object — a string label, an
Action dataclass instance, or an arbitrary domain-specific type.The priority level of this proposal. Use one of the
PriorityTag constants. Lower values are sorted earlier in the governance agenda. Misuse of high-priority tags is tracked by _check_tag_compliance and can reduce a member’s proposal budget.Unix timestamp (seconds since epoch) of when the proposal was created. Used as a tiebreaker when two proposals share the same tag — earlier timestamps are processed first.
Arbitrary key-value pairs that member scoring functions read during evaluation. The keys are not enforced by the framework; each concrete
ParliamentMember documents which keys it looks for. Common conventions include "risk", "expected_reward", and "identity_coherence".GovernanceDecision
GovernanceDecision is the output of every run_governance_cycle call. It records the elected action, the per-member score breakdown, the list of any members who cast a veto, and a metadata dict containing cycle-level bookkeeping. The is_default property is the canonical way to determine whether the cycle reached consensus or fell back to the configured default action.
Fields
The elected action. On a successful vote this is the
action field of the winning Proposal; on a default fallback this is SpeakerStateMachine.default_action.A mapping of
member_id to the score that member assigned to the winning proposal. Empty when the decision is a default fallback (no proposal survived the full protocol).A list of
member_id values that cast a veto against the winning proposal candidate. In practice the speaker skips a proposal the moment any veto is detected, so a non-empty list here reflects intermediate veto data rather than a veto on the final elected action.Structured bookkeeping from the governance cycle. On a consensus decision the dict contains:
On a default fallback the dict instead contains:
| Key | Type | Description |
|---|---|---|
round | int | The cycle round (1-indexed) in which consensus was reached. |
decision_class | str | The decision class used ("routine", "high_impact", or "identity"). |
winning_proposal | str | String representation of the proposal that won. |
falsification_counts | Dict[str, int] | Per-member count of tag-compliance violations detected this cycle. |
| Key | Type | Description |
|---|---|---|
is_default | bool | Always True on fallback decisions. |
reason | str | Human-readable reason, e.g. "No consensus after 3 rounds". |
decision_class | str | The decision class that was attempted. |
falsification_counts | Dict[str, int] | Per-member tag-compliance violation counts. |
Properties
Returns
True when governance_meta["is_default"] is set, which only occurs on a default fallback. Returns False for all consensus decisions. This is the canonical way to distinguish a real consensus from an emergency fallback.GovernanceContext
GovernanceContext is an optional carrier for system-wide state that can be passed into governance logic. It gathers the active contracts that constrain what actions are permissible, the recent decision history, per-member health statuses, and the system’s identity vector and ontology. None of its fields are required; the dataclass is designed to be incrementally populated.
Fields
A list of contract objects (typically
UlyssesContract instances) that represent pre-committed constraints on system behaviour. The governance layer enforces these constraints before any vote is resolved.A rolling log of past
GovernanceDecision objects. Higher-level orchestration layers may inspect this history to detect repeated defaults or pattern anomalies.A mapping of
member_id to an arbitrary status dict describing that member’s current health, suspension state, or diagnostic metadata. The schema of the inner dict is not enforced by the framework.An optional floating-point vector that represents the system’s current identity embedding. Used by identity-tier governance checks when
decision_class="identity" is in effect.An optional reference to the system’s ontology or concept graph. The framework does not prescribe a type; any object meaningful to your domain logic is accepted.