---
description: "List open Jira issues, pick one, and launch the multi-agent pipeline. Use when a Jira issue should be picked up and started without knowing its key in advance."
description-tr: "Açık Jira issue'larını listeler, birini seçtirir 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
---

# multi-agent jira  -  4-Step Picker (Account → Project → 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; one optional flag: `autopilot`.

**Access check, before anything else.** The pickers below can assign an issue and post a maturity comment before Phase 0 starts, so a refused person is stopped here, before the first question.

```bash
ACCESS_LINE=$(node "$HOME/.claude/scripts/usage-access.mjs"); ACCESS_RC=$?
```

`ACCESS_RC` 3: print `$ACCESS_LINE` as written and stop: no picker, no assignee change, no comment, no state, attended or unattended. Any other exit continues (the check fails open). Contract: `$HOME/.claude/multi-agent-refs/features/usage-reporting.md` "The access check".

## Flow

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

```bash
ACCOUNTS=$(~/.claude/lib/account-resolver.sh --providers jira)
```
- Show via AskUserQuestion
- Output: `ACCOUNT_JIRA_TOKEN_KEY`, `ACCOUNT_JIRA_HOST`

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

Fetch projects:
```bash
TOKEN=$(~/.claude/lib/credential-store.sh get "$ACCOUNT_JIRA_TOKEN_KEY")
printf 'Authorization: Bearer %s\n' "$TOKEN" | curl -s -H @- \
  "https://$ACCOUNT_JIRA_HOST/rest/api/2/project" \
  | python3 -c 'import json,sys; [print(p["key"]+"\t"+p["name"]) for p in json.load(sys.stdin)]'
```
- AskUserQuestion (multiSelect=true)
- Output: `JIRA_PROJECT_KEYS=PROJ,...`

### [3/4] Pick issue (aggregate, priority-sorted)

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.

Combine open issues across selected projects, sort by priority + status:
```bash
JQL="assignee=currentUser() AND project in (${JIRA_PROJECT_KEYS}) AND resolution = EMPTY AND status not in (Done,Closed,Cancelled)"
printf 'Authorization: Bearer %s\n' "$TOKEN" | curl -s -H @- \
  "https://$ACCOUNT_JIRA_HOST/rest/api/2/search?jql=$(printf '%s' "$JQL" | python3 -c 'import sys,urllib.parse; print(urllib.parse.quote(sys.stdin.read()))')&fields=key,summary,status,issuetype,priority,resolution,fixVersions&maxResults=50"
```

> **Filter**: `resolution = EMPTY` excludes already-resolved issues at JQL level. If a listed issue still surfaces a maturity blocker, the issue is marked resolved in Jira but stuck in `In Progress`  -  show user a hint.

**Sort order (descending precedence)**:
1. `priority` → Blocker(100) > Critical(90) > High(80) > Medium(50) > Low(30) > Lowest(10) > (none=0)
2. `status` → "In Progress" > "In Review" > "To Do" > others
3. `created` → newest first

**Format**: priority badge prefix, status suffix. Example list and the
maturity shape: `$HOME/.claude/multi-agent-refs/jira/picker-detail.md`; read it
before rendering the list.

- AskUserQuestion (multiSelect=false)
- Output: selected `KEY` (e.g. `PROJ-12345`)

> **Rule**: the sort signals priority; it never forces a pick.

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

After issue selection, inspect `maturity` (`score`, `blockers`, `warnings`, `summary`) from `~/.claude/lib/issue-fetcher.sh`.

> **Empty description → parent candidate**: the fetcher never auto-substitutes a parent's description; it offers it as `description_empty_parent_available` (a warning). How the candidate is found: `jira/picker-detail.md`.
>
> When `description_empty_parent_available` is present, ask a tailored question instead of the generic "Continue?" below:
> - `question` (outputLanguage): "Bu issue'nun (`{KEY}`) açıklaması boş, ama parent'ın (`{parentKey}`) açıklaması var. Parent'ın açıklamasından devam edilsin mi?" / "This issue's (`{KEY}`) description is empty, but its parent (`{parentKey}`) has one. Continue using the parent's description?" - show a short excerpt of `parentDescription` for context.
> - `header` (English, <=12 chars): `"Parent desc"`
> - `options`: `{ label: "Use parent's description" (Recommended), description: "Continue with descriptor.parentDescription as the working description for this task." }` / `{ label: "No, halt", description: "Treat like description_empty  -  fix the issue's own description in Jira first." }`
> - **Accept** → set the working `description` to `parentDescription` for every later phase (analysis/dev/review all read this one substituted value); log the substitution (source issue + parent key) to `agent-log.md`.
> - **Decline** → same as a `description_empty` blocker: halt, advise fixing the issue's own description.
> - **Autopilot**: auto-accepts "Use parent's description" (same "warnings auto-continue" rule as any other warning), logs the auto-accept + parent key to `agent-log.md`.
>
> **Sibling sub-tasks**: the fetcher also reads the parent's other sub-tasks into `descriptor.relatedIssues[]`. Show them as their own labelled block, never substituted into `description`. Both descriptions empty but a sibling has content: `description_empty_sibling_available` replaces the blocker  -  same question, sibling key. Contract: `$HOME/.claude/multi-agent-refs/features/jira-context.md`.

| Outcome | Behavior |
|---|---|
| `blockers` non-empty | **Ask, then halt** - see "Blockers" below. Default is still the halt |
| `warnings` contains `description_empty_parent_available` | Tailored parent-description question above (not the generic one) |
| `warnings` contains `description_empty_sibling_available` | Same question, sibling key substituted for the parent's |
| other `warnings` only | AskUserQuestion: show summary + "Continue?". Autopilot auto-continues; warnings logged to `agent-log.md` |
| both empty (score ≥ 90) | 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.
Only a DIFFERENT gap set ever earns a second comment; read the item's existing comments
first (`priorFromComments`, detail in `jira/picker-detail.md`).

> **Resolution check**: any set Jira `resolution` (`Fixed`, `Done`, `Won't Do`...) adds `already_resolved`. To reopen, clear `resolution` in Jira first.

> **fixVersions**: When `descriptor.fixVersions` is non-empty and a matching `release/<version>` branch exists in `prefs.projects[*].branches`, suggest that branch. Otherwise fall back to `develop`/cwd current.

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` → suggestions, then multi-select picker.

## Pipeline launch

1. **Write picker state** to `/tmp/multi-agent-picker-{taskId}.json` (`taskId`,
   `shortId`, `branch`, `baseBranch`, `issueRef`, `primary`, `extras`,
   `worktreeRoot`, `commitType`, `identity`; full shape in `jira/picker-detail.md`).

2. **Bridge to agent-state.json v2.1.0**  -  picker → Phase 0:
   ```bash
   ~/.claude/lib/multi-repo-pipeline.sh bridge /tmp/multi-agent-picker-{taskId}.json
   # writes ~/.claude/logs/multi-agent/{primary}/{taskId}/agent-state.json
   ```

3. **Prepare worktrees**:
   ```bash
   ~/.claude/lib/multi-repo-pipeline.sh prepare /tmp/multi-agent-picker-{taskId}.json
   ```

4. **Phase 0 entry**  -  reads the bridged `agent-state.json`, no refetch.

`autopilot` arg → start with `MULTI_AGENT_AUTOPILOT=1`.

## Error paths

- No accounts → redirect to `setup` skill
- Jira fetch fails → "wrong account?" → loop back to step [1/4]
- No issues → inform user + suggest `freetext` mode
