---
name: gmd:migrate-to-sequential
description: Migrate .planning/ from parallel -> sequential organizational mode (asymmetric safety; refuses with >1 In Progress; single migration commit)
argument-hint: "[--dry-run] [--yes]"
allowed-tools:
  - Read
  - Write
  - Bash
---
<objective>
Migrate `.planning/` from parallel to sequential organizational mode. Validates preconditions (clean working tree + parallel source + EXACTLY ONE milestone In Progress — SPEC D6 hard contract, NO override flag). Moves the in-progress milestone's content to .planning/ root; relocates shipped milestone folders to .planning/milestones/_archive/<slug>/; commits as single atomic migration commit.

`--dry-run` flag prints planned operations + exits 10 without executing.

**Reads:** `.planning/config.json`, `.planning/MILESTONES.md`, `.planning/STATE.md`, `.planning/milestones/<in-progress-slug>/`, `.planning/PROJECT.md`.

**Writes (on success):** Single atomic commit moving milestone contents to root + relocating shipped milestone folders to `_archive/` + rewriting PROJECT.md to sequential shape + rewriting MILESTONES.md to retrospective log + flipping config.json + clearing root STATE.md `current_milestone:` field + preserving in-progress MILESTONE.md as `.planning/milestones/_archive/<slug>-MILESTONE-source.md` audit trail.

**Refuses (fail-loud, exit 1):** Dirty working tree / already sequential / >1 milestones In Progress (SPEC D6 — no override) / 0 milestones In Progress (anomalous parallel state).
</objective>

<execution_context>
@C:/Users/Christopher/.claude/workflows/migrate-to-sequential.md
</execution_context>

<context>
No positional argument (sequential direction is parameter-less — the in-progress milestone is auto-resolved via MILESTONES.md `## In Progress` table).

Flags:
- `--dry-run` — print planned operations to stdout, exit `EXIT_DRYRUN=10`, ZERO file moves
- `--yes` — skip confirmation prompt

NO `--force` / `--allow-multi` override flag. Asymmetric safety per SPEC D6 is a hard contract: sequential mode CANNOT represent multiple concurrent milestones; the migration refuses unless source state is reducible to exactly one In-Progress milestone.

Single-commit atomicity contract (REQUIREMENTS line 92 + 68-CONTEXT.md Area 1 MC-A):
- All file moves + `_archive/` relocation + PROJECT.md rewrite + MILESTONES.md rewrite + config flip + STATE.md clear + MILESTONE.md audit-trail preservation land in ONE commit
- Commit subject LOCKED: `migrate(sequential): v1.5.9 .planning/ organization → sequential`
- On mid-step failure: scoped rollback via `git reset --hard HEAD && git clean -fd <touched-paths>` (NOT global)

`_archive/` relocation (SPEC §7 O3, resolved at Phase 68): shipped milestone folders (per `MILESTONES.md ## Shipped` table) move from `milestones/<slug>/` to `milestones/_archive/<slug>/` as part of this single migration commit. Distinct from `/gmd:complete-milestone` (Phase 66-04 CMD-05), which leaves shipped milestones at top-level for `/gmd:list-milestones` consumption.
</context>

<process>
Execute the migrate-to-sequential workflow from @C:/Users/Christopher/.claude/workflows/migrate-to-sequential.md end-to-end.

Preserve all workflow gates:
- Step 0 mode-load
- Step 1 dry-run internal validation (surfaces refusals BEFORE prompts; asymmetric safety check fires here)
- Step 2 planned-operations report display
- Step 3 `[y/N]` confirmation (skip if --yes)
- Step 4 atomic execution via `node bin/gmd-tools.cjs migrate-to-sequential <resolved-flags>`
- Step 5 result report + next-action recommendation

LOCKED refusal messages are emitted by the library (byte-for-byte test-asserted); surface them verbatim, never paraphrase.

ZERO `--no-verify` bypasses. Migration commit lands through the pre-commit hook (TD-07 + HF-02 mirror byte-identity enforcement). If the hook fails, executeMigration throws → scoped rollback restores tree.
</process>
