# Dispatcher  -  invocation table, agent list, picker commands, launcher, status

<!-- toc -->
- [Canonical invocation](#canonical-invocation)
- [Routing and loading tables](#routing-and-loading-tables)
- [Routing detail](#routing-detail)
- [Agent definitions](#agent-definitions)
- [jira Command](#jira-command)
- [issue Command](#issue-command)
- [Direct-ID Command ({JIRA_KEY}-N, gh URL, repo#N, free-text)](#direct-id-command-jira_key-n-gh-url-repon-free-text)
- [Interactive Launcher (shared by `jira` and `issue`)](#interactive-launcher-shared-by-jira-and-issue)
- [Status Display](#status-display)
- [Global Paths](#global-paths)
<!-- /toc -->

> Loaded by `commands/multi-agent/SKILL.md` (the `/multi-agent` dispatcher). The SKILL keeps a compact routing table and the rules; this file carries the full routing and loading tables, the per-CLI invocation table, the agent definitions, the `jira` / `issue` / Direct-ID step lists, the Interactive Launcher prompts, the status table and the global paths. Read the matching section before routing one of those inputs.

## Canonical invocation

Each helper subcommand has its own slash entry  -  use the CLI-native form:

| Helper | Claude Code | Copilot CLI |
|--------|-------------|-------------|
| update | `/multi-agent:update` | `/multi-agent-update` |
| setup  | `/multi-agent:setup`  | `/multi-agent-setup`  |
| status | `/multi-agent:status` | `/multi-agent-status` |
| sync   | `/multi-agent:sync`   | `/multi-agent-sync`   |
| jira   | `/multi-agent:jira`   | `/multi-agent-jira`   |
| issue  | `/multi-agent:issue`  | `/multi-agent-issue`  |
| help   | `/multi-agent:help`   | `/multi-agent-help`   |
| log, kill, resume, channels, test, ... | `/multi-agent:<name>` | `/multi-agent-<name>` |

The space-form (`multi-agent <subcommand>`) is still routed by this dispatcher
for backward compatibility, but the colon (Claude) / dash (Copilot) forms are
the canonical invocations and the only forms surfaced in autocomplete.

## Routing and loading tables

The full tables behind the dispatcher's compact routing table. Route first, then `Read` only the file the routed action needs.

### Routing

| Input Pattern | Action |
|---------------|--------|
| `#N`, `316` | GitHub Issue #  -  parse, select project, start pipeline |
| `https://github.com/.../issues/N` | GitHub Issue URL  -  fetch, auto-detect or ask project |
| `https://{JIRA_HOST}/browse/{JIRA_KEY}-XXXXX` | Jira URL  -  fetch, select project, start pipeline |
| `{JIRA_KEY}-XXXXX` | Jira ID  -  fetch, select project, start pipeline |
| Free-text | Bug/feature description  -  select project, start pipeline |
| `jira` | 4-step picker (hesap → proje → issue → dev-context)  -  `commands/multi-agent/jira/SKILL.md` delegate |
| `issue` | 4-step picker (hesap → repo → issue → dev-context)  -  `commands/multi-agent/issue/SKILL.md` delegate |
| `status` | List all tasks (scan `$HOME/.claude/logs/multi-agent/`) |
| `log [id]` | Show task log |
| `resume [id]` | Resume paused task |
| `kill [id]` | User-only: name `/multi-agent:kill [id]` for the user to type and stop; the command deletes the worktree (logs preserved) after a confirmation |
| `clear-logs` | **Superseded, do not run.** Say so and name `/multi-agent:prune-logs` for the user to type. It targeted `.worktrees/PROJ-*/agent-log.md`, a path nothing has written to since logs moved to `$HOME/.claude/logs/multi-agent/{project}/{task-id}/`; running it would report deleting nothing as success. |
| `purge` | User-only: name `/multi-agent:purge` for the user to type and stop; the command resets worktrees, logs and the counter after a double confirmation |
| `review [#N\|repo#N\|PR-url\|branch]` | Parallel review of a PR or branch diff; with no input (interactive) lists open GitHub + Bitbucket PRs to multi-select. Posts per-finding inline comments + approve/needs-work on PRs. No worktree. |
| `review-jira [KEY\|url]` | Grade a Jira issue's readiness for the pipeline (scope / AC / repro / design / API / stack), then post the gaps as a Jira comment. Read-only on code. |
| `review-issue [#N\|repo#N\|url]` | Grade a GitHub issue's readiness for the pipeline, then post the gaps as an issue comment. Read-only on code. |
| `analysis ["<feature>"]` | Standalone feature-spec analysis; stops after the document. No worktree, no commits, no dev chain. |
| `complaint-analysis ["<run-name>"] [--file <path>] [<jira-id\|confluence-url> ...]` | Customer-complaint triage to a report and a verdict; read-only on code. No worktree, commits or dev chain. |
| `build-optimize` | iOS-only Xcode build performance wrapper; recommend-first plan. Fail-fast on non-iOS stacks. |
| `channels [PR-url\|#N\|Jira-url\|Jira-id] [--channels pr,jira,confluence,wiki] [--content normal,test,auto-diff,note] [--message "..."]` | Post the task report to multi-select channels with multi-select content; Phase 5 delegates here, also post-hoc. No worktree. |
| `create-jira ["desc"] [figma-url] [swagger-url]` | Create a standards-compliant Jira issue (Task / Bug / Story) with full draft preview + explicit approval before create. No worktree, no commits. |
| `test` or `test [args]` | UI Bug Hunter  -  screenshot + tap + analyze on booted simulator via MCP (read `$HOME/.claude/commands/sim-test.md`). `/multi-agent:test` also resolves here via the `commands/multi-agent/test/SKILL.md` delegate. |
| `test-dark-mode` · `test-accessibility` · `test-dynamic-type` · `test-screenshots [locale]` | Fixed-scenario aliases for the four parameterless / single-parameter `test` scenarios, so the tag autocompletes instead of having to be quoted. Each delegates to the same `sim-test.md` with its scenario pinned; behaviour is identical to the quoted form, which is not deprecated. |
| `store-ready [repo] [--archive=\|--ipa=\|--aab=\|--apk=] [--skip-sweep]` | Pre-submission store readiness for a built package, iOS and Android, local-only. Validates only, never ships a build. |
| `manual-test [#id]` | Phase 5 standalone Manual Test  -  checks out the task branch, prints Xcode / SourceTree hints, waits for user verdict (`ok` / `fix: ...`). |
| `design-check [scope]` | Mock-mode vs Figma design audit (iOS / Android, local-only) with a coverage gate. No commits, no CI. |
| `stack [ios\|android\|backend\|mobile\|all]` | Swap skills for next conversation. No arg = show current stack. |
| `language [en\|tr]` | Show or set the assistant `outputLanguage` (explanations and chat replies). `promptLanguage` is locked to `en` and is not toggleable. No arg = show current `outputLanguage`. With `en` or `tr` = set and persist `outputLanguage`. Commits and branch names stay English; PR, Jira and wiki bodies follow it. |
| `setup` | Keychain token + Git Identity onboarding |
| `autopilot` | Skip user confirmations, auto commit/PR |
| `help` | Show usage guide |
| No args | Ask (`_entry-picker.md`), then route the answer. A modifier with no task prints usage; an unattended run refuses |

### Loading

`commands/multi-agent/{cmd}/SKILL.md` files are invocable actions (each its own `/multi-agent:<name>` slash command; one whose frontmatter sets `disable-model-invocation: true` runs only when the user types it, so the dispatcher names it and never reads it); `$HOME/.claude/multi-agent-refs/**` are internal references read by the dispatcher, never invoked directly, and live outside `commands/` so they never appear in slash-command autocomplete.

| Route | File to Read |
|-------|-------------|
| Pipeline task (any input type) | `$HOME/.claude/multi-agent-refs/phases.md` + `$HOME/.claude/multi-agent-refs/_account-picker.md` + `_repo-picker.md` + `_dev-context.md` |
| `jira` | `$HOME/.claude/commands/multi-agent/jira/SKILL.md` (4-step picker) |
| `issue` | `$HOME/.claude/commands/multi-agent/issue/SKILL.md` (4-step picker) |
| Direct ID (`{JIRA_KEY}-N`, `#N`, gh URL, repo#N, free-text) | `$HOME/.claude/multi-agent-refs/_input-parser.md` → `_account-picker.md` → `lib/issue-fetcher.sh` (maturity check) → `_dev-context.md` |
| `setup` | `$HOME/.claude/commands/multi-agent/setup/SKILL.md` |
| `help` | `$HOME/.claude/commands/multi-agent/help/SKILL.md` |
| `channels` | `$HOME/.claude/commands/multi-agent/channels/SKILL.md` |
| `sync` | `$HOME/.claude/commands/multi-agent/sync/SKILL.md` |
| `clear-logs` | Superseded: names `/multi-agent:prune-logs`, see the routing note |
| `review` | `$HOME/.claude/commands/multi-agent/review/SKILL.md` |
| `review-jira` | `$HOME/.claude/commands/multi-agent/review-jira/SKILL.md` (loads `$HOME/.claude/multi-agent-refs/readiness-review.md`) |
| `review-issue` | `$HOME/.claude/commands/multi-agent/review-issue/SKILL.md` (loads `$HOME/.claude/multi-agent-refs/readiness-review.md`) |
| `analysis` | `$HOME/.claude/commands/multi-agent/analysis/SKILL.md` |
| `complaint-analysis` | `$HOME/.claude/commands/multi-agent/complaint-analysis/SKILL.md` |
| `build-optimize` | `$HOME/.claude/commands/multi-agent/build-optimize/SKILL.md` |
| `create-jira` | `$HOME/.claude/commands/multi-agent/create-jira/SKILL.md` (loads `$HOME/.claude/multi-agent-refs/generate-issue.md`) |
| `stack` | `$HOME/.claude/commands/multi-agent/stack/SKILL.md` |
| `language` | Handled inline  -  set/show outputLanguage in preferences |
| SwiftUI component task (iOS) | `$HOME/.claude/multi-agent-refs/swiftui-guide.md` |
| Jetpack Compose task (Android) | `$HOME/.claude/multi-agent-refs/android-guide.md` |
| Backend API task | `$HOME/.claude/multi-agent-refs/backend-guide.md` |
| Web component task | `$HOME/.claude/multi-agent-refs/web-guide.md` |
| Phase 1 or Phase 5 (knowledge) | `$HOME/.claude/multi-agent-refs/knowledge.md` |
| Token lookup needed | `$HOME/.claude/multi-agent-refs/keychain.md` |
| Audit tools (Phase 3) | `$HOME/.claude/multi-agent-refs/audit-guide.md` |
| `test` | `$HOME/.claude/commands/sim-test.md` (colon-form `/multi-agent:test` uses the delegate at `commands/multi-agent/test/SKILL.md`) |
| `test-dark-mode` · `test-accessibility` · `test-dynamic-type` · `test-screenshots` | `$HOME/.claude/commands/sim-test.md`, scenario pinned by the command name (delegates at `commands/multi-agent/test-*/SKILL.md`) |
| `manual-test` | `$HOME/.claude/commands/multi-agent/manual-test/SKILL.md` |
| `design-check` | `$HOME/.claude/commands/multi-agent/design-check/SKILL.md` |

**Modifier flag** (`autopilot`) and **ops** (`status`, `log`, `resume`, `kill`, `purge`, `review`) are parsed inline by this file  -  no separate spec files, they compose with the pipeline or do one-shot work.

Guide selection (auto, from the Phase 1 detected stack):
- iOS detected -> load `swiftui-guide.md`
- Android detected -> load `android-guide.md`
- Python/Node.js/Go detected -> load `backend-guide.md`
- React/Vue/Next.js detected -> load `web-guide.md`
- Multiple stacks -> load all relevant guides

### Lib scripts

Under `~/.claude/lib/`:
- `account-resolver.sh`  -  keychain account inventory
- `issue-fetcher.sh`  -  Jira/GitHub fetch + maturity scoring
- `repo-cache.sh`  -  TTL-cached repo list
- `submodule-detector.sh`  -  `.gitmodules` parse → dev-context suggestions
- `multi-repo-pipeline.sh`  -  worktree/branch/commit/PR orchestration

## Routing detail

The full action descriptions for the routing rows the dispatcher keeps short.

| Input Pattern | Action |
|---------------|--------|
| `analysis ["<feature>"]` | Standalone feature-spec analizi: Figma / Swagger / Confluence / Jira / repo girdileri kanıta göre budanan, en fazla 23 bölümlük şablona dökülür, humanizer'dan geçer, Local/Confluence/Jira hedef(ler)ine post edilir. Worktree veya commit yok. Dev'e zincirleme yok. |
| `complaint-analysis ["<run-name>"] [--file <path>] [<jira-id\|confluence-url> ...]` | Müşteri şikayeti triyajı: şikayetler (serbest metin / csv-xlsx-txt-json dosya / Jira issue / Confluence URL) redakte edilerek alınır, trxId/conversationId ile Graylog kanıtı çekilir, seçili client + BFF repolarında salt-okunur eşleştirme yapılır; verdict: client/bff (kök neden + citation + mevcut mimariyi referans alan fix planı + hazır dev prompt'u) veya core (core ekibine yönlendirme önerisi) veya insufficient-evidence. Rapor + Stop; worktree, commit, dev zinciri yok. |
| `build-optimize` | iOS-only Xcode build performance wrapper. `build-time-optimizer`'a dispatch eder; benchmark + compilation / project / SPM analyzer'lar + recommend-first plan `.build-benchmark/optimization-plan.md`. Non-iOS stack'lerde fail-fast. |
| `channels [PR-url\|#N\|Jira-url\|Jira-id] [--channels pr,jira,confluence,wiki] [--content normal,test,auto-diff,note] [--message "..."]` | Post task report to multi-select channels (PR description, Jira comment, Confluence page, Wiki pages) with multi-select content sources. Humanizer pass per-channel. Bitbucket PR updates use reviewer-preserving PUT. Phase 5 delegates to this command; also invocable post-hoc for fixes made outside the pipeline. No worktree. |
| `create-jira ["desc"] [figma-url] [swagger-url]` | Create a standards-compliant Jira issue: asks the type (**Task** / **Bug** / **Story**), mines the project's recent same-type issues for conventions (summary format, labels, priority, test-scenario style), detects the active sprint, drafts from a standard template with auto-sizing sections (Design Reference / API Contract / Screenshots appear only when their source is given), asks about unknown fields, then full draft preview + explicit approval before create. No worktree, no commits. |
| `store-ready [repo] [--archive=\|--ipa=\|--aab=\|--apk=] [--skip-sweep]` | Pre-submission store readiness for a built **package**, iOS and Android, local-only. Three symmetric gates per platform  -  static package audit, the store's own validator, policy review vs repo source  -  plus the running-app sweep as Step A. A skipped gate is never folded into the pass count, and an Android run clears at most 2 of 3 unless Google Play is onboarded, because Play's authoritative check is server-side only (with it, Gate 2 validates in a throwaway edit that is deleted). Validates only, never ships a build. `testflight-validation` is the iOS-pinned alias; `test "store-ready"` hands off here. |
| `design-check [scope]` | Mock-mode vs Figma design audit (iOS / Android, local-only). Pick repo + module → mock-support feasibility gate (halts if unsupported) → **scenario inventory** (every launch arg / scenario case / scenario code / fixture / deep link becomes a countable target with file+line evidence) → scope resolve (empty = module, screen, `screen@variant`, target id, Figma URLs, `--resume`) → worktree Debug build + mock launch → drive EACH target by its own driver, capturing tap-reachable sub-states with it → per-variant pixel + px-spacing + typography + color compare → report (side-by-side + annotated overlay + stacked findings + fix prompt) exported to `~/DesignChecks/` as HTML + PDF (+ Confluence if enabled). **Coverage gate**: a target is audited or skipped with a concrete reason, else the run is reported INCOMPLETE with the missing ids. No commits, no CI. |

## Agent definitions

**Agent definitions** (used in Phase 1 and Phase 3):
- `$HOME/.claude/agents/code-reviewer.md`  -  Phase 3 reviewer persona (`preferredModel: fable`; Phase 3 overrides Reviewer 3 to `sonnet`)
- `$HOME/.claude/agents/explorer.md`  -  Phase 1 codebase scan persona (`preferredModel: sonnet`  -  scan work, cost-efficient)
- `$HOME/.claude/agents/ios-architect.md`  -  iOS architecture review (`preferredModel: fable`)
- `$HOME/.claude/agents/android-architect.md`  -  Android architecture review (`preferredModel: fable`)
- `$HOME/.claude/agents/backend-architect.md`  -  Backend/API architecture review (`preferredModel: fable`)
- `$HOME/.claude/agents/security-auditor.md`  -  Security audit (`preferredModel: opus`)

## jira Command

Delegates to `commands/multi-agent/jira/SKILL.md` (4-step picker). Read that file, then apply:

1. **Pick account**  -  `_account-picker.md` (`lib/account-resolver.sh --providers jira`)
2. **Pick projects (multi)**  -  Jira project list, multi-select
3. **Pick issue**  -  aggregate across selected projects, `lib/issue-fetcher.sh` with maturity check
4. **Maturity check**  -  halt on blocker, prompt on warning (autopilot auto-continues)
5. **Dev context** (`_dev-context.md`)  -  extra repo selection
6. → Interactive Launcher (branch/mode/autopilot) → Phase 0

Steps 1-5 are detailed in `jira.md`; the Interactive Launcher (below) consumes the result.


## issue Command

Delegates to `commands/multi-agent/issue/SKILL.md` (4-step picker). Read that file, then apply:

1. **Pick account**  -  `_account-picker.md` (`--providers github`)
2. **Pick repos (multi)**  -  `lib/repo-cache.sh github <owner>`, multi-select
3. **Pick issue**  -  aggregate across repos (`gh issue list`), maturity check
4. **Maturity check**  -  `lib/issue-fetcher.sh` maturity field; blocker halts, warning prompts
5. **Dev context** (`_dev-context.md`)  -  submodule auto-suggest + extra repos
6. → Interactive Launcher → Phase 0


## Direct-ID Command ({JIRA_KEY}-N, gh URL, repo#N, free-text)

When the user supplies an ID/URL/free-text:

1. **Detect type**  -  per `_input-parser.md`
2. **Pick account**  -  always asked (autopilot picks default)
3. **Fetch issue**  -  `lib/issue-fetcher.sh "$INPUT"` (Jira/GitHub fetch + maturity)
4. **Repo picker**  -  only for `gh-num` (e.g. `316`) when repo is ambiguous, multi-select
5. **Maturity check**  -  blocker halts (autopilot too), warning prompt/log. For a Jira input specifically, an empty own description with a non-empty parent surfaces as `description_empty_parent_available` (warning, not blocker)  -  ask the tailored parent-description question from `jira/SKILL.md`'s maturity section instead of the generic "Continue?" prompt. When the parent is empty too, `description_empty_sibling_available` says a sibling sub-task carries the content; `descriptor.relatedIssues[]` holds them either way.
6. **Dev context**  -  always runs, empty submit allowed
7. → Interactive Launcher → Phase 0


## Interactive Launcher (shared by `jira` and `issue`)

The access check (`usage-access.mjs`) has already run at the entry, before the first picker, so nothing below runs for a refused login (`features/usage-reporting.md` "The access check").

After the user selects an issue from either `jira` or `issue` command:

### Step 1  -  Branch Selection
Same as Phase 0 Step 3: fetch remote branches, sort (develop* first → release/* → main/master), present with Recent suggestion from prefs:
```
Base branch:
  Recent: → develop (enter to reuse)
  ────────────────────
  1. origin/develop
  2. origin/main
  ...
Select [number] or enter for suggested:
```
Save to `prefs.projects[{project}].branches`.

### Step 2  -  Mode Selection
```
One pipeline, 6 phases, Sonnet dev, parallel review + triage (CLI-aware
reviewer set). The questions Phase 0 asks are the workspace and autopilot,
never how much of the pipeline runs.
```

### Step 3  -  Autopilot
```
Enable autopilot? (skip confirmations, auto commit/PR)
  1. Yes
  2. No
Select [1/2]:
```

### Step 4  -  Launch
Compose the final command arguments and start the pipeline:
- `jira` source → input type is `jira-id` (e.g. `PROJ-1234`)
- `issue` source → input type is `github-issue-url` (e.g. `https://github.com/org/repo/issues/610`)

Pass selected base branch + mode flags. The pipeline enters Phase 0 Step 1 with the issue already fetched  -  skip redundant API calls.

## Status Display

Scan global log path `$HOME/.claude/logs/multi-agent/` for `agent-state.json` files across all projects:

```
Multi-Agent Tasks

| ID | Project | Task | Branch | Phase | Status | Duration |
|----|---------|------|--------|-------|--------|----------|
| #1 | my-app | PROJ-12345 | feature/PROJ-12345-... | 2/5 Dev | in progress | 4m |
| #2 | other-app | GH42 | feature/GH42-dark-mode | 4/5 Commit | complete | 12m |

Commands: kill #N | log #N | resume #N
```

---

## Global Paths

| Purpose | Path |
|---------|------|
| Logs & state | `${LOGS_ROOT:-$HOME/.claude/logs/multi-agent}/{project}/{task-id}/` |
| Knowledge base | `$HOME/.claude/knowledge/{project-name}/` |
| Helper scripts | `$HOME/.claude/scripts/` |
| Sub-command files | `$HOME/.claude/commands/multi-agent/` |
| Agent definitions | `$HOME/.claude/agents/` |
