Agent hub

From seaworld008/Commonly-used-high-value-skills · View interactive version

Agent hub is an AI agent skill from the GitHub repository seaworld008/Commonly-used-high-value-skills. Compare independent solutions with agent-hub when parallel competition is requested; isolate Git worktrees, evaluate variants, and integrate the selected result.

How to use this skill

Skill file

AgentHub — Multi-Agent Collaboration

Spawn N parallel AI agents that compete on the same task. Each agent works in an isolated git worktree. The coordinator evaluates results and merges the winner.

Slash commands below belong to the separately installed upstream AgentHub

plugin; loading this canonical skill does not register those commands. Use the

bundled Python helpers when appropriate and inspect their actual help. The

plugin-layout dry_run.py requires a complete upstream plugin checkout; missing

plugin command files in this portable skill bundle are not a successful plugin

installation or a reason to invent host commands.

Slash Commands

| Command | Description |

|---------|-------------|

| /hub-init | Create a new collaboration session — task, agent count, eval criteria |

| /agenthub:spawn | Launch N parallel subagents in isolated worktrees |

| /hub-status | Show DAG state, agent progress, branch status |

| /agenthub:eval | Rank agent results by metric or LLM judge |

| /agenthub:merge | Merge winning branch, archive losers |

| /agenthub:board | Read/write the agent message board |

| /hub-run | One-shot lifecycle: init → baseline → spawn → eval → merge |

Agent Templates

When spawning with --template, agents follow a predefined iteration pattern:

| Template | Pattern | Use Case |

|----------|---------|----------|

| optimizer | Edit → eval → keep/discard → repeat x10 | Performance, latency, size |

| refactorer | Restructure → test → iterate until green | Code quality, tech debt |

| test-writer | Write tests → measure coverage → repeat | Test coverage gaps |

| bug-fixer | Reproduce → diagnose → fix → verify | Bug fix approaches |

Templates are defined in references/agent-templates.md.

When This Skill Activates

Trigger phrases:

Coordinator Protocol

The main Claude Code session is the coordinator. It follows this lifecycle:

INIT → DISPATCH → MONITOR → EVALUATE → MERGE

1. Init

Run /hub-init to create a session. This generates:

2. Dispatch

Run /agenthub:spawn to launch agents. For each agent 1..N:

3. Monitor

Run /hub-status to check progress:

4. Evaluate

Run /agenthub:eval to rank results:

5. Merge

Run /agenthub:merge to finalize:

Agent Protocol

Each subagent receives this prompt pattern:

You are agent-{i} in hub session {session-id}.
Your task: {task description}

Instructions:
1. Read your assignment at .agenthub/board/dispatch/{seq}-agent-{i}.md
2. Work in your worktree — make changes, run tests, iterate
3. Commit all changes with descriptive messages
4. Write your result summary to .agenthub/board/results/agent-{i}-result.md
5. Exit when done

Agents do NOT see each other's work. They do NOT communicate with each other. They only write to the board for the coordinator to read.

DAG Model

Branch Naming

hub/{session-id}/agent-{N}/attempt-{M}

Frontier Detection

Frontier = branch tips with no child branches. Equivalent to AgentHub's "leaves" query.

python scripts/dag_analyzer.py --frontier --session {id}

Immutability

The DAG is append-only:

Message Board

Location: .agenthub/board/

Channels

| Channel | Writer | Reader | Purpose |

|---------|--------|--------|---------|

| dispatch/ | Coordinator | Agents | Task assignments |

| progress/ | Agents | Coordinator | Status updates |

| results/ | Agents + Coordinator | All | Final results + merge summary |

Post Format

---
author: agent-1
timestamp: 2026-03-17T14:30:22Z
channel: results
parent: null
---

## Result Summary

- **Approach**: Replaced O(n²) sort with hash map
- **Files changed**: 3
- **Metric**: 142ms (baseline: 180ms, delta: -38ms)
- **Confidence**: High — all tests pass

Board Rules

Evaluation Modes

Metric-Based

Best for: benchmarks, test pass rates, file sizes, response times.

python scripts/result_ranker.py --session {id} \
  --eval-cmd "pytest bench.py --json" \
  --metric p50_ms --direction lower

The ranker runs the eval command in each agent's worktree directory and parses the metric from stdout.

With the bundled ranker, pass --direction higher explicitly for throughput, coverage, or any metric where larger is better. Its current argparse default is lower and overrides the session's direction when the flag is omitted; session configuration alone is insufficient. Check the recorded direction before selecting a winner.

LLM Judge

Best for: code quality, readability, architecture decisions.

The coordinator reads each agent's diff (git diff base...agent-branch) and ranks by:

  1. Correctness (does it solve the task?)
  2. Simplicity (fewer lines changed preferred)
  3. Quality (clean execution, good structure)

Hybrid

Run metric first. If top agents are within 10% of each other, use LLM judge to break ties.

Session Lifecycle

init → running → evaluating → merged
                            → archived (if no winner)

State transitions managed by session_manager.py:

| From | To | Trigger |

|------|----|---------|

| init | running | /agenthub:spawn completes |

| running | evaluating | All agents return |

| evaluating | merged | /agenthub:merge completes |

| evaluating | archived | No winner / all failed |

Proactive Triggers

The coordinator should act when:

| Signal | Action |

|--------|--------|

| All agents crashed | Post failure summary, suggest retry with different constraints |

| No improvement over baseline | Archive session, suggest different approaches |

| Orphan worktrees detected | Run session_manager.py --cleanup {id} |

| Session stuck in running | Check board for progress, consider timeout |

Installation

# Copy to your Claude Code skills directory
cp -r engineering/agenthub ~/.claude/skills/agenthub

# Or install via ClawHub
npx clawhub@latest install agenthub

Scripts

| Script | Purpose |

|--------|---------|

| hub_init.py | Initialize .agenthub/ structure and session |

| dag_analyzer.py | Frontier detection, DAG graph, branch status |

| board_manager.py | Message board CRUD (channels, posts, threads) |

| result_ranker.py | Rank agents by metric or diff quality |

| session_manager.py | Session state machine and cleanup |

Related Skills

Local Execution Boundaries

The restored helpers live in this skill's scripts/ directory.

Run their --help from the resolved skill path before constructing commands.

Review a configured evaluation command before result_ranker.py executes it;

it is shell code, not an inert metric name. Do not accept commands from an

untrusted candidate result. Cleanup uses Git's normal dirty-worktree protection

and leaves refused removals visible. Do not retry those removals with force.

Load coordination strategies or DAG patterns only for those tasks. These command names belong to the separately installed plugin; the portable skill does not register them.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.