{
    "id": "adaptive-pattern",
    "name": "Dynamic Adaptation Pattern",
    "description": "Self-adjusting pattern that dynamically creates, modifies, and removes agents based on evolving task requirements and complexity",
    "version": "1.0.0",
    "type": "adaptive",
    "extends": "base-delegation-pattern",
    
    "pattern": {
        "coordinator": "adaptive-controller",
        "structure": "dynamic-network",
        "communication": "adaptive-routing",
        "decisionMaking": "complexity-based"
    },
    
    "workflow": {
        "pattern": "adaptive",
        "execution": {
            "type": "dynamic-adaptation",
            "stages": [
                {
                    "name": "initial-assessment",
                    "agents": ["complexity-assessor"],
                    "parallel": false,
                    "description": "Analyze task complexity and initial requirements"
                },
                {
                    "name": "dynamic-execution",
                    "agents": ["adaptive-agents"],
                    "parallel": true,
                    "adaptive": true,
                    "description": "Execute with dynamic agent creation and modification"
                },
                {
                    "name": "continuous-monitoring",
                    "agents": ["monitor"],
                    "parallel": true,
                    "continuous": true,
                    "description": "Monitor progress and adapt agent structure as needed"
                },
                {
                    "name": "adaptive-synthesis",
                    "agents": ["synthesizer"],
                    "parallel": false,
                    "description": "Synthesize results from dynamic agent network"
                }
            ]
        },
        "communication": {
            "protocol": "adaptive-routing",
            "dynamicChannels": true,
            "loadBalancing": true,
            "failoverSupport": true
        }
    },
    
    "agentRequirements": {
        "complexity-assessor": {
            "template": "base-analyst",
            "required": true,
            "capabilities": ["complexity-analysis", "requirement-assessment", "resource-planning"]
        },
        "adaptive-controller": {
            "template": "base-delegator",
            "required": true,
            "capabilities": ["dynamic-coordination", "agent-lifecycle-management", "adaptive-planning"]
        },
        "monitor": {
            "template": "base-analyst",
            "required": true,
            "capabilities": ["progress-monitoring", "bottleneck-detection", "adaptation-triggers"]
        },
        "synthesizer": {
            "template": "base-writer",
            "required": true,
            "capabilities": ["dynamic-synthesis", "result-integration", "adaptive-reporting"]
        }
    },
    
    "adaptation": {
        "triggers": [
            {"name": "complexity-increase", "threshold": 0.3, "action": "add-specialists"},
            {"name": "bottleneck-detected", "threshold": 0.2, "action": "parallel-processing"},
            {"name": "quality-insufficient", "threshold": 0.7, "action": "add-reviewers"},
            {"name": "resource-underutilized", "threshold": 0.4, "action": "consolidate-agents"}
        ],
        "scalingRules": {
            "minAgents": 2,
            "maxAgents": 12,
            "scaleUpThreshold": 0.8,
            "scaleDownThreshold": 0.3,
            "adaptationInterval": 30
        },
        "agentLifecycle": {
            "dynamicCreation": true,
            "dynamicRemoval": true,
            "roleModification": true,
            "capabilityAdjustment": true
        }
    },
    
    "complexityAssessment": {
        "factors": [
            {"name": "task-scope", "weight": 0.3},
            {"name": "data-volume", "weight": 0.2},
            {"name": "domain-breadth", "weight": 0.2},
            {"name": "time-constraints", "weight": 0.15},
            {"name": "quality-requirements", "weight": 0.15}
        ],
        "assessmentInterval": 60,
        "adaptationThreshold": 0.25
    },
    
    "monitoring": {
        "metrics": ["progress-rate", "quality-trends", "resource-utilization", "bottleneck-indicators"],
        "monitoringInterval": 15,
        "alertThresholds": {
            "progressRate": 0.1,
            "qualityTrends": -0.1,
            "resourceUtilization": 0.9,
            "bottleneckSeverity": 0.3
        },
        "adaptationActions": {
            "add-agent": ["specialist-needed", "bottleneck-detected"],
            "remove-agent": ["redundancy-detected", "underutilization"],
            "modify-role": ["skill-mismatch", "changing-requirements"],
            "redistribute-work": ["load-imbalance", "efficiency-optimization"]
        }
    },
    
    "resourceOptimization": {
        "loadBalancing": true,
        "efficiency-monitoring": true,
        "bottleneckDetection": true,
        "automaticOptimization": true,
        "adaptiveScheduling": true
    },
    
    "evaluation": {
        "metrics": ["adaptation-effectiveness", "resource-efficiency", "dynamic-performance", "scalability-success"],
        "thresholds": {
            "adaptationEffectiveness": 0.8,
            "resourceEfficiency": 0.75,
            "dynamicPerformance": 0.85,
            "scalabilitySuccess": 0.8,
            "maxAdaptations": 10
        }
    },
    
    "worksonaConfig": {
        "eventTracking": ["complexity-change", "agent-created", "agent-removed", "adaptation-triggered", "bottleneck-resolved"],
        "metricsCollection": true,
        "transactionGrouping": "adaptive-session",
        "enableAdaptationVisualization": true
    }
} 