Module: Legion::Extensions::Tick::Helpers::Constants

Defined in:
lib/legion/extensions/tick/helpers/constants.rb

Constant Summary collapse

MODES =

Tick modes

%i[dormant dormant_active sentinel full_active].freeze
PHASES =

16 phases of a full active tick

%i[
  sensory_processing
  emotional_evaluation
  memory_retrieval
  knowledge_retrieval
  identity_entropy_check
  working_memory_integration
  procedural_check
  prediction_engine
  mesh_interface
  social_cognition
  theory_of_mind
  gut_instinct
  action_selection
  memory_consolidation
  homeostasis_regulation
  post_tick_reflection
].freeze
DREAM_PHASES =

Phases for dream cycle (dormant_active mode)

%i[
  memory_audit
  association_walk
  contradiction_resolution
  identity_entropy_check
  agenda_formation
  consolidation_commit
  knowledge_promotion
  dream_reflection
  partner_reflection
  dream_narration
].freeze
MODE_PHASES =

Which phases run in each mode

{
  dormant:        %i[memory_consolidation],
  dormant_active: DREAM_PHASES,
  sentinel:       %i[sensory_processing emotional_evaluation memory_retrieval prediction_engine memory_consolidation],
  full_active:    PHASES
}.freeze
ACTIVE_TIMEOUT =

Timing constants (in seconds)

300
SENTINEL_TIMEOUT =

seconds without high-salience signal before demotion

3600
DREAM_IDLE_THRESHOLD =

seconds without any signal before demotion to dormant

1800
SENTINEL_TO_DREAM_THRESHOLD =

seconds dormant with no signal before entering dream cycle

600
MAX_TICK_DURATION =

seconds sentinel with no signal before entering dream cycle

5.0
SENTINEL_TICK_BUDGET =

hard ceiling for full active tick (seconds)

0.5
DORMANT_TICK_BUDGET =

time budget for sentinel tick

0.2
EMERGENCY_PROMOTION_BUDGET =

time budget for dormant tick

0.05
PHASE_BUDGETS =

Phase timing budgets (fraction of total tick time)

{
  sensory_processing:         0.12,
  emotional_evaluation:       0.08,
  memory_retrieval:           0.12,
  knowledge_retrieval:        0.05,
  identity_entropy_check:     0.04,
  working_memory_integration: 0.05,
  procedural_check:           0.08,
  prediction_engine:          0.12,
  mesh_interface:             0.04,
  social_cognition:           0.04,
  theory_of_mind:             0.04,
  gut_instinct:               0.04,
  action_selection:           0.04,
  memory_consolidation:       0.04,
  homeostasis_regulation:     0.05,
  post_tick_reflection:       0.05
}.freeze
HIGH_SALIENCE_THRESHOLD =

Salience thresholds for mode transitions

0.7
EMERGENCY_TRIGGERS =
%i[firmware_violation extinction_protocol].freeze

Class Method Summary collapse

Class Method Details

.phases_for_mode(mode) ⇒ Object



89
90
91
# File 'lib/legion/extensions/tick/helpers/constants.rb', line 89

def phases_for_mode(mode)
  MODE_PHASES.fetch(mode, PHASES)
end

.tick_budget(mode) ⇒ Object



93
94
95
96
97
98
99
100
# File 'lib/legion/extensions/tick/helpers/constants.rb', line 93

def tick_budget(mode)
  case mode
  when :dormant        then DORMANT_TICK_BUDGET
  when :dormant_active then Float::INFINITY
  when :sentinel       then SENTINEL_TICK_BUDGET
  else                      MAX_TICK_DURATION
  end
end