Module: Legion::Extensions::Agentic::Social::Governance::Helpers::Layers

Defined in:
lib/legion/extensions/agentic/social/governance/helpers/layers.rb

Constant Summary collapse

GOVERNANCE_LAYERS =

Four governance layers (spec: governance-protocol-spec.md)

%i[agent_validation anomaly_detection human_deliberation transparency].freeze
MIN_COUNCIL_SIZE =

Council quorum requirements

3
QUORUM_FRACTION =
0.66
VOTE_TIMEOUT =

24 hours

86_400
PROPOSAL_CATEGORIES =
%i[policy_change resource_allocation access_control emergency protocol_update].freeze

Class Method Summary collapse

Class Method Details

.quorum_met?(votes, council_size) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
33
# File 'lib/legion/extensions/agentic/social/governance/helpers/layers.rb', line 29

def quorum_met?(votes, council_size)
  return false if council_size < MIN_COUNCIL_SIZE

  votes >= (council_size * QUORUM_FRACTION).ceil
end

.valid_category?(category) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/legion/extensions/agentic/social/governance/helpers/layers.rb', line 25

def valid_category?(category)
  PROPOSAL_CATEGORIES.include?(category)
end

.valid_layer?(layer) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/legion/extensions/agentic/social/governance/helpers/layers.rb', line 21

def valid_layer?(layer)
  GOVERNANCE_LAYERS.include?(layer)
end