---
description: "List unassigned GitHub issues, pick one, auto-assign, and launch the multi-agent pipeline. Use when a GitHub issue should be picked up and started without knowing its number in advance."
description-tr: "Atanmamış GitHub issue'larını listeler, birini seçtirir, otomatik atar ve multi-agent pipeline'ı başlatır."
argument-hint: "[autopilot]  -  optional: run the pipeline without confirmations"
---

# multi-agent issue  -  4-Step Picker (Account → Repos → Issue → Dev Context)

**Input**: $ARGUMENTS

Fully interactive. Only one optional flag: `autopilot`.

## Flow

### [1/4] Pick account (`_account-picker`)

```bash
~/.claude/lib/account-resolver.sh --providers github
```
- AskUserQuestion
- Output: `ACCOUNT_GH_OWNER` (prefix → owner mapping), `ACCOUNT_GH_TOKEN_KEY`

### [2/4] Pick repos (multi-select)

```bash
~/.claude/lib/repo-cache.sh github "$ACCOUNT_GH_OWNER"
```
- Show via AskUserQuestion (multiSelect=true)
- cwd repo defaults to `[x]` when present
- Output: `SELECTED_REPOS=[{fullName, cloneUrl}, ...]`

### [3/4] Pick issue (aggregate)

```bash
for repo in "${SELECTED_REPOS[@]}"; do
  gh issue list --repo "$repo" --state open --assignee "" \
    --json number,title,labels --limit 50
done | python3 -c '
import json, sys
items=[]
for line in sys.stdin: items += json.loads(line)
for i in items:
    labels=",".join(l["name"] for l in i.get("labels",[]))
    if "implemented" in labels.lower() or "in progress" in labels.lower(): continue
    print(f"#{i[\"number\"]}  -  {i[\"title\"]}")
'
```
- AskUserQuestion (multiSelect=false)
- Selected issue: `OWNER/REPO#N`
- Auto `gh issue edit --add-assignee @me` (optional, with confirm)

### [3.5/4] Maturity check (auto)

After selection, inspect `maturity` from `~/.claude/lib/issue-fetcher.sh` (same rule set as Jira):

| Outcome | Behavior |
|---|---|
| `blockers` non-empty (e.g. `description_empty`, `status_closed`) | **Halt** (autopilot too): show summary, advise "fix the issue first" |
| only `warnings` | AskUserQuestion: show summary + "Continue?". Autopilot auto-continues; warnings logged to `agent-log.md` |
| both empty | Continue silently |

`PROMPT_LANG=en` is passed to `issue-fetcher.sh` (`promptLanguage` is locked to `"en"`).

### [4/4] Dev context (`_dev-context`)

`~/.claude/lib/submodule-detector.sh --remote "$OWNER/$REPO"` → suggestions + extra repo list, multi-select.

## Pipeline launch

1. **Write picker state** to `/tmp/multi-agent-picker-{taskId}.json` (same shape as `jira.md`).
2. **Bridge** → `~/.claude/lib/multi-repo-pipeline.sh bridge` writes `agent-state.json` v2.1.0.
3. **Prepare worktrees** → `~/.claude/lib/multi-repo-pipeline.sh prepare`.
4. **Phase 0 entry** consumes the bridged state, skipping redundant fetches.

`autopilot` flag → `MULTI_AGENT_AUTOPILOT=1`.

## Error paths

- No repos under account → prompt for manual `owner/repo`
- No open unassigned issues across selected repos → inform + suggest freetext
