---
description: "Standalone feature-spec analysis. Two profiles picked at intake: global (23-section development handoff, evidence-trimmed) or corporate (IG/UC/FG requirements document with traceability matrices). Platform-agnostic concept layer with repo-driven convention extraction (Phase 1c) and per-platform Pass B render; stack selection is optional. Collects Figma / Swagger / Confluence / Jira / Standards (Confluence + Wiki + local file) / Firebase / repo inputs. Stops after emit - does not chain into a dev run. Use when a feature needs a written specification before any code."
description-tr: "Bağımsız özellik-spesifikasyonu analizi. Girişte iki profil: global (23 bölümlük geliştirme dokümanı, kanıta göre budanır) veya kurumsal (izlenebilirlik matrisleriyle IG/UC/FG gereksinim dokümanı). Repo'dan konvansiyon çıkarımıyla (Faz 1c) platform-bağımsız kavram katmanı ve platform başına Pass B render; stack seçimi opsiyonel. Figma / Swagger / Confluence / Jira / Standartlar (Confluence + Wiki + yerel dosya) / Firebase / repo girdilerini toplar. Çıktıyı üretince durur - dev koşusuna zincirlenmez."
argument-hint: "[nothing, and it asks | \"<analysis-name>\" | check <doc.md> | refresh <doc.md> | conform <doc.md>] [--no-cache] [--preview-conventions]"
parameters: [{"name":"name","kind":"text"},{"name":"--no-cache","kind":"flag"},{"name":"--preview-conventions","kind":"flag"}]
gui: form
destructive: false
confirm: none
---

# multi-agent analysis - Feature Spec Analysis (v3)

**Access check, before anything else.** This command can write outside this machine, so a login the site closed is stopped here, before any question or write.

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

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

> **Pickers follow** `$HOME/.claude/multi-agent-refs/picker-contract.md`: never a one-option call; branch on the option selected, not its text. **Background runs** (`MULTI_AGENT_UNATTENDED=1`, no `autopilot`): never ask or default a picker; write `agent-state.json`, park on the question, stop (contract, Background).

Platform-agnostic *development* analysis before any code; not a screen spec. **Side-effect contract**: may write a local markdown file, post a Confluence page, or update a Jira description - but **never** creates branches, worktrees, commits, or PRs. It stops at the document. Prose stays English; `AskUserQuestion` text and the document body follow `outputLanguage`, `header` stays English (`$HOME/.claude/multi-agent-refs/rules.md` Language Application).

Before Phase 0 read `$HOME/.claude/multi-agent-refs/features/analysis-command-notes.md`: scope, the two profiles and templates, stack-optional output, file naming, source-handling notes.

## Gotchas

- Design is fetched only inside this command (Locked 29). A variant missing from the document is added by re-running analysis, never by a later phase.
- `status: final` fails the validator while any `AS-NN` is still open; publish drafts as `draft`.

## Locked decisions (do not re-ask)

Never surface them as questions, re-derive them or invite an override mid-run. The list of 37 is in `$HOME/.claude/multi-agent-refs/analysis/locked.md`; read it before the run starts, it is the contract the flow is judged against (`/multi-agent:analysis-resolve` inherits it). Cite as `Locked <n> (<short label>)`.

## Input

`$ARGUMENTS`: optional analysis name, else asked at Phase 0. `check|refresh <doc.md>`: follow `$HOME/.claude/multi-agent-refs/features/analysis-sources.md` instead. `conform <doc.md>`: follow `$HOME/.claude/multi-agent-refs/features/analysis-outline.md` instead.

`<tracker-ref> autopilot`: the unattended form continuous mode launches for an item carrying the repo's analysis label (`analysisGithubLabel` / `analysisJiraLabel`). The reference is the item itself - a Jira key or `owner/repo#N` - and the side-effect contract above is unchanged: the run stops at the document, which is what the queue records as `doc-delivered`. It is its own declared mode (`phases.json` `modes.analysis-autopilot`): record it as `mode: "analysis"` with `autopilot: true`, ask nothing, and answer every Phase 0 question from evidence or park on it - Phase 0 mounts the derivation contract, and nothing below is taken as a default because nobody answered.

With nothing after the command, read `$HOME/.claude/multi-agent-refs/_entry-picker.md` first: a bare invocation asks which of the four it is, rather than assuming a new analysis and asking only for a name. An unattended run with no argument refuses there and never reaches a question.

## Steps

### Phase 0 - Intake

