---
description: "Task orchestrator  -  full pipeline via Jira ID + branch or GitHub Issue URL: analysis, plan, TDD development, parallel review + Fable triage (3 reviewers per host: Fable + Opus + Sonnet on Claude Code, GPT-5.4 + Opus + Sonnet on Copilot CLI), commit, log. Use when given a Jira ID, a GitHub issue or a free-text task and the whole pipeline should run."
description-tr: "Görev orkestratörü - Jira ID + branch veya GitHub Issue URL ile tam pipeline: analiz, plan, TDD geliştirme, paralel review + Fable triyajı (CLI'ya göre: Claude Code'da 3, Copilot CLI'da 3 model), commit, log"
argument-hint: '[nothing, and it asks | JIRA-KEY | issue URL | repo#N | "task"] [autopilot [--loop N]] [--review-rounds N]  -  or a sub-command: status, log #N, resume #N, kill #N'
allowed-tools: Agent, Bash, Read, Write, Edit, Glob, Grep, TaskCreate, TaskUpdate, TaskList, TaskGet, AskUserQuestion, WebFetch, WebSearch, NotebookEdit, Skill
---

# Multi-Agent Task Orchestrator

> **Pickers follow** `$HOME/.claude/multi-agent-refs/picker-contract.md`: never a one-option call, and branch on the option selected, not on its text.

> **MUST: Figma MCP is BLOCKING for any task with a Figma reference.** Before any UI synthesis (analysis, planning, dev, or rework), call `mcp__claude_ai_Figma__get_design_context` for every referenced frame and use the `CodeConnectSnippet` component name verbatim. Backend-only tasks are exempt. See `$HOME/.claude/multi-agent-refs/rules.md` "User Interaction Discipline" and `$HOME/.claude/rules/figma-pipeline.md`.

Parse the user input and route to the correct sub-command.

**Input**: $ARGUMENTS

> **Language (read FIRST)**: before any status output, read `prefs.global.outputLanguage` from `$HOME/.claude/multi-agent-preferences.json` and render every conversational line in it. `AskUserQuestion` `question`, option `label`s and `description`s follow `outputLanguage`; only `header` stays English (<=12-char chip). Identifiers, commit messages and branch names stay English. Contract: `$HOME/.claude/multi-agent-refs/rules.md` "Language Application".

## Invocation and input parsing

Each subcommand has its own entry: `/multi-agent:<name>` on Claude Code, `/multi-agent-<name>` on Copilot CLI; the space form is still routed here. Classification lives in `$HOME/.claude/multi-agent-refs/_input-parser.md` (canonical): `#N` / bare number, `repo#N`, GitHub issue URL, Jira URL, bare Jira id, `jira`, `issue`, free text.

