lex-agentic-defense 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/README.md +38 -26
  4. data/lex-agentic-defense.gemspec +2 -2
  5. data/lib/legion/extensions/agentic/defense/confabulation/actors/decay.rb +1 -1
  6. data/lib/legion/extensions/agentic/defense/confabulation/runners/confabulation.rb +10 -0
  7. data/lib/legion/extensions/agentic/defense/dissonance/actors/update.rb +45 -0
  8. data/lib/legion/extensions/agentic/defense/erosion/actors/weather.rb +45 -0
  9. data/lib/legion/extensions/agentic/defense/extinction/runners/extinction.rb +15 -7
  10. data/lib/legion/extensions/agentic/defense/immune_response/actors/decay.rb +45 -0
  11. data/lib/legion/extensions/agentic/defense/immune_response/runners/cognitive_immune_response.rb +5 -0
  12. data/lib/legion/extensions/agentic/defense/immunology/actors/decay.rb +45 -0
  13. data/lib/legion/extensions/agentic/defense/immunology/runners/cognitive_immunology.rb +5 -0
  14. data/lib/legion/extensions/agentic/defense/phantom/actors/decay.rb +45 -0
  15. data/lib/legion/extensions/agentic/defense/version.rb +1 -1
  16. data/lib/legion/extensions/agentic/defense/whirlpool/actors/tick.rb +45 -0
  17. data/lib/legion/extensions/agentic/defense.rb +12 -0
  18. data/spec/legion/extensions/agentic/defense/confabulation/actors/decay_spec.rb +45 -0
  19. data/spec/legion/extensions/agentic/defense/confabulation/runners/confabulation_spec.rb +25 -0
  20. data/spec/legion/extensions/agentic/defense/dissonance/actors/update_spec.rb +45 -0
  21. data/spec/legion/extensions/agentic/defense/erosion/actors/weather_spec.rb +45 -0
  22. data/spec/legion/extensions/agentic/defense/immune_response/actors/decay_spec.rb +45 -0
  23. data/spec/legion/extensions/agentic/defense/immunology/actors/decay_spec.rb +45 -0
  24. data/spec/legion/extensions/agentic/defense/phantom/actors/decay_spec.rb +45 -0
  25. data/spec/legion/extensions/agentic/defense/whirlpool/actors/tick_spec.rb +45 -0
  26. metadata +22 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 583446b8b39752f9796c8f86906319984b4a8ae9c4b9589a69f70d403b737aad
4
- data.tar.gz: 38add46e9a7209f9f4266db6b6616dd04d6ae98d0e97f1122d5cb34a9ea7823c
3
+ metadata.gz: 438bf1f411bc8c25778ba2b7294eb8f9d2f5b0d917592e2840a8e3fc90456058
4
+ data.tar.gz: d88fb5784d2d8c146f385d04f1b30c0c8347962161ce0f95d317bd2946c3d4c8
5
5
  SHA512:
6
- metadata.gz: 23b0d5d145f941e42167bd0f0d6211b7f560d43794e1b75eaf0a573fbc1323549e6eec52e80ad1b1546a5d633aef1fe4f6adeaf56cbc4415d4b7b1ed329031ab
7
- data.tar.gz: c8c01a2513df60680899b495b7565892fd2d487b46d75db63f8a28adee67f5b94023688ef61a7448b2f66f7f16399ad5431c6c772335e120a0a47055c38358f6
6
+ metadata.gz: 6ea987da729a0f6da4eb313a8e7dbf9363c6bcbd5fdb165ba4849ec7f8a6a30e28e6dba79f1a26ea43709d95d756a61e365502d7d5625228ede0630b28ff9554
7
+ data.tar.gz: df8661c7ddbe9d0ef6271308c2222671049fe8e5895e944fe6d7b1d5598b76c0513f80c6af6148588e8b02bc15a5d1ab0fde0b8b9b33c144368e4c862ab21827
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.9] - 2026-04-22
4
+ ### Fixed
5
+ - Confabulation decay actor now calls `decay_claims` instead of read-only `confabulation_report`; added `decay_claims` method to age out stale unverified claims
6
+ - Extinction `rescue nil` blocks replaced with `rescue StandardError => e` + `log.error`
7
+ ### Added
8
+ - 6 new maintenance actors: ImmuneResponse::Decay (300s), Immunology::Decay (300s), Erosion::Weather (600s), Whirlpool::Tick (60s), Dissonance::Update (300s), Phantom::Decay (300s)
9
+
10
+ ## [0.1.8] - 2026-04-15
11
+ ### Changed
12
+ - Set `mcp_tools?`, `mcp_tools_deferred?`, and `transport_required?` to `false` — internal cognitive pipeline extension
13
+
3
14
  ## [0.1.7] - 2026-03-30
4
15
 
5
16
  ### Changed
data/README.md CHANGED
@@ -1,40 +1,52 @@
1
1
  # lex-agentic-defense
2
2
 
