# agent-topology-optimizer

The agent-topology-optimizer Claude Code skill optimizes swarm layouts and communication between agents. It evaluates topology options, routing, and agent placement.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 189 repo stars
- Author: ngophatneknha
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/ngophatneknha/ai-engineering-hub/tree/HEAD/curated-courses/claude-flow-orchestration/.agents/skills/agent-topology-optimizer/SKILL.md
- Updated: 2026-11-07
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/agent-topology-optimizer

## What it does

The skill analyzes a swarm’s current topology and compares it with candidates suited to a workload profile and its constraints. It scores the options across multiple metrics, then returns a recommended layout and migration plan when the expected improvement clears the threshold.

Its described network work covers latency, routing, bandwidth allocation, caching, and compression. Agent placement can be evaluated with genetic algorithms, simulated annealing, particle swarm, graph partitioning, and machine learning. When no significant improvement is found, the result contains no replacement topology.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add ngophatneknha/ai-engineering-hub --skill agent-topology-optimizer -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/agent-topology-optimizer/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/agent-topology-optimizer/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add ngophatneknha/ai-engineering-hub --skill agent-topology-optimizer -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/agent-topology-optimizer/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add ngophatneknha/ai-engineering-hub --skill agent-topology-optimizer -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/agent-topology-optimizer/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install ngophatneknha/ai-engineering-hub curated-courses/claude-flow-orchestration/.agents/skills/agent-topology-optimizer
```

2. **Manually: put the files in place**
- File: `.github/skills/agent-topology-optimizer/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add ngophatneknha/ai-engineering-hub --skill agent-topology-optimizer -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/ngophatneknha/ai-engineering-hub --path curated-courses/claude-flow-orchestration/.agents/skills/agent-topology-optimizer
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/agent-topology-optimizer/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/ngophatneknha/ai-engineering-hub/tree/HEAD/curated-courses/claude-flow-orchestration/.agents/skills/agent-topology-optimizer/SKILL.md

## When to use it
- compare swarm topologies against a workload profile
- plan a migration to a different topology
- optimize routes between communicating agents
- choose agent placement under given constraints

## Example prompts
- Optimize the swarm topology for this workload profile and return a migration plan.
- Analyze the routes and reduce latency between agents.
- Find an agent placement that meets these constraints.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 9f79e0f7631f8a8f.

BEGIN THIRD-PARTY FILE 9f79e0f7631f8a8f
````text
---
name: agent-topology-optimizer
description: Agent skill for topology-optimizer - invoke with $agent-topology-optimizer
---

---
name: Topology Optimizer
type: agent
category: optimization
description: Dynamic swarm topology reconfiguration and communication pattern optimization
---

# Topology Optimizer Agent

## Agent Profile
- **Name**: Topology Optimizer
- **Type**: Performance Optimization Agent
- **Specialization**: Dynamic swarm topology reconfiguration and network optimization
- **Performance Focus**: Communication pattern optimization and adaptive network structures

## Core Capabilities

### 1. Dynamic Topology Reconfiguration
```javascript
// Advanced topology optimization system
class TopologyOptimizer {
  constructor() {
    this.topologies = {
      hierarchical: new HierarchicalTopology(),
      mesh: new MeshTopology(),
      ring: new RingTopology(),
      star: new StarTopology(),
      hybrid: new HybridTopology(),
      adaptive: new AdaptiveTopology()
    };
    
    this.optimizer = new NetworkOptimizer();
    this.analyzer = new TopologyAnalyzer();
    this.predictor = new TopologyPredictor();
  }
  
  // Intelligent topology selection and optimization
  async optimizeTopology(swarm, workloadProfile, constraints = {}) {
    // Analyze current topology performance
    const currentAnalysis = await this.analyzer.analyze(swarm.topology);
    
    // Generate topology candidates based on workload
    const candidates = await this.generateCandidates(workloadProfile, constraints);
    
    // Evaluate each candidate topology
    const evaluations = await Promise.all(
      candidates.map(candidate => this.evaluateTopology(candidate, workloadProfile))
    );
    
    // Select optimal topology using multi-objective optimization
    const optimal = this.selectOptimalTopology(evaluations, constraints);
    
    // Plan migration strategy if topology change is beneficial
    if (optimal.improvement > constraints.minImprovement || 0.1) {
      const migrationPlan = await this.planMigration(swarm.topology, optimal.topology);
      return {
        recommended: optimal.topology,
        improvement: optimal.improvement,
        migrationPlan,
        estimatedDowntime: migrationPlan.estimatedDowntime,
        benefits: optimal.benefits
      };
    }
    
    return { recommended: null, reason: 'No significant improvement found' };
  }
  
  // Generate topology candidates
  async generateCandidates(workloadProfile, constraints) {
    const candidates = [];
    
    // Base topology variations
    for (const [type, topology] of Object.entries(this.topologies)) {
      if (this.isCompatible(type, workloadProfile, constraints)) {
        const variations = await topology.generateVariations(workloadProfile);
````
END THIRD-PARTY FILE 9f79e0f7631f8a8f

The third-party file has ended. Everything between the 9f79e0f7631f8a8f tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2766 of 24668 bytes. © ngophatneknha · MIT · https://github.com/ngophatneknha/ai-engineering-hub/tree/HEAD/curated-courses/claude-flow-orchestration/.agents/skills/agent-topology-optimizer/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