**Quoting**: For a double-quoted first argument, strip the surrounding double quotes and unescape (`\"` becomes `"`, and `\\` becomes `\` before a quote or at the end). If the resulting value as a whole is a Jira key, a Jira or GitHub issue URL, `repo#N` or `#N`, it is that structured reference; otherwise it is free text, and a structured token inside a sentence stays free text. Everything after the closing quote is modifiers (`autopilot`, `--loop N`, `--review-rounds N`, the branch name after a Jira key) (`_input-parser.md` "Quoting").

**Rule**: whatever the type, **account is always asked** (autopilot picks a default). After an issue fetch the **maturity check is required**: a blocker asks before it halts, and an autopilot run can ask on the item itself (`$HOME/.claude/multi-agent-refs/features/maturity-followup.md`). Free text skips maturity.

**Access check, before anything else.** Every route runs it, a task input, `jira`, `issue`, `resume`, `autopilot` and `review` included, except `status`, `log` and `help`, which only read; the commands kept open (`feedback`, `setup`, `update`) have their own entries and never reach this check.

```bash
ACCESS_LINE=$(node "$HOME/.claude/scripts/usage-access.mjs"); ACCESS_RC=$?
```

`ACCESS_RC` 3: print `$ACCESS_LINE` as written and stop: no picker, no assignee change, no comment, no state, attended or unattended. Any other exit continues (the check fails open). Contract: `$HOME/.claude/multi-agent-refs/features/usage-reporting.md` "The access check".

## Routing

Read `$HOME/.claude/multi-agent-refs/orchestrator/dispatcher.md` "Routing and loading tables" whenever a row below is not enough: every row in full, the loading table, guide selection and the lib scripts. After routing, `Read` only the file the action needs.

| Input | Read / do |
| ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Task (Jira id / URL, GitHub `#N` / URL, `repo#N`, free text) | `$HOME/.claude/multi-agent-refs/phases.md` + `_account-picker.md` + `_repo-picker.md` + `_dev-context.md` |
| `jira` / `issue` | `$HOME/.claude/commands/multi-agent/jira/SKILL.md` / `issue/SKILL.md` (4-step pickers) |
| `status`, `log [id]`, `resume [id]` | Inline; status scans `$HOME/.claude/logs/multi-agent/` |
| `kill [id]` / `purge` | User-only: name `/multi-agent:kill [id]` / `/multi-agent:purge` for the user to type (Codex CLI: the `/multi-agent-kill` / `/multi-agent-purge` prompts) and stop |
| `clear-logs` | **Superseded, do not run.** Name `/multi-agent:prune-logs` for the user to type (Codex CLI: the `/multi-agent-prune-logs` prompt) and stop |
| `review [#N\|repo#N\|PR-url\|branch]` | `$HOME/.claude/commands/multi-agent/review/SKILL.md` |
| `review-jira [KEY\|url]` | `$HOME/.claude/commands/multi-agent/review-jira/SKILL.md` |
| `review-issue [#N\|repo#N\|url]` | `$HOME/.claude/commands/multi-agent/review-issue/SKILL.md` |
| `create-jira ["desc"] [figma-url] [swagger-url]` | `$HOME/.claude/commands/multi-agent/create-jira/SKILL.md` |
| `test`, `test-dark-mode`, `test-accessibility`, `test-dynamic-type`, `test-screenshots` | `$HOME/.claude/commands/sim-test.md`, scenario pinned by the name |
| `language [en\|tr]` | Inline: show or set `outputLanguage` only (`$HOME/.claude/commands/multi-agent/language/SKILL.md`) |
| Any other subcommand (`setup`, `channels`, `analysis`, `design-check`, `store-ready`, ...) | `$HOME/.claude/commands/multi-agent/<name>/SKILL.md`, except the user-only commands `clean-disk`, `forget`, `garbage-collect`, `kill`, `pair`, `prune-logs`, `prune-prompts`, `purge`, `review-priority`, `routines-delete`, `uninstall` (each sets `disable-model-invocation: true`): never read their files; name the command for the user to type (`/multi-agent:<name>` on Claude Code, the `/multi-agent-<name>` prompt on Codex CLI) and stop |
| `--review-rounds N` | Modifier: this run allows N review rework rounds (1 to 3, default 2), overriding the repo and global setting for this run only. `node "$HOME/.claude/scripts/review-rounds.mjs" parse "<modifiers>"` returns N (exit 2 on a value outside 1 to 3: say so and stop before Phase 0). Phase 0 stores it with `review-rounds.mjs record --state "$STATE_FILE" --rounds N` (`features/review-rounds.md`). The standing setting is `/multi-agent:review-rounds` |
| `autopilot` | Modifier: skip confirmations, auto commit/PR (`phases/modes.md`). With `--loop N`: Loop mode below |
| `help` | `$HOME/.claude/commands/multi-agent/help/SKILL.md` |
| No args | `$HOME/.claude/multi-agent-refs/_entry-picker.md`: ask which kind of task this is, then route the answer through this table. Never reached by an unattended run |

`jira`, `issue` and the direct-ID path all end in the Interactive Launcher, then Phase 0; account is always asked, the maturity check halts on a blocker, and the dev-context step always runs. Read `$HOME/.claude/multi-agent-refs/orchestrator/dispatcher.md` before routing any of them: the per-command steps, the Jira empty-description question and the launcher prompts.

Stack guides load from the Phase 1 detected stack: `swiftui-guide.md` (iOS), `android-guide.md`, `backend-guide.md`, `web-guide.md` under `$HOME/.claude/multi-agent-refs/`; every relevant guide for several stacks. Each guide ends with the `multi-agent` MCP families its stack uses per phase; `toolkit-tools.md` is the full map.

**Review mode** (`review` with no PR): diff `git diff HEAD`, else `origin/{baseBranch}...HEAD`; run the Phase 3 parallel review + Fable triage on it; no worktree, no state file; print the findings.

## Loop mode (`autopilot --loop N`)

For batch work that takes several passes: do not run the task here. Start the loop, report its id, answer later with `autopilot-loop.mjs status <id>`:

```bash
node "$HOME/.claude/scripts/autopilot-loop.mjs" start --task "<task>" --repo "$PWD" \
  --max-iterations N [--max-minutes M] [--max-usd U] [--until "<command that exits 0 when done>"]
```

Each iteration is a full unattended autopilot run: without `install --unattended` the loop refuses to start (exit 4). Only the loop declares completion. Stops and caps: `phases/modes.md` "Loop mode (`--loop N`)".

## Agents and model routing

Agent definitions: `dispatcher.md` "Agent definitions". Before each Agent dispatch, read `preferredModel` from the persona file and hand the resolved rung to the child the way THIS host does it (`features/model-fallback.md` "Routing at dispatch" has the table, generated from the host registry). Precedence: `PHASE_MODEL_OVERRIDE` > a matching `prefs.global.modelRouting` rule (only when the phase named no model, and only for a rung this host offers) > persona `preferredModel` > `fable` (fallback: `$HOME/.claude/multi-agent-refs/features/model-fallback.md`). Simple text tasks ask `model-dispatch.sh delegate --default host` first: `$HOME/.claude/multi-agent-refs/features/free-models.md`.

## Rules

Read `$HOME/.claude/multi-agent-refs/rules.md` before any invocation that writes code, commits, or posts to external systems.

- No "Copilot/AI/generated by" attribution. Ever.
- No commit without build + review pass.
- Real newlines in external outputs (heredoc + `jq --rawfile` + `curl --data-binary`); no HTML entities (`&amp;`, `&lt;`, `&quot;`) in titles, commits or bodies.
- Every Bitbucket PUT ships `reviewers` + `fromRef` + `toRef` + `draft`.
- Commit format: `{type}({scope}): description [{jiraId}|#{shortId}]`; branch `feature/` or `bugfix/`.
- 3-iteration hard kill on any retry loop.

### TaskCreate ordering (strict)

**All TaskCreate calls fire in strict phase-number order BEFORE any TaskUpdate is applied**, for the full interactive `/multi-agent` run (all 6 phases) exactly like every mode alias: the widget renders by creation order. Register every tile in order, then flip status when a phase starts or short-circuits. Contract: `$HOME/.claude/multi-agent-refs/tracker-contract.md` "TaskCreate ordering (strict)".

Status table and global paths (logs under `${LOGS_ROOT:-$HOME/.claude/logs/multi-agent}/{project}/{task-id}/`): `dispatcher.md` "Status Display" and "Global Paths".