3
- Domain consolidation gem for cognitive defense, immunity, and error management. Bundles 15 source extensions into one loadable unit under `Legion::Extensions::Agentic::Defense`.
3
+ Domain consolidation gem for cognitive defense, immunity, and error management. Bundles 15 sub-modules into one loadable unit under `Legion::Extensions::Agentic::Defense`.
4
4
 
5
5
  ## Overview
6
6
 
7
7
  **Gem**: `lex-agentic-defense`
8
- **Version**: 0.1.5
8
+ **Version**: 0.1.9
9
9
  **Namespace**: `Legion::Extensions::Agentic::Defense`
10
10
 
11
11
  ## Sub-Modules
12
12
 
13
- | Sub-Module | Source Gem | Purpose |
14
- |---|---|---|
15
- | `Defense::ImmuneResponse` | `lex-cognitive-immune-response` | Active defense responses to cognitive threats |
16
- | `Defense::Immunology` | `lex-cognitive-immunology` | Immune system modeling for belief protection |
17
- | `Defense::Erosion` | `lex-cognitive-erosion` | Gradual degradation of outdated beliefs |
18
- | `Defense::Friction` | `lex-cognitive-friction` | Resistance to undesired belief or behavior change |
19
- | `Defense::Quicksand` | `lex-cognitive-quicksand` | Entrapment patterns — stuck states |
20
- | `Defense::Quicksilver` | `lex-cognitive-quicksilver` | Rapid adaptive response to threats |
21
- | `Defense::Phantom` | `lex-cognitive-phantom` | Phantom cognitive states — residual patterns after removal |
22
- | `Defense::EpistemicVigilance` | `lex-epistemic-vigilance` | Critical evaluation of incoming information, deception detection |
23
- | `Defense::Bias` | `lex-bias` | Cognitive bias catalog and de-biasing strategies |
24
- | `Defense::Confabulation` | `lex-confabulation` | False memory generation detection |
25
- | `Defense::Dissonance` | `lex-dissonance` | Cognitive dissonance detection and reduction |
26
- | `Defense::ErrorMonitoring` | `lex-error-monitoring` | ACC error monitoring — anterior cingulate analog |
27
- | `Defense::Extinction` | `lex-extinction` | Four-level containment ladder with authority-gated escalation |
28
- | `Defense::Avalanche` | `lex-cognitive-avalanche` | Cascading cognitive failure detection |
29
- | `Defense::Whirlpool` | `lex-cognitive-whirlpool` | Circular/recursive thought pattern detection |
13
+ | Sub-Module | Purpose |
14
+ |---|---|
15
+ | `Defense::ImmuneResponse` | Reactive immune memory antigen/antibody matching, vaccination, immunity decay |
16
+ | `Defense::Immunology` | Proactive threat detection and resistance building |
17
+ | `Defense::Erosion` | Gradual degradation of outdated beliefs |
18
+ | `Defense::Friction` | Resistance to undesired belief or behavior change |
19
+ | `Defense::Quicksand` | Entrapment patterns — stuck states |
20
+ | `Defense::Quicksilver` | Rapid adaptive response to threats |
21
+ | `Defense::Phantom` | Phantom cognitive states — residual patterns after removal |
22
+ | `Defense::EpistemicVigilance` | Critical evaluation of incoming information, deception detection |
23
+ | `Defense::Bias` | Cognitive bias catalog and de-biasing strategies |
24
+ | `Defense::Confabulation` | False memory generation detection and claim decay |
25
+ | `Defense::Dissonance` | Cognitive dissonance detection and reduction |
26
+ | `Defense::ErrorMonitoring` | ACC error monitoring — anterior cingulate analog |
27
+ | `Defense::Extinction` | Four-level containment ladder with authority-gated escalation |
28
+ | `Defense::Avalanche` | Cascading cognitive failure detection |
29
+ | `Defense::Whirlpool` | Circular/recursive thought pattern detection |
30
30
 
31
31
  ## Actors
32
32
 
33
- - `Defense::Bias::Actors::Update` — interval actor, updates bias calibration state
34
- - `Defense::Confabulation::Actors::Decay` — interval actor, decays confabulation detections
35
- - `Defense::EpistemicVigilance::Actors::Update` — interval actor, updates vigilance baseline
36
- - `Defense::ErrorMonitoring::Actors::Tick` — interval actor, runs error monitoring tick
37
- - `Defense::Extinction::Actors::ProtocolMonitor` — runs every 300s, monitors containment protocol state
33
+ 11 interval-based actors handle autonomous background processing:
34
+
35
+ - `Defense::Bias::Actor::Update` — every 60s, updates bias calibration
36
+ - `Defense::Confabulation::Actor::Decay` — every 300s, decays unverified claims
37
+ - `Defense::Dissonance::Actor::Update` — every 300s, updates dissonance model
38
+ - `Defense::EpistemicVigilance::Actor::Update` — every 300s, updates vigilance baseline
39
+ - `Defense::ErrorMonitoring::Actor::Tick` — every 15s, runs error monitoring tick
40
+ - `Defense::Erosion::Actor::Weather` — every 600s, weathers belief formations
41
+ - `Defense::Extinction::Actor::ProtocolMonitor` — every 300s, monitors containment protocol state
42
+ - `Defense::ImmuneResponse::Actor::Decay` — every 300s, decays immune responses
43
+ - `Defense::Immunology::Actor::Decay` — every 300s, decays immunological resistance
44
+ - `Defense::Phantom::Actor::Decay` — every 300s, decays phantom states
45
+ - `Defense::Whirlpool::Actor::Tick` — every 60s, ticks whirlpool detection
46
+
47
+ ## Safety Note
48
+
49
+ `Defense::Extinction` level 4 is **irreversible** and triggers cryptographic erasure. Level escalation requires authority-gated governance approval.
38
50
 
