Module: Legion::Extensions::Agentic::Affect::Resilience::Helpers::Constants

Defined in:
lib/legion/extensions/agentic/affect/resilience/helpers/constants.rb

Constant Summary collapse

ADVERSITY_TYPES =

Adversity types the resilience system tracks

%i[
  prediction_failure
  trust_violation
  conflict_escalation
  resource_depletion
  communication_failure
  goal_failure
  emotional_shock
  system_error
].freeze
RECOVERY_PHASES =

Recovery phases (Masten’s resilience model)

%i[
  absorbing
  adapting
  recovering
  thriving
].freeze
DIMENSIONS =

Resilience dimensions

{
  elasticity:   { description: 'Speed of recovery to baseline', weight: 0.30 },
  robustness:   { description: 'Resistance to initial disruption', weight: 0.25 },
  adaptability: { description: 'Capacity to adjust strategy', weight: 0.25 },
  growth:       { description: 'Ability to improve from adversity', weight: 0.20 }
}.freeze
RESILIENCE_ALPHA =

EMA alpha for resilience dimension tracking

0.08
GROWTH_INCREMENT =

Growth bonus per successful recovery

0.02
MAX_GROWTH_BONUS =

Maximum growth bonus (anti-fragile ceiling)

0.3
SEVERITY_LEVELS =

Adversity severity levels

{
  minor:    { impact: 0.1, recovery_ticks: 5 },
  moderate: { impact: 0.3, recovery_ticks: 15 },
  major:    { impact: 0.5, recovery_ticks: 30 },
  severe:   { impact: 0.8, recovery_ticks: 60 },
  critical: { impact: 1.0, recovery_ticks: 100 }
}.freeze
RECOVERY_THRESHOLD =

Threshold for considering recovery complete

0.9
MAX_ACTIVE_ADVERSITIES =

Maximum active adversity events tracked

20
MAX_RESILIENCE_HISTORY =

History cap

200
FRAGILITY_THRESHOLD =

Fragility threshold — below this, the system is fragile

0.3
ANTIFRAGILITY_THRESHOLD =

Anti-fragility threshold — above this, the system grows from stress

0.7
GROWTH_TRIGGER =

Consecutive recoveries needed to boost growth dimension

3