---
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"
parameters: [{"name":"autopilot","kind":"flag"}]
gui: button
destructive: false
confirm: none
not-for: jira
---

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

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

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)

The same list, already merged, sorted and scrubbed of hosts and URLs, is `node "$HOME/.claude/scripts/issues.mjs" --json` (Jira and GitHub in one shape); prefer it over hand-rolled calls when it answers.

```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`) | **Ask, then halt** - see "Blockers" below. Default is still the halt |
| only `warnings` | AskUserQuestion: show summary + "Continue?". Autopilot auto-continues; warnings logged to `agent-log.md` |
| both empty | Continue silently |

**Blockers: ask, do not just stop.** `$HOME/.claude/multi-agent-refs/features/maturity-followup.md`
owns this. In short: an interactive run asks at this step (open the item and fix it /
continue without it, recording which gap was waved through / abort) instead of ending
with a summary; an autopilot run with `prefs.global.maturityFollowup.autopilotCommentsOnIssue`
on posts ONE comment on the item asking for what is missing, then halts on the circuit
breaker with `state.waitingFor = "maturity"` so `resume` re-enters THIS step with the item
re-fetched. Both defaults keep today's behaviour: the comment is off, the halt is the halt.
An edit is a reason to re-check, never proof the gap closed - the check re-runs on the new
content, and only a DIFFERENT gap set ever earns a second comment. Read the item's existing
comments FIRST and derive the prior ask from the newest one of ours (`priorFromComments`):
a scan is a new run with a fresh state file, so state alone would make every scan a first ask.

The fetcher renders `maturity.summary` in `prefs.global.outputLanguage`; every other descriptor field is machine-readable and stays English.

### [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