39
51
  ## Installation
40
52
 
@@ -46,8 +58,8 @@ gem 'lex-agentic-defense'
46
58
 
47
59
  ```bash
48
60
  bundle install
49
- bundle exec rspec # 1713 examples, 0 failures
50
- bundle exec rubocop # 0 offenses
61
+ bundle exec rspec
62
+ bundle exec rubocop
51
63
  ```
52
64
 
53
65
  ## License
@@ -32,6 +32,6 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency 'legion-settings', '>= 1.3.14'
33
33
  spec.add_dependency 'legion-transport', '>= 1.3.9'
34
34
  spec.add_development_dependency 'rspec', '~> 3.13'
35
- spec.add_development_dependency 'rubocop', '~> 1.75'
36
- spec.add_development_dependency 'rubocop-rspec', '~> 2.26'
35
+ spec.add_development_dependency 'rubocop'
36
+ spec.add_development_dependency 'rubocop-rspec'
37
37
  end
@@ -14,7 +14,7 @@ module Legion
14
14
  end
15
15
 
16
16
  def runner_function
17
- 'confabulation_report'
17
+ 'decay_claims'
18
18
  end
19
19
 
20
20
  def time
@@ -60,6 +60,16 @@ module Legion
60
60
  { engine: confabulation_engine.to_h }
61
61
  end
62
62
 
63
+ def decay_claims(max_age_seconds: 3600, **)
64
+ engine = confabulation_engine
65
+ before = engine.claims.size
66
+ cutoff = Time.now.utc - max_age_seconds
67
+ engine.claims.reject! { |_id, claim| !claim.verified && claim.created_at < cutoff }
68
+ removed = before - engine.claims.size
69
+ log.info("[confabulation] decay: removed=#{removed} remaining=#{engine.claims.size}")
70
+ { removed: removed, remaining: engine.claims.size }
71
+ end
72
+
63
73
  private
64
74
 
65
75
  def confabulation_engine
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Defense
9
+ module Dissonance
10
+ module Actor
11
+ class Update < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Defense::Dissonance::Runners::Dissonance
14
+ end
15
+
16
+ def runner_function
17
+ 'update_dissonance'
18
+ end
19
+
20
+ def time
21
+ 300
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Defense
9
+ module Erosion
10
+ module Actor
11
+ class Weather < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Defense::Erosion::Runners::CognitiveErosion
14
+ end
15
+
16
+ def runner_function
17
+ 'weather_all'
18
+ end
19
+
20
+ def time
21
+ 600
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -73,15 +73,23 @@ module Legion
73
73
 
74
74
  def enforce_escalation_effects(level)
75
75
  if level >= 1 && defined?(Legion::Extensions::Mesh::Runners::Mesh)
76
- Legion::Extensions::Mesh::Runners::Mesh.disconnect rescue nil # rubocop:disable Style/RescueModifier
77
- log.warn('[extinction] mesh isolation enforced')
76
+ begin
77
+ Legion::Extensions::Mesh::Runners::Mesh.disconnect
78
+ log.warn('[extinction] mesh isolation enforced')
79
+ rescue StandardError => e
80
+ log.error("[extinction] mesh isolation failed: #{e.message}")
81
+ end
78
82
  end
79
83
 
80
84
  return unless level == 4
81
85
 
82
86
  if defined?(Legion::Extensions::Privatecore::Runners::Privatecore)
83
- Legion::Extensions::Privatecore::Runners::Privatecore.erase_all rescue nil # rubocop:disable Style/RescueModifier
84
- log.warn('[extinction] cryptographic erasure triggered')
87
+ begin
88
+ Legion::Extensions::Privatecore::Runners::Privatecore.erase_all
89
+ log.warn('[extinction] cryptographic erasure triggered')
90
+ rescue StandardError => e
91
+ log.error("[extinction] cryptographic erasure failed: #{e.message}")
92
+ end
85
93
  end
86
94
 
87
95
  if defined?(Legion::Data::Model::DigitalWorker)
@@ -89,10 +97,10 @@ module Legion
89
97
  Legion::Data::Model::DigitalWorker.where(lifecycle_state: 'active').update(
90
98
  lifecycle_state: 'terminated', updated_at: Time.now.utc
91
99
  )
