---
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)'
parameters: [{"name":"task","kind":"text","required":true}]
gui: form
destructive: false
confirm: none
---

# multi-agent autopilot  -  Autonomous Pipeline

> **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.

**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.

## Gotchas

- The guard decides within a 5-second internal deadline and fails closed when unattended. On a heavily loaded machine a correct command can be refused for time, not for policy.
- An unattended run never pushes or opens a PR itself: it records the request in `pr-request.json` and the runner publishes it.
- An unattended run cannot run `/multi-agent:stack` or write `.claude/` in the repo; a missing stack toolkit is read from a local marketplace clone instead.

## What changes

| Phase | Normal | Autopilot |
|-----|--------|-----------|
| Phase 1 (Plan Approval Gate) | Clarification (max 2 rounds) + approval loop  -  user confirms / cancels / sends free text | **Gate skipped**  -  log the plan, jump straight to Phase 2 (autopilot contract: zero interaction) |
| Phase 3 (User test, the tail of Review) | "Want to test?" → wait | Skip → Phase 4 |
| Phase 4 (Commit) | "Commit?" → wait | Auto-commit + push |
| Phase 4 (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:Plan" "2:Dev" "3:Review" "4:Commit" "5: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. Register one tile per phase of the active set (`0:Init 1:Plan 2:Dev 3:Review 4:Commit 5:Report`) with `TaskCreate`, persist each `taskId` via `phase-tracker.sh meta <N> tasklist_id "<taskId>"`, and at every phase entry, sub-step and exit pair a `TaskUpdate` (status or `activeForm`) with the matching `phase-tracker.sh update`. Call pattern: `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "Call pattern". Mirror each with `phase-tracker.sh task` ("Mirroring the host's task list").

`autopilot` mode TaskCreates all 6 phases (no phase is skipped).

#### TaskCreate ordering (strict)

**All TaskCreate calls in a batch fire in strict phase-number order BEFORE any TaskUpdate is applied**, and a later batch only ever appends phases numbered above everything already registered. For `autopilot` that means: Phase 0 → Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5. 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 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.
