# Analysis Resume Contract

Loaded on demand by `/multi-agent:analysis` when `/multi-agent:resume` re-enters an analysis run.

`state.analysisSpec.phase` enumeration:

- `intake` (Phase 0 in progress)
- `fetching` (Phase 1 in progress)
- `collecting_repo_evidence` (Phase 1b)
- `extracting_conventions` (Phase 1c)
- `synthesizing_pass_a` (Phase 2 Pass A)
- `awaiting_pass_b_approval` (Phase 2a - preview not yet answered)
- `rendering_pass_b` (Phase 2b)
- `drafting` (Phase 3)
- `awaiting_output_decision` (Phase 3.5 - drafts written, picker not yet answered)
- `dispatching` (Phase 4)
- `reporting` (Phase 5)
- `done`
- `cancelled_at_pass_b_preview` (user cancelled at Phase 2a)

When `/multi-agent:resume` is invoked and `phase == "awaiting_output_decision"`:

1. Check `state.analysisSpec.outputs.draftDir` exists on disk and contains the expected per-platform `.md` files.
2. If present, jump directly to Phase 3.5 (re-prompt the output picker; do not re-fetch evidence, do not re-synthesize).
3. If missing, print `WARN: scratch drafts at <draftDir> are gone; re-running Phase 2 synthesis from fetched evidence.` and restart from Phase 2 (cheap: evidence is still in state).

When `phase == "awaiting_pass_b_approval"`:

1. Re-present the convention preview table (Phase 2a) with the same options.
2. Pass A synthesis results are kept in state; Phase 1b / 1c results are kept too.
3. Approval continues to Phase 2b without re-running anything.

When `phase == "cancelled_at_pass_b_preview"`:

1. Print `state.analysisSpec.outputs.draftDir` (likely empty unless prior drafts exist from a previous run).
2. Show the convention preview that was rejected (for context).
3. Ask whether to restart from Phase 0, retry Phase 1c with fresh evidence, or abort.