92
- rescue StandardError => _e
93
- nil
100
+ log.warn('[extinction] all active workers terminated')
101
+ rescue StandardError => e
102
+ log.error("[extinction] worker termination failed: #{e.message}")
94
103
  end
95
- log.warn('[extinction] all active workers terminated')
96
104
  end
97
105
 
98
106
  return unless defined?(Legion::Extensions::Apollo::Runners::Knowledge)
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Defense
9
+ module ImmuneResponse
10
+ module Actor
11
+ class Decay < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Defense::ImmuneResponse::Runners::CognitiveImmuneResponse
14
+ end
15
+
16
+ def runner_function
17
+ 'decay_all'
18
+ end
19
+
20
+ def time
21
+ 300
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,5 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # immune_response = reactive immune memory (antigen -> antibody matching).
4
+ # Tracks encountered threats, builds antibodies through exposure, and decays
5
+ # immunity over time. Contrast with immunology/ which handles proactive
6
+ # threat detection and resistance building.
7
+
3
8
  module Legion
4
9
  module Extensions
5
10
  module Agentic
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Defense
9
+ module Immunology
10
+ module Actor
11
+ class Decay < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Defense::Immunology::Runners::CognitiveImmunology
14
+ end
15
+
16
+ def runner_function
17
+ 'decay_all'
18
+ end
19
+
20
+ def time
21
+ 300
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,5 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # immunology = proactive threat detection and resistance building.
4
+ # Scans for adversarial tactics, quarantines threats, creates defensive
5
+ # antibodies, and manages inflammatory responses. Contrast with
6
+ # immune_response/ which handles reactive antigen-antibody memory.
7
+
3
8
  module Legion
4
9
  module Extensions
5
10
  module Agentic
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Defense
9
+ module Phantom
10
+ module Actor
11
+ class Decay < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Defense::Phantom::Runners::CognitivePhantom
14
+ end
15
+
16
+ def runner_function
17
+ 'decay_all'
18
+ end
19
+
20
+ def time
21
+ 300
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -4,7 +4,7 @@ module Legion
4
4
  module Extensions
5
5
  module Agentic
6
6
  module Defense
7
- VERSION = '0.1.7'
7
+ VERSION = '0.1.9'
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/actors/every'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module Agentic
8
+ module Defense
9
+ module Whirlpool
10
+ module Actor
11
+ class Tick < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
12
+ def runner_class
13
+ Legion::Extensions::Agentic::Defense::Whirlpool::Runners::CognitiveWhirlpool
14
+ end
15
+
16
+ def runner_function
17
+ 'tick_all'
18
+ end
19
+
20
+ def time
21
+ 60
22
+ end
23
+
24
+ def run_now?
25
+ false
26
+ end
27
+
28
+ def use_runner?
29
+ false
30
+ end
31
+
32
+ def check_subtask?
33
+ false
34
+ end
35
+
36
+ def generate_task?
37
+ false
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -26,6 +26,18 @@ module Legion
26
26
  def self.remote_invocable?
27
27
  false
28
28
  end
29
+
30
+ def self.mcp_tools?
31
+ false
32
+ end
33
+
34
+ def self.mcp_tools_deferred?
35
+ false
36
+ end
37
+
38
+ def self.transport_required?
39
+ false
40
+ end
29
41
  end
30
42
  end
31
43
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Actors
6
+ class Every; end # rubocop:disable Lint/EmptyClass
7
+ end
8
+ end
9
+ end
10
+
11
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
12
+
13
+ require_relative '../../../../../../../lib/legion/extensions/agentic/defense/confabulation/actors/decay'
14
+
15
+ RSpec.describe Legion::Extensions::Agentic::Defense::Confabulation::Actor::Decay do
16
+ subject(:actor) { described_class.new }
17
+
18
+ describe '#runner_class' do
19
+ it { expect(actor.runner_class).to eq Legion::Extensions::Agentic::Defense::Confabulation::Runners::Confabulation }
20
+ end
21
+
22
+ describe '#runner_function' do
23
+ it { expect(actor.runner_function).to eq 'decay_claims' }
24
+ end
25
+
26
+ describe '#time' do
27
+ it { expect(actor.time).to eq 300 }
28
+ end
29
+
30
+ describe '#run_now?' do
31
+ it { expect(actor.run_now?).to be false }
32
+ end
33
+
34
+ describe '#use_runner?' do
35
+ it { expect(actor.use_runner?).to be false }
36
+ end
37
+
38
+ describe '#check_subtask?' do
39
+ it { expect(actor.check_subtask?).to be false }
40
+ end
41
+
42
+ describe '#generate_task?' do
43
+ it { expect(actor.generate_task?).to be false }
44
+ end
45
+ end
@@ -99,6 +99,31 @@ RSpec.describe Legion::Extensions::Agentic::Defense::Confabulation::Runners::Con
99
99
  end
100
100
  end
101
101
 
