---
name: migrate
description: Detect and apply native Antigravity CLI skills and MCP migrations from other coding agents.
argument-hint: "<detect|apply|doctor> [--json]"
---

# /omagy:migrate

Use this skill to migrate only native skills and MCP server configuration from
other local coding agents into Antigravity CLI's native user configuration.

This command deliberately does not migrate hooks, plugins, commands, agents, or
other host-specific extension systems.

The legacy Antigravity IDE profile is treated as a source only for native
skills and MCP:

```text
~/.gemini/antigravity-ide/global_skills/
~/.gemini/antigravity-ide/mcp_config.json
```

Do not migrate legacy IDE `brain/`, `conversations/`, `annotations/`,
`browser_recordings/`, `code_tracker/`, `knowledge/`, `prompting/`, or protobuf
settings files.

## Commands

```bash
omagy migrate detect --json
omagy migrate apply --input '{"applyToken":"<token-from-detect>"}' --json
omagy migrate doctor --json
```

## Semantics

- `detect` is read-only. Run this first. It reports raw source records and the
  reconciled canonical items that would be written.
- `apply` writes only canonical `applyable` and `mergeable` items. It skips
  `review_required` and `conflict` items, and only runs when given the current
  `applyToken` from `detect`.
- Host-specific skills that depend on another coding agent's runtime contract
  are `not_migratable`, not `review_required`. Examples include skills that
  rely on OMX/Codex `$name` workflows, `.omx/` files, `delegate(...)`,
  `run_in_background`, `ToolSearch`, `ask_codex`, Claude Code paths, or Cursor
  host-specific behavior. Report the reason and require manual adaptation.
- MCP apply may clean old equivalent source aliases when writing one canonical
  server name, but only when the alias points to the same effective command/URL
  configuration.
- If an earlier migration wrote a host-specific skill that is now
  `not_migratable`, `apply` may remove that skill only when its
  `.omagy-migration.json` proves it was migration-managed and the current
  `SKILL.md` content has not been user-edited.
- `doctor` verifies the migration surface and reports readiness.
- A single conflict must not block unrelated safe migrations.
- Do not use `--yes`, `--force`, or overwrite unmanaged Antigravity user config.
- Bare `/omagy:migrate` and bare `omagy migrate apply` must not write anything.

## Status Meanings

- `ready`: all canonical items can be safely applied.
- `partial`: some items need review or conflict, but safe canonical items can
  still be applied.
- `blocked`: no safe canonical items can be applied.
- `empty`: no migratable skills or MCP servers were found.

## Target Locations

Migration writes to Antigravity CLI's native user configuration:

```text
~/.gemini/antigravity-cli/skills/
~/.gemini/antigravity-cli/mcp_config.json
~/.gemini/config/mcp_config.json
```

MCP is written to both Antigravity CLI's documented CLI config path and the
shared Antigravity config path observed in current agy installations. This
prevents a false "migration succeeded" result when agy materializes MCP tools
from the shared config path.

## Workflow

### Default and Detect

For bare `/omagy:migrate` and `/omagy:migrate detect`:

1. Run `omagy migrate detect --json`.
2. Print the detect summary before any other migration action:
   - `status`
   - `summary.sourceRecords`
   - `summary.canonicalItems`
   - `summary.applyable`
   - `summary.mergeable`
   - `summary.review_required`
   - `summary.not_migratable`
   - `summary.conflicts`
   - review-required names and reasons
   - conflict names and reasons
   - target paths
3. Include both an overall total and a per-source coding agent breakdown. The
   per-source breakdown is based on raw source records and must cover `codex`,
   `claude`, `gemini`, `antigravity-ide`, and `cursor` when present, with
   counts for:
   - source records
   - not_migratable
   - skills
   - MCP servers
4. Then report canonical reconciliation:
   - `applyable`: one source maps cleanly to one Antigravity target.
   - `mergeable`: multiple sources are equivalent after host-normalization and
     will write one canonical target.
   - `review_required`: same target/logical MCP but different effective content;
     do not apply automatically.
   - `conflict`: Antigravity already has incompatible unmanaged target config;
     do not apply automatically.
5. A concise report shape is:

   ```text
   Migration Detection Summary

   Overall:
   - Status: partial
   - Source Records: 48
   - Canonical Items: 46
   - Applyable: 40
   - Mergeable Duplicates: 4
   - Review Required: 1
   - Not migratable: 5
   - Conflicts: 1

   By Source:
   - codex: 38 source records, 0 not migratable (32 skills, 6 MCP)
   - claude: ...
   - gemini: ...
   - antigravity-ide: ...
   - cursor: ...

   Mergeable Duplicates:
   - mcp omx-state: codex omx_state + claude omx-state + gemini omx-state

   Review Required:
   - skill omagy-migration-smoke: same target name with different content

   Conflicts:
   - mcp existing-server: target MCP server already exists with different effective config
   ```

6. State clearly: "No files have been written."
7. Do not ask an interactive confirmation question.
8. If `summary.applyable + summary.mergeable > 0`, end with this next-step hint
   and the write targets:

   ```text
   To apply the safe canonical items, run:
   /omagy:migrate apply

   Applying will write only applyable and mergeable items to:
   - ~/.gemini/antigravity-cli/skills/
   - ~/.gemini/antigravity-cli/mcp_config.json
   - ~/.gemini/config/mcp_config.json

   Review-required and conflicted items will be skipped.
   ```

9. If there are review-required or conflicted items, state that those items are
   skipped and must be resolved manually.

### Apply

For `/omagy:migrate apply`:

1. Run `omagy migrate detect --json` again and print the same summary.
2. If `summary.applyable + summary.mergeable` is `0`, do not apply. Explain why.
3. If `status` is `ready` or `partial`, run:

   ```bash
   omagy migrate apply --input '{"applyToken":"<token-from-detect>"}' --json
   ```

4. Do not invent or reuse stale tokens. Use only the current token returned by
   the immediately preceding detect command.
5. Run `omagy migrate doctor --json` after applying.
6. Tell the user whether Antigravity CLI needs to be restarted to reload newly
   migrated skills or MCP configuration.

Do not use agy's interactive Question UI for this command. `/omagy:migrate`
is detect-only; `/omagy:migrate apply` is the explicit write action.

## Conflict Handling

If review-required or conflicted items are reported:

- Explain which names conflict.
- Explain which names require manual review and why.
- Do not overwrite existing Antigravity skills or MCP server entries.
- Do not edit user config to resolve conflicts automatically.
- Safe `applyable` and `mergeable` items may still be migrated by `apply`.
