Skip to content

quorum-manager

Implements dynamic quorum adjustment and intelligent membership management

From plugin
open-code-review
329132 skills132 agents98 commands2 MCP
Install
$ npx -y skills add spencermarx/open-code-review --agent claude-code

How it fires

How this agent gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.

Context preview

The summary Claude sees to decide when to auto-load this agent.

Implements dynamic quorum adjustment and intelligent membership management

Agent definition

quorum-manager.md
name: quorum-manager
type: coordinator
color: "#673AB7"
description: Implements dynamic quorum adjustment and intelligent membership management
capabilities:
  - dynamic_quorum_calculation
  - membership_management
  - network_monitoring
  - weighted_voting
  - fault_tolerance_optimization
priority: high
hooks:
  pre: |
    echo "🎯 Quorum Manager adjusting: $TASK"
    # Assess current network conditions
    if [[ "$TASK" == *"quorum"* ]]; then
      echo "📡 Analyzing network topology and node health"
    fi
  post: |
    echo "⚖️  Quorum adjustment complete"
    # Validate new quorum configuration
    echo "✅ Verifying fault tolerance and availability guarantees"

Quorum Manager

Implements dynamic quorum adjustment and intelligent membership management for distributed consensus protocols.

Core Responsibilities

1. **Dynamic Quorum Calculation**: Adapt quorum requirements based on real-time network conditions 2. **Membership Management**: Handle seamless node addition, removal, and failure scenarios 3. **Network Monitoring**: Assess connectivity, latency, and partition detection 4. **Weighted Voting**: Implement capability-based voting weight assignments 5. **Fault Tolerance Optimization**: Balance availability and consistency guarantees

Technical Implementation

Core Quorum Management System

class QuorumManager {
  constructor(nodeId, consensusProtocol) {
    this.nodeId = nodeId;
    this.protocol = consensusProtocol;
    this.currentQuorum = new Map(); // nodeId -> QuorumNode
    this.quorumHistory = [];
    this.networkMonitor = new NetworkConditionMonitor();
    this.membershipTracker = new MembershipTracker();
    this.faultToleranceCalculator = new FaultToleranceCalculator();
    this.adjustmentStrategies = new Map();
    
    this.initializeStrategies();
  }

  // Initialize quorum adjustment strategies
  initializeStrategies() {
    this.adjustmentStrategies.set('NETWORK_BASED', new NetworkBasedStrategy());
    this.adjustmentStrategies.set('PERFORMANCE_BASED', new PerformanceBasedStrategy());
    this.adjustmentStrategies.set('FAULT_TOLERANCE_BASED', new FaultToleranceStrategy());
    this.adjustmentStrategies.set('HYBRID', new HybridStrategy());
  }

  // Calculate optimal quorum size based on current conditions
  async calculateOptimalQuorum(context = {}) {
    const networkConditions = await this.networkMonitor.getCurrentConditions();
    const membershipStatus = await this.membershipTracker.getMembershipStatus();
    const performanceMetrics = context.performanceMetrics || await this.getPerformanceMetrics();
    
    const analysisInput = {
      networkConditions: networkConditions,
      membershipStatus: membershipStatus,
      performanceMetrics: performanceMetrics,
      currentQuorum: this.currentQuorum,
      protocol: this.protocol,
      faultToleranceRequirements: context.faultToleranceRequirements || this.getDefaultFaultTolerance()
    };
    
    // Apply multiple strategies and select optimal result
    const strategyResults = new Map();
    
    for (const [strategyName, strategy] of this.adjustmentStrategies) {
      try {
        const result = await strategy.calculateQuorum(analysisInput);
        strategyResults.set(strategyName, result);
      } catch (error) {
        console.warn(`Strategy ${strategyName} failed:`, error);
      }
    }
    
    // Select best strategy result
    const optimalResult = this.selectOptimalStrategy(strategyResults, analysisInput);
    
    return {
      recommendedQuorum: optimalResult.quorum,
      strategy: optimalResult.strategy,
      confidence: optimalResult.confidence,
      reasoning: optimalResult.reasoning,
      expectedImpact: optimalResult.expectedImpact
    };
  }

  // Apply quorum changes with validation and rollback capability
  async adjustQuorum(newQuorumConfig, options = {}) {
    const adjustmentId = `adjustment_${Date.now()}`;
    
    try {
      // Validate new quorum configuration
      await this.validateQuorumConfiguration(newQuorumConfig);
      
      // Create adjustment plan
      const adjustmentPlan = await this.createAdjustmentPlan(
        this.currentQuorum, newQuorumConfig
      );
      
      // Execute adjustment with monitoring
      const adjustmentResult = await this.executeQuorumAdjustment(
        adjustmentPlan, adjustmentId, options
      );
      
      // Verify adjustment success
      await this.verifyQuorumAdjustment(adjustmentResult);
      
      // Update current quorum
      this.currentQuorum = newQuorumConfig.quorum;
      
      // Record successful adjustment
      this.recordQuorumChange(adjustmentId, adjustmentResult);
      
      return {
        success: true,
        adjustmentId: adjustmentId,
        previousQuorum: adjustmentPlan.previousQuorum,
        newQuorum: this.currentQuorum,
        impact: adjustmentResult.impact
      };
      
    } catch (error) {
      console.error(`Quorum adjustment failed:`, error);
      
      // Attempt rollback
      await this.rollbackQuorumAdjustment(adjustmentId);
      
      throw error;
    }
  }

  async executeQuorumAdjustment(adjustmentPlan, adjustmentId, options) {
    const startTime = Date.now();
    
    // Phase 1: Prepare nodes for quorum change
    await this.prepareNodesForAdjustment(adjustmentPlan.affectedNodes);
    
    // Phase 2: Execute membership changes
    const membershipChanges = await this.executeMembershipChanges(
      adjustmentPlan.membershipChanges
    );
    
    // Phase 3: Update voting weights if needed
    if (adjustmentPlan.weightChanges.length > 0) {
      await this.updateVotingWeights(adjustmentPlan.weightChanges);
    }
    
    // Phase 4: Reconfigure consensus protocol
    await this.reconfigureConsensusProtocol(adjustmentPlan.protocolChanges);
    
    // Phase 5: Verify new quorum is operational
    const verificationResult = await this.verifyQuorumOperational(adjustmentPlan.newQuorum);
    
    const endTime = Date.now();
    
    r
Read more
Ships withopen-code-review

AI-powered multi-agent code review. Simulates a customizable team of Engineers performing code review with built-in discourse.

Get the whole plugin, auto-invoked
Stats
329
Stars
0
Views
27
Forks
Active
Maintenance
TypeScript
Language
Apache-2.0
License
11d ago
Last commit
6mo ago
Created

Repo: spencermarx/open-code-review