---
description: "Launch any task in autopilot mode: skips every confirmation, runs end-to-end autonomously. Use when a task should run end to end with no confirmation prompts."
description-tr: "Herhangi bir görevi autopilot modunda başlatır: tüm onayları atlar, uçtan uca otonom çalışır."
argument-hint: '"task"  -  issue URL, Jira ID, free-text, or #id (for resume)'
---

# multi-agent autopilot  -  Autonomous Pipeline

**Input**: $ARGUMENTS

> **Language (read FIRST)**: Before any status output, read `prefs.global.outputLanguage` and render every conversational line in it. `AskUserQuestion` renders its `question`, option `label`s and option `description`s in `outputLanguage`; only `header` stays English (<=12-char chip); external payload bodies follow `outputLanguage` too (identifiers, commit messages, branch names stay English). Full contract: `$HOME/.claude/multi-agent-refs/rules.md` "Language Application".

Run the task end-to-end with no confirmations.

## What changes

| Phase | Normal | Autopilot |
|-----|--------|-----------|
| Phase 2 (Plan Approval Gate) | Clarification (max 2 rounds) + approval loop  -  user confirms / cancels / sends free text | **Gate skipped**  -  log the plan, jump straight to Phase 3 (autopilot contract: zero interaction) |
| Phase 5 (Test) | "Want to test?" → wait | Skip → Phase 6 |
| Phase 6 (Commit) | "Commit?" → wait | Auto-commit + push |
| Phase 6 (PR) | "Open PR?" → wait | Auto-create PR |

## What is NEVER skipped

- 🔴 **Review-blocking finding** → auto fix + rebuild (max 3 retries)
- 💥 **Build failure** → auto fix + rebuild (max 3 retries, then pause)
- ⚠️ **Kill / Purge** → always asks for confirmation (destructive)

## Usage

```
# GitHub Issue
/multi-agent:autopilot https://github.com/.../issues/316

# Jira ID
/multi-agent:autopilot {JIRA-KEY}-12345

# Free text
/multi-agent:autopilot LoginView dark mode fix

# Resume a stopped task in autopilot
/multi-agent:autopilot resume #3
```

## Steps

1. **Parse input**  -  standard multi-agent input formats
2. **Set the autopilot flag**  -  write `"autopilot": true` to `agent-state.json`
3. **Launch the multi-agent pipeline**  -  every confirmation is skipped
4. **On error**  -  after 3 failed retries, pause and ask the user
## Required: outward-facing payload contracts

Before writing anything outward-facing  -  PR body, Jira comment, Confluence page, closing report  -  load `$HOME/.claude/multi-agent-refs/payload-contracts.md`. It names the canonical section set for each payload, the markup dialect per surface (PR body is Markdown, Jira is wiki markup  -  mixing them is a defect), and the token/duration numbers the closing report must carry. Improvising a payload shape from memory is the most common failure of the short modes.

## Required: Phase Tracker Contract

**The phase tracker is mandatory**  -  the agent cannot skip it. Full spec: [`$HOME/.claude/multi-agent-refs/tracker-contract.md`]($HOME/.claude/multi-agent-refs/tracker-contract.md).

> **Autopilot mode:** user confirmations are skipped. The tracker is still mandatory  -  autopilot agent calls cannot skip it; skipping breaks `smoke-tracker-contract.sh`.

Two channels run in parallel at every phase boundary:

1. **State channel** (every CLI, identical): `phase-tracker.sh` writes to `tracker-state.json`. Drives `:resume`, `:log`, `:status`.
2. **Visual channel** (CLI-specific): native widget on Claude Code, ANSI render on every other CLI. Without it the user sees no phase progress.

```bash
# Phase 0, very first shell call (every CLI):
bash $HOME/.claude/scripts/phase-tracker.sh init "$TASK_ID"
for p in "0:Init" "1:Analysis" "2:Planning" "3:Dev" "4:Review" "6:Commit" "7:Report"; do
  bash $HOME/.claude/scripts/phase-tracker.sh add "${p%%:*}" "${p#*:}"
done
bash $HOME/.claude/scripts/phase-tracker.sh update 0 in_progress

# Every phase boundary (every CLI):
bash $HOME/.claude/scripts/phase-tracker.sh update <N> in_progress|completed|failed|skipped

# After every LLM call (every CLI):
bash $HOME/.claude/scripts/phase-tracker.sh tokens <N> <in> <out> [cached]
```

### Visual channel  -  Claude Code (native TaskList widget, required)

In Claude Code the agent MUST also drive the native TaskList widget so the user sees a sticky phase tile stack  -  this is the only progress signal Claude Code surfaces. Skipping these calls is the #1 source of "I don't see any phases" complaints.

**TaskCreate ordering (strict)**: All TaskCreate calls fire in strict phase-number order BEFORE any TaskUpdate is applied. The native widget renders by creation order, not by phase number  -  out-of-order calls produce visually scrambled tile stacks (e.g. `1 ✓ · 2 ✓ · 4 ✓ · 0 ▶ · 3 ☐`) even when the underlying state is correct. Pre-marking phases as completed/skipped before Phase 0 starts is FORBIDDEN  -  register the tile in order, then flip status via TaskUpdate when the phase actually short-circuits. Full contract in `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "TaskCreate ordering (strict)".

```text
# Phase 0 startup  -  register one tile per phase (0..N), capture the taskId, persist it:
for each phase in 0:Init, 1:Analysis, 2:Planning, 3:Dev, 4:Review, 6:Commit, 7:Report:
  TaskCreate({ subject: "Phase <N>: <Name>", activeForm: "<doing-form>" })
    -> returns taskId
  bash $HOME/.claude/scripts/phase-tracker.sh meta <N> tasklist_id "<taskId>"

# Phase entry  -  flip the tile to in_progress alongside the state update:
TaskUpdate({ taskId: <saved>, status: "in_progress" })
bash $HOME/.claude/scripts/phase-tracker.sh update <N> in_progress

# Active sub-step inside a phase  -  update activeForm so the spinner header reflects what's happening now:
TaskUpdate({ taskId: <saved>, activeForm: "Editing TopBarView.swift" })

# Phase exit  -  flip to completed/failed/skipped on both channels:
TaskUpdate({ taskId: <saved>, status: "completed" })
bash $HOME/.claude/scripts/phase-tracker.sh update <N> completed
```

`autopilot` mode does NOT TaskCreate phases 5  -  those are not part of the `autopilot` phase set (`0:Init 1:Analysis 2:Planning 3:Dev 4:Review 6:Commit 7:Report`). Only register tiles for the active set.

#### TaskCreate ordering (strict)

**All TaskCreate calls fire in strict phase-number order BEFORE any TaskUpdate is applied.** For `autopilot` that means: Phase 0 → Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 6 → Phase 7. The native widget renders by creation order, not by phase number  -  out-of-order calls produce visually scrambled tile stacks. Full ordering contract in `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "TaskCreate ordering (strict)".

### Visual channel  -  Copilot CLI / plain shell

These CLIs have no TaskList widget. After every state change the agent calls render, which prints a bordered ANSI card as the last tool result so the user sees an updated phase table:

```bash
bash $HOME/.claude/scripts/phase-tracker.sh render
```

Do NOT call TaskCreate on these CLIs  -  the tool does not exist and the call fails.
