---
description: "Internal  -  input type detection for multi-agent dispatcher."
---

# _input-parser  -  Multi-Agent Input Type Classification

The top-level `multi-agent` command classifies user arguments per the rules below.

> **Language**: Schema reference only  -  no user-facing text. Picker `header` is always English (`promptLanguage` is locked to `"en"`); `question` + `label` + `description` follow `outputLanguage` per the `rules.md` matrix. Commit messages, branch names and PR titles stay English; PR/Jira/Confluence **bodies** follow `outputLanguage`.

## Type Table

| # | Pattern | Type | Example |
|---|---|---|---|
| 1 | `^[A-Z]+-[0-9]+$` | `jira-id` | `PROJ-1` |
| 2 | `https?://.*atlassian\.net/browse/.*` or `https?://jira\..*/browse/.*` | `jira-url` | `https://jira.example.com/browse/PROJ-1` |
| 3 | `https?://github\.com/.*/issues/[0-9]+` | `gh-url` | `https://github.com/o/r/issues/316` |
| 4 | `^[a-z0-9_-]+#[0-9]+$` | `gh-short` | `my-ios-app#316` |
| 5 | `^#?[0-9]+$` | `gh-num` | `316`, `#316` |
| 6 | `^jira$` | `picker-jira` | `jira` |
| 7 | `^issue$` | `picker-issue` | `issue` |
| 8 | (none of the above) | `freetext` | `"LoginView dark mode fix"` |

## Quoting

A double-quoted first argument is read in two steps: strip the surrounding
double quotes and unescape, then classify the value.

- **Unescape.** Inside the quotes `\"` becomes `"`, and `\\` becomes `\` only
  where it stands before a quote or at the end of the value. Every other
  backslash is kept as typed (`C:\path`, `\n` stay as they are). Nothing else is
  trimmed, normalised or rewritten.
- **Classify the whole value.** If the resulting value as a whole is a Jira key, a Jira or GitHub issue URL, `repo#N` or `#N`, it is that structured reference:
  `/multi-agent "PROJ-1" autopilot` and `/multi-agent "https://github.com/o/r/issues/316"`
  fetch the issue exactly as their unquoted forms do. Otherwise the value is
  `freetext`, and a structured token inside a sentence stays free text:
  `"PROJ-1 crashes on login"` is a task description, never an issue fetch.
- **The closing quote** is the first `"` that is not escaped. Everything after
  it is modifiers: `autopilot`, `--loop N`, `--review-rounds N` (1 to 3; `review-rounds.mjs parse` reads it), and the branch name that may follow
  a Jira key (`"PROJ-1" "feature/PROJ-1-desc"`). A quoted branch name is
  unquoted and unescaped the same way: strip its surrounding double quotes,
  `\"` becomes `"`, and `\\` becomes `\` before a quote or at the end. A word
  there that is not a modifier is not folded into the task; say which
  modifiers exist.

## Flow Effect

| Type | Account picker | Repo picker | Issue picker | Dev-context picker |
|---|---|---|---|---|
| `jira-id` / `jira-url` | ✅ (always) | ❌ | ❌ | ✅ |
| `gh-url` | ✅ | ❌ (URL implies repo) | ❌ | ✅ |
| `gh-short` | ✅ | ❌ (input implies repo) | ❌ | ✅ |
| `gh-num` | ✅ | ✅ (single-select) | ❌ | ✅ |
| `picker-jira` | ✅ | ✅ project (multi) | ✅ aggregate | ✅ |
| `picker-issue` | ✅ | ✅ repo (multi) | ✅ aggregate | ✅ |
| `freetext` | conditional¹ | ✅ (single-select, sources merged²) | ❌ | ✅ |

¹ Account picker is **skipped** when the resolved primary repo is local-only
  (`provider="local"`). No token lookup, no provider auth  -  the pipeline
  proceeds with `accountId=null` and Phases 4/5 honor the local-only mode.

² Free-text flow merges `github`+`bitbucket`+`local` repo caches into a
  single picker list; `(local)` rows come from `repo-cache.sh local "$HOME"`.

> **Rule**: Dev-context picker **always** runs (empty submit allowed → primary repo only).
