lex-agentic-self 0.1.11 → 0.1.13
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 +13 -0
- data/README.md +27 -22
- data/lex-agentic-self.gemspec +1 -1
- data/lib/legion/extensions/agentic/self/identity/helpers/vault_secrets.rb +6 -1
- data/lib/legion/extensions/agentic/self/metacognition/helpers/self_model.rb +8 -2
- data/lib/legion/extensions/agentic/self/narrative_self/runners/narrative_self.rb +2 -2
- data/lib/legion/extensions/agentic/self/relationship_arc/runners/relationship_arc.rb +3 -2
- data/lib/legion/extensions/agentic/self/version.rb +1 -1
- data/lib/legion/extensions/agentic/self.rb +49 -0
- data/spec/legion/extensions/agentic/self/narrative_self/client_spec.rb +4 -4
- data/spec/legion/extensions/agentic/self/narrative_self/runners/narrative_self_spec.rb +11 -11
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86842222337e93a3e159eff411592f845792f5fde64fb32691feed47fff7ef7b
|
|
4
|
+
data.tar.gz: 440179ab3ad0a8dde91657cd0e2955a2dae16a2e50fdcdd99b7aff163fcda232
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b180e99b145fc1f272cb29fafa7d09d28fa9b26aa3f5d56b11e6ab3263a31062234625f921ddd2eed47e891063aae2607298cdca21967b28f6072add6efb5184
|
|
7
|
+
data.tar.gz: 84e76ec6b1d8a781ce47f91c63218fefcc6a641068ec76bc0ec1e32aeb30f8da1869737b11c74a015a859b814f1bb69f3af3d2557483fd37970fdf3df24fd858
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.13] - 2026-04-22
|
|
4
|
+
### Added
|
|
5
|
+
- Module-level snapshot methods (`personality_snapshot`, `reflection_snapshot`, `restore_personality`, `restore_reflections`) enabling memory↔self bridge for snapshot save/restore
|
|
6
|
+
- RelationshipArc documented in CLAUDE.md
|
|
7
|
+
### Fixed
|
|
8
|
+
- Faraday moved from development to runtime dependency (was causing LoadError in production)
|
|
9
|
+
- NarrativeSelf `record_episode` renamed to `record_narrative_self_episode` to resolve collision with NarrativeIdentity
|
|
10
|
+
- Silent rescue blocks in vault_secrets, self_model, relationship_arc now log errors
|
|
11
|
+
|
|
12
|
+
## [0.1.12] - 2026-04-15
|
|
13
|
+
### Changed
|
|
14
|
+
- Set `mcp_tools?`, `mcp_tools_deferred?`, and `transport_required?` to `false` — internal cognitive pipeline extension
|
|
15
|
+
|
|
3
16
|
## [0.1.11] - 2026-03-31
|
|
4
17
|
|
|
5
18
|
### Fixed
|
data/README.md
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
# lex-agentic-self
|
|
2
2
|
|
|
3
|
-
Domain consolidation gem for self-model, identity, metacognition, and self-awareness. Bundles
|
|
3
|
+
Domain consolidation gem for self-model, identity, metacognition, and self-awareness. Bundles 17 sub-modules 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.
|
|
8
|
+
**Version**: 0.1.13
|
|
9
9
|
**Namespace**: `Legion::Extensions::Agentic::Self`
|
|
10
10
|
|
|
11
11
|
## Sub-Modules
|
|
12
12
|
|
|
13
|
-
| Sub-Module |
|
|
14
|
-
|
|
15
|
-
| `Self::Identity` |
|
|
16
|
-
| `Self::Metacognition` |
|
|
17
|
-
| `Self::MetacognitiveMonitoring` |
|
|
18
|
-
| `Self::SelfModel` |
|
|
19
|
-
| `Self::SelfTalk` |
|
|
20
|
-
| `Self::Reflection` |
|
|
21
|
-
| `Self::NarrativeArc` |
|
|
22
|
-
| `Self::NarrativeIdentity` |
|
|
23
|
-
| `Self::NarrativeSelf` |
|
|
24
|
-
| `Self::Architecture` |
|
|
25
|
-
| `Self::Fingerprint` |
|
|
26
|
-
| `Self::Anchor` |
|
|
27
|
-
| `Self::Agency` |
|
|
28
|
-
| `Self::Personality` |
|
|
29
|
-
| `Self::Anosognosia` |
|
|
30
|
-
| `Self::DefaultModeNetwork` |
|
|
13
|
+
| Sub-Module | Purpose |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `Self::Identity` | Behavioral fingerprint (6 dimensions, entropy anomaly) + Entra ID binding |
|
|
16
|
+
| `Self::Metacognition` | Second-order self-model — discovers loaded extensions, maps capabilities |
|
|
17
|
+
| `Self::MetacognitiveMonitoring` | Continuous confidence calibration, feeling-of-knowing |
|
|
18
|
+
| `Self::SelfModel` | Stable beliefs about capabilities, limitations, and values |
|
|
19
|
+
| `Self::SelfTalk` | IFS-inspired inner dialogue — typed turns before action |
|
|
20
|
+
| `Self::Reflection` | Post-tick meta-cognitive analysis — seven categories, EMA health scores |
|
|
21
|
+
| `Self::NarrativeArc` | McAdams narrative arc — beats, tension, resolution |
|
|
22
|
+
| `Self::NarrativeIdentity` | McAdams narrative identity — the agent's life story |
|
|
23
|
+
| `Self::NarrativeSelf` | Minimal self vs. narrative self; autobiographical episode recording |
|
|
24
|
+
| `Self::Architecture` | Meta-layer graph of cognitive subsystems — bottleneck detection |
|
|
25
|
+
| `Self::Fingerprint` | Unique cognitive style profile |
|
|
26
|
+
| `Self::Anchor` | Stable cognitive anchor points |
|
|
27
|
+
| `Self::Agency` | Sense of agency — authorship detection |
|
|
28
|
+
| `Self::Personality` | Big Five OCEAN trait model |
|
|
29
|
+
| `Self::Anosognosia` | Unawareness of own deficits |
|
|
30
|
+
| `Self::DefaultModeNetwork` | DMN analog — active during self-referential processing |
|
|
31
|
+
| `Self::RelationshipArc` | Tracks relationship milestones and bond progression with other agents; stamps NarrativeIdentity episodes on milestone events |
|
|
31
32
|
|
|
32
33
|
## Actors
|
|
33
34
|
|
|
@@ -37,6 +38,10 @@ Domain consolidation gem for self-model, identity, metacognition, and self-aware
|
|
|
37
38
|
- `Self::NarrativeIdentity::Actors::NarrativeDecay` — interval actor, decays narrative identity strength
|
|
38
39
|
- `Self::SelfTalk::Actors::VolumeDecay` — runs every 300s, decays inner voice volumes
|
|
39
40
|
|
|
41
|
+
## Dependencies
|
|
42
|
+
|
|
43
|
+
Runtime: `legion-cache`, `legion-crypt`, `legion-data`, `legion-json`, `legion-logging`, `legion-settings`, `legion-transport`, `faraday ~> 2.0` (for Identity Microsoft Graph API calls).
|
|
44
|
+
|
|
40
45
|
## Installation
|
|
41
46
|
|
|
42
47
|
```ruby
|
|
@@ -47,8 +52,8 @@ gem 'lex-agentic-self'
|
|
|
47
52
|
|
|
48
53
|
```bash
|
|
49
54
|
bundle install
|
|
50
|
-
bundle exec rspec
|
|
51
|
-
bundle exec rubocop
|
|
55
|
+
bundle exec rspec
|
|
56
|
+
bundle exec rubocop
|
|
52
57
|
```
|
|
53
58
|
|
|
54
59
|
## License
|
data/lex-agentic-self.gemspec
CHANGED
|
@@ -32,7 +32,7 @@ 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
|
|
|
35
|
-
spec.
|
|
35
|
+
spec.add_dependency 'faraday', '~> 2.0'
|
|
36
36
|
spec.add_development_dependency 'rspec', '~> 3.13'
|
|
37
37
|
spec.add_development_dependency 'rubocop'
|
|
38
38
|
spec.add_development_dependency 'rubocop-legion'
|
|
@@ -16,6 +16,10 @@ module Legion
|
|
|
16
16
|
module VaultSecrets
|
|
17
17
|
VAULT_PATH_PREFIX = 'secret/data/legion/workers'
|
|
18
18
|
|
|
19
|
+
def self.log
|
|
20
|
+
Legion::Logging
|
|
21
|
+
end
|
|
22
|
+
|
|
19
23
|
def self.secret_path(worker_id)
|
|
20
24
|
"#{VAULT_PATH_PREFIX}/#{worker_id}/entra"
|
|
21
25
|
end
|
|
@@ -68,7 +72,8 @@ module Legion
|
|
|
68
72
|
defined?(Legion::Crypt) &&
|
|
69
73
|
defined?(Legion::Settings) &&
|
|
70
74
|
Legion::Settings[:crypt][:vault][:connected] == true
|
|
71
|
-
rescue StandardError =>
|
|
75
|
+
rescue StandardError => e
|
|
76
|
+
log.error "[identity:vault] vault_available? check failed: #{e.message}"
|
|
72
77
|
false
|
|
73
78
|
end
|
|
74
79
|
end
|
|
@@ -7,6 +7,10 @@ module Legion
|
|
|
7
7
|
module Metacognition
|
|
8
8
|
module Helpers
|
|
9
9
|
module SelfModel
|
|
10
|
+
def self.log
|
|
11
|
+
Legion::Logging
|
|
12
|
+
end
|
|
13
|
+
|
|
10
14
|
module_function
|
|
11
15
|
|
|
12
16
|
def build(subsystem_states: {}, tick_results: {})
|
|
@@ -31,7 +35,8 @@ module Legion
|
|
|
31
35
|
ns = agentic.const_get(domain, false)
|
|
32
36
|
ns.is_a?(Module) && ns.const_defined?(ext_sym, false)
|
|
33
37
|
end
|
|
34
|
-
rescue StandardError =>
|
|
38
|
+
rescue StandardError => e
|
|
39
|
+
log.error "[metacognition] extension_loaded? check failed: #{e.message}"
|
|
35
40
|
false
|
|
36
41
|
end
|
|
37
42
|
|
|
@@ -39,7 +44,8 @@ module Legion
|
|
|
39
44
|
Constants::EXTENSION_CAPABILITIES.each_with_object({}) do |(ext_sym, _cat), acc|
|
|
40
45
|
acc[ext_sym] = { loaded: extension_loaded?(ext_sym) }
|
|
41
46
|
end
|
|
42
|
-
rescue StandardError =>
|
|
47
|
+
rescue StandardError => e
|
|
48
|
+
log.error "[metacognition] discover_loaded_extensions failed: #{e.message}"
|
|
43
49
|
{}
|
|
44
50
|
end
|
|
45
51
|
|
|
@@ -10,8 +10,8 @@ module Legion
|
|
|
10
10
|
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
|
|
11
11
|
Legion::Extensions::Helpers.const_defined?(:Lex, false)
|
|
12
12
|
|
|
13
|
-
def
|
|
14
|
-
|
|
13
|
+
def record_narrative_self_episode(description:, episode_type: :insight, domain: :general,
|
|
14
|
+
significance: nil, emotional_valence: 0.0, tags: [], **)
|
|
15
15
|
episode = autobiography.record_episode(
|
|
16
16
|
description: description,
|
|
17
17
|
episode_type: episode_type,
|
|
@@ -61,14 +61,15 @@ module Legion
|
|
|
61
61
|
tags: ['partner', 'milestone', milestone.type.to_s]
|
|
62
62
|
)
|
|
63
63
|
rescue StandardError => e
|
|
64
|
-
|
|
64
|
+
log.error "[relationship_arc] narrative stamp failed: #{e.message}"
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def resolve_narrative_identity
|
|
68
68
|
return nil unless defined?(Legion::Extensions::Agentic::Self::NarrativeIdentity::Client)
|
|
69
69
|
|
|
70
70
|
@narrative_client ||= Legion::Extensions::Agentic::Self::NarrativeIdentity::Client.new
|
|
71
|
-
rescue StandardError =>
|
|
71
|
+
rescue StandardError => e
|
|
72
|
+
log.error "[relationship_arc] resolve_narrative_identity failed: #{e.message}"
|
|
72
73
|
nil
|
|
73
74
|
end
|
|
74
75
|
end
|
|
@@ -28,6 +28,55 @@ module Legion
|
|
|
28
28
|
def self.remote_invocable?
|
|
29
29
|
false
|
|
30
30
|
end
|
|
31
|
+
|
|
32
|
+
def self.mcp_tools?
|
|
33
|
+
false
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.mcp_tools_deferred?
|
|
37
|
+
false
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.transport_required?
|
|
41
|
+
false
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.log
|
|
45
|
+
Legion::Logging
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.personality_snapshot
|
|
49
|
+
client = Personality::Client.new
|
|
50
|
+
client.personality_profile
|
|
51
|
+
rescue StandardError => e
|
|
52
|
+
log.warn "[self] personality_snapshot failed: #{e.message}"
|
|
53
|
+
{}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.reflection_snapshot
|
|
57
|
+
client = Reflection::Client.new
|
|
58
|
+
result = client.recent_reflections(limit: 100)
|
|
59
|
+
result.is_a?(Hash) ? (result[:reflections] || []) : []
|
|
60
|
+
rescue StandardError => e
|
|
61
|
+
log.warn "[self] reflection_snapshot failed: #{e.message}"
|
|
62
|
+
[]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.restore_personality(data)
|
|
66
|
+
return unless data.is_a?(Hash) && !data.empty?
|
|
67
|
+
|
|
68
|
+
log.info "[self] restore_personality: #{data.keys.join(', ')}"
|
|
69
|
+
rescue StandardError => e
|
|
70
|
+
log.error "[self] restore_personality failed: #{e.message}"
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def self.restore_reflections(data)
|
|
74
|
+
return unless data.is_a?(Array) && !data.empty?
|
|
75
|
+
|
|
76
|
+
log.info "[self] restore_reflections: #{data.size} entries"
|
|
77
|
+
rescue StandardError => e
|
|
78
|
+
log.error "[self] restore_reflections failed: #{e.message}"
|
|
79
|
+
end
|
|
31
80
|
end
|
|
32
81
|
end
|
|
33
82
|
end
|
|
@@ -8,7 +8,7 @@ RSpec.describe Legion::Extensions::Agentic::Self::NarrativeSelf::Client do
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
it 'includes all runner methods' do
|
|
11
|
-
expect(client).to respond_to(:
|
|
11
|
+
expect(client).to respond_to(:record_narrative_self_episode)
|
|
12
12
|
expect(client).to respond_to(:recent_episodes)
|
|
13
13
|
expect(client).to respond_to(:significant_episodes)
|
|
14
14
|
expect(client).to respond_to(:create_thread)
|
|
@@ -28,20 +28,20 @@ RSpec.describe Legion::Extensions::Agentic::Self::NarrativeSelf::Client do
|
|
|
28
28
|
client.create_thread(theme: :mastery, domain: :technical)
|
|
29
29
|
|
|
30
30
|
# Record experiences
|
|
31
|
-
client.
|
|
31
|
+
client.record_narrative_self_episode(
|
|
32
32
|
description: 'built first extension',
|
|
33
33
|
episode_type: :achievement,
|
|
34
34
|
domain: :technical,
|
|
35
35
|
emotional_valence: 0.7,
|
|
36
36
|
tags: %i[building mastery]
|
|
37
37
|
)
|
|
38
|
-
client.
|
|
38
|
+
client.record_narrative_self_episode(
|
|
39
39
|
description: 'learned about EMA',
|
|
40
40
|
episode_type: :insight,
|
|
41
41
|
domain: :cognition,
|
|
42
42
|
tags: %i[learning math]
|
|
43
43
|
)
|
|
44
|
-
client.
|
|
44
|
+
client.record_narrative_self_episode(
|
|
45
45
|
description: 'test failure taught me about edge cases',
|
|
46
46
|
episode_type: :discovery,
|
|
47
47
|
domain: :technical,
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
RSpec.describe Legion::Extensions::Agentic::Self::NarrativeSelf::Runners::NarrativeSelf do
|
|
4
4
|
let(:client) { Legion::Extensions::Agentic::Self::NarrativeSelf::Client.new }
|
|
5
5
|
|
|
6
|
-
describe '#
|
|
6
|
+
describe '#record_narrative_self_episode' do
|
|
7
7
|
it 'returns success with episode data' do
|
|
8
|
-
result = client.
|
|
8
|
+
result = client.record_narrative_self_episode(description: 'completed first build', episode_type: :achievement)
|
|
9
9
|
expect(result[:success]).to be true
|
|
10
10
|
expect(result[:episode][:description]).to eq('completed first build')
|
|
11
11
|
expect(result[:episode][:episode_type]).to eq(:achievement)
|
|
@@ -14,7 +14,7 @@ RSpec.describe Legion::Extensions::Agentic::Self::NarrativeSelf::Runners::Narrat
|
|
|
14
14
|
|
|
15
15
|
describe '#recent_episodes' do
|
|
16
16
|
before do
|
|
17
|
-
3.times { |i| client.
|
|
17
|
+
3.times { |i| client.record_narrative_self_episode(description: "event #{i}") }
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it 'returns recent episodes' do
|
|
@@ -26,8 +26,8 @@ RSpec.describe Legion::Extensions::Agentic::Self::NarrativeSelf::Runners::Narrat
|
|
|
26
26
|
|
|
27
27
|
describe '#significant_episodes' do
|
|
28
28
|
before do
|
|
29
|
-
client.
|
|
30
|
-
client.
|
|
29
|
+
client.record_narrative_self_episode(description: 'major', significance: 0.9)
|
|
30
|
+
client.record_narrative_self_episode(description: 'minor', significance: 0.1)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
it 'filters by significance' do
|
|
@@ -39,8 +39,8 @@ RSpec.describe Legion::Extensions::Agentic::Self::NarrativeSelf::Runners::Narrat
|
|
|
39
39
|
|
|
40
40
|
describe '#episodes_by_type' do
|
|
41
41
|
before do
|
|
42
|
-
client.
|
|
43
|
-
client.
|
|
42
|
+
client.record_narrative_self_episode(description: 'win', episode_type: :achievement)
|
|
43
|
+
client.record_narrative_self_episode(description: 'learn', episode_type: :insight)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
it 'filters by type' do
|
|
@@ -72,7 +72,7 @@ RSpec.describe Legion::Extensions::Agentic::Self::NarrativeSelf::Runners::Narrat
|
|
|
72
72
|
|
|
73
73
|
describe '#timeline' do
|
|
74
74
|
before do
|
|
75
|
-
3.times { |i| client.
|
|
75
|
+
3.times { |i| client.record_narrative_self_episode(description: "event #{i}") }
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
it 'returns timeline entries' do
|
|
@@ -85,8 +85,8 @@ RSpec.describe Legion::Extensions::Agentic::Self::NarrativeSelf::Runners::Narrat
|
|
|
85
85
|
|
|
86
86
|
describe '#self_summary' do
|
|
87
87
|
before do
|
|
88
|
-
client.
|
|
89
|
-
client.
|
|
88
|
+
client.record_narrative_self_episode(description: 'a', episode_type: :achievement, domain: :tech)
|
|
89
|
+
client.record_narrative_self_episode(description: 'b', episode_type: :insight, domain: :personal)
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
it 'returns comprehensive summary' do
|
|
@@ -100,7 +100,7 @@ RSpec.describe Legion::Extensions::Agentic::Self::NarrativeSelf::Runners::Narrat
|
|
|
100
100
|
|
|
101
101
|
describe '#update_narrative_self' do
|
|
102
102
|
it 'decays and reports counts' do
|
|
103
|
-
client.
|
|
103
|
+
client.record_narrative_self_episode(description: 'test')
|
|
104
104
|
result = client.update_narrative_self
|
|
105
105
|
expect(result[:success]).to be true
|
|
106
106
|
expect(result[:episode_count]).to eq(1)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lex-agentic-self
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
@@ -114,7 +114,7 @@ dependencies:
|
|
|
114
114
|
- - "~>"
|
|
115
115
|
- !ruby/object:Gem::Version
|
|
116
116
|
version: '2.0'
|
|
117
|
-
type: :
|
|
117
|
+
type: :runtime
|
|
118
118
|
prerelease: false
|
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
120
|
requirements:
|