worker-dispatch
Skill1 starsChanged 3 months agoMITView on GitHub
Conductor-only. How to run one worker through the workflow MCP and decide whether to accept its result — check, prepare the worktree, compose, run, inspect, record the decision, integrate, clean up, resume. Use for every dispatch any command makes. Trigger on "dispatch", "prepare_worktree", "build_worker_prompt", "inspect_dispatch", "record_decision", "dispatch_stats", "run the worker", "retry the worker", "resume a dispatch", "worker failed", "accept the report", "change a role's engine".
1 other project uses a version of this.
Adopted by
Most recently taken up by
- troykelly/claude-skillstheir own version, first seen Jan 2, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- troykelly/claude-skills★ 11same name
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 repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adversarial-reviewSkill
- clean-architectureSkill
- decision-recordingSkill
- design-system-checkSkill
- feature-branchingSkill
- finding-dispositionSkill
- git-recoverySkill
- gotcha-recordingSkill
- human-checkpointSkill
- plan-reviewSkill
- plan-writingSkill
- pr-createSkill
- spec-writingSkill
- tdd-loopSkill
- update-toolkitSkill
- wiki-updateSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 48
Dispatching into a worktree whose setup failed: Every result from it measures the environment, not the change.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Worker Dispatch
One procedure for every dispatch any command makes. The command decides which role gets what brief; this decides how the worker runs and whether its result is accepted.
Read first
tools/workflow-mcp/engine-setup.md— only the section for an enginecheckreports a problem with.
Once per cycle, before the first dispatch
- Call
checkand act on every field before composing anything:ok: false→ regenerate withsync— or, iftools/workflow-mcp/changed since the server started, rungenerate.mjsdirectly: the server caches its own source (tools/workflow-mcp/getting-started.md§ Troubleshooting).- A role you are about to dispatch appears in
roles_without_an_available_engine→human-checkpoint. - An engine that role resolves to has
setup.ok: false→human-checkpointnaming itsmissing_command_grantsandmissing_url_grants(a web-capable role'sread_url(*), user-global) — or itsproblem, a settings file that exists but could not be read, whichgrant_antigravity_setuprefuses to touch. A worker on it dies on its first denied command or URL. On the human's yes,grant_antigravity_setupwrites exactly what is listed. - The role appears in
capability_gapsfor its first engine → dispatch it withcli_engineset to an engine not listed there. architecture.enforced: falseon a project whosedocs/wiki/architecture.md § Layersis filled → say so in the cycle report; the layers are then enforced by review alone.
Per dispatch
- Prepare.
prepare_worktreewith a task id — and, for the next case of a cycle,reuse: <the previous case's task id>once that case is decided and integrated: the same directory on a new branch at HEAD, its installed dependencies intact, instead of a fresh checkout and a fresh install. A review whosediff_rangeends before HEAD takesat: <that end>, so the files the reviewer reads are the ones its diff produced. If it returns asetup_command, run that one line: it runs every configured setup step in the worktree, underworkerTimeoutSeconds, stops at the first failure and prints only a failure's output (on a reused worktree it is quick, and still needed if the last case changed a dependency). Never paste the individualsetup_commandsinto your shell. A failing setup command is a blocker — never dispatch into a half-built worktree. Whatever setup creates must be gitignored; otherwise inspection reads it as worker output. - Compose.
build_worker_promptwith the role,instructionsorinstructions_file, theworkspaceand the sametask_id— plusowned_pathsandcommit_messagefor a write role, anddiff_rangefor any review. The role receives the skills its command declares for it (androles.<role>.extraSkills) without being asked; passcommandwhen two commands would give it different ones, andskillsonly to narrow the list. Re-composing into a task whose last attempt already ran archives that attempt (with the verdict it had) and counts this one as a retry; a retry in a fresh worktree passesretry_of: <previous task id>. Composing into a task whose attempt is still running is refused — a live process would finish into the new attempt's record — so wait and inspect it, or passabandon_running: trueonly once you know that process is gone. Read thewarnings: a fallback engine, a shared quota, an empty diff, a capability the engine lacks. - Run the returned
commandverbatim — onenode …/run-worker.mjs <dir>line, the same in bash, zsh, PowerShell or cmd, on the machine that holds the checkout (not a WSL shell over a Windows checkout). It launches the engine, stops it and everything it started atworkerTimeoutSeconds, records the outcome and prints the report. A worker takes minutes: where the shell tool has a short limit, run it in the background and wait for it to finish (Claude Code:run_in_background, then the completion notification) — a call the tool moves to the background is still running, andinspect_dispatchsaysrunninguntil it ends. Never compose into the task meanwhile. - Inspect.
inspect_dispatchwith the task id, then act onverdict.mechanical:reject→ the result is not accepted, whatever the report says. Each reason names the failure — nonzero exit, empty report, a denied action (the refused target is in the report), a change outside scope, a commit on the worker branch, a subagent call. Fix the cause (a grant, an input inlined instead of read from outside the worktree, a narrower brief) and re-dispatch, orhuman-checkpoint. Never re-send an unchanged brief: the same inputs fail the same way — with one exception. When the verdict carriestransient: true, the engine ended the run after rejecting its own malformed tool call (measured on agy); the brief was not the cause, so re-dispatch once unchanged. A second transient failure is ahuman-checkpoint, not a third try.incomplete→ it has not run or not finished — or it is a developer dispatch that declaredtest_pathsand its Red is not proven yet. Runred.command— Green with the implementation, the architecture check, then Red without it (exit 0 proven; 1 not green, architecture failing, refuted or timed out; 2 a phase could not run) — read the output tail it prints, and inspect again. Never commit in the worktree before this: the check compares the working tree againstbase_sha.pass→ nothing computable is wrong, which is not the same as the work being right. Read the report atreport.pathand judge it against what the command defines as done — numbered findings with aChecked:line for a review, a proven Red plus a green suite and architecture check for a developer case. Weighverdict.warningstoo: on agy and codex the audit lists reads outside the workspace and skills the worker opened but was not sent — for a reviewer, either can mean it read the author's material, and then its independence is gone. Claude workers have no transcript to audit, but their denied tool calls come back as warnings too.
- Decide.
record_decisionwithacceptedorrejectedand the one-sentence reason — for every finished dispatch, rejections included. Accepting anything but apassneedsoverride_mechanical: trueand a reason that answers each rejection reason; if you cannot write that sentence, you are not accepting it. For a review dispatch, also passfindings(counts raised per severity, and per disposition once you have disposed of them — record the decision again then) andreviewed_task_ids; that is what letsdispatch_statsreport whether a review role earns its tokens. Undecided attempts are what makedispatch_statsmeaningless. - Integrate an accepted write role: stage exactly its
owned_pathsin its worktree, commit with the message you passed, then mergeworker/<id>into your branch with a plaingit merge— never--ff-only, because the worktree branched from an older HEAD whenever your branch has moved since. Resolve conflicts pergit-recoveryand keep the merge commit. A path the worker reported as superseded is yours togit rmin the same commit: workers cannot delete files. Lines under the report'sFollow-ups:(todos, wiki-todos) are yours to append in that commit too. - Clean up.
remove_worktreeonce the work is integrated — unless the next dispatch reuses it (step 1) — or once a rejected attempt's worktree holds nothing you still need. A refusal means read before retrying; never force it. The dispatch record outlives the worktree.
Resuming an interrupted dispatch
list_worktrees shows what exists; inspect_dispatch per task gives state, attempt, base_sha, owned_paths, decision and the report path. Resume from the state: prepared → step 2; composed → step 3; finished with no decision → step 4; accepted but not merged (worktree.merged: false) → step 6.
Changing which engine a role runs on
Call dispatch_stats first and compare, for that role, accepted over finished, retries, and median duration per engine — on real cycles, not a single run. A change to .agents/config.json with no stats behind it is a guess; if you make one anyway, say so in its log entry.
Anti-patterns
- Accepting on the exit code, or on the report's own claim of success. Measured:
exit 0+SUCCESS+ a denied read, and a Red "confirmed" by a green suite that never reached the code. - Dispatching into a worktree whose setup failed. Every result from it measures the environment, not the change.
- Leaving attempts undecided.
- Running a long command raw in your shell — a test suite, an install, a setup step. It has no limit, and a shell tool that gives up on it can stop the shell and leave its children running (measured: a stopped shell's grep ran on for an hour and a half). Run it as
node tools/workflow-mcp/bounded.mjs [--timeout <s>] -- "<command>": its whole tree stops at the limit or when the runner itself is stopped, and it prints a bounded tail. Workers, red checks and setup already run this way. - Running a role through your own native subagent tool. It inherits your context and your checkout (
AGENTS.md, Delegating work).
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.

