# @mmerterden/multi-agent-pipeline

[![GitHub Release](https://img.shields.io/github/v/release/multi-agent-ecosystem/multi-agent-pipeline?color=blue)](https://github.com/multi-agent-ecosystem/multi-agent-pipeline/releases)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node.js](https://img.shields.io/badge/Node.js-20%20%7C%2022-green)](https://nodejs.org)
[![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](https://github.com/multi-agent-ecosystem/multi-agent-pipeline/blob/main/package.json)
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/multi-agent-ecosystem/multi-agent-pipeline/badge)](https://scorecard.dev/viewer/?uri=github.com/multi-agent-ecosystem/multi-agent-pipeline)

🇹🇷 Türkçe: [README.tr.md](./README.tr.md)

A <!-- fact:phaseCount -->6<!-- /fact -->-phase AI development pipeline for **Claude Code**, **Copilot CLI**, **Codex CLI** and a **local-model host**. Drives a Jira issue or GitHub URL to a merged PR in one command - analysis → plan → TDD → review → test → commit → PR - with multi-repo orchestration, a plan-approval gate, CLI-aware parallel review, and store-compliance checks. Component and Figma-to-code work is dispatched to the per-stack marketplace plugins (iOS/SwiftUI, Android/Compose) rather than bundled, so component skills live in one place.

Runs natively on Claude Code, Copilot CLI, Codex CLI and a fourth host that is the Codex engine pointed at a model served from your own machine. macOS only. Zero runtime dependencies.

📐 **[Architecture diagrams](./docs/architecture.md)** - the <!-- fact:phaseCount -->6<!-- /fact -->-phase flow, operating modes, review/triage, Figma subphases, component layout. **[Ecosystem diagram](./docs/ecosystem.md)** - how this repo, the `multi-agent-plugins` marketplace and `multi-agent-mcp` compose.

### Prerequisites

- **Node.js >= 20.11** - required; the pipeline's own tooling runs on it.
- **`jq`** - required for nine paths, optional for the rest. 98 shell files call it. The nine that publish or decide - the autopilot queue, Jira comments, Jira Issue Links, PR reviews, issue updates, the plan file, both Figma fetchers and log search - refuse with exit 3 rather than run, because a missing `jq` renders as empty DATA and the work carries on with it. Everywhere else it still degrades. The install prints a note when it is missing.
- **`gh`** - for GitHub issue and PR work. Its built-in `--jq` is independent of the `jq` binary.

## Quick Start

```bash
# from the public registry (no auth) - pick the CLIs you actually use
npx @mmerterden/multi-agent-pipeline install --claude    # Claude Code only (default)
npx @mmerterden/multi-agent-pipeline install --copilot   # Copilot CLI only
npx @mmerterden/multi-agent-pipeline install --codex     # Codex CLI only
npx @mmerterden/multi-agent-pipeline install --local     # a model served from this machine
npx @mmerterden/multi-agent-pipeline install --all       # every host above

# then, once:
/multi-agent:setup          # keychain token scan + git identity + default stack
```

### No `npx` on that machine?

`npx` ships with npm, and npm ships with Node - so "npx: command not found" almost
always means Node is missing from that shell, not that anything is wrong with the
package. Check first, then pick the row that matches:

```bash
node -v; npm -v; command -v node npm npx
```

| What you see                                   | What to do                                                                               |
| ---------------------------------------------- | ---------------------------------------------------------------------------------------- |
| nothing at all                                 | Install Node >= 20.11: `brew install node`, or the LTS installer from nodejs.org         |
| `node` works, `npx` does not                   | `npm i -g @mmerterden/multi-agent-pipeline` then `multi-agent-pipeline install --claude` |
| nvm is installed but the shell does not see it | `source ~/.nvm/nvm.sh && nvm use --lts`, or just open a new terminal                     |
| npm is ancient (< 5.2, which predates npx)     | `npm i -g npm@latest`, or use the global-install row above                               |

And the path that needs neither `npx` nor a global install - clone and run the
installer directly:

```bash
git clone https://github.com/multi-agent-ecosystem/multi-agent-pipeline.git
cd multi-agent-pipeline
node index.js install --claude        # add --dry-run first to see what it would write
```

`npm exec @mmerterden/multi-agent-pipeline install --claude` also works on any npm
7+ without `npx` on `PATH`.

**One error that is not an npx problem.** This package declares `os: ["darwin"]`,
so npm refuses to install it anywhere else and says `npm ERR! notsup Unsupported
platform`. That is deliberate ([ADR-0012](./docs/adr/0012-macos-only.md)), not a
missing tool: every credential read shells `security`, every iOS build
`xcodebuild`, every piece of visual evidence `simctl`.

Tool flags combine (`--claude --codex`). With no tool flag at all, the installer targets Claude Code only. Other flags: `--dry-run` (show what would be written, write nothing), `--platform=ios|android|all` (skip the stack skills you do not need), `--offline` (deliver stack skills only from a copy of the marketplace already on this machine), `--link` (symlink instead of copy, for local development).

Run a task - the input type is auto-detected:

```bash
/multi-agent "PROJ-1234"                              # Jira id → fetch, plan, build
/multi-agent "https://github.com/org/repo/issues/42"  # GitHub issue URL
/multi-agent "my-app#42"                              # repo + issue number
/multi-agent "fix dark-mode contrast on LoginView"    # free-text bug/feature
/multi-agent:jira                                     # browse your open Jira issues → pick
/multi-agent:issue                                    # browse unassigned GitHub issues → pick
```

Every input runs the same short intake - **account → (repo) → maturity check → dev-context** - then enters Phase 0. A Jira id or GitHub URL is fetched and maturity-checked _before_ any code is written; free-text skips the fetch and goes straight to planning. Multi-repo tasks add extra repos at the dev-context step.

Add `autopilot` to skip confirmations (e.g. `/multi-agent "PROJ-1234" autopilot`; `--loop N` runs it as a bounded background loop). The workspace is not a flag either - it is the one question the run asks about its own shape at Phase 0: where to run, a worktree or your current checkout.

Update later with `/multi-agent:update`. Uninstall (tokens preserved) with `npx @mmerterden/multi-agent-pipeline uninstall`.

**Stack skills are marketplace plugins.** On Claude Code the `ai-<stack>-toolkit` plugins (`multi-agent-plugins` marketplace) are the only stack-skill source - nothing is copied into `~/.claude/skills`. Pick the active stack(s) per repo with `/multi-agent:stack` (multi-select: `ios backend`, or a native picker with no args); each plugin ships a language-aware catalog at `ai-<stack>-toolkit:help`. Copilot CLI and Codex CLI have no plugin loader, so they receive a local copy filtered to the same enabled stacks - delivered from a copy of the marketplace, since the package carries the plugins' skill list rather than the skills.

## How it works

One command runs <!-- fact:phaseCount -->6<!-- /fact --> phases, with a gate between the risky ones. Every run
carries the whole set; the one question Phase 0 asks about shape is where the
branch lives, a worktree or your current checkout:

- **0 · Init** - parse the input (Jira id / GitHub URL / free text), pick account + repo(s), fetch the issue, run a maturity check.
- **1 · Plan** - detect the stack, scan the codebase and write the analysis document, then break it into tasks with file-level targets and **stop for your approval** before touching code. Analysis and planning are one decision, so they are one phase ([ADR-0014](./docs/adr/0014-six-phase-consolidation.md)). Codebase scanning runs on the explorer persona (Sonnet).
- **2 · Dev** - TDD: failing test → code → green, following the repo's style + the active stack skills. The phase ends at its own gate: build, lint, tests and a secret scan, run **once**; Review reads that log rather than building again.
- **3 · Review** - a **CLI-aware parallel review** against the logs Dev produced - Claude Code runs 3 models (Fable + Opus + Sonnet; Opus + Sonnet while the fable rung is off), Copilot CLI runs 3 (GPT-5.4 + Opus + Sonnet) - then a **Fable triage** keeps only actionable findings; blockers loop back to Phase 2. The optional user test lives here, keeping its waiting state.
- **4 · Commit/PR** - conventional commit, push (must succeed), open a PR (`Ref: #N`, never auto-close). An unattended run stops at the commit and hands a PR request to the autopilot runner, which verifies it and opens a draft PR.
- **5 · Report** - technical summary + a Jira comment with test scenarios, posted through the channels layer. This is the one step a terminal autopilot run still pauses at; an unattended run ends at the Phase 4 hand-off, and the runner posts the reports you configured once the PR is open.

The phase list lives in `pipeline/schemas/phases.json`, and `smoke-phase-contract.sh` holds every other copy of it - the generator's output, the token budget, the state-schema bounds, the progress fractions in sample output - to that one file. Each phase also declares its own sub-steps there (`steps`), and `phase-tracker.sh add` registers them with the host's progress widget, so a run reaches its first boundary already showing `0.1 Intake`, `0.2 Workspace` and `0.3 Task contract` under Phase 0, and the same under Plan, Review, Commit and Report. Dev declares none on purpose: its sub-steps are Phase 1's plan tasks, which the plan attaches when it is approved. The number rides inside the row text, because the widget renders one string per row and carries no field beside it.

While a phase works it also says what it is doing: `schemas/now-lines.json` holds the canonical lines, `multi-agent-refs/tracker-contract.md` carries the `phase-tracker.sh now <id>` call for every phase in one table, and `scripts/lint-now-lines.mjs` holds the two to each other. The line reaches the native task widget's subject, the card's `Now:` row and the office's phase card from the one record, and a phase that moved without writing a line falls back to the name of its step in progress. The same subject carries the model spending, the elapsed time, the tokens, the rough cost and the step count, dropped in a fixed order when the line will not fit. At the end of a run `scripts/render-work-summary.sh --format terminal` prints a plain summary: what changed, what was checked, what was delivered and what is left for you.

`/multi-agent:analysis` runs its own shorter chain and reviews what it wrote before publishing it: the draft goes through the same three-reviewer set and triage as a code diff, a blocking finding returns it to synthesis with dispatch closed, and the gaps that survive are either searched, asked about, or recorded with an owner.

### Install verification, cost, and one state directory

- **`multi-agent-pipeline verify`.** The install is a copy, and from the moment it is written the two halves drift independently: an edit in the installed tree is behaviour with no source, and a file the installer skipped is a script the docs describe and nobody has. `verify` compares both against a manifest built at pack time. What a green result proves is stated plainly - the bytes match what the publisher recorded, not who published them. Details: [verify](pipeline/multi-agent-refs/features/verify.md).
- **Cost, past the single run.** The per-task ceiling cannot see the two ways a budget actually empties: a drift that trips nothing, and one session that burns a week in an hour while every run stays under its cap. `cost-analyze` projects, finds days out of family by median absolute deviation, and reports acceleration - as LIST-price estimates, which it says on every run rather than in a footnote.
- **A run's state lives in one place.** `{project}/{taskId}/` is canonical, the flat layout is still read, and a run that exists in both is counted once.
- **Server readiness, entirely opt-in.** `doctor --profile=server` adds four checks that only matter when nobody is at the keyboard, and `install --unattended` writes a permission profile after printing it. The default install writes no permissions and the default doctor run leaves the server checks out, because a laptop told it fails a server check learns to ignore doctor.

### Your package manager, your hooks, your MCP surface

Three places where the pipeline looks instead of assuming:

- **Phase 2 uses the repo's package manager.** It is resolved from the repo - an env override, then `package.json#packageManager`, then the lock file, then npm reported as a default rather than as evidence - so a pnpm, yarn or bun repo does not fail after its worktree and branch exist. iOS and Android are untouched.
- **A compaction keeps what a phase learned.** The hooks template flushes captures at `PreCompact` as well as at session end, because an auto-compaction summarizes a long review or development phase while it is still running.
- **`doctor` counts your MCP servers.** Every registered server sends its tool list on every turn and they are added one at a time, so nobody ever sees the total. It reports the count and nothing else: no warning, no blocking, no disabling.

### Maturity: the check has an effect

Phase 0 scores how ready the item is before anything is built. A score that only halts leaves the item exactly as immature as it was found, and the next scan halts on it for the same reason, so the result drives a next step.

An interactive run **asks at that step** - open the item and fix it, continue without it, or abort - and records which gap you waved through rather than just that you continued. An autopilot run parks the item and can be told to **ask on the item itself** (`prefs.global.maturityFollowup.autopilotCommentsOnIssue`, off by default): one comment naming what is missing. Never a status change, never an assignee, never a close, `Ref:` and never `Closes:`.

`resume` re-enters the maturity step with the item re-fetched, and the check decides. An edit is only a reason to look again - a reply reading "will do later" moves the timestamp and fixes nothing. The same question is never asked twice.

### Base branch: evidence, then a question

Phase 0 Step 3 collects the candidates **with the evidence behind each one** before it asks. An issue carrying a target version, or linking a separate issue that represents the release, already names the branch on a repo whose release branches encode the version - so that becomes a ranked row whose description says why, next to rows that say "the repository's default branch" or "you used this last time". You still choose; the evidence only reorders.

Nothing is hardcoded: any Jira field whose schema resolves to `version` is read whatever the board calls it, and the release-branch naming convention is inferred from the refs that exist rather than read off a table - one repo yields `<prefix>/develop_<version>`, another `release-<version>`, out of the same code. A version whose branch has not been cut yet is reported as a note, never offered as an option you cannot check out.

A failed `git fetch` degrades loudly rather than silently: the list falls back to local refs, the question says so, it gains a retry row, and the exit gate refuses to close Phase 0 if a degraded run recorded its list as the remote's answer. Turn the whole thing off with `prefs.global.baseBranchEvidence.enabled: false` and Step 3 asks with the plain branch list.

### Workspace: worktree or local

Phase 0 Step 5b asks where the branch lives. **Worktree** (`.worktrees/{id}/`) leaves your current checkout untouched; **Local** works in the project root on a new branch, and needs the project root clean. It is a question, not a flag: there is no `:local` command and no `--local` switch, so the answer is always visible in the run rather than buried in how the run was typed. `autopilot` resolves it to a worktree without asking, because an unattended run commits and pushes from wherever it stands and doing that in your own checkout is what worktrees exist to prevent. The manual-test offer at the end of Review follows the same answer: a worktree run is asked whether to check the branch out and test it, a local run already is that checkout, so there is nothing to offer.

Under the hood: each task runs in its own **git worktree** (or the current branch when you choose local), commits use the **git identity routed from the repo's origin URL**, and **multi-repo** tasks get per-repo worktrees plus an integration build. Tokens stay in the OS keychain; nothing is committed or logged. `/multi-agent:review` can also review an existing GitHub/Bitbucket PR - per-finding inline comments anchored to `file:line` + an explicit Approve / Needs-Work state.

The discipline behind all of this - bounded loops, evidence gates, token-budgeted phase docs, immutable tests, fresh-context handoffs - is catalogued in [docs/engineering.md](./docs/engineering.md). The full feature list lives in [docs/features.md](./docs/features.md). How this repo, the `multi-agent-plugins` marketplace, and the `multi-agent-mcp` server compose at install time and at run time is diagrammed in [docs/ecosystem.md](./docs/ecosystem.md).

## Modes

| Mode      | Command                              | Flow                                                                                                                                                             |
| --------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Full      | `/multi-agent "task"`                | All <!-- fact:phaseCount -->6<!-- /fact --> phases, interactive                                                                                                                                        |
| Autopilot | `/multi-agent "task" autopilot`      | The same <!-- fact:phaseCount -->6<!-- /fact --> phases, no confirmations; the workspace resolves to a worktree and the user-test gate inside Review is skipped                                                                                                       |
| Audit     | `/multi-agent:design-check`          | Mock-mode vs Figma conformance, local-only                                                                                                                       |
| Audit     | `/multi-agent:testflight-validation` | Pre-submission gates for a TestFlight build: static archive audit → Apple's `altool --validate-app` → Review-Guidelines check. Validates only, never uploads     |

`autopilot` is the only knob on the run itself; everything else is its own command. The full catalog is below.

## Commands

`/multi-agent` plus <!-- fact:commandCount -->82<!-- /fact --> sub-commands. `/multi-agent:help` renders the same catalog in your terminal, in your `outputLanguage`.

### Pipeline entries

| Command                               | What it does                                                                                         |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/multi-agent "task"`                 | The pipeline; Phase 0 asks where the branch lives                                                    |
| `/multi-agent "task" autopilot`       | The same pipeline, unattended: worktree resolved, no confirmations; `--loop N` repeats it in the background |
| `/multi-agent:resume`                 | Unfinished work, either source: a stopped run picks up where it left off, a branch with no run behind it gets the tail (Review → Build+Test → Commit/PR → Report) |

**Typed with nothing after it, `/multi-agent` and `/multi-agent:analysis` ask instead of printing the guide.** Both are argument-shaped - a key, a URL, `repo#N`, free text, a sub-command - which is fast once you know the forms and a wall to read before that. `/multi-agent` offers your tracker items, unassigned issues, describing a task in one line, or the guide; `/multi-agent:analysis` offers a new analysis, or checking, refreshing or conforming a document you name. Every typed form routes exactly as before, and the account, maturity and dev-context steps still run after the answer. `scripts/entry-mode.mjs` decides which of four it is - `typed`, `picker`, `usage` (a modifier such as `autopilot` with no task, where asking would silently drop the modifier) or `refuse-unattended` - so the answer comes out the same on every host, and an unattended run started with no task says so in one line instead of waiting until it times out having produced nothing.

### Task control

| Command                                 | What it does                                                                                                                                             |
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/multi-agent:status`                   | Every task's ID, phase, branch and state                                                                                                                 |
| `/multi-agent:log [#N]`                 | Show a task's `agent-log.md` (most recent by default)                                                                                                    |
| `/multi-agent:resume [#N]`              | Carry a stopped or failed task on from its last phase, or run the tail over a branch with no run behind it                                                |
| `/multi-agent:kill [#N]`                | Stop a task, remove its worktree and branch                                                                                                              |
| `/multi-agent:steer #N "<instruction>"` | Correct a running task without stopping it; applied at the next phase boundary                                                                           |
| `/multi-agent:search`                   | Ranked search across every task log; `--semantic` queries the triage corpus; the toolkit's `learnings_*` tools read the learnings ledger of every repo                                                                              |
| `/multi-agent:garbage-collect`          | Sweep leftover scratch, orphan worktrees and offloaded payloads. `--abandoned` also reaps runs that stopped and were never picked back up. Dry-run first |
| `/multi-agent:prune-logs`               | Delete per-task logs by age / project / task. Audit trail and metrics kept                                                                               |
| `/multi-agent:clean-disk`               | Free disk space: measure every category, choose what to delete, apply, report the space freed. Nothing is deleted before you choose                    |
| `/multi-agent:purge`                    | Wipe every worktree, branch, log and state file. Double confirmation                                                                                     |

### Review

| Command                            | What it does                                                                                |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `/multi-agent:review`              | Parallel review of a branch diff or a PR; inline comments + approve/needs-work on PR input  |
| `/multi-agent:review-jira`         | Grade a Jira issue's readiness for development, comment the gaps                            |
| `/multi-agent:address-review`      | Answer human review on your own open PR: verify each thread, fix test-first or push back with a `file:line`; every reply, resolve and push approved one at a time, drafts only in autopilot |
| `/multi-agent:review-priority`     | Grade a team's open bug priorities against its rule file. Read-only; one approved change at a time |
| `/multi-agent:review-issue`        | Same grading for a GitHub issue                                                             |
| `/multi-agent:review-analysis`     | Review a written analysis document; findings cite the Locked rule they break                |
| `/multi-agent:diff-explain`        | Map a Phase 3 triage finding back to the diff lines that caused it                          |
| `/multi-agent:estimate`            | Effort range from similar closed work: P25-P75 per role, with the tickets behind it         |
| `/multi-agent:postmortem`          | Post-mortem of a run from its transcripts: loops, stalls, root-cause hypotheses on file:line |
| `/multi-agent:scenario-audit`      | Check test scenarios against the code; each PRESENT on a resolving file:line                |
| `/multi-agent:refactor`            | Best-practice extraction + bug hunt + derived-skill drift + toolkit MCP research → one plan |
| `/multi-agent:scan`                | Skill security scan of local skill directories against a tiered pattern catalog             |
| `/multi-agent:prune-prompts`       | Zero-base review of the always-on instruction footprint; keep / trial / delete per rule     |
| `/multi-agent:ios-coding-standard` | Audit an iOS module against the stable-ID rule registry, produce a remediation plan                |
| `/multi-agent:security-review`    | Standalone static security review of a diff, branch or repo: threat model, OWASP + CWE findings with CVSS, offline dependency inventory, every cited line proven to exist, optional SARIF export |

### Analysis

| Command                           | What it does                                                                              |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/multi-agent:analysis`           | Standalone feature spec: global (23-section handoff) or corporate (IG/UC/FG) profile      |
| `/multi-agent:analysis-resolve`   | Answer an analysis doc's Section 20 open questions one row at a time                      |
| `/multi-agent:analysis-jira`      | Turn a final analysis document into a Jira story tree: stories from its rule ids, two-way coverage, full preview, creates only what is missing |
| `/multi-agent:graph`              | Build and query the repo's code graph: symbols, imports, references; deterministic, no API tokens. The toolkit also serves it read-only: stats, hubs, clusters and cross-cluster links |
| `/multi-agent:research <id>`      | Answer an item's gaps from its tracker thread, linked docs and repo before anyone is asked; interactive runs can add community reports and video transcripts |
| `/multi-agent:complaint-analysis` | Customer-complaint triage with Graylog evidence: client / bff root cause, or core routing. Store reviews can come in too, ranked into themes with verbatim quotes |

### Testing on a device

| Command                                  | What it does                                                              |
| ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `/multi-agent:test`                      | UI Bug Hunter on a booted simulator or emulator: screenshot, tap, analyze |
| `/multi-agent:test-dark-mode`            | Walk every screen light then dark, report contrast and colour bugs; layout shift between the two is measured, not eyeballed |
| `/multi-agent:test-accessibility`        | VoiceOver labels, sub-44pt tap targets, traits, and contrast measured as a WCAG ratio |
| `/multi-agent:test-dynamic-type`         | Re-walk every screen at XL through accessibility-XL, report truncation    |
| `/multi-agent:test-screenshots [locale]` | App Store screenshot set in a locale (defaults to `tr`)                   |
| `/multi-agent:bug-bash`                  | Parallel exploratory sessions by charter and device profile; only findings a failing repro test proves are reported |
| `/multi-agent:test-gen`                  | Writes the tests an app lacks, stage by stage: inventory, read-only gap analysis, handles, tests, repeated runs, per-test classification |
| `/multi-agent:manual-test`               | Phase 3 standalone: check out the task branch and prepare it for Xcode    |

### Design, build and store

| Command                              | What it does                                                                             |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `/multi-agent:design-check`          | Mock-mode vs Figma audit with a coverage gate; annotated HTML + PDF report               |
| `/multi-agent:store-ready`           | Pre-submission gates for iOS and Android: package audit, store validation, policy review; listing text checked for limits and banned claims |
| `/multi-agent:testflight-validation` | iOS-pinned alias of `store-ready`. Validates only, never uploads                         |
| `/multi-agent:build-optimize`        | Benchmark an Xcode build, run the analyzers, produce a recommend-first plan              |

### Tickets and reporting

| Command                    | What it does                                                                        |
| -------------------------- | ----------------------------------------------------------------------------------- |
| `/multi-agent:jira`        | Browse your open Jira issues → pick → branch → mode → launch                        |
| `/multi-agent:issue`       | Browse unassigned GitHub issues → pick → auto-assign → launch                       |
| `/multi-agent:create-jira` | Draft a Task / Bug / Story to the project's own conventions, preview before create  |
| `/multi-agent:channels`    | Post the multi-channel report: Jira, Confluence, Wiki, PR description, board status |
| `/multi-agent:feedback`    | Send one message to the maintainer. Only your text is sent, no logs or paths        |

### Your own routines

| Command                                | What it does                                                                       |
| -------------------------------------- | ---------------------------------------------------------------------------------- |
| `/multi-agent:save [name]`             | Save a recurring job as a reusable `/multi-agent:<name>`. Local-only, never synced |
| `/multi-agent:routines`                | List saved routines with what each one does                                        |
| `/multi-agent:routines-share <name>`   | Publish a saved routine to site members, after a secret scan and a preview         |
| `/multi-agent:routines-browse [query]` | List the routines site members shared with you                                     |
| `/multi-agent:routines-import <id>`    | Install a shared routine as a local-only command, full body shown first            |
| `/multi-agent:routines-update`         | Bring imported routines up to their owner's latest version, diff first             |
| `/multi-agent:routines-delete <id>`    | Withdraw a routine you published                                                   |
| `/multi-agent:forget [name]`           | Remove a saved routine and its registry entry                                      |

### Setup and maintenance

| Command                          | What it does                                                                   |
| -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/multi-agent:setup`             | First-run wizard: keychain token discovery, git identity, pipeline preparation |
| `/multi-agent:stack [ids]`       | Enable the marketplace plugin(s) for this repo. Multi-select                   |
| `/multi-agent:scaffold <stack> <name>` | New project skeleton from the toolkit's scaffold skill, green before its first commit |
| `/multi-agent:language [en\|tr]` | Show or set `outputLanguage`; `promptLanguage` stays English                   |
| `/multi-agent:review-rounds [1\|2\|3\|status\|reset] [--repo]` | How many times review may send work back to development: <!-- fact:reworkDefault -->2<!-- /fact --> rounds by default, adjustable from 1 to <!-- fact:reworkCap -->3<!-- /fact -->. No argument opens a picker; `/multi-agent "task" --review-rounds N` sets it for one run |
| `/multi-agent:sync`              | One-shot sync: Claude Code, Copilot CLI, pipeline repo, website, toolkit MCP   |
| `/multi-agent:update`            | Update to the latest published npm release and run migrations                  |
| `/multi-agent:version`           | The version of each repository this machine runs - pipeline, MCP toolkit, plugin marketplace - with the date each was released and which one is behind |
| `/multi-agent:doctor`            | Health check of the install: layout, preferences, credentials, hooks, host capabilities; the exit code is the verdict |
| `/multi-agent:health`            | One look at the machine: services, toolkit, install, sessions and today's cost, autopilot, office, disk, the last local gate, errors; `--lang en\|tr` picks the language |
| `/multi-agent:uninstall`         | Remove the pipeline from every CLI. Keychain tokens always left intact         |
| `/multi-agent:serve`             | Local contract server for a client: 127.0.0.1 only, token, stops when idle     |
| `/multi-agent:help`              | This catalog, in the terminal, in your `outputLanguage`                        |

### Subagents

Ten are installed alongside the commands: `explorer` and `task-clarifier` (Phase 0-1), `ios-architect` / `android-architect` / `backend-architect` and `plan-critic` (Phase 1, the critic only with the quality gates active), `dev-critic` (end of Phase 2), `code-reviewer` and `security-auditor` (Phase 3), and `bulk-reader`, which `bulk-read.sh` dispatches to summarise one large file when a whole-file read is blocked.

### Skills that are not commands

Two compliance skills install on every host and back the store gates: `apple-archive-compliance` (18-rule Apple review scan with ITMS code mapping) and `google-play-compliance` (21-rule Play policy catalog with Console error codes). Everything else stack-shaped - SwiftUI, Compose, backend, frontend - comes from the marketplace plugins described below.

## Continuous mode

Everything above starts when you start it. Continuous mode is the same pipeline
picking work up on its own, on ONE machine you choose, from repos you choose.

| Command                         | What it does                                                                                                                                                            |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/multi-agent:autopilot-on`     | Pick the repos this machine watches. Labelled GitHub issues and assigned + labelled Jira items then run in a worktree and stop at a draft PR. Re-run to change the list |
| `/multi-agent:autopilot-status` | What is running and at which phase, what is queued, what is waiting for an answer, the PRs of the last day, and the rolling spend                                       |
| `/multi-agent:autopilot-off`    | Remove the schedule. Work already running finishes; the repo selection is kept. `--now` also stops the item in flight, after naming it and asking                      |

**Analysis queues separately.** `/multi-agent:analysis` has an unattended queue of its own on its own tracker labels, so a repository can take analysis work without taking development work and the reverse. The labels are per repository - `analysisGithubLabel` and `analysisJiraLabel`, both defaulting to `agent-analysis` - and a configuration that gives an analysis label the same value as the development label is refused with both fields named, because one item would otherwise be picked up by both queues. An analysis item runs the analysis command against the item itself and ends at the document: the terminal outcome is `doc-delivered`, and an analysis item never opens a pull request. The per-repo Jira search for it is by label, so a repository with a custom development JQL still picks analysis work up.

### Autopilot (unattended)

The runner is a launchd tick. Each tick takes the head of the queue, runs the
whole pipeline on it in a worktree with `MULTI_AGENT_UNATTENDED=1` set, and
ends at a **draft** pull request. A person reviews it and merges it; nothing in
the pipeline merges.

- **Research before asking.** A run that parks on a maturity blocker or an open analysis question gets a research pass before it is left for a person. `/multi-agent:research <id> --autonomous` reads the tracker thread, linked items and documents, similar closed items and the repository; `research-gate.mjs` closes only what a quoted source or a resolving `file:line` backs, and the maturity check or the open-questions gate re-runs on the result and decides. Whatever is still open parks the run with the candidates found. [Research](./pipeline/multi-agent-refs/features/research.md)
- **One outward writer.** The session never pushes. Phase 4 writes a PR request, and the runner, outside the session, re-runs the stack's build and tests itself, re-checks the gate ledger, the secret scan over the commit range and the outbound gate, pushes the branch the run recorded from a clean staging repository, and opens the PR with `gh pr create --draft`. A check that fails leaves the item `verification-failed` with the verdict on disk. On Bitbucket the branch is pushed and a summary written, since there is no draft PR to open. [Unattended security](./pipeline/multi-agent-refs/features/unattended-security.md)
- **Operations around a run.** A second launchd agent keeps the Mac awake while the mode is on (`caffeinate -s -i`, plus `-d` if you answer yes to the display question at `autopilot-on`), and each run holds a sleep lock until its tick ends. Every credential a configured repo needs is probed before the schedule is offered and again on every tick, so a locked keychain refuses with the key and the fix. A circuit breaker stops launching after consecutive attempts that produced nothing, `costCeilingUsd` caps spend over a rolling 24 hours, `maxParallelAgents` caps sessions working at once, and once a day the runner writes a cleanup report and, when enabled, a digest. [Autopilot operations](./pipeline/multi-agent-refs/features/autopilot-operations.md)
- **A fail-closed guard.** Under the variable, the Bash guard judges a command only when it reduces to simple commands joined by `;`, `&&`, `||` and plain pipes, and refuses anything else unparsed. On what it can parse: no push, PR, issue or tracker write, no Keychain read, no fetch outside the network allowlist, no package install or manifest edit, no write into a protected path. Ticket, page and PR text reaches the model inside untrusted-data delimiters. The permission profile (`install --unattended`) is a second line; the boundary is a separate non-admin macOS user and GitHub rulesets on the default and release branches, which the operator applies. [Unattended security](./pipeline/multi-agent-refs/features/unattended-security.md)
- **Claims are checked, not trusted.** With the quality gates active, a run's claims about the repository are checked before it commits: a localization key or endpoint the change references exists, open analysis questions are answered or park the run, a triage citation quotes the line it cites, a "pre-existing" finding points at a line the diff did not touch, the plan's steps are covered, and a test pass shows a positive executed count read with the stack's own markers (8 stacks: `ios`, `android`, `web`, `backend-node`, `python`, `go`, `rust`, `jvm`) along with a new test that fails without the change. Every verdict goes to a gate ledger, and the commit hook refuses a commit whose required gates did not pass for HEAD. [Unattended gates](./pipeline/multi-agent-refs/features/unattended-gates.md), [stack adapters](./pipeline/multi-agent-refs/features/stack-adapters.md)
- **Spec, plan and review discipline.** `/multi-agent:analysis` writes a project constitution (security, accessibility, architecture and licensing rules, each tied to a source), and a spec-consistency gate checks by id that every requirement has a task and a test and that nothing waives a binding rule. Phase 1 ends with one plan-critic round under six lenses (scope, feasibility, security, a cheaper alternative, an unstated input, a decision left to the implementer), answered once and judged by a script. In review, a `blocking` finding stops the run only when two independent reviewers carry it or a failing test shows it; otherwise it is lowered to `important`, never dropped. [Constitution](./pipeline/multi-agent-refs/features/constitution.md), [plan critic](./pipeline/multi-agent-refs/features/plan-critic.md), [review decision](./pipeline/multi-agent-refs/features/review-decision.md)
- **A client contract.** Commands and run questions are declared as data. `/multi-agent:serve` starts a localhost HTTP server over the same JSON the CLI prints, and `pipeline/contract/` ships the manifest, TypeScript types and fixtures a client builds against. The server listens on 127.0.0.1 only. [Client kit](./pipeline/contract/README.md)

**Attended use is unchanged.** Every behaviour above keys on
`MULTI_AGENT_UNATTENDED=1` or on autopilot mode. With neither, no gate writes a
ledger entry or parks a run, and the guard answers as it did before; a smoke
suite holds each direction. The full contract, entry point by entry point:
[unattended-contract.md](./pipeline/multi-agent-refs/unattended-contract.md).

**Nothing is on by default and nothing is added implicitly.** Installing the
package writes no state and schedules nothing; `smoke-autopilot-default-off.sh`
fails the build if that ever changes. A label is a filter, not a gate - anyone
who can open an issue in a repo you have push on could add one - so the gate is
the picker, and it is per machine.

The biggest win is not parallelism. Measured here, the median run is 44 minutes,
but an item that finishes at 14:00 waits until you sit down again: overnight that
is 16 hours against 40 minutes. Continuous mode removes the waiting, not the work.

**What it will not do.** It does not merge - the runner stops at a draft PR and
the decision stays yours. It does not touch an attended run: per-repo concurrency
is always 1, so the queue steps around a repo you are working in rather than
competing for `.git/index.lock`. There is no cap on PRs; the bounds are
`costCeilingUsd` over a rolling 24 hours, `maxParallelAgents` when you set it,
and what the machine can hold.

**A menu bar indicator**, when `swiftc` is present, draws the same `status.json`
in the top right and refreshes on its own: one row per item with its id, the
phase as a fraction, the elapsed time and the stack. A row disappears the moment
the item finishes and reappears under Reports with its PR. It only draws - it
cannot start, stop or change a run, and the one command it names is spelled the
way your CLI spells it. Its labels render in `prefs.global.outputLanguage`, from
the same table the terminal renders from. ActivityKit is unavailable on macOS,
so this is an `NSStatusItem`, built from source on demand rather than shipped as
a binary that would need signing.

**It survives a restart with no command to run.** launchd loads the job at
**login**, not at boot, and that is correct rather than a limitation: the login
keychain is what unlocks the tokens, so a tick that fired before login could not
reach Jira or GitHub anyway. There is no `autopilot-resume` - a command you have
to remember is a queue that silently stops when you forget it. `doctor` reports
the real failure instead: configured, but launchd holds no job.

**Sleep.** launchd's interval does not wake a sleeping Mac, so while the mode is
on the awake agent holds system sleep off on AC and idle sleep off on battery
too. A laptop left unplugged with the mode on stays awake until it is plugged in
or the mode is turned off; `awake.enabled: false` removes the agent and leaves
only the per-run lock, which macOS honours on AC only.

**The three commands ship to all three CLIs and behave identically there** (the local-model host does not offer continuous mode), because
what they control is not a CLI feature: it is a launchd user agent whose tick
spawns a `claude --bg` child regardless of which CLI you typed the command in.
Continuous mode therefore needs the `claude` binary on `PATH` everywhere. The
queue and the repo selection live in `~/.claude/autopilot/` on every host, on
purpose - two CLIs on one machine must read one queue, not two.

## The office

A local web page that shows the pipeline as a pixel office and lets you drive
it. `/multi-agent:office-on` starts the contract server on 127.0.0.1 and opens
the page with a one-time code; the server runs until `/multi-agent:office-off`.

![The company floor: reception, orientation, the open office, kitchen, accounting and the restroom](.github/office/floor.png)

- **Runs come alive.** Agents wait at their desks in the open office and walk
  to a run's room when the run calls their role. Each repository has its own
  floor of Development rooms (`/multi-agent`) and Analysis rooms
  (`/multi-agent:analysis`); a run that touches more repositories opens an
  annex desk on theirs.
- **Two views of the same floor.** A button in the header switches between the
  flat office and a solid one, drawn in WebGL2 with no engine and no model
  files: the same rooms, desks, people and runs, lit by day or by night, inside
  the block and the streets around it. Both views are built on one floor model
  (`office-src/floor-model.js`), so they agree on every name, every tooltip and
  what a click does, and nobody moves when you switch. A browser without WebGL2
  stays on the flat view and says so.
- **The native task widget, on the table.** The table sign shows the phase
  (`Phase 3/6 Dev`), a bar that fills as that phase's tasks finish and the
  task in progress. A PostToolUse hook copies `TaskCreate` / `TaskUpdate` into
  the run's tracker, so the office and the terminal show the same list. A
  thought cloud over a working agent says what it is doing.
- **The rest of the ecosystem has a room.** Reception starts a run from a Jira
  or GitHub issue or free text. The mail room lists pull requests on every
  GitHub account `gh` is logged in to and on Bitbucket Server. The server room
  holds the toolkit MCP tools, the services, the key cabinet (names and probe
  verdicts, never a value) and the machine's CPU, memory and disk. The library
  holds stacks, commands, the skill catalog and what the pipeline learned per
  repository. The
  restroom clears worktrees, abandoned runs and old run logs after a preview,
  and frees disk space by category.
  Accounting shows tokens and cost, the manager's office holds autopilot,
  routines and the settings (output language, the fable rung, model routing),
  and the orientation room explains the building.
- **The server room's control panel.** Every Claude Code session with its
  work and spend, today's totals per model, and health lights for doctor,
  hooks, the toolkit, the last local gate, run errors and autopilot; the rack
  sums them.
- **The memory archive.** The archive room shows what the learning loop holds
  per repository: decisions with their rationale, security notes, learnings,
  and the code graph report's hubs, clusters and questions. It is local and
  never leaves this machine.
- **The skill catalog.** The library's card catalog (also a button in the
  commands window) lists every `/multi-agent` command, marketplace plugin
  skill and saved routine in one place: search by name, invoke name or
  description, filter by kind and source, and pick a repository to see which
  plugin skills are on there. A command card keeps the commands window's
  button. It reads `GET /v1/skills`, which is local-only, since it names the
  routines kept on this machine.
- **Disk space in the restroom.** The cleanup window measures what the disk
  cleaner can free, category by category: the size, the largest items, why
  items were kept, the reclaimable total and the free space expected
  afterwards. Tick categories, read the preview and confirm; only those are
  deleted. The Trash and old transcripts start unticked with a warning, and a
  server started unattended only measures. It runs `POST /v1/disk-clean`,
  which is local-only, since it shows real paths.
- **Install the page as an app.** The page carries a web app manifest, so it
  can be added to the Dock (Safari: File, Add to Dock). It opens `/office` and
  works while the server runs.
- **People take jobs.** Click one, pick a job, confirm. Writes that change the
  machine are local-only and take two requests. Work that is interactive or
  changes the installation stays in the terminal, and the commands window says
  why for each command.

![Repository floors with Development and Analysis rooms, a live analysis and an annex desk](.github/office/rooms.png)

| Command                      | What it does                                                    |
| ---------------------------- | --------------------------------------------------------------- |
| `/multi-agent:office-on`     | Start or reuse the server and open the page                     |
| `/multi-agent:office-status` | Whether it runs, its URL (never the token) and its last actions |
| `/multi-agent:office-off`    | Stop the server; it runs until you do                           |

Security model: [office threat model](pipeline/multi-agent-refs/features/office-threat-model.md).
The office itself is local to this machine and opens no port to the network. Phone control is a separate, opt-in feature described below.

### Remote control from a phone (optional, off by default)

`/multi-agent:pair` pairs a phone so you can list runs, read a run's pending
question, answer it with one of its offered options and stop a run's session
from the phone. Nothing runs until the site enables it for your account and a
phone is paired; no port is opened, the computer only polls the site over
HTTPS, and every request is re-verified here against a passkey pinned at
pairing. What leaves the machine and what the site can and cannot do:
[remote control](pipeline/multi-agent-refs/features/remote-control.md).

## Which model answers

The ladder is `fable -> opus -> sonnet -> haiku`, and a run walks it on failure.
Routing lets a policy pick the rung instead, per call site, and is off until you
turn it on.

| Command                     | What it does                                                                                                                                        |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `/multi-agent:route-on`     | Pick a strategy, a scope and the rules that say which rung a call lands on; `--free` sends simple text work to verified free models first. Validated against `route-config.schema.json` before anything is written |
| `/multi-agent:route-off`    | Disarm it. The rules are KEPT, so turning it back on does not re-ask for the same configuration                                                     |
| `/multi-agent:route-status` | Whether it is armed, which rule applies where, which rung the last dispatches took, and what this run has cost                                      |
| `/multi-agent:fable-on`     | Put the top rung in play, and move the cost ledger's pricing to `fable` in the same write                                                           |
| `/multi-agent:fable-off`    | Take it out of play, move the pricing to `opus` in the same write, and print what that does to the review panel                                     |
| `/multi-agent:fable-status` | Whether the rung is on, the pricing model, and what the switch means on this host                                                                   |

**The scope cannot be the whole session.** `scope` accepts `subagent`,
`bulk-read`, `delegate` and `research`; there is no `host-session` value and that
is a schema gate, not a convention. Owning the host's base URL would send every
call you make through a third layer, including work that has nothing to do with
this pipeline.

**Free models for simple work: `route-on --free`.** Large-file reads, log and
document summaries, field extraction, labels and translation or commit-body
drafts go to the multi-agent-mcp's free-model chain first (Groq, Mistral,
Gemini, OpenRouter free models, Z.AI GLM Flash, a local Ollama). Every answer is
verified against its source before it is used - no truncation or refusal, schema
and label checks, every identifier, number and file name present in the source -
and when none passes, Claude does the task as before. By default only providers
that do not train on prompts see the text; `--allow-training` widens that. One
free Groq key is enough; `route-status` reports what was answered free, what went
back to Claude and the tokens kept off Claude. Contract:
[`free-models.md`](pipeline/multi-agent-refs/features/free-models.md).

**The honest limit, which `route-status` prints rather than hides.** A subagent
is dispatched by the host, so Phase 1-3 personas stay on the ladder that host
offers whatever the rules say: a rung the running host does not carry, or whose
model belongs to a provider it does not dispatch, is skipped and the next rung
in the rule answers. The `free` rung answers only where the pipeline makes the
call itself, `bulk-read.sh` and the `delegate` call site, and decisions, plans,
code, reviews and triage stay with the host's own models.

### Where it runs: the host registry

Every host is one record in `pipeline/schemas/hosts.json`, validated by `hosts.schema.json`, and that record is the only place a host differs. It names the install flag and root, the subtrees installed under it, where its sub-command specs live and what prefixes them, the path rewrites that turn one authored tree into that host's shape, the model rung table, the review panel and the triage slot, how a child is handed its model, the price ceiling the cost ledger prices a run at, and the argv for a headless call. `lib/host.mjs` and `lib/host.sh` read it, `lib/model-resolve.mjs` resolves a rung through it, `lib/reviewer-families.mjs` takes the panel from it, and `scripts/gen-host-tables.mjs` renders the dispatch and panel tables in the reference documents from it, so a table and the registry cannot drift apart. Adding a host is a record, not a branch in each consumer.

| Host | Install flag and root | Model rungs | Review panel | Children at once | Network |
| ---- | --------------------- | ----------- | ------------ | ---------------- | ------- |
| Claude Code | `--claude`, `~/.claude` | fable, opus, sonnet, haiku | three in parallel, one vendor | no stated ceiling | required |
| Copilot CLI | `--copilot`, `~/.copilot` | opus, sonnet, haiku | three in parallel, two vendors | no stated ceiling | required |
| Codex CLI | `--codex`, `~/.codex` | four rungs, each a model and a reasoning effort | three in parallel, one vendor | 3 | required |
| Local LLM | `--local`, `~/.codex-local` | all four collapse to the one model you serve | one reviewer, triage on the same model | 1 | optional |

### A model served from your own machine

`install --local` is the Codex engine pointed at a model on this machine, installed into a tree of its own so it cannot retune an existing Codex install. It is not "any OpenAI-compatible server": the engine speaks the OpenAI **Responses** API and no other, so the server has to answer `POST /v1/responses`. Ollama serves that endpoint from v0.13.3 and the engine asks for v0.13.4 or newer; whether another local server qualifies is a question about which endpoint that server offers, and LM Studio and generic servers have not been measured here.

Two values are yours and live in preferences, validated before either reaches a config or an agent file: `global.localModel.baseUrl` (loopback unless you set `allowRemote`, because the base URL is where every prompt in a run goes), `global.localModel.model`, and `global.localModel.contextWindow`, which is required rather than guessed - a window set too small truncates the diff and the run then reports on a file it never saw. `/multi-agent:doctor` carries a `local-model` check that reads them, and with `--probe` asks the server whether it answers.

The profile claims the pipeline runs, not that it runs as well: one reviewer instead of three is less disagreement to triage, and a smaller model reads a diff less carefully. Autopilot is not offered on it. Price is zero per token and the ledger still counts tokens, so a run stays comparable with one that cost money. The gate `smoke-local-host.sh` covers the registry shape, the preference refusals, an install that keeps to its own tree and the agent binding with and without a configured model; no model is started there, and no end-to-end run against a real local model has been recorded. [Local LLM host](./pipeline/multi-agent-refs/features/local-model.md)

**The top rung is a switch.** `/multi-agent:fable-on` and `/multi-agent:fable-off` turn `fable` on and off
(`prefs.global.modelFallback.fableEnabled`, shipped off). The review commands,
triage and the plan critic resolve their slots through it: on Claude Code,
`/multi-agent:review` runs Fable + Opus + Sonnet while it is on and Opus + Sonnet
while it is off.

## Stacks

Stack skills ship as versioned plugins in the [`multi-agent-ecosystem/multi-agent-plugins`](https://github.com/multi-agent-ecosystem/multi-agent-plugins) marketplace. Select a stack per-repo:

```bash
/multi-agent:stack ios        # or android / frontend / backend / mobile / all
```

This enables the matching plugin (+ the shared `ai-common` plugin) in the repo's `.claude/settings.json`. Phase 1 auto-detects the stack for routing. New repos default to iOS.

## Tool support

The pipeline runs natively on **Claude Code**, **Copilot CLI**, **Codex CLI** and the **local-model host** - every one installs from the same `pipeline/` source and gets the same <!-- fact:commandCount -->82<!-- /fact --> commands. Which host you are on is a record in `pipeline/schemas/hosts.json`, not a branch in each installer.

| Tool        | Flag                 | What it installs                                                                                       |
| ----------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Claude Code | `--claude` (default) | slash commands + skills + agents + the enforcement hooks (secret scan, agent-guard, read-size gate, run-scope guard, run-stop guard) |
| Copilot CLI | `--copilot`          | instructions + <!-- fact:commandCount -->82<!-- /fact --> sub-command skills + scripts + its own `multi-agent-refs` tree                                                                                                       |
| Codex CLI   | `--codex`            | one router skill + <!-- fact:commandCount -->82<!-- /fact --> specs as refs + a `/multi-agent-<name>` prompt per user-only command + <!-- fact:agentCount -->11<!-- /fact --> agent TOML + `AGENTS.md` block + `codex mcp add` |
| Local LLM | `--local`            | the same as Codex CLI, in `~/.codex-local/`, bound to a model served from this machine ([local LLM](pipeline/multi-agent-refs/features/local-model.md))                                                                      |

Filter skills by stack with `--platform=ios\|android\|all`.

**Why Codex gets one skill and not <!-- fact:commandCount -->82<!-- /fact -->.** Codex assembles every discovered skill's name
and description into a single prompt block and drops entries when it overflows, with no
error. Measured on 0.145: installing one plugin that declares 142 skills surfaced only
75 of them and evicted an unrelated user skill. So on Codex the pipeline ships a single
`multi-agent` router and keeps the sub-command specs as reference files that cost
nothing until read - same commands, same behaviour, a layout the host can actually hold.

Reviewer sets differ because the available models do: Claude Code runs 3 reviewers
(Fable + Opus + Sonnet; 2 while the fable rung is off), Copilot CLI 3 (Opus + GPT-5.4 + Sonnet), Codex CLI 3 (gpt-5.6 at
xhigh, gpt-5.4, gpt-5.6 at medium), and the local-model host 1, with triage on the same
model - a panel of one is the honest limit of running on a single local model, not a
configuration choice. Claude Code and Codex are single-vendor panels, so
consensus among their three is weaker evidence than the same consensus on Copilot CLI,
the one host whose panel spans two vendors, and the triage note says so.

## Tokens & integrations

`setup` scans your OS keychain and records each credential as a **service account**: one entry that carries the service, the host the credential may be sent to, and the credential-store item **names** that hold it (`prefs.global.serviceAccounts`). Literal keychain names never appear in synced files, and no value is ever written to preferences. Tokens stay in the macOS Keychain, are **never committed or logged**, and are all **optional** - the pipeline asks for any it needs at Phase 0.

`pipeline/lib/service-account.mjs` is the only module that decides a destination, and two rules shape it. **A secret is never produced without a destination that was checked against the account holding it**: a request naming no host is refused rather than answered from the default account, and a host no account covers is refused rather than matched to the nearest one. **A file with no `serviceAccounts` in it resolves identically**, because the same entries are derived in memory from the flat keys - a missing array is the old shape, read the new way, not a refusal.

The host is matched **exactly**: a subdomain of a configured host, a name that merely ends in one, and userinfo in the URL are refused rather than allowed, and `http` is accepted only at loopback, where there is no network to carry the request. A credential supplied through an environment variable is answered too - a CI job, a container and a first run before setup all supply one that way - but it is bound differently, because nobody said which host it belongs to: it reaches a host a configured account already covers, the vendor's own hosts, whatever its own `*_HOST` variable names, and loopback, and nothing else. It never wins a destination a configured account also covers, and it never becomes the default. Shell callers go through `pipeline/lib/_service-account.sh`, which hands curl a config carrying the URL and the credential together and refuses redirects, so nothing can point the request elsewhere between the check and the send; the credential reaches neither argv, an environment variable, nor a log. One account per service is a complete setup; two accounts of the same service are told apart by the host, the identity or the account id. [Service accounts](./pipeline/multi-agent-refs/features/service-accounts.md)

| Token                 | Used for                                                         | Phase                   |
| --------------------- | ---------------------------------------------------------------- | ----------------------- |
| `jira`                | fetch the issue · post the report comment                        | 0, 5                    |
| `github`              | issues · PRs · `gh` auth                                         | 0, 4                    |
| `bitbucket`           | PR create/update (reviewer-preserving) · diff                    | 4                       |
| `confluence`          | publish analysis / wiki pages                                    | 5                       |
| `figma` + `figma_mcp` | fetch design context                                             | analysis only           |
| `fortify`             | security-scan findings gate                                      | 2                       |
| `firebase`            | Firebase service-account JSON for Firebase projects              | as needed               |
| `jenkins`             | CI trigger / status                                              | build / deploy          |
| `npm`                 | package publish (mostly CI)                                      | release                 |
| `appstore_connect_*`  | TestFlight / App Store pre-submission validation (optional, iOS) | `testflight-validation` |

The **secret scan** runs as a `PreToolUse` hook on Claude Code (hard-blocks a commit on a hit) and as a pre-push check elsewhere.

**Hooks per host.** The enforcement hooks are Claude Code's; `install` registers them and `/multi-agent:doctor` (`hook-reachability`) says which are missing from your settings.

| Hook | Claude Code | Codex CLI | Copilot CLI |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------- | ---------------------------------------------------- |
| `pre-commit-check.sh` (secret scan, owned paths, attended build/test evidence, unattended ledger) | PreToolUse `Bash` | none: pre-push check | none: pre-push check |
| `agent-guard.sh` (attribution, force-push, skipped git hooks, argv secrets, closure confirmations, read-only repos, your own `guardRules`, unattended policy) | PreToolUse `Bash`, file edits, fetch and toolkit tools | none | none |
| `pr-write-guard.sh` (asks before `/multi-agent:address-review` writes to GitHub, denies it unattended) | PreToolUse `Bash` | none: the engine's own propose/apply token stands alone | none |
| `run-scope-guard.sh` (Figma phase rule, worktree boundary warning) | PreToolUse Figma tools, file edits | none: the phase records its own MCP calls | none |
| `run-stop-guard.sh` (no silent stop mid-run) | Stop | none: halts stay the phase's own write | none |
| `task-mirror.sh` (native task list into the run tracker, so the office shows it) | PostToolUse `TaskCreate`/`TaskUpdate` | none: the phase calls `phase-tracker.sh task` itself | none: the phase calls `phase-tracker.sh task` itself |
| `session-brief.sh` (opt-in, `sessionBrief.enabled`: a cached index of the repo's learnings ledger with a pointer per line and one code-graph line, about 350 tokens per session and again after each compaction; nothing for a repo with neither; silent when unattended) | SessionStart | none | none |
| `file-context.sh` (what the repo's memory says about a file, when it is read or searched, fitted to the 10,000-character hook output limit) | PreToolUse `Read`/`Grep`/`Glob`, PostToolUse `Read` | none | none |
| `graph-hint.sh` (points a whole-repo identifier search at a current code graph, once per session) | PreToolUse `Grep`/`Glob` | none | none |
| `note-agent-event.sh` (a subagent's outcome or a failed tool call, into the session notes) | SubagentStop, PostToolUseFailure | none | none |
| `answer-check.sh` (an AskUserQuestion submitted without a choice is asked again, not defaulted) | PostToolUse `AskUserQuestion` | none | none |
| `note-skill-use.sh` (skill name, outcome, time, host and repo folder name into a local log, so unused skills can be pruned on evidence; never arguments, prompts or output) | PostToolUse / PostToolUseFailure `Skill` | none: Codex reads skill files, no tool call to hook | none: no Copilot hooks are installed |
| `note-mcp-failure.sh` (server, tool, time and a closed error class of a failed MCP call into a local log, read by doctor's `mcp-failures` check; never arguments, output or error text) | PostToolUseFailure `mcp__.*` | none | none: no Copilot hooks are installed |
| `edit-syntax-gate.sh` | PostToolUse file edits | PostToolUse `apply_patch` | none: Copilot discards postToolUse output |
| `check-read-size.sh`, capture hooks | registered | none | none |

Where a host has no equivalent hook the rule is still in the phase documents; it is a request there, not enforcement.

**Your own guard rules.** `prefs.global.guardRules` adds rules to `agent-guard.sh`: each names a tool (`Bash`, `Edit`, `Write`, `Read` or a toolkit tool glob), a regex and an action (`warn`, `ask` or `block`). A rule can only make the guard stricter, never allow what it refuses, and unattended an `ask` is a `block`. Messages name the rule id and reason, never the matched text, and `/multi-agent:doctor` (`guard-rules`) reports an invalid rule and one whose tool the guard is not registered on, such as `Read` under the default hooks, warns when the preferences file does not parse (unattended, that refuses every call a rule could govern when the file names `guardRules`), and names a rule whose pattern has a slow shape, which still runs under a 1-second matching budget. [Unattended security](./pipeline/multi-agent-refs/features/unattended-security.md#user-guard-rules)

## Outside a pipeline run

Installing the pipeline is not only useful when you run it. Open an ordinary session and the same three things are available, announced by `rules/outside-the-pipeline.md` which loads with every conversation:

- **Services you already onboarded.** The token `setup` mapped is readable now - resolve the logical name through `credential-store.sh` and fetch the issue, the page, the log. **Reads are ordinary work; writes are not.** Posting a Jira comment, editing an issue or opening a PR goes through the pipeline commands, because the rules that make those safe (never auto-close, `Ref:` not `Closes:`, humanizer on outward prose) live there.
- **The stack skills `/multi-agent:stack` enabled for the repo.** Each toolkit's own `index` skill routes; the pipeline keeps no copy of that table.
- **The `multi-agent` MCP.** <!-- fact:toolCount -->272<!-- /fact --> tools, most of them for a running app - screen state, crash logs, design comparison, store pre-submission, web scraping and browser test states. Several measure instead of judging by eye: WCAG contrast (`design_contrast_check`), layout shift across themes or a mirrored locale (`ios_visual_diff` with `mode: "layout"`), store listing limits (`store_listing_lint`), review themes with verbatim quotes (`store_review_themes`) and whether security findings cite real lines (`security_evidence_check`, with `security_sarif_export` for code-scanning views). The learnings ledger and the code graph are readable through it too (`learnings_*`, `graph_*`).

Uninstall preserves this layer: the tokens, the reader that opens them, the mapping that names them, and the MCP registration. Removing the pipeline should not cost you the credentials you onboarded through it.

## Usage reporting

A run reports coarse metadata to the maintainer's site so a failing install can be diagnosed from its record. Every field is one of four things: a number or a boolean, a value from a closed list shipped inside the package (commands, skills, tools, models, modes, halt codes), a keyed digest (run, repository and machine identifiers, which the site cannot turn back into names), or the documented subject (the GitHub login used for access, and feedback text you write yourself). Names that are not on a shipped list go out as `other` or `private`.

Never sent, outside the two opt-in fields below (a pull request address names its repository): prompts, code, diffs, file paths, repository names, ticket keys, titles, token values. Two fields are opt-in and reduced before they leave: a title becomes a word count, a ticket-shape flag and a language code, and a pull request address is kept only for the four public code hosts.

`usageLog.optOut: true` turns reporting off before any network call or credential read. Two things still run: the access check, which sends the login and the version and nothing else, and feedback you send on purpose. `/multi-agent:doctor` shows the outcome of the last send. The full field table is in `pipeline/multi-agent-refs/features/usage-reporting.md`.

## Platform support

Runs on **macOS** only. The package declares `os: ["darwin"]`, so `npm` refuses to install it elsewhere rather than letting a run fail halfway through: every credential read shells `security`, every iOS build `xcodebuild`, every piece of visual evidence `simctl`. Node.js 20.11+ (tested on 20 and 22). Reasoning: [ADR-0012](docs/adr/0012-macos-only.md).

## Companion repos

| Repo                                                                                          | What it is                                                                                                                                                                                                                                                                                                                                             |
| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`multi-agent-ecosystem/multi-agent-plugins`](https://github.com/multi-agent-ecosystem/multi-agent-plugins)         | Marketplace of per-stack skill toolkits (iOS / Android / Frontend / Backend + common). `/multi-agent:stack` enables the matching plugin.                                                                                                                                                                                                               |
| [`multi-agent-ecosystem/multi-agent-mcp`](https://github.com/multi-agent-ecosystem/multi-agent-mcp) | MCP server for device, browser, store and code tools - powers `/multi-agent:test` and the Review phase's device checks; every family by stack and phase is in [`toolkit-tools.md`](pipeline/multi-agent-refs/toolkit-tools.md). Published on the public npm registry as [`@mmerterden/multi-agent-mcp`](https://www.npmjs.com/package/@mmerterden/multi-agent-mcp); the installer registers it with each CLI for you, so `npx` resolves it with no extra configuration. |

## License

MIT - see [LICENSE](./LICENSE). Security issues: see [SECURITY.md](./SECURITY.md) (do not open public issues for vulnerabilities).
