Module: Legion::Extensions::Agentic::Affect::Emotion::Runners::Gut
- Includes:
- Helpers::Lex
- Included in:
- Client
- Defined in:
- lib/legion/extensions/agentic/affect/emotion/runners/gut.rb
Instance Method Summary collapse
- #decay_momentum ⇒ Object
- #emotional_state ⇒ Object
- #gut_instinct(valences:, memory_signals: [], confidence_threshold: 0.5) ⇒ Object
Instance Method Details
#decay_momentum ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/legion/extensions/agentic/affect/emotion/runners/gut.rb', line 41 def decay_momentum(**) neutral = { urgency: 0.5, importance: 0.5, novelty: 0.5, familiarity: 0.5 } momentum = emotion_momentum momentum.update(neutral, 0.5) stability = momentum.stability log.debug("[emotion] momentum decay: stability=#{stability.round(2)}") { decayed: true, stability: stability } end |
#emotional_state ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/legion/extensions/agentic/affect/emotion/runners/gut.rb', line 52 def emotional_state(**) momentum = emotion_momentum state = momentum.emotional_state log.debug("[emotion] state query: stability=#{state[:stability]&.round(2)}") { momentum: state, baseline: emotion_baseline.dimensions } end |
#gut_instinct(valences:, memory_signals: [], confidence_threshold: 0.5) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/legion/extensions/agentic/affect/emotion/runners/gut.rb', line 13 def gut_instinct(valences:, memory_signals: [], confidence_threshold: 0.5, **) return { signal: :neutral, confidence: 0.0, basis: :insufficient_data } if valences.empty? arousal = Helpers::Valence.compute_arousal(valences) aggregate = Helpers::Valence.aggregate(valences) dominant = Helpers::Valence.dominant_dimension(aggregate) signal = determine_signal(aggregate, arousal) confidence = compute_confidence(valences, memory_signals) log.debug("[emotion] gut instinct: signal=#{signal} confidence=#{confidence.round(2)} " \ "arousal=#{arousal.round(2)} dominant=#{dominant} reliable=#{confidence >= confidence_threshold}") result = { signal: signal, confidence: confidence, arousal: arousal, dominant: dominant, aggregate: aggregate, reliable: confidence >= confidence_threshold } # Update momentum if available emotion_momentum.update(aggregate, arousal) if respond_to?(:emotion_momentum, true) result end |