102
+ describe '#decay_claims' do
103
+ it 'removes unverified claims older than max_age_seconds' do
104
+ client.register_claim(content: 'stale claim', claim_type: :factual, confidence: 0.5, evidence_strength: 0.1)
105
+ result = client.decay_claims(max_age_seconds: -1)
106
+ expect(result).to have_key(:removed)
107
+ expect(result).to have_key(:remaining)
108
+ expect(result[:removed]).to eq(1)
109
+ end
110
+
111
+ it 'retains claims newer than max_age_seconds' do
112
+ client.register_claim(content: 'fresh claim', claim_type: :factual, confidence: 0.5, evidence_strength: 0.5)
113
+ result = client.decay_claims(max_age_seconds: 3600)
114
+ expect(result[:removed]).to eq(0)
115
+ expect(result[:remaining]).to eq(1)
116
+ end
117
+
118
+ it 'does not remove verified claims' do
119
+ claim = client.register_claim(content: 'verified claim', claim_type: :factual,
120
+ confidence: 0.6, evidence_strength: 0.6)
121
+ client.verify_claim(claim_id: claim[:id])
122
+ result = client.decay_claims(max_age_seconds: -1)
123
+ expect(result[:removed]).to eq(0)
124
+ end
125
+ end
126
+
102
127
  describe 'full cycle' do
103
128
  it 'registers, verifies, flags and reports correctly' do
