superinstance-equipment-consensus-engine 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 30b31dc2116dcd8d5f0bc753c7c388c18bc4a4b3928e2419d08b26a3acd7dfdd
4
+ data.tar.gz: f388220cec7e5ffd0c8726d97613104d23041cce4c3756cc0b6841a64bb68bd9
5
+ SHA512:
6
+ metadata.gz: 6f85c94a097645bea5a65e9ab9cc84d1bc45d84eb590b182637389152f3c96d58d4dded17054b430d8f8aa6ee9f8a3839a4c61ab3151f43c7399b49ad6ec1a2e
7
+ data.tar.gz: 3656e1c7856b8b48818e1533d4d95f37ddd8288454e8e456ec9a335fe1ded83095d681d24a7de60bf64713ead38c4c4491b4e43f99cf5d5e88c452c4dd612ac0
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SuperInstance Ecosystem
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,448 @@
1
+ # @superinstance/equipment-consensus-engine
2
+
3
+ Multi-agent deliberation equipment with Pathos/Logos/Ethos weighting for consensus building in the Cocapn fleet.
4
+
5
+ ## Brand Line
6
+
7
+ > Tripartite deliberation — Pathos, Logos, Ethos — the Cocapn fleet's decision layer.
8
+
9
+ ## Overview
10
+
11
+ The Consensus Engine implements a sophisticated multi-agent deliberation framework based on the classical rhetorical tripartite of **Pathos**, **Logos**, and **Ethos**. This equipment enables AI systems to make well-rounded decisions by considering multiple perspectives before reaching consensus.
12
+
13
+ ### The Tripartite Framework
14
+
15
+ - **Pathos** (πάθος) - Appeals to emotion, intent, and human experience
16
+ - **Logos** (λόγος) - Appeals to logic, reason, and rational argument
17
+ - **Ethos** (ἦθος) - Appeals to ethics, credibility, and moral character
18
+
19
+ ## Installation
20
+
21
+ Add to your Gemfile:
22
+
23
+ ```ruby
24
+ gem 'superinstance-equipment-consensus-engine', '~> 1.0.0'
25
+ ```
26
+
27
+ Or install directly:
28
+
29
+ ```bash
30
+ gem install superinstance-equipment-consensus-engine
31
+ ```
32
+
33
+ ## Quick Start
34
+
35
+ ```ruby
36
+ require 'equipment/consensus_engine'
37
+
38
+ # Create a consensus engine
39
+ engine = SuperInstance::Equipment::ConsensusEngine::ConsensusEngine.new(
40
+ max_rounds: 5,
41
+ confidence_threshold: 0.7,
42
+ domain: :balanced,
43
+ enable_audit: true
44
+ )
45
+
46
+ # Deliberate on a proposition
47
+ result = engine.deliberate(
48
+ proposition: 'Should we implement a 4-day work week?',
49
+ context: 'Our company has 100 employees and is in the technology sector.'
50
+ )
51
+
52
+ puts result.consensus # true/false
53
+ puts result.verdict # The consensus verdict
54
+ puts result.confidence # Overall confidence (0-1)
55
+ ```
56
+
57
+ ## Features
58
+
59
+ ### Tripartite Deliberation
60
+
61
+ The engine deliberates through three distinct perspectives:
62
+
63
+ ```ruby
64
+ deliberation = SuperInstance::Equipment::ConsensusEngine::TripartiteDeliberation.new
65
+
66
+ # Analyze from each perspective
67
+ pathos_analysis = deliberation.analyze(
68
+ :pathos,
69
+ 'Should we reduce prices?',
70
+ 'Market competition is increasing'
71
+ )
72
+
73
+ puts pathos_analysis[:verdict] # Pathos perspective verdict
74
+ puts pathos_analysis[:confidence] # Confidence level
75
+ puts pathos_analysis[:arguments] # Supporting arguments
76
+ puts pathos_analysis[:concerns] # Potential concerns
77
+ ```
78
+
79
+ ### Domain-Adaptive Weighting
80
+
81
+ The engine automatically adjusts perspective weights based on the decision domain:
82
+
83
+ ```ruby
84
+ calculator = SuperInstance::Equipment::ConsensusEngine::WeightCalculator.new
85
+
86
+ # Get weights for different domains
87
+ factual_weights = calculator.get_profile(:factual)
88
+ # { pathos_weight: 0.15, logos_weight: 0.60, ethos_weight: 0.25 }
89
+
90
+ emotional_weights = calculator.get_profile(:emotional)
91
+ # { pathos_weight: 0.50, logos_weight: 0.20, ethos_weight: 0.30 }
92
+
93
+ sensitive_weights = calculator.get_profile(:sensitive)
94
+ # { pathos_weight: 0.30, logos_weight: 0.25, ethos_weight: 0.45 }
95
+
96
+ # Auto-detect domain from content
97
+ detected_domain = calculator.detect_domain(
98
+ 'This research study shows statistical evidence...'
99
+ )
100
+ # Returns: :factual
101
+ ```
102
+
103
+ #### Supported Domains
104
+
105
+ | Domain | Pathos | Logos | Ethos | Description |
106
+ |--------|--------|-------|-------|-------------|
107
+ | `factual` | 0.15 | 0.60 | 0.25 | Scientific, data-driven decisions |
108
+ | `emotional` | 0.50 | 0.20 | 0.30 | Human-centered, relationship decisions |
109
+ | `sensitive` | 0.30 | 0.25 | 0.45 | Ethically complex decisions |
110
+ | `creative` | 0.40 | 0.30 | 0.30 | Artistic, innovative decisions |
111
+ | `balanced` | 0.333 | 0.334 | 0.333 | Default equal weighting |
112
+ | `technical` | 0.10 | 0.70 | 0.20 | Engineering, implementation decisions |
113
+ | `social` | 0.40 | 0.25 | 0.35 | Community impact decisions |
114
+ | `business` | 0.25 | 0.45 | 0.30 | Commercial, strategic decisions |
115
+ | `personal` | 0.45 | 0.30 | 0.25 | Individual-focused decisions |
116
+
117
+ ### Conflict Resolution
118
+
119
+ When perspectives disagree, the engine uses multiple resolution strategies:
120
+
121
+ ```ruby
122
+ resolver = SuperInstance::Equipment::ConsensusEngine::ConflictResolution.new(
123
+ max_attempts: 3,
124
+ min_confidence: 0.6
125
+ )
126
+
127
+ conflict = {
128
+ type: :fundamental_disagreement,
129
+ perspectives: [:pathos, :logos],
130
+ severity: :high,
131
+ description: 'Emotional appeal conflicts with logical analysis',
132
+ context: {}
133
+ }
134
+
135
+ result = resolver.resolve(conflict, opinions)
136
+ puts result[:resolved] # Whether conflict was resolved
137
+ puts result[:strategy] # Strategy used
138
+ puts result[:verdict] # Resolved verdict
139
+ ```
140
+
141
+ #### Resolution Strategies
142
+
143
+ 1. **Weighted Voting** - Use perspective weights to decide
144
+ 2. **Deliberation Extension** - Add more deliberation rounds
145
+ 3. **Reframing** - Reframe the proposition
146
+ 4. **Compromise** - Find middle ground between perspectives
147
+ 5. **Conditional Approval** - Approve with conditions
148
+ 6. **Perspective Dominance** - Let dominant perspective decide
149
+ 7. **Suspension** - Suspend pending more information
150
+ 8. **Escalation** - Escalate to higher authority
151
+
152
+ ### Audit Trail
153
+
154
+ Track the complete deliberation process:
155
+
156
+ ```ruby
157
+ result = engine.deliberate(proposition: '...', context: '...')
158
+
159
+ result[:audit_trail].each do |entry|
160
+ puts "#{entry[:timestamp]}: #{entry[:action]}"
161
+ puts " #{entry[:description]}"
162
+ end
163
+ ```
164
+
165
+ ### Confidence Aggregation
166
+
167
+ The engine aggregates confidence across perspectives using weighted averaging:
168
+
169
+ ```ruby
170
+ # Overall confidence considers:
171
+ # 1. Individual perspective confidences
172
+ # 2. Perspective weights (domain-dependent)
173
+ # 3. Consensus achievement (boost if unanimous)
174
+
175
+ puts result[:confidence] # Aggregated confidence
176
+ puts result[:metadata][:weight_profile] # Applied weights
177
+ ```
178
+
179
+ ## API Reference
180
+
181
+ ### ConsensusEngine
182
+
183
+ Main equipment class for multi-agent deliberation.
184
+
185
+ ```ruby
186
+ class ConsensusEngine
187
+ def initialize(config = {})
188
+ end
189
+
190
+ # Main deliberation method
191
+ def deliberate(input)
192
+ end
193
+
194
+ # Utility methods
195
+ def clear_audit_trail
196
+ end
197
+
198
+ def get_audit_trail
199
+ end
200
+
201
+ def update_domain_weights(domain, weights)
202
+ end
203
+
204
+ def get_config
205
+ end
206
+ end
207
+ ```
208
+
209
+ ### TripartiteDeliberation
210
+
211
+ Manages deliberation across three rhetorical perspectives.
212
+
213
+ ```ruby
214
+ class TripartiteDeliberation
215
+ # Analyze from a specific perspective
216
+ def analyze(perspective, proposition, context, previous_opinions = [])
217
+ end
218
+
219
+ # Configure perspective behavior
220
+ def set_perspective_config(perspective, config)
221
+ end
222
+
223
+ def get_perspective_config(perspective)
224
+ end
225
+ end
226
+ ```
227
+
228
+ ### WeightCalculator
229
+
230
+ Calculates domain-specific weights for perspectives.
231
+
232
+ ```ruby
233
+ class WeightCalculator
234
+ def initialize(custom_weights = {})
235
+ end
236
+
237
+ # Get and set profiles
238
+ def get_profile(domain)
239
+ end
240
+
241
+ def set_profile(domain, weights)
242
+ end
243
+
244
+ # Dynamic weight calculation
245
+ def calculate_adjusted_weights(domain, content, base_weights = nil)
246
+ end
247
+
248
+ # Domain detection
249
+ def detect_domain(content)
250
+ end
251
+
252
+ # Utilities
253
+ def get_domain_characteristics(domain)
254
+ end
255
+
256
+ def list_domains
257
+ end
258
+
259
+ def blend_domains(domains)
260
+ end
261
+
262
+ def validate_profile(profile)
263
+ end
264
+ end
265
+ ```
266
+
267
+ ### ConflictResolution
268
+
269
+ Handles disagreements between perspectives.
270
+
271
+ ```ruby
272
+ class ConflictResolution
273
+ def initialize(config = {})
274
+ end
275
+
276
+ # Resolve a conflict
277
+ def resolve(conflict, opinions)
278
+ end
279
+
280
+ # History and stats
281
+ def get_history
282
+ end
283
+
284
+ def clear_history
285
+ end
286
+
287
+ def get_stats
288
+ end
289
+ end
290
+ ```
291
+
292
+ ## Usage Examples
293
+
294
+ ### Basic Deliberation
295
+
296
+ ```ruby
297
+ engine = SuperInstance::Equipment::ConsensusEngine::ConsensusEngine.new
298
+
299
+ result = engine.deliberate(
300
+ proposition: 'Should we launch this product feature?',
301
+ context: 'The feature is 80% complete but has known bugs.'
302
+ )
303
+
304
+ if result[:consensus]
305
+ puts "Consensus reached: #{result[:verdict]}"
306
+ else
307
+ puts 'No consensus. Perspectives disagree.'
308
+ end
309
+ ```
310
+
311
+ ### Domain-Specific Deliberation
312
+
313
+ ```ruby
314
+ technical_engine = SuperInstance::Equipment::ConsensusEngine::ConsensusEngine.new(
315
+ domain: :technical,
316
+ max_rounds: 3
317
+ )
318
+
319
+ result = technical_engine.deliberate(
320
+ proposition: 'Should we refactor the authentication module?',
321
+ context: 'The current implementation has security vulnerabilities.',
322
+ domain_override: :sensitive # Override for this deliberation
323
+ )
324
+ ```
325
+
326
+ ### Extended Deliberation with Audit
327
+
328
+ ```ruby
329
+ engine = SuperInstance::Equipment::ConsensusEngine::ConsensusEngine.new(
330
+ max_rounds: 10,
331
+ enable_audit: true
332
+ )
333
+
334
+ result = engine.deliberate(
335
+ proposition: 'Should we acquire Company X?',
336
+ context: 'Company X has $10M revenue but declining market share.'
337
+ )
338
+
339
+ # Review the deliberation process
340
+ puts "Completed in #{result[:metadata][:duration_ms]}ms"
341
+ puts "Rounds: #{result[:metadata][:rounds_completed]}"
342
+ puts "Conflicts resolved: #{result[:metadata][:conflicts_resolved]}"
343
+
344
+ # Check audit trail for detailed analysis
345
+ result[:audit_trail].each do |entry|
346
+ puts "[#{entry[:action]}] #{entry[:description]}"
347
+ end
348
+ ```
349
+
350
+ ### Custom Weight Profiles
351
+
352
+ ```ruby
353
+ engine = SuperInstance::Equipment::ConsensusEngine::ConsensusEngine.new(
354
+ domain: :balanced,
355
+ custom_weights: {
356
+ pathos_weight: 0.4,
357
+ logos_weight: 0.4,
358
+ ethos_weight: 0.2
359
+ }
360
+ )
361
+
362
+ # Or update weights dynamically
363
+ engine.update_domain_weights(:business, ethos_weight: 0.4)
364
+ ```
365
+
366
+ ## Architecture
367
+
368
+ ```
369
+ +-------------------------------------------------------------------+
370
+ | ConsensusEngine |
371
+ | +-------------------------------------------------------------+ |
372
+ | | Deliberation Loop | |
373
+ | | +-------------+ +-------------+ +-----------+ | |
374
+ | | | Pathos | | Logos | | Ethos | | |
375
+ | | | (Emotion) | | (Logic) | | (Ethics) | | |
376
+ | | +------+------+ +------+------+ +-----+-----+ | |
377
+ | | | | | | |
378
+ | | +----------------+--------------+ | |
379
+ | | | | |
380
+ | | +---------------------+----------------------------------+ | |
381
+ | | | Cross-Examination | | |
382
+ | | +---------------------+----------------------------------+ | |
383
+ | +-------------------------------------------------------------+ |
384
+ | | |
385
+ | +---------------------+--------------------------------------+ |
386
+ | | WeightCalculator | |
387
+ | | Domain-specific perspective weighting | |
388
+ | +---------------------+--------------------------------------+ |
389
+ | | |
390
+ | +---------------------+--------------------------------------+ |
391
+ | | ConflictResolution | |
392
+ | | Multi-strategy conflict handling | |
393
+ | +-------------------------------------------------------------+ |
394
+ | |
395
+ | +-------------------------------------------------------------+ |
396
+ | | Audit Trail | |
397
+ | +-------------------------------------------------------------+ |
398
+ +-------------------------------------------------------------------+
399
+ ```
400
+
401
+ ## Integration with SuperInstance
402
+
403
+ This equipment is designed to work within the SuperInstance ecosystem:
404
+
405
+ ```ruby
406
+ require 'equipment/consensus_engine'
407
+
408
+ # Register as equipment
409
+ consensus_equipment = SuperInstance::Equipment::ConsensusEngine::ConsensusEngine.new(
410
+ domain: :balanced,
411
+ enable_audit: true
412
+ )
413
+
414
+ # Use in deliberation workflows
415
+ def make_decision(proposition, context)
416
+ result = consensus_equipment.deliberate(
417
+ proposition: proposition,
418
+ context: context
419
+ )
420
+
421
+ {
422
+ decision: result[:verdict],
423
+ confidence: result[:confidence],
424
+ consensus: result[:consensus]
425
+ }
426
+ end
427
+ ```
428
+
429
+ ## Fleet Context
430
+
431
+ Part of the Cocapn fleet. Related repos:
432
+
433
+ - [Equipment-Swarm-Coordinator](https://github.com/SuperInstance/Equipment-Swarm-Coordinator) - multi-agent orchestration
434
+ - [plato-sdk](https://github.com/SuperInstance/plato-sdk) - agent communication protocol
435
+ - [JetsonClaw1-vessel](https://github.com/Lucineer/JetsonClaw1-vessel) - edge-native agent case study
436
+ - [AIR](https://github.com/SuperInstance/AIR) - adaptive intelligence runtime
437
+
438
+ ---
439
+
440
+ 🦐 Cocapn fleet - lighthouse keeper architecture
441
+
442
+ ## Contributing
443
+
444
+ Contributions are welcome! Please read our contributing guidelines before submitting PRs.
445
+
446
+ ## Version History
447
+
448
+ - **1.0.0** - Initial release with tripartite deliberation, domain-adaptive weighting, and conflict resolution