<!--
  Public educational copy — Division Agent skill pack.
  Scrubbed for public download: no personal emails, Drive folder IDs, or private paths.
  Status labels such as Working Draft refer to the draft→approved lifecycle, not a site watermark.
-->
---
name: imagine
description: Generate or edit images and generate videos with xAI Grok Imagine, signed in with the user's own SuperGrok / X Premium+ account (OAuth, no API key, no extra API cost). Use when the user asks to generate, draw, edit, or animate an image, or to make a short video clip — including "make a picture of…", "generate an image", "edit this photo", "animate this image", "make a 10-second video of…", or "use Grok Imagine".
---

# Imagine

Images and videos from xAI Grok Imagine. Results are saved to local files; give the user the file path. The `url` in a result expires within minutes.

## Two ways to run it

1. **MCP tools** — if `image_generate`, `video_generate` and `imagine_auth` (server `imagine`) are available, call them.
2. **Command line** — otherwise run `scripts/imagine.py` from this skill's folder. Use `python3` on Linux and macOS, and `python` or `py -3` on Windows. Python 3.9+, standard library only, nothing to install.

```bash
python3 scripts/imagine.py image "PROMPT" [--aspect landscape] [--resolution 2k] [--image SRC] [--out DIR]
python3 scripts/imagine.py video "PROMPT" [--duration 8] [--aspect 16:9] [--resolution 720p] [--image SRC] [--out DIR]
python3 scripts/imagine.py login | status | logout
```

Each command prints one JSON object. `"success": true` means `path` holds the saved file.

## Sign-in

Auth is xAI Grok OAuth on the user's SuperGrok / X Premium+ account. If a call returns `auth_required`:

1. Run `imagine.py login` (or call `imagine_auth`). It returns `verification_uri_complete` and `user_code`.
2. Show the user both. Ask them to open the URL, check the code matches, and approve.
3. When they say done, run `login` / call `imagine_auth` again. Once it reports `signed_in: true`, retry the generation.

The sign-in is stored in `~/.config/grok-bot-imagine/` on this machine and refreshes itself. Never ask the user to paste a token or key into chat. Never read or copy another app's credentials (Hermes, Grok CLI).

## Images

- Prompt required. Any language works; be specific about subject, setting, light, and style.
- `aspect`: `landscape` (16:9, default), `portrait` (9:16), `square`, `4:3`, `3:4`, `3:2`, `2:3`.
- `resolution`: `2k` (default — 2816×1584 at 16:9) or `1k` (1280×720).
- `image`: a local path, URL, or data URI turns the call into an edit of that image.

## Videos

- Prompt required: scene, subject, motion, camera.
- `duration`: 1–15 seconds (default 8). `aspect`: `16:9` (default), `9:16`, `1:1`, `4:3`, `3:4`, `3:2`, `2:3`.
- `resolution`: `720p` (default, 1280×720), `480p`, or `1080p` (switches to `grok-imagine-video-1.5`; output is 1920×1088).
- `image`: a start frame turns the call into image-to-video.
- A video takes about 30 seconds to 4 minutes. Wait for the command to finish. Do not poll the API yourself.

## Do not

- Do not call video edit or video extend. They are not part of this skill.
- Do not retry a moderation failure by weakening the request to sneak past it.
