lex-agentic-self 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +46 -3
- data/lib/legion/extensions/agentic/self/architecture/helpers/architecture_engine.rb +8 -0
- data/lib/legion/extensions/agentic/self/architecture/version.rb +1 -1
- data/lib/legion/extensions/agentic/self/narrative_identity/helpers/narrative_engine.rb +4 -0
- data/lib/legion/extensions/agentic/self/narrative_identity/version.rb +1 -1
- data/lib/legion/extensions/agentic/self/version.rb +1 -1
- data/spec/legion/extensions/agentic/self/architecture/helpers/architecture_engine_spec.rb +24 -0
- data/spec/legion/extensions/agentic/self/narrative_identity/helpers/narrative_engine_spec.rb +24 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2d8b77eb5ec95e5f1ca51b1e58e7aa86999de7bda365e0771180dfdd06ff0d53
|
|
4
|
+
data.tar.gz: 7b0951301d43d15e5e7e198a7ab74a6a026afd0dc9c9b859d2b7a7c16efe4c1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 331f1b725ee8c2b93b654032318a0e3ab3bd371491d444d72914f81c0449df2d3ea4300b628c2d097af0275d7659d8138d44dddcece8901daf15ca34ad0f1bb5
|
|
7
|
+
data.tar.gz: c9687bd1e633d47a9abf4b4e6d3362950682047b5212c4ff32817264e3a45094673a48a33c702543409fa74ec6cf2a48e9203e23674ab34bad34b2a9083b9dcd
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.1.1] - 2026-03-18
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Enforce SUBSYSTEM_TYPES validation in Architecture::ArchitectureEngine#register_subsystem (raises ArgumentError)
|
|
9
|
+
- Enforce CONNECTION_TYPES validation in Architecture::ArchitectureEngine#create_connection (raises ArgumentError)
|
|
10
|
+
- Enforce EPISODE_TYPES validation in NarrativeIdentity::NarrativeEngine#add_episode (returns nil)
|
|
11
|
+
- Enforce THEME_TYPES validation in NarrativeIdentity::NarrativeEngine#add_theme (returns nil)
|
|
12
|
+
|
|
5
13
|
## [0.1.0] - 2026-03-18
|
|
6
14
|
|
|
7
15
|
### Added
|
data/README.md
CHANGED
|
@@ -1,13 +1,56 @@
|
|
|
1
1
|
# lex-agentic-self
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Domain consolidation gem for self-model, identity, metacognition, and self-awareness. Bundles 16 source extensions into one loadable unit under `Legion::Extensions::Agentic::Self`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Gem**: `lex-agentic-self`
|
|
8
|
+
**Version**: 0.1.1
|
|
9
|
+
**Namespace**: `Legion::Extensions::Agentic::Self`
|
|
10
|
+
|
|
11
|
+
## Sub-Modules
|
|
12
|
+
|
|
13
|
+
| Sub-Module | Source Gem | Purpose |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| `Self::Identity` | `lex-identity` | Behavioral fingerprint (6 dimensions, entropy anomaly) + Entra ID binding |
|
|
16
|
+
| `Self::Metacognition` | `lex-metacognition` | Second-order self-model — discovers loaded extensions, maps capabilities |
|
|
17
|
+
| `Self::MetacognitiveMonitoring` | `lex-metacognitive-monitoring` | Continuous confidence calibration, feeling-of-knowing |
|
|
18
|
+
| `Self::SelfModel` | `lex-self-model` | Stable beliefs about capabilities, limitations, and values |
|
|
19
|
+
| `Self::SelfTalk` | `lex-self-talk` | IFS-inspired inner dialogue — typed turns before action |
|
|
20
|
+
| `Self::Reflection` | `lex-reflection` | Post-tick meta-cognitive analysis — seven categories, EMA health scores |
|
|
21
|
+
| `Self::NarrativeArc` | `lex-cognitive-narrative-arc` | McAdams narrative arc — beats, tension, resolution |
|
|
22
|
+
| `Self::NarrativeIdentity` | `lex-narrative-identity` | McAdams narrative identity — the agent's life story |
|
|
23
|
+
| `Self::NarrativeSelf` | `lex-narrative-self` | Minimal self vs. narrative self |
|
|
24
|
+
| `Self::Architecture` | `lex-cognitive-architecture` | Meta-layer graph of cognitive subsystems — bottleneck detection |
|
|
25
|
+
| `Self::Fingerprint` | `lex-cognitive-fingerprint` | Unique cognitive style profile |
|
|
26
|
+
| `Self::Anchor` | `lex-cognitive-anchor` | Stable cognitive anchor points |
|
|
27
|
+
| `Self::Agency` | `lex-agency` | Sense of agency — authorship detection |
|
|
28
|
+
| `Self::Personality` | `lex-personality` | Big Five OCEAN trait model |
|
|
29
|
+
| `Self::Anosognosia` | `lex-anosognosia` | Unawareness of own deficits |
|
|
30
|
+
| `Self::DefaultModeNetwork` | `lex-default-mode-network` | DMN analog — active during self-referential processing |
|
|
31
|
+
|
|
32
|
+
## Actors
|
|
33
|
+
|
|
34
|
+
- `Self::DefaultModeNetwork::Actors::Idle` — interval actor, activates DMN during idle periods
|
|
35
|
+
- `Self::Identity::Actors::CredentialRefresh` — interval actor, refreshes Entra ID credentials
|
|
36
|
+
- `Self::Identity::Actors::OrphanCheck` — runs every 14400s (4hr), checks for orphaned workers
|
|
37
|
+
- `Self::NarrativeIdentity::Actors::NarrativeDecay` — interval actor, decays narrative identity strength
|
|
38
|
+
- `Self::SelfTalk::Actors::VolumeDecay` — runs every 300s, decays inner voice volumes
|
|
8
39
|
|
|
9
40
|
## Installation
|
|
10
41
|
|
|
11
42
|
```ruby
|
|
12
43
|
gem 'lex-agentic-self'
|
|
13
44
|
```
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
bundle install
|
|
50
|
+
bundle exec rspec # 1774 examples, 0 failures
|
|
51
|
+
bundle exec rubocop # 0 offenses
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT
|
|
@@ -15,6 +15,10 @@ module Legion
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def register_subsystem(name:, subsystem_type:, health: Constants::DEFAULT_HEALTH)
|
|
18
|
+
unless Constants::SUBSYSTEM_TYPES.include?(subsystem_type.to_sym)
|
|
19
|
+
raise ArgumentError,
|
|
20
|
+
"invalid subsystem_type: #{subsystem_type.inspect}, must be one of #{Constants::SUBSYSTEM_TYPES}"
|
|
21
|
+
end
|
|
18
22
|
raise ArgumentError, "subsystem '#{name}' already registered" if @subsystems.key?(name.to_sym)
|
|
19
23
|
raise ArgumentError, "max subsystems (#{Constants::MAX_SUBSYSTEMS}) reached" if @subsystems.size >= Constants::MAX_SUBSYSTEMS
|
|
20
24
|
|
|
@@ -24,6 +28,10 @@ module Legion
|
|
|
24
28
|
end
|
|
25
29
|
|
|
26
30
|
def create_connection(source_name:, target_name:, connection_type: :informational, weight: 0.5)
|
|
31
|
+
unless Constants::CONNECTION_TYPES.include?(connection_type.to_sym)
|
|
32
|
+
raise ArgumentError,
|
|
33
|
+
"invalid connection_type: #{connection_type.inspect}, must be one of #{Constants::CONNECTION_TYPES}"
|
|
34
|
+
end
|
|
27
35
|
raise ArgumentError, "max connections (#{Constants::MAX_CONNECTIONS}) reached" if @connections.size >= Constants::MAX_CONNECTIONS
|
|
28
36
|
|
|
29
37
|
source = find_subsystem!(source_name)
|
|
@@ -16,6 +16,8 @@ module Legion
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def add_episode(content:, episode_type:, emotional_valence:, significance:, domain:)
|
|
19
|
+
return nil unless Constants::EPISODE_TYPES.include?(episode_type)
|
|
20
|
+
|
|
19
21
|
prune_episodes! if @episodes.size >= Constants::MAX_EPISODES
|
|
20
22
|
episode = Episode.new(
|
|
21
23
|
content: content,
|
|
@@ -54,6 +56,8 @@ module Legion
|
|
|
54
56
|
end
|
|
55
57
|
|
|
56
58
|
def add_theme(name:, theme_type:)
|
|
59
|
+
return nil unless Constants::THEME_TYPES.include?(theme_type)
|
|
60
|
+
|
|
57
61
|
prune_themes! if @themes.size >= Constants::MAX_THEMES
|
|
58
62
|
theme = Theme.new(name: name, theme_type: theme_type)
|
|
59
63
|
@themes[theme.id] = theme
|
|
@@ -31,6 +31,18 @@ RSpec.describe Legion::Extensions::Agentic::Self::Architecture::Helpers::Archite
|
|
|
31
31
|
sub = engine.register_subsystem(name: :custom, subsystem_type: :safety, health: 0.5)
|
|
32
32
|
expect(sub.health).to eq(0.5)
|
|
33
33
|
end
|
|
34
|
+
|
|
35
|
+
it 'raises on invalid subsystem_type' do
|
|
36
|
+
expect { engine.register_subsystem(name: :bad, subsystem_type: :telekinesis) }
|
|
37
|
+
.to raise_error(ArgumentError, /invalid subsystem_type/)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'accepts all valid SUBSYSTEM_TYPES' do
|
|
41
|
+
constants::SUBSYSTEM_TYPES.each do |stype|
|
|
42
|
+
result = engine.register_subsystem(name: :"sub_#{stype}", subsystem_type: stype)
|
|
43
|
+
expect(result).not_to be_nil
|
|
44
|
+
end
|
|
45
|
+
end
|
|
34
46
|
end
|
|
35
47
|
|
|
36
48
|
describe '#create_connection' do
|
|
@@ -61,6 +73,18 @@ RSpec.describe Legion::Extensions::Agentic::Self::Architecture::Helpers::Archite
|
|
|
61
73
|
expect(conn.connection_type).to eq(:excitatory)
|
|
62
74
|
expect(conn.weight).to eq(0.9)
|
|
63
75
|
end
|
|
76
|
+
|
|
77
|
+
it 'raises on invalid connection_type' do
|
|
78
|
+
expect { engine.create_connection(source_name: :source, target_name: :target, connection_type: :telepathic) }
|
|
79
|
+
.to raise_error(ArgumentError, /invalid connection_type/)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'accepts all valid CONNECTION_TYPES' do
|
|
83
|
+
constants::CONNECTION_TYPES.each do |ctype|
|
|
84
|
+
conn = engine.create_connection(source_name: :source, target_name: :target, connection_type: ctype)
|
|
85
|
+
expect(conn).not_to be_nil
|
|
86
|
+
end
|
|
87
|
+
end
|
|
64
88
|
end
|
|
65
89
|
|
|
66
90
|
describe '#activate_subsystem' do
|
data/spec/legion/extensions/agentic/self/narrative_identity/helpers/narrative_engine_spec.rb
CHANGED
|
@@ -37,6 +37,18 @@ RSpec.describe Legion::Extensions::Agentic::Self::NarrativeIdentity::Helpers::Na
|
|
|
37
37
|
expect(engine.episodes.size).to eq(max)
|
|
38
38
|
expect(engine.episodes.key?(first_ep.id)).to be false
|
|
39
39
|
end
|
|
40
|
+
|
|
41
|
+
it 'rejects invalid episode_type' do
|
|
42
|
+
expect(add_ep(type: :daydream)).to be_nil
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'accepts all valid EPISODE_TYPES' do
|
|
46
|
+
constants = Legion::Extensions::Agentic::Self::NarrativeIdentity::Helpers::Constants
|
|
47
|
+
constants::EPISODE_TYPES.each do |etype|
|
|
48
|
+
result = add_ep(type: etype)
|
|
49
|
+
expect(result).not_to be_nil
|
|
50
|
+
end
|
|
51
|
+
end
|
|
40
52
|
end
|
|
41
53
|
|
|
42
54
|
describe '#create_chapter' do
|
|
@@ -107,6 +119,18 @@ RSpec.describe Legion::Extensions::Agentic::Self::NarrativeIdentity::Helpers::Na
|
|
|
107
119
|
Legion::Extensions::Agentic::Self::NarrativeIdentity::Helpers::Theme
|
|
108
120
|
)
|
|
109
121
|
end
|
|
122
|
+
|
|
123
|
+
it 'rejects invalid theme_type' do
|
|
124
|
+
expect(engine.add_theme(name: 'bad', theme_type: :chaos)).to be_nil
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it 'accepts all valid THEME_TYPES' do
|
|
128
|
+
constants = Legion::Extensions::Agentic::Self::NarrativeIdentity::Helpers::Constants
|
|
129
|
+
constants::THEME_TYPES.each do |ttype|
|
|
130
|
+
result = engine.add_theme(name: "theme_#{ttype}", theme_type: ttype)
|
|
131
|
+
expect(result).not_to be_nil
|
|
132
|
+
end
|
|
133
|
+
end
|
|
110
134
|
end
|
|
111
135
|
|
|
112
136
|
describe '#link_theme' do
|