multi-agent-orchestrator
Skill1 starsChanged 6 days agoMITView on GitHub
Orchestrates delegation of bounded subtasks to the local `agent-hub` MCP server, which runs agy (Antigravity), opencode, and GitHub copilot CLIs off Claude's own quota, plus routes Claude subagent tiers (haiku/sonnet/opus). Trigger: multi-agent, delegate, orchestrate, parallelize, agent team, agent swarm, second opinion, save tokens, don't burn Claude, "agy", "antigravity", "gemini flash", "opencode", "muse", "copilot", free model, which agent, agent dashboard, adversarial review, distribute this task, use all agents, revalidate agents, agent-hub dashboard.
- Reads credentials
11 other projects use a version of this.
Adopted by
Most recently taken up by
- hongphuc5497/skillstheir own version, first seen Nov 1, 2026
- Phat-Po/multi-agent-orchestratortheir own version, first seen Oct 15, 2026
- saintgo7/claude-skillstheir own version, first seen Oct 11, 2026
- SuperMate-Ai/SuperMate-Harness-Systemtheir own version, first seen Aug 30, 2026
- iratus137-hue/multi-agent-orchestratortheir own version, first seen Jul 23, 2026
- tekliner/improvado-agentic-frameworks-and-skillstheir own version, first seen Jun 17, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- egorfedorov/Slot-Casino-Game-Developer-Skills-for-Stake-Engine★ 68same name
- tekliner/improvado-agentic-frameworks-and-skills★ 17same name
- tellmefrankie/ai-investment-skills★ 14same name
- hongphuc5497/skills★ 3same name
- hyw007726/multi-agent-orchestrator-skill★ 2same name
- SKY-lv/multi-agent-orchestrator★ 2same name
- lazze2026/multi-agent-orchestrator-skill★ 1same name
- SuperMate-Ai/SuperMate-Harness-System★ 1same name
- iratus137-hue/multi-agent-orchestrator★ 0same name
- Phat-Po/multi-agent-orchestrator★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
- dashboard/AGENTS.mdAGENTS.md
- agy-delegateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. 0 are common, 4 are distinctive, and 13 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
Use when a subtask is bounded and read-heavy (recon, call-chain trace, artifact summary, second opinion, adversarial review) and the useful …
- Very specific: line 26
Do not delegate: a judgment you will have to re-verify by reading the code yourself (you pay twice).
- Very specific: line 103
Use this instead of one write-mode delegate call whenever the change is non-trivial.
- Distinctive: line 129
Delivery review: Don't stop at "it says it's done." Run the task's own required verification commands yourself (see the task header …
- Very specific: line 222
Never rely on a structured-output flag (e.g.
- Very specific: line 228
Never put secrets, .env contents, tokens, or credentials in a task string.
- Very specific: line 248
Do not add "run the tests/type-check/lint and paste the output" to the header — an agy job that tries measurably loses the work (see …
- Very specific: line 272
After any delegated write, in this order: git diff (review it yourself), your repo's own type-check/lint/test commands, and any other …
- Very specific: line 278
Every agent above is a local CLI.
- Distinctive: line 317
Read jobs (recon, review, second opinion, plan) run in parallel in the checkout you are working in.
- Very specific: line 339
If the tree changes during the run, the job still succeeds and reports readGuard.level:'warn' with the changed paths.
- Very specific: line 357
Conflicts: if a writer and you (or another writer) changed the same lines, nothing is applied.
- Distinctive: line 384
After a worktree's work is delivered and merged into the integration branch, refresh sibling worktrees still in flight (rebase or recreate …
- Very specific: line 413
When every candidate in a chain is unavailable/breaker-open, route returns primary:null — fall back to a Claude subagent (Agent tool) or do …
- Very specific: line 431
Record a gotcha: When you hit something non-obvious about an agent/model/taskType (a model hangs, a mode writes anyway, a flag is …
- Very specific: line 449
If agent-hub is not registered in this session (no agents_status/route/delegate tools available):
- Very specific: line 487
Never put secrets, .env contents, credentials, or tokens in a task, in cwd contents passed to a read-mode delegate, or in a write-mode diff …
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
When to use / not
Use when a subtask is bounded and read-heavy (recon, call-chain trace, artifact summary, second opinion, adversarial review) and the useful answer is short relative to what must be read to produce it. Also use for cheap/free-quota work (triage, GitHub-context calls, mechanical writes in an isolated worktree) to preserve Claude's own quota. Read work needs no worktree: fan it out in your own checkout, the way you would launch parallel subagents (see "Parallel reads" below).
Do not delegate: a judgment you will have to re-verify by reading the code yourself (you
pay twice); anything whose answer is inherently long; anything touching secrets/.env/tokens;
work where being wrong is expensive and hard to detect; implementation that needs this repo's
CLAUDE.md/skills/hooks (only Claude Code loads those — see implementation-with-repo-rules).
The loop
agents_status → route → delegate → job_wait / job_status → job_result → (job_reply)* → synthesizeagents_status({refresh?})— L0-L2 preflight (no ping) for every agy/opencode/copilot pair in the delegation map. Returnsready|degraded|unavailable,reason,latencyMs,quotaSignal,dataPolicybadge, andbinPath/cliVersion(null until a discovery row exists for that agent). The MCP server fires CLI discovery (L0--version+ L1 model list — never an L3 ping) in the background at startup, persisted todiscovery.jsonunderAGENT_HUB_HOMEwith a 15-min TTL, so the firstagents_statuscall in a session is usually already warm.AGENT_HUB_DISABLE_STARTUP_DISCOVERY=1opts out (used by the server's own test suite). Callagents_statusonce per session or when routing looks stale;refresh:truebypasses the 15-min cache.route({taskType, mode?, includeCatalog?})—taskTypeis one of the keys in the Delegation map below;modeis'read'|'write'. Returns{primary:{agent,model,mode}, fallbacks[], skipped[], discovery, reason, appliedProposal}, wherediscoveryis a per-CLI{binPath, version, modelCount, checkedAt, error}summary andappliedProposalis the accepted proposal whose reorder was applied (ornull) — a human accepted it from the dashboard, so treat that order as intended. PassincludeCatalog:trueonly when you need the model ids a CLI actually offers (the full catalog costs several KB of context) — route stays advisory, it never blocks you, only orders/filters candidates.skippedlists every filtered-out chain candidate as{agent, model, reason}:held(a human put this pair on hold from the dashboard — don't silently route around it, tell the user),cli_not_found(the CLI isn't installed or isn't on PATH — this needs a human, not a retry),cached_unavailable, orbreaker_open.{agent:'claude', model: 'haiku'|'sonnet'|'opus'}in the result means run it yourself via the Agent tool — never pass it todelegate. When the choice matters and the pair has history, callagents_metricsfirst (groupByoptional) — success rate, p50/p95 latency and error kinds per agent/model/mode/taskType beat a guess.IMPORTANT: Before delegating, check
agents_quota(or thequotaannotation onroute's returned agents). If a chosen agent is exhausted, TELL THE USER with the reset time instead of delegating to it. agent-hub does not skip exhausted agents automatically — the human decides whether to switch agents, wait, or upgrade.delegate({agent, model, task, cwd, mode?, timeoutS?, title?, variant?, taskType?, verify?, isolation?, output?})—agentis'agy'|'opencode'|'copilot'. Returns{jobId, status:'queued'}immediately.taskmust name the output shape and a line budget (see Prompt-shaping below).mode:'write'requirescwdto be a secondarygit worktree addcheckout or an allowlisted path; read mode runs in your own checkout (isolation, defaultauto: agy in a hub-managed scratch copy, copilot/codex/opencode in place).output:'review'gets findings back as JSON injob_result.review.variantis opencode's reasoning effort (minimal/low/medium/high/max); ignored by agy/copilot. Muse Spark 1.3 defaults tohighfrom the model registry whenvariantis omitted. Pass the sametaskTypeyou gaveroute— it feeds metrics, adaptive timeouts and learnings. Never ask the agent to run tests/builds/dev servers itself (agy in particular: its CLI silently kills and abandons a slowrun_commandwhile still reporting success — the hub's own prompt guard already tells it not to). Passverify: [{name, argv, expectExitCode?, cwd?, timeoutS?}]instead: the hub runs those checks in the foreground, incwdby default, once the job succeeds, and recordsverificationon the job (see "Verification" below and../../docs/verification.md).job_wait({jobId, timeoutS<=60})to block until terminal, orjob_status({jobId})to poll without blocking. Both return{status, errorKind, error, ...}. For a fan-out, passjobIds:[...]instead (until:'any'to take each as it finishes) and re-call withpending.job_result({jobId, maxLines?})— head of the response (default 20 lines) plus{truncated, fullPath, tokens, costUsd, sessionId, verification}. ReadfullPathonly if the head is insufficient — do not default to pulling the whole file into context.verificationisnullunlessverifywas given; see "Verification" below.job_reply({jobId, message, mode?, timeoutS?, title?, taskType?})— optional: start a new turn in a terminal agy/opencode job's conversation, resuming its recordedsessionId.modeandtaskTypedefault to the parent job's (so metrics and adaptive timeouts keep grouping the conversation's turns together); switching towritegoes through the same worktree gate + lock asdelegate. copilot has no session resume (errorKind:'unsupported', nothing spawned); a non-terminal parent getserrorKind:'not_terminal'; a parent with nosessionIdgetserrorKind:'no_session'. The reply returnsturnDepthand, once the conversation is 5 turns deep, awarningsuggesting a freshdelegatewith a short summary. See "Guided delegation workflow" below for the read → read → write → read pattern this exists for.- Synthesize: report what each delegate found, flag disagreements, do not restate raw output.
job_cancel({jobId}) kills the whole process group (needed for opencode, which ignores
SIGTERM — the hub SIGKILLs it). MCP prompts recon, adversarial-review and guided-write
(args {goal, cwd, files?}) package this loop for clients that surface prompts.
Guided delegation workflow (plan → review → execute → delivery review)
Use this instead of one write-mode delegate call whenever the change is non-trivial. It applies
to both agy and opencode (both support session resume via job_reply; copilot doesn't, so it
can't run this pattern). This mirrors a real manual workflow observed across dozens of delegated
tasks (notes/gemini*-plan-corrections.md, notes/opencode-*-go.md,
notes/gemini*-delivery-corrections.md in a large monorepo migration): plan first, a human (or
Claude) checks the plan against the real tree before any write happens, and the delivery itself
gets one more correction pass before it's considered done — never trust either self-report.
- Plan.
delegate({agent, model, task:'<propose a plan for X, do not edit anything>', cwd: <your checkout>, mode:'read'})— read mode. Do not assume the CLI honors it. Verified:agy --mode planwrites files with or without--dangerously-skip-permissions(opencode's plan agent did respect read mode in testing). That is why the hub runs agy read turns in its own scratch copy of your tree (uncommitted and untracked files included, removed after the turn): whatever agy writes there is discarded and listed inisolation.discardedPaths, so you need no worktree. Only a write to an absolute path in your checkout escapes the copy; it shows up asreadGuard.level:'warn'. A non-emptydiscardedPathsmeans "the plan turn tried to edit," not a bad plan. - Plan review.
job_wait/job_resultthe plan, and check it against the actual code (not just internal consistency) — the real corrections seen in practice were things like "this validation schema already exists, reuse it," "that field starts at 0 in the legacy code, keep it," "don't touch this other file, a different task owns it." If it needs changes:job_reply({jobId, message:'<specific, numbered feedback>', mode:'read'})— still read mode, same conversation, so the model has the earlier turn's context. Repeat until the plan is right. - Execute. Once approved:
job_reply({jobId: <the last reply's jobId>, message:'execute the approved plan', mode:'write'})— the one call that can touch the filesystem, through the normal write-mode worktree gate + lock. - Delivery review. Don't stop at "it says it's done." Run the task's own required
verification commands yourself (see the task header template below) and read the diff. If
anything is off — a behavior change nobody asked for, missing tests the task actually required,
leftover dead code, a validation gap — send it back in the same conversation, still in
write mode, without a commit yet:
job_reply({jobId: <execute job's id>, message:'<numbered corrections>', mode:'write'}). Only commit once this comes back clean.
Each job_reply call passes the previous job's sessionId (agy: --conversation; opencode:
-s) — that is what lets step 3 (accept-edits/build) act on exactly what steps 1-2
negotiated, and step 4's corrections land in the same worktree/branch as step 3, instead of
starting cold every time. (The manual version of this workflow re-pastes the corrected plan as a
brand-new message instead of resuming a real session — job_reply is strictly better: the model
keeps the actual prior turns, not a human's paraphrase of them.)
Verification
agy's CLI auto-detaches a slow run_command (test/build/dev-server) into a background task and
its own idle-exit then kills it while still reporting SUCCESS — the model's work is lost, not
just slow. The hub's buildArgv prepends a fixed guard to every agy prompt telling it to write
code and an unexecuted RED test only; asking any agent to "run the tests and report the output" in
the task string fights that guard and wastes the call. Pass verification commands to
delegate/dispatch via verify instead:
delegate({..., mode:'write', verify:[
{name:'tests', argv:['npm','test']},
{name:'typecheck', argv:['npm','run','typecheck']},
]})The hub runs each check in the foreground, in the job cwd by default (bounded timeouts, never a
shell), only after the job reaches succeeded. A job that ends incomplete/failed/canceled
never runs them — job_result/job_status still report verification:{ok:null, skipped:true,
reason} so you can tell "never ran" apart from "ran and failed." A failing check never flips the
job's own status or trips a circuit breaker: read verification.ok and verification.checks[]
({name, ok, exitCode, durationMs, outputTail}) explicitly — don't infer pass/fail from status
alone. Full shape and the argv/artifact/diff/schema check kinds: ../../docs/verification.md.
Break-even rule
tokens(files the agent would read) >> tokens(answer returned) + tokens(verification you still need)The third term is the one people skip. If you cannot trust the answer without opening the same files, you paid two quotas for one answer. Delegate when the answer is a location, list, count, or summary. Do not delegate a judgment you must audit yourself.
Delegation map (from router.mjs DELEGATION_MAP)
| taskType | Primary | Fallback(s) | Why |
recon | agy gemini-4-hydrogen-low | opencode @free → Claude haiku | proven context compression, cheap refreshable quota |
call-chain-trace | agy gemini-4-hydrogen-high | opencode @free → opencode @go → Claude sonnet | needs multi-hop reasoning, 1M ctx |
research | opencode @free (up to 2 models) | agy gemini-4-hydrogen-medium | zero cost, 1M ctx |
triage | opencode @free | copilot auto | lowest latency |
second-opinion | agy gemini-4-hydrogen-high | copilot auto | different model lineage than Claude Code |
adversarial-review | agy claude-sonnet-4-6 parallel with copilot auto | agy claude-opus-4-6-thinking | dual blind review off the Claude Code quota |
github-context | copilot auto | — | built-in GitHub MCP; no second fallback (see copilot.md) |
mechanical-edit | agy gemini-4-hydrogen-medium (write) | opencode @go (write) → copilot auto (write) | cheap write-capable; single writer |
implementation-with-repo-rules | Claude sonnet (Agent tool) | — | only Claude Code loads CLAUDE.md + skills + hooks |
architecture | Claude opus (Agent tool) | agy claude-opus-4-6-thinking | highest reasoning |
structured-mechanical | Claude haiku (Agent tool) | — | cheapest Claude tier |
ui-test | agy gemini-4-hydrogen-high | agy claude-sonnet-4-6 | drives a real browser through Playwright MCP; requires browser (page must already be running) |
Unknown taskType throws — call route with one of the exact strings above.
What each CLI's models are good for
- agy (Antigravity):
gemini-4-hydrogen-{low,medium,high}for recon → call-chain-trace by size;gemini-3.1-pro-{low,high}for a second architectural opinion;claude-sonnet-4-6/claude-opus-4-6-thinkingare Claude models hosted inside Antigravity — adversarial review and architecture judgment at zero Claude-quota cost. Full detail:references/agents/agy.md. - opencode: chains use pools, not model ids.
@free(zero-cost catalog models) and@go(OpenCode Go subscription) expand to the models the user allowed in the dashboard (Agents → opencode models); undecided free models are allowed, Go and paid ones are blocked. An explicitdelegateto a model the policy blocks fails withcode: model_blocked: do not retry it, pick an allowed model or ask the user to allow it. Free models may train on prompts (badge stays visible). Full detail:references/agents/opencode.md. - copilot:
--modelavailability is subscription-specific — an explicit id can be rejected withmodel_unavailableeven when it's listed inhelp config; treat any explicit id as unverified until an L3 ping confirms it, and default toauto, which is always accepted.autocovers triage, second-opinion, github-context, and write-mode mechanical edits. Full detail (incl. one verified setup):references/agents/copilot.md. - Claude subagents (haiku/sonnet/opus): never called via
delegate— run through the Agent tool. Full detail:references/agents/claude-subagents.md.
Prompt-shaping rules (the task field)
- Name the exact output shape and a hard line budget in every
task— an unshaped prompt to agy measured 108s/~27k tokens offile://noise vs 4s/233 tokens with a contract. Example:"List files under src/ that define X. One relative path per line. Max 15 lines." - Never rely on a structured-output flag (e.g. agy's
--json-schema) — measured unreliable (emptystructured_outputwhile the free text held the right answer). Shape output through the prompt text instead. - Batch related questions into one
taskas numbered blocks — each call carries a large fixed baseline (agy: ~21k tokens from~/.gemini/GEMINI.md); three questions in one call cost roughly a third of three separate calls. - Never put secrets,
.envcontents, tokens, or credentials in ataskstring.
Task header template (write-mode / non-trivial tasks)
For anything past a one-shot read, prepend a fixed header to the task — paste the same block
into every task of a batch so nothing has to be re-derived per call. Adapted from a header reused
across dozens of real delegated tasks in this codebase:
Repo: <absolute worktree path> (branch <name>). App/package: <target>.
Read first: <AGENTS.md/CLAUDE.md path(s) with the load-bearing rules — see the agy.md gotcha:
a raw CLI call does not auto-load this repo's rules, restate them>.
Rules: 1) same behavior as <baseline>, except what the framework forces; 2) TDD — write a failing
test first, but do not run it yourself (the hub verifies after); 3) do not touch: <explicit
denylist for this task — a different task or a generated file>; 4) no commit, no push; 5) do not
start a dev server (one may already be running); 6) <any other repo-specific rule that would
otherwise only live in CLAUDE.md/AGENTS.md>.
Delivery: files touched, new tests added. Max <N> lines.Do not add "run the tests/type-check/lint and paste the output" to the header — an agy job
that tries measurably loses the work (see "Verification" above). Pass those same commands as
verify on the delegate/dispatch call instead; the hub runs them itself once the job
succeeds and records the result, no re-derivation needed per task.
The "do not touch" list is what keeps two parallel worktrees/tasks from fighting over the same file (see Parallel work below) — it is policy the hub does not enforce, so it only works if every task's header states it explicitly.
Write mode
With a writeScope, see "Parallel writes: scoped writers" below. Without one,
mode:'write' requires cwd to be a secondary git worktree add checkout (or an entry in
config.mjs's WRITE_ALLOWLIST, empty by default) — the hub refuses writes into the primary
checkout (errorKind:'worktree_denied') and serializes writers per cwd with a lock file
(errorKind:'locked' if held). The file-pattern denylist is policy, not enforced by the hub —
define your repo's own never-touch list and apply it yourself before delegating a write:
generated/derived files, migration tooling, config that changes build/deploy output, and
anything strict TDD reserves for the user to write (tests) belong on that list by default.
Example: author's setup (verified 2026-09), a Next.js monorepo —
prisma/(migrate devbanned), anything that produces a URL (a repo-specific base-path rule),src/server/openapi/**(generated), tests (strict TDD),next.config.ts,package.json,turbo.json.
After any delegated write, in this order: git diff (review it yourself), your repo's own
type-check/lint/test commands, and any other project-specific check it requires (codegen,
bundle checks — set AGENT_HUB_POST_EDIT_CHECK so agy-run.sh prints it after a write).
Cloud delegation (Jules)
Every agent above is a local CLI. Jules is not: it is a REST API, the work runs
on Google's servers against a GitHub repo connected in the Jules web UI, and the
output is a pull request rather than a change to cwd. Use it when the user
wants to hand a task over and walk away, not for anything they are waiting on.
It has its own tools and is absent from the delegation map, so route never
picks it and delegate cannot reach it:
jules_sources— the repos Jules can work on. Repos are connected in the web UI; the API cannot add one, so an unlisted repo needs a human there first.jules_delegate({task, cwd?, source?, startingBranch?, requirePlanApproval?, automationMode?, timeoutS?})— needsJULES_API_KEYand eithercwd(the source and branch are inferred from theoriginremote) or an explicitsource. Returns{jobId, status:'queued'};job_status,job_waitandjob_resultthen work exactly as for a local job.job_reply({jobId, message})orjob_reply({jobId, action:'approve_plan'})— relays to the live session instead of spawning a turn. WithrequirePlanApproval:truethe session waits for that approval before coding.jules_check({jobId})— one live read: state, pull-request URL, branch, last message. Needs no poller.jules_sessions({limit?, state?})— every session the account has, each with the localjobIdornull.
The machine being off is the normal case, not an error. The MCP server dies
with the session and the dashboard dies with the machine, while Jules keeps
going. When the user comes back and asks what happened, do not report a stale
local status: call jules_check (or jules_sessions when there is no jobId)
and answer from the live read. jules_check also finalizes a job still marked
running, so job_result starts returning the real answer with the PR link.
job_cancel does not stop Jules. There is no cancel endpoint. It marks the
job canceled and stops polling; the session keeps running and still opens its
PR. Say that plainly rather than reporting the task as stopped.
The API is alpha, quotas are per account (Pro: 100 tasks/day, 15 concurrent) and
exhaustion surfaces as errorKind:'quota' from a 429.
Parallel reads: fan out in your own checkout
Read jobs (recon, review, second opinion, plan) run in parallel in the checkout you are working in. You create no worktree and keep git to yourself. Use the same pattern as parallel Claude Code subagents:
- Launch all of them in one turn,
waitMode:'none'ondispatch(delegate never waits):dispatch({taskType:'adversarial-review', fanout:true, output:'review', ...})starts the routed primary plus its declaredparallelWithpair (parallelJobs[]).- For N identical reviewers, call
dispatchN times with distinctlabels. Without a label, identical calls dedupe into one job for 10 minutes. - To pin exact pairs, use one
delegateper agent.
- Wait once for all of them with
job_wait({jobIds}), thenjob_resulteach. Ask foroutput:'review'so findings come back as JSON (review.findings) rather than prose you have to re-parse; onreviewErrorfall back to the text. - Isolation is automatic (
isolation:'auto'):- agy runs in a hub-managed scratch copy of your tree (uncommitted and untracked files included, removed after the job).
- copilot/codex/opencode/gentle-shell run in place, because their CLIs enforce read-only.
- Browser evidence survives the scratch copy: a
ui-testjob's screenshots and page snapshots (.playwright-mcp/) are saved toruns/<jobId>/artifacts/and listed inisolation.artifacts, even when.playwright-mcp/is gitignored. Read them from there; do not passisolation:'in-place'just to keep screenshots. A path the agent quotes inside the scratch dir is already gone. - If the tree changes during the run, the job still succeeds and reports
readGuard.level:'warn'with the changed paths. Usually that is your own edit or a sibling job's, but the guard cannot tell who wrote it: check any path you did not touch.AGENT_HUB_READGUARD=strictrestores failing on any change.
- Writes are different: a write job still needs a secondary worktree (next section). Keep implementation either in your own session or in one write delegate per worktree.
Parallel writes: scoped writers in your checkout
The default way to parallelize writes is a scoped writer: delegate/dispatch with
mode:'write' and a writeScope (repo-relative globs such as ['src/features/people/**']).
- No worktree: the writer runs in a hub-managed scratch copy, even from your primary
checkout, and when it succeeds the hub applies to your working tree only its changes inside the
scope (
scratchWrite.appliedPaths). Everything else it touched is discarded (scratchWrite.discardedPaths). - Same lifecycle as subagents: launch several writers with disjoint scopes in one turn, keep
editing other files yourself, wait with
job_wait({jobIds}), then review the applied diff withgit diff. You still own git: nothing is staged or committed for you. - Conflicts: if a writer and you (or another writer) changed the same lines, nothing is
applied. The job ends
apply_conflictandscratchWrite.patchPathpoints toscope.patch; apply it by hand after resolving, or re-run the writer. - Make the scope the task boundary: a scope narrower than the work silently drops the rest,
so check
discardedPathsafter every writer. - Tell writers never to
git reset,git checkout -- <path>orgit stash: the copy starts with your uncommitted changes, so a rewind inside it becomes a diff that reverts them within the scope, and the hub applies that revert to your tree.
Parallel writes without a scope: one worktree per block, serialize within it
The hub's write lock (errorKind:'locked') only serializes jobs targeting the exact same cwd —
it has no idea whether two different worktrees touch overlapping files. Observed pattern for
running several write-mode delegates at once without them corrupting each other's git index or
breaking each other's tests:
- One worktree per block of work that touches a distinct set of files (e.g. one worktree for "move shared components," a separate one for "rewrite routing," another for "one feature module"). Different worktrees can run fully in parallel.
- Inside one worktree, tasks that touch overlapping files go one at a time, oldest first — even across different agents/models. Say so explicitly in the task header ("do not start until task X above is delivered and merged in this worktree").
- State the exact worktree path and branch in every task header (see the template above) — never let a task infer or guess it, and never let two agents write into the primary checkout.
- Give every
delegate/job_replyatitlethat encodes agent+task, e.g.gemini1-roles,opencode-D5-people— with several jobs in flight across worktrees, a consistent short label is what lets you (and the dashboard's Job history panel) tell them apart later. - After a worktree's work is delivered and merged into the integration branch, refresh sibling worktrees still in flight (rebase or recreate them) rather than letting them drift further from what already landed — the longer they diverge, the more the next delivery-review pass has to reconcile by hand.
Failure handling by errorKind
This table is for a delegate/job_* call that already ran. A candidate route filtered out
before you ever called delegate shows up in skipped instead (see loop step 2) — held and
cli_not_found there both mean "needs a human," not "retry."
| errorKind | Meaning | Action |
quota | 429/RESOURCE_EXHAUSTED or rate limit | retriable; router's next fallback candidate; repeats ≥2 in 30min opens the circuit breaker for that pair |
canceled | agy silently auto-denied a permission prompt (status:CANCELED, empty response, exit 0) | retriable once; if it repeats, the task needs a mode/tool the CLI won't grant headless |
billing | opencode provider returned 402/insufficient balance (e.g. DeepSeek) | not retriable on that model; a single occurrence opens the circuit breaker immediately (no threshold wait) — re-route to a free model |
model_unavailable | copilot rejected an explicit --model id | not retriable on that id; re-route to auto |
timeout | agy's own --print-timeout fired (turn abandoned, not just slow) or the hub's hard kill hit (kill ladder sends SIGINT first — best-effort against opencode's shared background server, see the opencode reference doc — then SIGTERM, then SIGKILL) | the turn is genuinely abandoned — verified live, resuming and asking for the answer returned UNFINISHED, not the real answer. For opencode specifically, the hub also fires an independent, best-effort session.interrupt cleanup call after finalizing the job (recorded as a separate job.interrupted event, never changing this errorKind) — it does not affect what you see here. job_result still returns whatever partial text streamed before the cutoff. Retry via job_reply({jobId, message:'<retry or narrower ask>'}) on the same sessionId rather than re-delegateing cold; latency is highly variable (4s-300s+ measured) |
empty | opencode's JSON stream dropped text/step_finish (documented, nondeterministic), or agy returned status:SUCCESS with an empty response and no streamed text at all | retriable once, same job_reply-on-sessionId pattern as timeout |
crash | no valid result envelope / unexpected exit | not retriable without changing the task |
read_mode_violation | a read-mode job with the strict guard saw its git-visible tree change during the turn: an adapter without a read policy, isolation:'in-place' on agy, a scratch-copy fallback, or AGENT_HUB_READGUARD=strict | the turn (or someone else) edited files despite read mode; check git status, then re-run with the default isolation:'auto' (agy goes to a scratch copy) |
orphaned | job's process was gone when the hub restarted | dead; re-delegate |
apply_conflict | a scoped writer succeeded but its in-scope patch no longer applies to your tree (you or another writer changed the same lines) | nothing was applied; resolve with git apply on scratchWrite.patchPath (scope.patch) or re-run the writer on the current tree |
scratch_unavailable | a scoped writer could not get a scratch copy (not a git repo, no commits, too many untracked files, ignored cwd, ...) | the error names why; fix that or fall back to a writer in a secondary worktree without writeScope |
auth | CLI not authenticated | not retriable; needs a human to log in |
not_terminal | job_reply called on a job that has not finished yet | wait for the parent job to reach a terminal status first |
no_session | job_reply called on a job with no recorded sessionId | that job never produced a resumable conversation; re-delegate instead |
unsupported | job_reply called on a copilot job | copilot has no session resume; nothing was spawned — re-delegate a fresh job instead |
When every candidate in a chain is unavailable/breaker-open, route returns primary:null
— fall back to a Claude subagent (Agent tool) or do the work yourself.
Deferred-issues ledger
A delegate reviewing or implementing one thing will often surface something real but out of
scope (a pre-existing bug, a legacy quirk deliberately being preserved, a decision that needs a
human/product call). Don't let that block the current task and don't lose it either — keep one
running Markdown table for the whole effort (one row per finding: id, which task/delegate found
it, the problem, file:line evidence, a proposed fix) and file each row as a real issue once the
work merges. This is what kept dozens of delegated tasks in one migration from either stalling on
tangents or quietly losing real findings. See the issue-creation skill for turning a ledger row
into an actual issue.
Self-improvement loop
The hub learns from its own runs, but every mutation is human-gated:
- Record a gotcha. When you hit something non-obvious about an agent/model/taskType (a model
hangs, a mode writes anyway, a flag is unreliable), call
learning_propose({text, agent?, model?, taskType?, sourceJobId?}). It is storedpending; a human approves it at#/approvals?tab=learnings, after which it is prepended (max 3, 300 chars each, sanitized) to matching root turns. - Probe it for evidence.
learning_probe({learningId})runs the same read task with and without the pending learning (2 parallel jobs; task/cwd default to itssourceJobId), andlearning_probe_result({probeId})stores the comparison and averdictHinton the learning for the approver. It costs 2 jobs per learning and never approves anything. - Review routing evidence.
#/approvals?tab=proposalslists chain-reorder proposals the hub computed from job metrics — an alternative whose 95% Wilson lower bound beats the current primary's upper bound, once both have 10+ samples. Accepting one is the only way it applies;routethen reports it asappliedProposal. Check#/metrics(oragents_metrics) first. - Timeouts tune themselves. Adaptive timeouts raise from observed p95 (x1.5, capped at
3600s) once a pair has 10 samples;
#/metricsis where to see why a timeout moved.
No-MCP fallback
If agent-hub is not registered in this session (no agents_status/route/delegate tools
available):
- For
agyspecifically:~/.claude/skills/agy-delegate/scripts/agy-run.sh --task "<question>" [--model low|medium|high|pro|sonnet|opus|oss]— see~/.claude/skills/agy-delegate/SKILL.md. - To check what's actually reachable without the MCP:
agent-hub preflight [--agent X] [--model Y] [--ping](CLI, same ladder asagents_status,--pingadds a real L3 PONG check) oragent-hub selftest.
Dashboard
agent-hub-dashboard (systemd --user unit) serves http://127.0.0.1:7777 as a sidebar app
with deep links — hand the user the exact view instead of describing it: #/overview (what
needs attention), #/agents?filter=all|unhealthy|held|breaker&q= (grouped by CLI; row menu
Revalidate, Ping (L3), Hold/Release, Reset breaker; header Revalidate all /
Rediscover CLIs), #/jobs (running, with Cancel), #/history?status=&agent=&q= (status
failed|succeeded|canceled, errorKind, reply chains, error detail), #/metrics?taskType=
(success-rate chart, per-pair table), #/subagents, #/timeline?source=&q=,
#/approvals?tab=proposals|learnings (accept/reject proposals and learnings) and
#/config?section=delegation|process|breaker|overrides|paths. Ping, Reset breaker, Cancel and
proposal/learning decisions ask for confirmation. HTTP surface: GET /api/config, GET
/api/metrics, GET /api/proposals, POST /api/proposals/refresh, POST
/api/proposals/:id/accept|reject, GET|POST /api/learnings, POST
/api/learnings/:id/approve|reject, DELETE /api/learnings/:id, GET /api/jobs/:id/result,
POST /api/agents/refresh {agent?,model?,ping?}, POST /api/discovery/refresh, POST
/api/overrides, DELETE /api/overrides/:agent/:model.
overrides.json ({ "agent:model": {hold?, breakerReset?, reason?, setAt} }, under
AGENT_HUB_HOME) is how a human holds a pair or resets its breaker via the dashboard's
Hold/Release/Reset breaker buttons — agents must never edit this file themselves, only through
those actions or the HTTP endpoints above.
Point the user to the dashboard to revalidate a pair, hold/release it, or reset its breaker,
rather than re-running a long preflight in chat; agents_status({refresh:true}) is the
in-session equivalent when the user isn't looking at the dashboard. Point them there too instead
of re-describing job state in chat when they ask "what's running" or "what failed."
Security
Never put secrets, .env contents, credentials, or tokens in a task, in cwd contents
passed to a read-mode delegate, or in a write-mode diff review. All three external CLIs run
outside Claude Code's sandboxing.
References
- Per-agent invocation, models, health signals, measured numbers, gotchas:
references/agents/agy.md,references/agents/opencode.md,references/agents/copilot.md,references/agents/claude-subagents.md. - MCP server source of truth lives in this same repo, relative to this skill:
../../README.md,../../src/router.mjs,../../src/config.mjs,../../src/discovery.mjs,../../src/dashboard.mjs. A default install puts the repo at~/.claude/mcp-servers/agent-hub/.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

