> ## Documentation Index
> Fetch the complete documentation index at: https://docs.migma.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Handoff

> Copy Migma setup prompts for Claude Code, Codex, Cursor, and app-builder agents.

Agent handoff copies the right Migma instructions for the agent you are already using. Use it when a coding agent needs to audit an app, create or reuse Migma emails, and wire backend sends safely.

## Handoff paths

| Surface                                   | Use it for                  | What gets copied                                                                                |
| ----------------------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------- |
| **Create → Set up Migma with agent**      | First-time app setup        | `/setup` skill/plugin install paths, agent auth, sender/domain status, and backend wiring steps |
| **Publish or Send via API → Copy for AI** | Use one email in an app     | selected `emailId`, sender/domain status, agent auth, and send instructions                     |
| **Canvas export → Copy for AI**           | Wire selected canvas emails | selected email IDs, future-email preference, sender/domain status, and app wiring steps         |

## First-time app setup

<Steps>
  <Step title="Open Create">
    In Migma, open **Create** and click **Set up Migma with agent** beside the composer send button.
  </Step>

  <Step title="Copy for AI">
    Migma checks sender and domain status, then copies a setup prompt for Claude Code, Codex, Cursor, or any skills-compatible agent.
  </Step>

  <Step title="Paste into your agent">
    Paste the prompt into the agent working inside your app repository. It tells the agent to use the official setup skill or plugin when available.
  </Step>

  <Step title="Approve access">
    The prompt tells the agent to use [agent registration](/agent-registration) first. You approve a short code, and the agent receives a scoped key. Use a fallback API key only when that flow is unavailable.
  </Step>

  <Step title="Review the report">
    The agent should report the stack found, email systems found, Migma brand used, email IDs created or reused, files changed, and dry-run result.
  </Step>
</Steps>

## What the `/setup` prompt asks for

* Audit transactional sends, templates, newsletters, lifecycle jobs, queues, webhooks, and existing provider config.
* Resolve the right Migma brand after credentials are ready.
* Reuse matching Migma emails before creating new ones.
* Create missing emails from code evidence: trigger files, recipients, variables, subject copy, CTAs, and timing.
* Store `emailId`, subject, sender, and trigger mapping in server-side config.
* Wire sends only through trusted backend paths.
* Add idempotency and one dry-run or smoke test before live sends.

## Existing email handoff

Use **Copy for AI** from Publish, Send via API, or canvas export when an email already exists in Migma. This path does not use the full setup skill by default. It gives the agent selected `emailId` values and instructions for wiring those emails into the app.

## Live agent status

External agents can show up in Migma while they work. On Create, Migma shows the agent activity pill, types the incoming prompt into the composer, and opens the generated chat when the agent-created conversation is ready.

## Related

<CardGroup cols={2}>
  <Card title="/setup" icon="plug" href="/setup">
    Full setup skill and plugin guide.
  </Card>

  <Card title="Agent Registration" icon="key" href="/agent-registration">
    Scoped agent access without copy-pasting keys.
  </Card>

  <Card title="Skills" icon="https://mintcdn.com/migmaai/kT6TJgF40rDP8_qB/images/logos/skill.svg?fit=max&auto=format&n=kT6TJgF40rDP8_qB&q=85&s=16eaf6658a39a735ef9f2afd040eba19" href="/skills" width="24" height="24" data-path="images/logos/skill.svg">
    Install Migma workflows into supported agents.
  </Card>

  <Card title="AI App Builders" icon="cube" href="/agents/app-builders">
    Lovable, Bolt, v0, Replit, and similar builders.
  </Card>
</CardGroup>