104
129
  c1 = client.register_claim(content: 'valid fact', claim_type: :factual,
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Actors
6
+ class Every; end # rubocop:disable Lint/EmptyClass
7
+ end
8
+ end
9
+ end
10
+
11
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
12
+
13
+ require_relative '../../../../../../../lib/legion/extensions/agentic/defense/dissonance/actors/update'
14
+
15
+ RSpec.describe Legion::Extensions::Agentic::Defense::Dissonance::Actor::Update do
16
+ subject(:actor) { described_class.new }
17
+
18
+ describe '#runner_class' do
19
+ it { expect(actor.runner_class).to eq Legion::Extensions::Agentic::Defense::Dissonance::Runners::Dissonance }
20
+ end
21
+
22
+ describe '#runner_function' do
23
+ it { expect(actor.runner_function).to eq 'update_dissonance' }
24
+ end
25
+
26
+ describe '#time' do
27
+ it { expect(actor.time).to eq 300 }
28
+ end
29
+
30
+ describe '#run_now?' do
31
+ it { expect(actor.run_now?).to be false }
32
+ end
33
+
34
+ describe '#use_runner?' do
35
+ it { expect(actor.use_runner?).to be false }
36
+ end
37
+
38
+ describe '#check_subtask?' do
39
+ it { expect(actor.check_subtask?).to be false }
40
+ end
41
+
42
+ describe '#generate_task?' do
43
+ it { expect(actor.generate_task?).to be false }
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Actors
6
+ class Every; end # rubocop:disable Lint/EmptyClass
7
+ end
8
+ end
9
+ end
10
+
11
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
12
+
13
+ require_relative '../../../../../../../lib/legion/extensions/agentic/defense/erosion/actors/weather'
14
+
15
+ RSpec.describe Legion::Extensions::Agentic::Defense::Erosion::Actor::Weather do
16
+ subject(:actor) { described_class.new }
17
+
18
+ describe '#runner_class' do
19
+ it { expect(actor.runner_class).to eq Legion::Extensions::Agentic::Defense::Erosion::Runners::CognitiveErosion }
20
+ end
21
+
22
+ describe '#runner_function' do
23
+ it { expect(actor.runner_function).to eq 'weather_all' }
24
+ end
25
+
26
+ describe '#time' do
27
+ it { expect(actor.time).to eq 600 }
28
+ end
29
+
30
+ describe '#run_now?' do
31
+ it { expect(actor.run_now?).to be false }
32
+ end
33
+
34
+ describe '#use_runner?' do
35
+ it { expect(actor.use_runner?).to be false }
36
+ end
37
+
38
+ describe '#check_subtask?' do
39
+ it { expect(actor.check_subtask?).to be false }
40
+ end
41
+
42
+ describe '#generate_task?' do
43
+ it { expect(actor.generate_task?).to be false }
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Actors
6
+ class Every; end # rubocop:disable Lint/EmptyClass
7
+ end
8
+ end
9
+ end
10
+
11
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
12
+
13
+ require_relative '../../../../../../../lib/legion/extensions/agentic/defense/immune_response/actors/decay'
14
+
15
+ RSpec.describe Legion::Extensions::Agentic::Defense::ImmuneResponse::Actor::Decay do
16
+ subject(:actor) { described_class.new }
17
+
18
+ describe '#runner_class' do
19
+ it { expect(actor.runner_class).to eq Legion::Extensions::Agentic::Defense::ImmuneResponse::Runners::CognitiveImmuneResponse }
20
+ end
21
+
22
+ describe '#runner_function' do
23
+ it { expect(actor.runner_function).to eq 'decay_all' }
24
+ end
25
+
26
+ describe '#time' do
27
+ it { expect(actor.time).to eq 300 }
28
+ end
29
+
30
+ describe '#run_now?' do
31
+ it { expect(actor.run_now?).to be false }
32
+ end
33
+
34
+ describe '#use_runner?' do
35
+ it { expect(actor.use_runner?).to be false }
36
+ end
37
+
38
+ describe '#check_subtask?' do
39
+ it { expect(actor.check_subtask?).to be false }
40
+ end
41
+
42
+ describe '#generate_task?' do
43
+ it { expect(actor.generate_task?).to be false }
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Actors
6
+ class Every; end # rubocop:disable Lint/EmptyClass
7
+ end
8
+ end
9
+ end
10
+
11
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
12
+
13
+ require_relative '../../../../../../../lib/legion/extensions/agentic/defense/immunology/actors/decay'
14
+
15
+ RSpec.describe Legion::Extensions::Agentic::Defense::Immunology::Actor::Decay do
16
+ subject(:actor) { described_class.new }
17
+
18
+ describe '#runner_class' do
19
+ it { expect(actor.runner_class).to eq Legion::Extensions::Agentic::Defense::Immunology::Runners::CognitiveImmunology }
20
+ end
21
+
22
+ describe '#runner_function' do
23
+ it { expect(actor.runner_function).to eq 'decay_all' }
24
+ end
25
+
26
+ describe '#time' do
27
+ it { expect(actor.time).to eq 300 }
28
+ end
29
+
30
+ describe '#run_now?' do
31
+ it { expect(actor.run_now?).to be false }
32
+ end
33
+
34
+ describe '#use_runner?' do
35
+ it { expect(actor.use_runner?).to be false }
36
+ end
37
+
38
+ describe '#check_subtask?' do
39
+ it { expect(actor.check_subtask?).to be false }
40
+ end
41
+
42
+ describe '#generate_task?' do
43
+ it { expect(actor.generate_task?).to be false }
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Actors
6
+ class Every; end # rubocop:disable Lint/EmptyClass
7
+ end
8
+ end
9
+ end
10
+
11
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
12
+
13
+ require_relative '../../../../../../../lib/legion/extensions/agentic/defense/phantom/actors/decay'
14
+
15
+ RSpec.describe Legion::Extensions::Agentic::Defense::Phantom::Actor::Decay do
16
+ subject(:actor) { described_class.new }
17
+
18
+ describe '#runner_class' do
19
+ it { expect(actor.runner_class).to eq Legion::Extensions::Agentic::Defense::Phantom::Runners::CognitivePhantom }
20
+ end
21
+
22
+ describe '#runner_function' do
23
+ it { expect(actor.runner_function).to eq 'decay_all' }
24
+ end
25
+
26
+ describe '#time' do
27
+ it { expect(actor.time).to eq 300 }
28
+ end
29
+
30
+ describe '#run_now?' do
31
+ it { expect(actor.run_now?).to be false }
32
+ end
33
+
34
+ describe '#use_runner?' do
35
+ it { expect(actor.use_runner?).to be false }
36
+ end
37
+
38
+ describe '#check_subtask?' do
39
+ it { expect(actor.check_subtask?).to be false }
40
+ end
41
+
42
+ describe '#generate_task?' do
43
+ it { expect(actor.generate_task?).to be false }
44
+ end
45
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Legion
4
+ module Extensions
5
+ module Actors
6
+ class Every; end # rubocop:disable Lint/EmptyClass
7
+ end
8
+ end
9
+ end
10
+
11
+ $LOADED_FEATURES << 'legion/extensions/actors/every'
12
+
13
+ require_relative '../../../../../../../lib/legion/extensions/agentic/defense/whirlpool/actors/tick'
14
+
15
+ RSpec.describe Legion::Extensions::Agentic::Defense::Whirlpool::Actor::Tick do
16
+ subject(:actor) { described_class.new }
17
+
18
+ describe '#runner_class' do
19
+ it { expect(actor.runner_class).to eq Legion::Extensions::Agentic::Defense::Whirlpool::Runners::CognitiveWhirlpool }
20
+ end
21
+
22
+ describe '#runner_function' do
23
+ it { expect(actor.runner_function).to eq 'tick_all' }
24
+ end
25
+
26
+ describe '#time' do
27
+ it { expect(actor.time).to eq 60 }
28
+ end
29
+
30
+ describe '#run_now?' do
31
+ it { expect(actor.run_now?).to be false }
32
+ end
33
+
34
+ describe '#use_runner?' do
35
+ it { expect(actor.use_runner?).to be false }
36
+ end
37
+
38
+ describe '#check_subtask?' do
39
+ it { expect(actor.check_subtask?).to be false }
40
+ end
41
+
42
+ describe '#generate_task?' do
43
+ it { expect(actor.generate_task?).to be false }
44
+ end
45
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-agentic-defense
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -125,30 +125,30 @@ dependencies:
125
125
  name: rubocop
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - "~>"
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
- version: '1.75'
130
+ version: '0'
131
131
  type: :development
132
132
  prerelease: false
133
133
  version_requirements: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - "~>"
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
- version: '1.75'
137
+ version: '0'
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: rubocop-rspec
140
140
  requirement: !ruby/object:Gem::Requirement
141
141
  requirements:
142
- - - "~>"
142
+ - - ">="
143
143
  - !ruby/object:Gem::Version
144
- version: '2.26'
144
+ version: '0'
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - "~>"
149
+ - - ">="
150
150
  - !ruby/object:Gem::Version
151
- version: '2.26'
151
+ version: '0'
152
152
  description: 'LEX agentic defense domain: threat detection, stress response, boundaries'
153
153
  email:
154
154
  - matthewdiverson@gmail.com
@@ -188,6 +188,7 @@ files:
188
188
  - lib/legion/extensions/agentic/defense/confabulation/runners/confabulation.rb
189
189
  - lib/legion/extensions/agentic/defense/confabulation/version.rb
190
190
  - lib/legion/extensions/agentic/defense/dissonance.rb
191
+ - lib/legion/extensions/agentic/defense/dissonance/actors/update.rb
191
192
  - lib/legion/extensions/agentic/defense/dissonance/client.rb
192
193
  - lib/legion/extensions/agentic/defense/dissonance/helpers/belief.rb
193
194
  - lib/legion/extensions/agentic/defense/dissonance/helpers/constants.rb
@@ -206,6 +207,7 @@ files:
206
207
  - lib/legion/extensions/agentic/defense/epistemic_vigilance/runners/epistemic_vigilance.rb
207
208
  - lib/legion/extensions/agentic/defense/epistemic_vigilance/version.rb
208
209
  - lib/legion/extensions/agentic/defense/erosion.rb
210
+ - lib/legion/extensions/agentic/defense/erosion/actors/weather.rb
209
211
  - lib/legion/extensions/agentic/defense/erosion/client.rb
210
212
  - lib/legion/extensions/agentic/defense/erosion/helpers/channel.rb
211
213
  - lib/legion/extensions/agentic/defense/erosion/helpers/constants.rb
@@ -237,6 +239,7 @@ files:
237
239
  - lib/legion/extensions/agentic/defense/friction/runners/cognitive_friction.rb
238
240
  - lib/legion/extensions/agentic/defense/friction/version.rb
239
241
  - lib/legion/extensions/agentic/defense/immune_response.rb
242
+ - lib/legion/extensions/agentic/defense/immune_response/actors/decay.rb
240
243
  - lib/legion/extensions/agentic/defense/immune_response/client.rb
241
244
  - lib/legion/extensions/agentic/defense/immune_response/helpers/antibody.rb
242
245
  - lib/legion/extensions/agentic/defense/immune_response/helpers/antigen.rb
@@ -246,6 +249,7 @@ files:
246
249
  - lib/legion/extensions/agentic/defense/immune_response/runners/cognitive_immune_response.rb
247
250
  - lib/legion/extensions/agentic/defense/immune_response/version.rb
248
251
  - lib/legion/extensions/agentic/defense/immunology.rb
252
+ - lib/legion/extensions/agentic/defense/immunology/actors/decay.rb
249
253
  - lib/legion/extensions/agentic/defense/immunology/client.rb
250
254
  - lib/legion/extensions/agentic/defense/immunology/helpers/antibody.rb
251
255
  - lib/legion/extensions/agentic/defense/immunology/helpers/constants.rb
@@ -254,6 +258,7 @@ files:
254
258
  - lib/legion/extensions/agentic/defense/immunology/runners/cognitive_immunology.rb
255
259
  - lib/legion/extensions/agentic/defense/immunology/version.rb
256
260
  - lib/legion/extensions/agentic/defense/phantom.rb
261
+ - lib/legion/extensions/agentic/defense/phantom/actors/decay.rb
257
262
  - lib/legion/extensions/agentic/defense/phantom/client.rb
258
263
  - lib/legion/extensions/agentic/defense/phantom/helpers/constants.rb
259
264
  - lib/legion/extensions/agentic/defense/phantom/helpers/phantom_engine.rb
@@ -279,6 +284,7 @@ files:
279
284
  - lib/legion/extensions/agentic/defense/quicksilver/version.rb
280
285
  - lib/legion/extensions/agentic/defense/version.rb
281
286
  - lib/legion/extensions/agentic/defense/whirlpool.rb
287
+ - lib/legion/extensions/agentic/defense/whirlpool/actors/tick.rb
282
288
  - lib/legion/extensions/agentic/defense/whirlpool/client.rb
283
289
  - lib/legion/extensions/agentic/defense/whirlpool/helpers/captured_thought.rb
284
290
  - lib/legion/extensions/agentic/defense/whirlpool/helpers/constants.rb
@@ -297,11 +303,13 @@ files:
297
303
  - spec/legion/extensions/agentic/defense/bias/helpers/bias_event_spec.rb
298
304
  - spec/legion/extensions/agentic/defense/bias/helpers/bias_store_spec.rb
299
305
  - spec/legion/extensions/agentic/defense/bias/runners/bias_spec.rb
306
+ - spec/legion/extensions/agentic/defense/confabulation/actors/decay_spec.rb
300
307
  - spec/legion/extensions/agentic/defense/confabulation/client_spec.rb
301
308
  - spec/legion/extensions/agentic/defense/confabulation/helpers/claim_spec.rb
302
309
  - spec/legion/extensions/agentic/defense/confabulation/helpers/confabulation_engine_spec.rb
303
310
  - spec/legion/extensions/agentic/defense/confabulation/helpers/constants_spec.rb
304
311
  - spec/legion/extensions/agentic/defense/confabulation/runners/confabulation_spec.rb
312
+ - spec/legion/extensions/agentic/defense/dissonance/actors/update_spec.rb
305
313
  - spec/legion/extensions/agentic/defense/dissonance/client_spec.rb
306
314
  - spec/legion/extensions/agentic/defense/dissonance/helpers/belief_spec.rb
307
315
  - spec/legion/extensions/agentic/defense/dissonance/helpers/constants_spec.rb
@@ -314,6 +322,7 @@ files:
314
322
  - spec/legion/extensions/agentic/defense/epistemic_vigilance/helpers/source_spec.rb
315
323
  - spec/legion/extensions/agentic/defense/epistemic_vigilance/helpers/vigilance_engine_spec.rb
316
324
  - spec/legion/extensions/agentic/defense/epistemic_vigilance/runners/epistemic_vigilance_spec.rb
325
+ - spec/legion/extensions/agentic/defense/erosion/actors/weather_spec.rb
317
326
  - spec/legion/extensions/agentic/defense/erosion/client_spec.rb
318
327
  - spec/legion/extensions/agentic/defense/erosion/helpers/channel_spec.rb
319
328
  - spec/legion/extensions/agentic/defense/erosion/helpers/constants_spec.rb
@@ -334,6 +343,7 @@ files:
334
343
  - spec/legion/extensions/agentic/defense/friction/helpers/friction_engine_spec.rb
335
344
  - spec/legion/extensions/agentic/defense/friction/helpers/state_transition_spec.rb
336
345
  - spec/legion/extensions/agentic/defense/friction/runners/cognitive_friction_spec.rb
346
+ - spec/legion/extensions/agentic/defense/immune_response/actors/decay_spec.rb
337
347
  - spec/legion/extensions/agentic/defense/immune_response/client_spec.rb
338
348
  - spec/legion/extensions/agentic/defense/immune_response/cognitive_immune_response_spec.rb
339
349
  - spec/legion/extensions/agentic/defense/immune_response/helpers/antibody_spec.rb
@@ -342,12 +352,14 @@ files:
342
352
  - spec/legion/extensions/agentic/defense/immune_response/helpers/immune_engine_spec.rb
343
353
  - spec/legion/extensions/agentic/defense/immune_response/helpers/immune_response_spec.rb
344
354
  - spec/legion/extensions/agentic/defense/immune_response/runners_spec.rb
355
+ - spec/legion/extensions/agentic/defense/immunology/actors/decay_spec.rb
345
356
  - spec/legion/extensions/agentic/defense/immunology/client_spec.rb
346
357
  - spec/legion/extensions/agentic/defense/immunology/helpers/antibody_spec.rb
347
358
  - spec/legion/extensions/agentic/defense/immunology/helpers/constants_spec.rb
348
359
  - spec/legion/extensions/agentic/defense/immunology/helpers/immune_engine_spec.rb
349
360
  - spec/legion/extensions/agentic/defense/immunology/helpers/threat_spec.rb
350
361
  - spec/legion/extensions/agentic/defense/immunology/runners/cognitive_immunology_spec.rb
362
+ - spec/legion/extensions/agentic/defense/phantom/actors/decay_spec.rb
351
363
  - spec/legion/extensions/agentic/defense/phantom/client_spec.rb
352
364
  - spec/legion/extensions/agentic/defense/phantom/helpers/constants_spec.rb
353
365
  - spec/legion/extensions/agentic/defense/phantom/helpers/phantom_engine_spec.rb
@@ -366,6 +378,7 @@ files:
366
378
  - spec/legion/extensions/agentic/defense/quicksilver/helpers/pool_spec.rb
367
379
  - spec/legion/extensions/agentic/defense/quicksilver/helpers/quicksilver_engine_spec.rb
368
380
  - spec/legion/extensions/agentic/defense/quicksilver/runners/cognitive_quicksilver_spec.rb
381
+ - spec/legion/extensions/agentic/defense/whirlpool/actors/tick_spec.rb
369
382
  - spec/legion/extensions/agentic/defense/whirlpool/client_spec.rb
370
383
  - spec/legion/extensions/agentic/defense/whirlpool/helpers/captured_thought_spec.rb
371
384
  - spec/legion/extensions/agentic/defense/whirlpool/helpers/constants_spec.rb