Summary: Orchestrator protocol for driving multi-agent task execution. One coordinating agent (the orchestrator, often Codex) slices a task into parallel-safe units and dispatches worker agents (often Claude) via the Tools/agent_review CLI wrapper. Covers work slicing, context hygiene, temp report files, parallelism, avoiding conflicting edits, polling/tailing results, and output validation. Use when the user asks an agent to act as orchestrator/coordinator/dispatcher rather than do the work directly.
Key Files: Tools/agent_review, AGENT_WORKFLOW.md, AGENT_REVIEW.md, CODING_CONVENTIONS.md
Status: IMPLEMENTED
Adopt the orchestrator role when:
- User request: User or agent explicitly asks for an orchestrator, coordinator, or dispatcher role.
- Wide mechanical work: A change touches many independent files (rename sweep, per-file refactor, per-file doc update) where workers can run in parallel.
- Mixed read/write fan-out: Several read-only investigations plus a few isolated edits can proceed concurrently.
- Context pressure: The full task would blow the primary agent's context; slicing keeps each worker's context small and the orchestrator's clean.
Do not orchestrate trivial single-file work — the dispatch overhead is not worth it. Do the work directly per AGENT_WORKFLOW.md.
- Orchestrator: owns the plan, the work slices, the dispatch, and the validation. Often Codex (or whichever agent the user is driving). Never holds large file dumps in its own context — it reads worker report files, not raw worker transcripts.
- Worker: a fresh CLI agent spawned per slice via
Tools/agent_review. Often Claude (claude-opus-4-8). Each worker gets a tight brief, does one slice, and writes a concise result to a temp file.
The orchestrator and a worker should not be the same model family running the same slice — keep workers fresh-context so they don't inherit the orchestrator's assumptions (same rationale as AGENT_REVIEW.md § Context Isolation).
The orchestrator's context is the scarce resource. Protect it:
- Never paste worker transcripts or large diffs into the orchestrator's own reasoning. Have workers write to temp report files and read only the summary.
- Give each worker a self-contained brief: this doc, the task source, the exact files/slice it owns, and the expected output contract. Do not pass the orchestrator's full investigation trail.
- Keep the worker's deliverable small — a short structured report, not a re-dump of everything it read.
- When fanning out reads, ask each worker to return only a verdict + 2–5 bullets, not full file contents (same pattern as
AGENT_WORKFLOW.mdStep 1 worksheet fan-out).
Slice so workers never collide:
- One edit agent per touched file set. Each writing worker owns a disjoint set of files. Two workers must never edit the same file — overlapping edits silently clobber each other.
- Group files that must change together (a class plus its test, a doc plus its
Key Files:source) into one slice so a single worker keeps them consistent. - Read-only investigations can overlap freely — they touch nothing.
- Keep each slice small enough that one worker finishes it in a single focused pass with a small context.
- If two slices have a dependency (B needs A's output), run them in sequence, not parallel; pass A's report file path to B.
- Name off-limits files in every brief. Human-owned or do-not-touch files (e.g.
DataMigration.gd) must be called out explicitly in the worker prompt, even for slices that legitimately touch nearby code. Workers will otherwise "fix" them or stall debating whether they may — state up front which files to read-but-not-edit and which to leave entirely alone.
Every worker prompt should include the same core contract. Missing pieces create avoidable stalls, scope creep, or unusable reports.
- Role and mode:
read-only,edit,validation,review, orwrap - Exact slice: task number/name, files or file families owned, and what success means
- Allowed files: the files or directories the worker may edit
- Forbidden files: human-owned, unrelated, or explicitly out-of-scope files
- Context inputs: docs, worksheets, report files, or scratch diffs the worker must read
- Output path: a predictable
/tmp/gso_<slice>.mdreport file - Report shape: files changed, commands run, pass/fail, blockers, and follow-up recommendations
- Validation expectation: tests/lints to run, or an explicit reason they are not required
- Stop condition: stop and report instead of guessing when a blocker appears
Template:
<SLICE NAME> ONLY. You are a <mode> worker in this repo.
Read <docs/reports>. Edit only <allowed files>. Do not edit <forbidden files>.
Do <exact task>. Run <validation>.
Write /tmp/gso_<slice>.md with: files changed, behavior, commands/results, blockers.
Stdout one line only with status and report path. Do not commit.
The worker's stdout should be disposable. The report file is the interface.
- Run read-only workers in parallel. Investigations, audits, and validations have no write conflicts — dispatch them concurrently and collect their report files.
- Run writing workers in parallel only when their file sets are disjoint (see slicing). When in doubt, serialize the writers.
- Background long-running workers and poll their result files rather than blocking on each one (see Polling).
- Cap concurrency to what the machine and metered-model budget allow; free pools (Copilot, Cursor included pool) are cheaper to fan out wide.
Workers communicate results through files, not stdout-into-orchestrator-context.
- Each worker writes to a predictable path, e.g.
/tmp/claude_step0.md,/tmp/claude_step1.md, … one file per slice. - Use a consistent prefix (
claude_) and a slice index or slug so the orchestrator can tail/poll deterministically. - For large inputs handed to a worker (a big diff, a file list), write the input to a gitignored scratch path inside the repo and tell the worker to read that path — keeps both the worker and the orchestrator under context limits.
- Report files are scratch; do not commit them.
Workers are spawned through the same wrapper used for cross-review, so one tool covers all CLI agent families. The wrapper owns per-CLI transport quirks (read-only enforcement, < /dev/null stdin redirect, effort-flag mapping, default models); when a CLI's API changes, fix Tools/agent_review and this doc stays the same.
Tools/agent_review <agent> <model|default> <effort|default> "<prompt>"<agent>—copilot|codex|claude|cursor<model>— a model id for that agent, ordefault<effort>—low|medium|high|none|default<prompt>— the worker brief; pass-to read it from stdin
The repo is the current git toplevel; override with REPO=/path. List models with Tools/agent_review <agent> --list-models.
Agents, their default model, and when to reach for each:
(SIDENOTE: this heuristic is for "Jamon" -- if this is being run under some other user, this MAY NOT BE TRUE and you must check with the user regarding their specific account circumstances and refine this section first)
copilot→gpt-5.4— prefer first for free read-only fan-out: Copilot tokens are free.autoandclaude-sonnet-4.5reject--effort(the wrapper retries without it automatically).codex→gpt-5.5— OpenAI frontier (metered). Use when you specifically wantgpt-5.5.claude→claude-opus-4-8— Anthropic frontier (metered). Default worker model. Use the idclaude-opus-4-8, notclaude-opus-4-8-thinking-high.cursor→composer-2.5— Cursor's own model from the included pool (effectively free on Pro). Cursor bakes reasoning effort into the model id, so<effort>is a no-op for Cursor. Headlesscursor-agent -pneeds--force --trust(the wrapper passes both) or it hangs and exits empty;--mode planstill blocks edits.
If the user specified an agent / model / effort, that takes precedence. Otherwise:
- Default to Opus 4.8 at
loweffort for routine slices unless the user says otherwise. Escalate effort only for genuinely hard or cross-system slices. - Prefer free pools (
copilot,cursorincluded) for wide read-only fan-out; reserve metered frontier (codex,claude) for slices that need it. - Do not use "fast mode" anywhere — it burns tokens quickly.
Before fanning out to a CLI agent, confirm it is actually usable — a misconfigured login wastes a whole dispatch round.
- Claude login check: verify the
claudeCLI is authenticated before dispatching Claude workers (e.g. a trivialTools/agent_review claude default low "reply OK"smoke test). A logged-out CLI returns empty/garbage, which reads as a silent worker failure. - Smoke-test any agent family you have not used this session before relying on it for a batch.
- Smoke tests are necessary but not sufficient. Direct
claude -pmay answer a tiny prompt and still empty-exit on a larger write-worker brief, especially when the brief is passed through stdin or shell substitution. If a direct Claude worker exits with no stdout, no report file, and no progress log, stop retrying broad prompts; switch to a smaller brief,Tools/agent_reviewfor read-only work, or another agent family.
Prefer resuming a live/recent agent session for follow-up critique or course correction instead of starting a fresh context every time. It is easier on credits and often benefits from provider-side KV cache when resumed quickly.
- Claude: use
claude --continuefor the most recent conversation in the current directory, orclaude --resume <session-id>when you have a specific session. For planned long-running workers, consider--session-id <uuid>or a memorable--nameso the session is easy to resume. - Cursor: use
cursor-agent --continue,cursor-agent --resume <chatId>, orcursor-agent create-chat/cursor-agent lsto manage reusable planning/review chats. - Use resume for targeted follow-ups: "review this plan again with these constraints", "tighten the patch to only these files", "continue from your prior report and address finding M1".
- Do not resume a broad worker after major repo state changes unless you explicitly tell it what changed (new commits, files edited by others, tests now passing/failing).
# Read-only investigation worker writing to a temp report file
Tools/agent_review claude default low \
"Read Docs/Workflow/AGENT_ORCHESTRATOR.md. Investigate <slice>. \
Write a concise report (verdict + 3-5 bullets, file:line refs) to /tmp/gso_step0.md. \
Do not dump file contents into your reply." < /dev/null
# Fan out several read-only workers in parallel, each to its own report file
for i in 0 1 2; do
Tools/agent_review copilot default low \
"Read Docs/Workflow/AGENT_ORCHESTRATOR.md. Handle slice $i (see /tmp/gso_slice_$i.md). \
Write findings to /tmp/gso_step$i.md." < /dev/null &
done
wait- After dispatching background workers, poll their report files for existence/completion rather than holding the worker process in the orchestrator's context.
tail -for re-read a report file once the worker exits; read only the summary section the worker was told to produce.- If a report file is missing or empty after the worker exits, treat it as a failed slice — re-dispatch with a tighter brief or escalate effort.
Progress files are useful but only reliable when the prompt makes them an explicit contract. For long edit workers, require a heartbeat file separate from the final report:
- Worker creates
/tmp/<slice>_progress.logas its first action. - Worker appends one line before and after each phase:
start,inventory,edit,lint,tests,report. - Each line should include a timestamp, a short phase label, and at most one concrete fact, e.g.
2026-06-27T07:30 edit Career.gd/Me.gd done. - The final report is still
/tmp/<slice>_impl.md; stdout is disposable. - The orchestrator polls
ps, the heartbeat mtime, and the final report. Avoid reading the raw transcript unless the worker exits without a report or the report contradicts the diff. - If the process is alive but the heartbeat file was never created after a reasonable startup window, assume the prompt was not followed or the CLI failed before tool use. Resume or restart with a much smaller first task: "create the heartbeat file, then do inventory only."
This is good enough for most work, but not perfect. It is a liveness signal, not proof of quality; the orchestrator still owns diff review and validation.
Workers go quiet for legitimate reasons. Do not mistake silence for failure:
- Claude workers often run quietly for several minutes while tests execute or while they iterate internally. This is normal — prefer generous timeouts and polling over interrupting early.
- Poll
psand the report file on an interval rather than blocking; allow the worker the wall-clock a real test run or multi-step edit needs before considering intervention. - Distinguish "silent but active" from "silent and idle." A worker with a live child process (test runner, compiler) or a report file that is still growing is working — leave it alone. A worker with no child process and no report file written after enough time is a stalled idle wrapper — only then interrupt.
- When in doubt, wait one more poll cycle. Interrupting a worker mid-test-run wastes the whole slice.
Hard-won dispatch hints:
- Plan mode blocks writes — including tests and
/tmpreports.claude --permission-mode plancan refuse to run tests or write report files. Use plan mode only for pure read-only review. When plan mode blocks a/tmpwrite, expect the output to land in~/.claude/plansinstead — check there if a report file is missing. - Validation-only workers: forbid edits in the prompt, not via plan mode. Dispatch them with
bypassPermissions(or the appropriate non-plan mode) and explicitly state "do not edit any files" in the brief — plan mode would otherwise prevent the tests the validation depends on. - Long-running edit workers can stall silently after partial edits. Tell every edit worker to write a progress/report file early and update it as it goes, so a stall is detectable. Poll with
psplus the report file rather than blocking. Be ready to interrupt a stalled worker and hand its partialgit diffto a smaller follow-up worker to finish the slice. - Forbid stash/checkout in write-worker prompts. Direct CLI workers may reach for
git stashto run a baseline comparison, which is risky in an orchestrated dirty tree. Tell workers to report suspected baselines instead of stashing, and have the orchestrator run any baseline check in a separate clean worktree or after committing the slice. - Use
--flag=valuefor direct Claude tool filters. Withclaude -p,--disallowedTools Edit,Write "prompt"can consume the prompt as more tool names. Prefer--disallowedTools=Edit,Write "prompt"when bypassing the wrapper for direct read/write workers. - Use Cursor for planning/review when it is the better fit. Cursor Composer 2.5 has been useful
as a read-only scout/reviewer through
Tools/agent_review. Treat its plans as drafts: the orchestrator should critique assumptions, add architecture guidance, and feed sharper follow-up prompts back into the same resumed Cursor session when possible. - Do not over-interpret transient credit/auth failures. Any agent family can hit credits, auth, CLI, or network issues. Record the operational failure and switch routes, but do not treat a credit outage as evidence that the model is bad for the task.
Do not interrupt just because a worker is quiet. Use process state:
- Active child process: wait. A test runner, compiler, linter, or Godot process means the worker is still doing useful work.
- Report file growing: wait. The worker is communicating through the expected channel.
- Wrapper only, no child process, no report: poll a few times, then interrupt and preserve the partial diff.
- After interruption: do not resume the same broad prompt. Dispatch a smaller follow-up worker with the current
git diff, the last known report, and one clear finishing task. - After a worker edits files: do not launch another writer over the same file set until the first worker is done or interrupted.
Prefer patience for test-heavy slices. Prefer interruption for idle wrappers that have no child process and no report file after several poll cycles.
Worker output is advisory until validated. The orchestrator owns correctness:
- Re-read each report file and check it against the slice contract — did the worker do what it was asked, in the right files only?
- For edit slices, inspect the actual
git difffor the worker's file set, not just its self-report. Confirm no out-of-slice files were touched. - Run the project gates the change requires:
python3 Tools/gdlint.py <changed .gd>for code,python3 Tools/lint_docs.pyfor any.mdin./DocsorAGENTS.md. - Cross-check overlapping claims between parallel read-only workers; divergence flags a slice that needs a second pass.
- Reject and re-dispatch any slice whose output is incomplete, out-of-scope, or fails a gate. Do not merge unvalidated worker output.
Large GDScript type migrations can confuse the Godot LSP and therefore Tools/gdlint.py.
- If gdlint reports impossible type errors after a broad type migration, compare against real Godot test runs before assuming the code is broken.
- Restart the headless Godot LSP when practical before final gdlint. Stale daemon state can make the final gate noisy.
- Do not hand-wave lint failures silently. Record whether they are real, stale-LSP artifacts, or pre-existing warnings, and include the exact command/result in the wrap report.
- New
class_namescripts and.uidfiles must be staged together before the final gate/commit, or tools may fail to resolve them.
Use a two-phase wrap for substantial orchestrated work.
- Prepare wrap report: ask a worker to summarize changed files, commands, test results, lint status, docs/worksheet/changelog/TODOS updates, risks, and proposed commit message
- Orchestrator review: personally read the report, inspect
git status, inspect key diffs, and decide whether the commit is allowed - Commit: only then let a worker stage and commit, or commit directly
Wrap-worker contract:
- Do not include
Co-Authored-By - Do not use
--no-verifyunless explicitly approved by the orchestrator after reviewing the gate failure - Stage all intended files, including new
.uidfiles - Never stage unrelated user changes by accident; list the staged files in the report
- Include validation caveats in the commit body when a gate is noisy or skipped
If a hook blocks on a suspected stale tool state, prefer fixing/restarting the tool and rerunning the gate. If the orchestrator decides to commit anyway, the final report must say exactly why.
AGENT_WORKFLOW.md— single-task workflow; orchestration sits on top of it for wide/parallel workAGENT_REVIEW.md— cross-review protocol; shares theTools/agent_reviewwrapper and context-isolation rationaleAGENT_LOOP.md— night-shift cadence; an orchestrator can drive a loop's wide tasksCODING_CONVENTIONS.md— quality bar workers must meetDOCS_AUTHORING_GUIDE.md— rules for any doc slice a worker edits