lex-synapse 0.4.0 → 0.4.2
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 +11 -0
- data/CLAUDE.md +25 -8
- data/lib/legion/extensions/synapse/actors/challenge.rb +6 -0
- data/lib/legion/extensions/synapse/actors/crystallize.rb +6 -0
- data/lib/legion/extensions/synapse/actors/decay.rb +17 -14
- data/lib/legion/extensions/synapse/actors/propose.rb +6 -0
- data/lib/legion/extensions/synapse/runners/challenge.rb +2 -0
- data/lib/legion/extensions/synapse/runners/crystallize.rb +2 -0
- data/lib/legion/extensions/synapse/runners/evaluate.rb +2 -0
- data/lib/legion/extensions/synapse/runners/pain.rb +2 -0
- data/lib/legion/extensions/synapse/runners/propose.rb +2 -0
- data/lib/legion/extensions/synapse/version.rb +1 -1
- 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: 0fd3abbde7ec695013ddfe41801f8da65b8513f87fb6bc7e2648238728f5d19a
|
|
4
|
+
data.tar.gz: 67081b1e1ffb5b043f5c5123788d81289b01760a23626e220571fff8799a6c7f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3aa579de0a149d2c9e75725b8b444d387130e39c870d61bc6e6c5740ade2d55867f5642bd1da354d156db74f01f20e6ab8e5284fd565150c5eb227c34277d0e6
|
|
7
|
+
data.tar.gz: ce0f497bc6eb45c32a45ae1be1adb56feac5ac43574ae53ab0fa9b44546e6c336fd8dfe1b99fa330f98f265b920a70eef0d1d564cfb0eb147737779535846801
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.2] - 2026-03-22
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Add `include Helpers::Lex` to Crystallize, Challenge, Evaluate, Pain, and Propose runners so methods are callable at module level by framework actor auto-dispatch
|
|
7
|
+
|
|
8
|
+
## [0.4.1] - 2026-03-22
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Challenge, Propose, and Crystallize actors now include their runner modules and override `runner_class` to return `self.class`, fixing `NoMethodError` at runtime
|
|
12
|
+
- Decay actor converted to self-contained pattern (like Homeostasis) — no `Runners::Decay` module existed
|
|
13
|
+
|
|
3
14
|
## [0.4.0] - 2026-03-22
|
|
4
15
|
|
|
5
16
|
### Added
|
data/CLAUDE.md
CHANGED
|
@@ -10,7 +10,7 @@ Cognitive routing layer that wraps task chain relationships with observation, le
|
|
|
10
10
|
|
|
11
11
|
**GitHub**: https://github.com/LegionIO/lex-synapse
|
|
12
12
|
**License**: MIT
|
|
13
|
-
**Version**: 0.
|
|
13
|
+
**Version**: 0.4.0
|
|
14
14
|
|
|
15
15
|
## Architecture
|
|
16
16
|
|
|
@@ -22,7 +22,8 @@ Legion::Extensions::Synapse
|
|
|
22
22
|
│ ├── Crystallize # Every 300s — emergent synapse detection
|
|
23
23
|
│ ├── Homeostasis # Every 30s — spike/drought monitoring
|
|
24
24
|
│ ├── Decay # Every 3600s — idle confidence decay
|
|
25
|
-
│
|
|
25
|
+
│ ├── Propose # Every 300s — proactive proposal analysis for AUTONOMOUS synapses
|
|
26
|
+
│ └── Challenge # Every 60s — adversarial challenge pipeline for pending proposals
|
|
26
27
|
├── Runners/
|
|
27
28
|
│ ├── Evaluate # attention -> transform -> route -> record
|
|
28
29
|
│ ├── Pain # failure recording, confidence hit, auto-revert
|
|
@@ -34,14 +35,16 @@ Legion::Extensions::Synapse
|
|
|
34
35
|
│ ├── GaiaReport # GAIA tick hook: report confidence and health per synapse
|
|
35
36
|
│ ├── Promote # Apollo integration: promote high-confidence synapse patterns to shared knowledge
|
|
36
37
|
│ ├── Retrieve # Apollo integration: retrieve relevant synapse patterns from shared knowledge
|
|
37
|
-
│
|
|
38
|
+
│ ├── Propose # reactive (signal-driven) + proactive (periodic) proposal generation
|
|
39
|
+
│ └── Challenge # conflict detection, LLM challenge, weighted aggregation, outcome resolution
|
|
38
40
|
├── Helpers/
|
|
39
41
|
│ ├── Confidence # scoring, adjustments, autonomy ranges, decay
|
|
40
42
|
│ ├── Homeostasis # spike/drought detection, baseline tracking
|
|
41
|
-
│
|
|
43
|
+
│ ├── RelationshipWrapper # Layer 1 -> Layer 2 wrapping
|
|
44
|
+
│ └── Challenge # settings, constants, impact threshold helpers
|
|
42
45
|
├── Data/
|
|
43
|
-
│ ├── Migrations/ # 001 synapses, 002 mutations, 003 signals
|
|
44
|
-
│ └── Models/ # Synapse, SynapseMutation, SynapseSignal
|
|
46
|
+
│ ├── Migrations/ # 001 synapses, 002 mutations, 003 signals, 004 proposals, 005 challenges
|
|
47
|
+
│ └── Models/ # Synapse, SynapseMutation, SynapseSignal, SynapseProposal, SynapseChallenge
|
|
45
48
|
├── Transport/
|
|
46
49
|
│ ├── Exchanges/Synapse
|
|
47
50
|
│ ├── Queues/Evaluate, Pain
|
|
@@ -80,6 +83,8 @@ Legion::Extensions::Synapse
|
|
|
80
83
|
- **synapses**: Core routing definition with confidence, status, version, baseline_throughput
|
|
81
84
|
- **synapse_mutations**: Versioned change history with before/after JSON snapshots
|
|
82
85
|
- **synapse_signals**: Per-signal outcome records (attention pass, transform success, latency, downstream outcome)
|
|
86
|
+
- **synapse_proposals**: Proposed changes with status lifecycle, challenge_state, challenge_score, impact_score
|
|
87
|
+
- **synapse_challenges**: Per-challenge verdicts (conflict/LLM), confidence tracking, outcome resolution
|
|
83
88
|
|
|
84
89
|
## Autonomous Observation Mode (v0.3.0)
|
|
85
90
|
|
|
@@ -91,6 +96,18 @@ Legion::Extensions::Synapse
|
|
|
91
96
|
- **Data**: `synapse_proposals` table with status lifecycle (pending -> approved/rejected/applied/expired)
|
|
92
97
|
- **Client methods**: `proposals(synapse_id:, status:)`, `review_proposal(proposal_id:, status:)`
|
|
93
98
|
|
|
99
|
+
## Adversarial Challenge Phase (v0.4.0)
|
|
100
|
+
|
|
101
|
+
- **Challenge pipeline**: pending proposals go through conflict detection (mechanical) -> impact scoring -> LLM challenge (gated) -> weighted aggregation -> auto-accept/reject/await-review
|
|
102
|
+
- **Conflict detection**: queries sibling pending proposals on same synapse; conflicting types produce 'challenge' verdict
|
|
103
|
+
- **LLM challenge**: gated by `impact_score >= 0.3`; calls lex-transformer LLM engine; parses SUPPORT/CHALLENGE/ABSTAIN
|
|
104
|
+
- **Aggregation**: `support_weight / (support_weight + challenge_weight)`, abstains excluded; >= 0.85 auto-accepts, <= 0.15 auto-rejects
|
|
105
|
+
- **Challenger confidence**: starting 0.5, correct +0.05, incorrect -0.08, decay *0.998/hr; tracks via outcome resolution after observation window (50 signals post-application)
|
|
106
|
+
- **Settings**: `lex-synapse.challenge.*` — enabled, impact_threshold, auto_accept_threshold, auto_reject_threshold, llm_engine_options, outcome_observation_window, max_per_cycle
|
|
107
|
+
- **Data**: `synapse_challenges` table; `synapse_proposals` gains challenge_state, challenge_score, impact_score columns
|
|
108
|
+
- **Statuses**: `auto_accepted`, `auto_rejected` added to proposal lifecycle
|
|
109
|
+
- **Client methods**: `challenge_proposal(proposal_id:)`, `challenges(proposal_id:)`, `challenger_stats`
|
|
110
|
+
|
|
94
111
|
## GAIA / Apollo Integration (v0.2.2)
|
|
95
112
|
|
|
96
113
|
- **GaiaReport runner**: Called during the GAIA tick cycle to report per-synapse confidence and health metrics.
|
|
@@ -110,11 +127,11 @@ Legion::Extensions::Synapse
|
|
|
110
127
|
|
|
111
128
|
```bash
|
|
112
129
|
bundle install
|
|
113
|
-
bundle exec rspec #
|
|
130
|
+
bundle exec rspec # 412 specs, 0 failures
|
|
114
131
|
bundle exec rubocop # 0 offenses
|
|
115
132
|
```
|
|
116
133
|
|
|
117
|
-
|
|
134
|
+
412 specs, 94%+ coverage. Uses in-memory SQLite for model/runner tests.
|
|
118
135
|
|
|
119
136
|
---
|
|
120
137
|
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative '../runners/challenge'
|
|
4
|
+
|
|
3
5
|
module Legion
|
|
4
6
|
module Extensions
|
|
5
7
|
module Synapse
|
|
6
8
|
module Actor
|
|
7
9
|
class Challenge < Legion::Extensions::Actors::Every
|
|
10
|
+
include Legion::Extensions::Synapse::Runners::Challenge
|
|
11
|
+
|
|
12
|
+
def runner_class = self.class
|
|
13
|
+
|
|
8
14
|
def runner_function
|
|
9
15
|
'run_challenge_cycle'
|
|
10
16
|
end
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative '../runners/crystallize'
|
|
4
|
+
|
|
3
5
|
module Legion
|
|
4
6
|
module Extensions
|
|
5
7
|
module Synapse
|
|
6
8
|
module Actor
|
|
7
9
|
class Crystallize < Legion::Extensions::Actors::Every
|
|
10
|
+
include Legion::Extensions::Synapse::Runners::Crystallize
|
|
11
|
+
|
|
12
|
+
def runner_class = self.class
|
|
13
|
+
|
|
8
14
|
def runner_function
|
|
9
15
|
'crystallize'
|
|
10
16
|
end
|
|
@@ -5,24 +5,27 @@ module Legion
|
|
|
5
5
|
module Synapse
|
|
6
6
|
module Actor
|
|
7
7
|
class Decay < Legion::Extensions::Actors::Every
|
|
8
|
-
def
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
def runner_class = self.class
|
|
9
|
+
def time = 3600
|
|
10
|
+
def use_runner? = false
|
|
11
|
+
def check_subtask? = false
|
|
12
|
+
def generate_task? = false
|
|
11
13
|
|
|
12
|
-
def
|
|
13
|
-
|
|
14
|
-
end
|
|
14
|
+
def action(**_opts)
|
|
15
|
+
return { status: :skipped, reason: :no_data } unless defined?(Legion::Data)
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
end
|
|
17
|
+
Data::Model.define_synapse_model
|
|
18
|
+
decayed = 0
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
Data::Model::Synapse.where(status: 'active').each do |synapse|
|
|
21
|
+
new_conf = Helpers::Confidence.decay(synapse.confidence, hours: 1)
|
|
22
|
+
next if new_conf == synapse.confidence
|
|
23
|
+
|
|
24
|
+
synapse.update(confidence: new_conf)
|
|
25
|
+
decayed += 1
|
|
26
|
+
end
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
false
|
|
28
|
+
{ decayed: decayed }
|
|
26
29
|
end
|
|
27
30
|
end
|
|
28
31
|
end
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative '../runners/propose'
|
|
4
|
+
|
|
3
5
|
module Legion
|
|
4
6
|
module Extensions
|
|
5
7
|
module Synapse
|
|
6
8
|
module Actor
|
|
7
9
|
class Propose < Legion::Extensions::Actors::Every
|
|
10
|
+
include Legion::Extensions::Synapse::Runners::Propose
|
|
11
|
+
|
|
12
|
+
def runner_class = self.class
|
|
13
|
+
|
|
8
14
|
def runner_function
|
|
9
15
|
'propose_proactive'
|
|
10
16
|
end
|
|
@@ -246,6 +246,8 @@ module Legion
|
|
|
246
246
|
"There have been #{recent_failures.size} downstream failures despite attention passing. " \
|
|
247
247
|
'Suggest refined attention rules as a JSON condition object. Return only JSON.'
|
|
248
248
|
end
|
|
249
|
+
|
|
250
|
+
include Legion::Extensions::Helpers::Lex if defined?(Legion::Extensions::Helpers::Lex)
|
|
249
251
|
end
|
|
250
252
|
end
|
|
251
253
|
end
|