$npx -y skills add SamarthaKV29/antigravity-god-mode --skill agent-orchestration-multi-agent-optimizeOptimize multi-agent systems with coordinated profiling, workload distribution, and cost-aware orchestration. Use when improving agent performance, throughput, or reliability.
| 1 | # Multi-Agent Optimization Toolkit |
| 2 | |
| 3 | ## Use this skill when |
| 4 | |
| 5 | - Improving multi-agent coordination, throughput, or latency |
| 6 | - Profiling agent workflows to identify bottlenecks |
| 7 | - Designing orchestration strategies for complex workflows |
| 8 | - Optimizing cost, context usage, or tool efficiency |
| 9 | |
| 10 | ## Do not use this skill when |
| 11 | |
| 12 | - You only need to tune a single agent prompt |
| 13 | - There are no measurable metrics or evaluation data |
| 14 | - The task is unrelated to multi-agent orchestration |
| 15 | |
| 16 | ## Instructions |
| 17 | |
| 18 | 1. Establish baseline metrics and target performance goals. |
| 19 | 2. Profile agent workloads and identify coordination bottlenecks. |
| 20 | 3. Apply orchestration changes and cost controls incrementally. |
| 21 | 4. Validate improvements with repeatable tests and rollbacks. |
| 22 | |
| 23 | ## Safety |
| 24 | |
| 25 | - Avoid deploying orchestration changes without regression testing. |
| 26 | - Roll out changes gradually to prevent system-wide regressions. |
| 27 | |
| 28 | ## Role: AI-Powered Multi-Agent Performance Engineering Specialist |
| 29 | |
| 30 | ### Context |
| 31 | |
| 32 | The Multi-Agent Optimization Tool is an advanced AI-driven framework designed to holistically improve system performance through intelligent, coordinated agent-based optimization. Leveraging cutting-edge AI orchestration techniques, this tool provides a comprehensive approach to performance engineering across multiple domains. |
| 33 | |
| 34 | ### Core Capabilities |
| 35 | |
| 36 | - Intelligent multi-agent coordination |
| 37 | - Performance profiling and bottleneck identification |
| 38 | - Adaptive optimization strategies |
| 39 | - Cross-domain performance optimization |
| 40 | - Cost and efficiency tracking |
| 41 | |
| 42 | ## Arguments Handling |
| 43 | |
| 44 | The tool processes optimization arguments with flexible input parameters: |
| 45 | |
| 46 | - `$TARGET`: Primary system/application to optimize |
| 47 | - `$PERFORMANCE_GOALS`: Specific performance metrics and objectives |
| 48 | - `$OPTIMIZATION_SCOPE`: Depth of optimization (quick-win, comprehensive) |
| 49 | - `$BUDGET_CONSTRAINTS`: Cost and resource limitations |
| 50 | - `$QUALITY_METRICS`: Performance quality thresholds |
| 51 | |
| 52 | ## 1. Multi-Agent Performance Profiling |
| 53 | |
| 54 | ### Profiling Strategy |
| 55 | |
| 56 | - Distributed performance monitoring across system layers |
| 57 | - Real-time metrics collection and analysis |
| 58 | - Continuous performance signature tracking |
| 59 | |
| 60 | #### Profiling Agents |
| 61 | |
| 62 | 1. **Database Performance Agent** |
| 63 | - Query execution time analysis |
| 64 | - Index utilization tracking |
| 65 | - Resource consumption monitoring |
| 66 | |
| 67 | 2. **Application Performance Agent** |
| 68 | - CPU and memory profiling |
| 69 | - Algorithmic complexity assessment |
| 70 | - Concurrency and async operation analysis |
| 71 | |
| 72 | 3. **Frontend Performance Agent** |
| 73 | - Rendering performance metrics |
| 74 | - Network request optimization |
| 75 | - Core Web Vitals monitoring |
| 76 | |
| 77 | ### Profiling Code Example |
| 78 | |
| 79 | ```python |
| 80 | def multi_agent_profiler(target_system): |
| 81 | agents = [ |
| 82 | DatabasePerformanceAgent(target_system), |
| 83 | ApplicationPerformanceAgent(target_system), |
| 84 | FrontendPerformanceAgent(target_system) |
| 85 | ] |
| 86 | |
| 87 | performance_profile = {} |
| 88 | for agent in agents: |
| 89 | performance_profile[agent.__class__.__name__] = agent.profile() |
| 90 | |
| 91 | return aggregate_performance_metrics(performance_profile) |
| 92 | ``` |
| 93 | |
| 94 | ## 2. Context Window Optimization |
| 95 | |
| 96 | ### Optimization Techniques |
| 97 | |
| 98 | - Intelligent context compression |
| 99 | - Semantic relevance filtering |
| 100 | - Dynamic context window resizing |
| 101 | - Token budget management |
| 102 | |
| 103 | ### Context Compression Algorithm |
| 104 | |
| 105 | ```python |
| 106 | def compress_context(context, max_tokens=4000): |
| 107 | # Semantic compression using embedding-based truncation |
| 108 | compressed_context = semantic_truncate( |
| 109 | context, |
| 110 | max_tokens=max_tokens, |
| 111 | importance_threshold=0.7 |
| 112 | ) |
| 113 | return compressed_context |
| 114 | ``` |
| 115 | |
| 116 | ## 3. Agent Coordination Efficiency |
| 117 | |
| 118 | ### Coordination Principles |
| 119 | |
| 120 | - Parallel execution design |
| 121 | - Minimal inter-agent communication overhead |
| 122 | - Dynamic workload distribution |
| 123 | - Fault-tolerant agent interactions |
| 124 | |
| 125 | ### Orchestration Framework |
| 126 | |
| 127 | ```python |
| 128 | class MultiAgentOrchestrator: |
| 129 | def __init__(self, agents): |
| 130 | self.agents = agents |
| 131 | self.execution_queue = PriorityQueue() |
| 132 | self.performance_tracker = PerformanceTracker() |
| 133 | |
| 134 | def optimize(self, target_system): |
| 135 | # Parallel agent execution with coordinated optimization |
| 136 | with concurrent.futures.ThreadPoolExecutor() as executor: |
| 137 | futures = { |
| 138 | executor.submit(agent.optimize, target_system): agent |
| 139 | for agent in self.agents |
| 140 | } |
| 141 | |
| 142 | for future in concurrent.futures.as_completed(futures): |
| 143 | agent = futures[future] |
| 144 | result = future.result() |
| 145 | self.performance_tracker.log(agent, result) |
| 146 | ``` |
| 147 | |
| 148 | ## 4. Parallel Execution Optimization |
| 149 | |
| 150 | ### Key Strategies |
| 151 | |
| 152 | - Asynchronous agent processing |
| 153 | - Workload partitioning |
| 154 | - Dynamic resource allocation |
| 155 | - Minimal blocking operations |
| 156 | |
| 157 | ## 5. Cost Optimization Strategies |
| 158 | |
| 159 | ### LLM Cost Management |
| 160 | |
| 161 | - To |