# Agent — Migration status

Read `_shared.md` first.

## Goal

Summarize per-assembly migration health: total, applied, pending, branch-only
count, and whether the snapshot is dirty. Never mutate.

## Steps

1. Invoke the CLI:

   ```bash
   npx --prefer-offline tsx skills/efcore/cli/status/index.ts --spec '{"cwd":"<WORKTREE>"}'
   ```

2. Note `branchType` + `baseBranch` — the reference branch is chosen by branch
   type (feature→develop, release/hotfix/develop→main), so `branchOnly` reflects
   what is genuinely unique to this branch. Also note:
   - `baseResolved: false` — the reference ref is missing (not fetched);
     `branchOnly` is reported empty on purpose. Advise `git fetch origin <base>`.
   - `behindBase > 0` — the branch is behind its reference; a squash is unsafe
     until synced (see decisions).

3. For each assembly reported:
   - Show counts (`total` / `applied` / `pending`).
   - List `branchOnly` migrations (files present on the current branch that are
     absent on the reference branch — i.e. NOT yet in the merge target).
   - Flag `snapshotDirty: true` — the user has unstaged snapshot changes.

## Decisions

- If `behindBase > 0`, recommend syncing first (`/gitflow sync`) and do **not**
  recommend a squash — squashing while behind can drop reference migrations.
- If any assembly has `pending > 0`, recommend `agents/db-update.md`.
- If `branchOnly.length >= 2` **and** `behindBase === 0`, recommend
  `agents/squash.md` before merging (it consolidates only the branch-only set;
  reference-branch migrations are preserved).
- If `snapshotDirty` and no migration is in flight, warn: the snapshot
  shouldn't change without a matching migration file.

## What NOT to do

- Never fix snapshot drift silently — always route to `rebase-snapshot` or
  `squash` agents for that.
