Class: EnhanceSwarm::TaskCoordinator

Inherits:
Object
  • Object
show all
Defined in:
lib/enhance_swarm/task_coordinator.rb

Overview

Intelligent task coordination and delegation system Implements real dev team patterns with minimal overlap and smart handoffs

Instance Method Summary collapse

Constructor Details

#initializeTaskCoordinator

Returns a new instance of TaskCoordinator.



13
14
15
16
17
18
19
20
# File 'lib/enhance_swarm/task_coordinator.rb', line 13

def initialize
  @config = EnhanceSwarm.configuration
  @session_manager = SessionManager.new
  @agent_spawner = AgentSpawner.new
  @project_analyzer = ProjectAnalyzer.new
  @task_queue = []
  @agent_assignments = {}
end

Instance Method Details

#coordinate_task(description) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/enhance_swarm/task_coordinator.rb', line 22

def coordinate_task(description)
  Logger.info("🎯 ENHANCE SWARM TASK COORDINATOR ACTIVATED")
  Logger.info("πŸ“‹ Master Task: #{description}")
  Logger.info("πŸ” Beginning intelligent task analysis and decomposition...")
  
  # 1. Analyze project context
  Logger.info("πŸ”¬ PHASE 1: Project Context Analysis")
  @project_analyzer.analyze
  project_context = @project_analyzer.generate_smart_defaults
  
  project_type = project_context[:project_type] || 'Generic'
  tech_stack = project_context[:technology_stack]&.join(', ') || 'Unknown'
  Logger.info("   πŸ“Š Detected: #{project_type} project using #{tech_stack}")
  
  # 2. Break down task into specialized subtasks
  Logger.info("🧩 PHASE 2: Intelligent Task Decomposition")
  subtasks = decompose_task(description, project_context)
  Logger.info("   ⚑ Decomposed into #{subtasks.length} specialized agent tasks")
  subtasks.each_with_index do |task, i|
    Logger.info("      #{i+1}. #{task[:role].upcase}: #{task[:description]}")
  end
  
  # 3. Create dependency-aware execution plan
  Logger.info("πŸ—ΊοΈ  PHASE 3: Dependency-Aware Execution Planning")
  execution_plan = create_execution_plan(subtasks)
  phases = execution_plan[:phases].length
  total_agents = execution_plan[:phases].sum { |p| p[:tasks].length }
  Logger.info("   🎯 Generated #{phases}-phase execution plan with #{total_agents} coordinated agents")
  
  # 4. Execute plan with coordination
  Logger.info("πŸš€ PHASE 4: Multi-Agent Orchestration Launch")
  Logger.info("═" * 60)
  execute_coordinated_plan(execution_plan)
end