First, record the run so its hooks see an analysis run: `S="$HOME/.claude/logs/multi-agent/$TASK_ID"; mkdir -p "$S"; printf '{"taskId":"%s","mode":"analysis","status":"in_progress","currentPhase":0}' "$TASK_ID" | node $HOME/.claude/scripts/write-state.mjs "$S/agent-state.json"`. Picker chain: `$HOME/.claude/multi-agent-refs/analysis/intake.md`.

### Phases 1-1c - Evidence

`$HOME/.claude/multi-agent-refs/analysis/evidence.md`. Writes no document.

### Phase 2-2b - Synthesis

`$HOME/.claude/multi-agent-refs/analysis/synthesis.md` (conventions preview, Locked 25; footnote per cell, Locked 24).

### Phases 3-5 - Render, review, publish, report

`$HOME/.claude/multi-agent-refs/analysis/render.md`. The **required** `ai-common-toolkit:humanizer` pass and `validate-analysis-doc.mjs` run in every mode, plus `build-references.mjs --check` (Locked 33); a document that skipped either is not shippable. Jira gets a comment; the description is never overwritten without a backup and a confirmation. Report, then stop.

### Resume

`$HOME/.claude/multi-agent-refs/analysis/resume.md`; state already gathered is never re-fetched. Extra refs: `$HOME/.claude/multi-agent-refs/analysis/reusable-refs.md`.

## Required: Phase Tracker Contract

**The phase tracker is required**  -  the agent cannot skip it. Full spec: [`$HOME/.claude/multi-agent-refs/tracker-contract.md`]($HOME/.claude/multi-agent-refs/tracker-contract.md).

Two channels run in parallel at every phase boundary:

1. **State channel** (every CLI, identical): `phase-tracker.sh` writes to `tracker-state.json`. Drives `:resume`, `:log`, `:status`.
2. **Visual channel** (CLI-specific): native widget on Claude Code, ANSI render on every other CLI. Without it the user sees no phase progress.

```bash
# Phase 0, very first shell call (every CLI):
bash $HOME/.claude/scripts/phase-tracker.sh init "$TASK_ID"
for p in "0:Intake" "1:Evidence" "2:Synthesis" "3:Review" "4:Publish" "5:Report"; do
  bash $HOME/.claude/scripts/phase-tracker.sh add "${p%%:*}" "${p#*:}"
done
bash $HOME/.claude/scripts/phase-tracker.sh update 0 in_progress

# Every phase boundary (every CLI):
bash $HOME/.claude/scripts/phase-tracker.sh update <N> in_progress|completed|failed|skipped

# After every LLM call (every CLI):
bash $HOME/.claude/scripts/phase-tracker.sh tokens <N> <in> <out> [cached]
```

### Visual channel  -  Claude Code (native TaskList widget, required)

In Claude Code the agent MUST also drive the native TaskList widget so the user sees a sticky phase tile stack  -  this is the only progress signal Claude Code surfaces. Register one tile per phase of the active set (`0:Intake 1:Evidence 2:Synthesis 3:Review 4:Publish 5:Report`) with `TaskCreate`, persist each `taskId` via `phase-tracker.sh meta <N> tasklist_id "<taskId>"`, and at every phase entry, sub-step and exit pair a `TaskUpdate` (status or `activeForm`) with the matching `phase-tracker.sh update`. Call pattern: `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "Call pattern". Mirror each with `phase-tracker.sh task` ("Mirroring the host's task list").

`analysis` mode TaskCreates all 6 phases (no phase is skipped).

#### TaskCreate ordering (strict)

**All TaskCreate calls in a batch fire in strict phase-number order BEFORE any TaskUpdate is applied**, and a later batch only ever appends phases numbered above everything already registered. For `analysis` that means: Phase 0 → Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5. The native widget renders by creation order, not by phase number  -  out-of-order calls produce visually scrambled tile stacks (e.g. `1 ✓ · 2 ✓ · 4 ✓ · 0 ▶ · 3 ☐`) even when the underlying state is correct. Pre-marking phases as completed/skipped before Phase 0 starts is FORBIDDEN  -  register the tile in order, then flip status via TaskUpdate when the phase actually short-circuits. Full ordering contract in `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "TaskCreate ordering (strict)".

### Visual channel  -  Copilot CLI / plain shell

These CLIs have no TaskList widget. After every state change the agent calls render, which prints a bordered ANSI card as the last tool result so the user sees an updated phase table:

```bash
bash $HOME/.claude/scripts/phase-tracker.sh render
```

Do NOT call TaskCreate on these CLIs  -  the tool does not exist and the call fails.
