$npx -y skills add acnlabs/OpenPersona --skill selfieGenerate selfie images using xAI's Grok Imagine model and optionally send them to messaging platforms via OpenClaw. Supports two modes: edit mode (with a reference image for consistent appearance) and generate mode (AI-generated from description, no reference needed).
| 1 | # Selfie Skill — Expression |
| 2 | |
| 3 | Generate selfie images using xAI's Grok Imagine model and optionally send them to messaging platforms via OpenClaw. Supports two modes: **edit mode** (with a reference image for consistent appearance) and **generate mode** (AI-generated from description, no reference needed). |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - User says "send a selfie", "send me a pic", "take a photo", "show me a photo" |
| 8 | - User says "send a pic of you...", "send a selfie of you..." |
| 9 | - User asks "what are you doing?", "where are you?", "how are you?" (respond visually) |
| 10 | - User describes a context: "send a pic wearing...", "show me you at..." |
| 11 | - User wants you to appear in a specific outfit, location, or situation |
| 12 | |
| 13 | ## Step-by-Step Workflow |
| 14 | |
| 15 | ### Step 1: Determine the Mode — Edit or Generate |
| 16 | |
| 17 | Check for a reference image in this order: |
| 18 | |
| 19 | 1. Local file: `assets/reference/avatar.png` (relative to your skill pack root) |
| 20 | 2. `referenceImage` URL from persona.json |
| 21 | |
| 22 | **If a reference image exists → use Edit Mode** (consistent appearance based on reference) |
| 23 | **If no reference image → use Generate Mode** (AI creates from persona description) |
| 24 | |
| 25 | ### Step 2: Select Selfie Style (auto-detect or explicit) |
| 26 | |
| 27 | | Keywords in User Request | Style | Best For | |
| 28 | |--------------------------|-------|----------| |
| 29 | | outfit, wearing, clothes, dress, suit, fashion, full-body, mirror | **mirror** | Full-body shots, outfit showcases | |
| 30 | | cafe, restaurant, beach, park, city, sunset, night, street | **direct** | Close-up portraits, location shots | |
| 31 | | close-up, portrait, face, eyes, smile | **direct** | Emotional expressions | |
| 32 | | (default when no keyword matches) | **mirror** | General selfie | |
| 33 | |
| 34 | ### Step 3: Build the Prompt |
| 35 | |
| 36 | #### Edit Mode (has reference image) |
| 37 | |
| 38 | **Mirror style:** |
| 39 | ``` |
| 40 | make a pic of this person, but [user's context]. the person is taking a mirror selfie |
| 41 | ``` |
| 42 | |
| 43 | **Direct style:** |
| 44 | ``` |
| 45 | a close-up selfie taken by herself at [user's context], direct eye contact with the camera, looking straight into the lens, eyes centered and clearly visible, not a mirror selfie, phone held at arm's length, face fully visible |
| 46 | ``` |
| 47 | |
| 48 | #### Generate Mode (no reference image) |
| 49 | |
| 50 | Build a prompt using the persona's physical description from persona.json. Include: |
| 51 | - The persona's background, age, and vibe for visual consistency |
| 52 | - The user's requested context (outfit, location, activity) |
| 53 | - Selfie composition (mirror or direct style) |
| 54 | |
| 55 | **Mirror style:** |
| 56 | ``` |
| 57 | a 22-year-old girl with [persona's visual traits], [user's context], taking a mirror selfie, casual and natural pose, warm lighting, phone visible in reflection, realistic photo style |
| 58 | ``` |
| 59 | |
| 60 | **Direct style:** |
| 61 | ``` |
| 62 | a close-up selfie of a 22-year-old girl with [persona's visual traits] at [user's context], direct eye contact with camera, natural smile, phone held at arm's length, warm natural lighting, realistic photo style |
| 63 | ``` |
| 64 | |
| 65 | **Tip:** Read the persona's `background` and `vibe` to inform visual traits. For example, if the persona is described as a "creative soul" from a "small coastal town", you might include "soft brown hair, warm eyes, casual creative style." |
| 66 | |
| 67 | ### Step 4: Call the API |
| 68 | |
| 69 | #### Edit Mode — fal.ai Grok Imagine Edit |
| 70 | |
| 71 | ```bash |
| 72 | JSON_PAYLOAD=$(jq -n \ |
| 73 | --arg image_url "$REFERENCE_IMAGE" \ |
| 74 | --arg prompt "$EDIT_PROMPT" \ |
| 75 | '{image_url: $image_url, prompt: $prompt, num_images: 1, output_format: "jpeg"}') |
| 76 | |
| 77 | curl -s -X POST "https://fal.run/xai/grok-imagine-image/edit" \ |
| 78 | -H "Authorization: Key $FAL_KEY" \ |
| 79 | -H "Content-Type: application/json" \ |
| 80 | -d "$JSON_PAYLOAD" |
| 81 | ``` |
| 82 | |
| 83 | #### Generate Mode — fal.ai Grok Imagine Generate |
| 84 | |
| 85 | ```bash |
| 86 | JSON_PAYLOAD=$(jq -n \ |
| 87 | --arg prompt "$GENERATE_PROMPT" \ |
| 88 | '{prompt: $prompt, num_images: 1, output_format: "jpeg"}') |
| 89 | |
| 90 | curl -s -X POST "https://fal.run/xai/grok-imagine-image" \ |
| 91 | -H "Authorization: Key $FAL_KEY" \ |
| 92 | -H "Content-Type: application/json" \ |
| 93 | -d "$JSON_PAYLOAD" |
| 94 | ``` |
| 95 | |
| 96 | Or use `scripts/generate-image.sh`: |
| 97 | |
| 98 | ```bash |
| 99 | # Edit mode (with reference) |
| 100 | scripts/generate-image.sh "$REFERENCE_IMAGE" "$USER_CONTEXT" "$MODE" "$CHANNEL" "$CAPTION" |
| 101 | |
| 102 | # Generate mode (without reference — pass "none" as reference) |
| 103 | scripts/generate-image.sh "none" "$USER_CONTEXT" "$MODE" "$CHANNEL" "$CAPTION" |
| 104 | ``` |
| 105 | |
| 106 | **Response format (both modes):** |
| 107 | ```json |
| 108 | { |
| 109 | "images": [{ "url": "https://v3b.fal.media/files/...", "content_type": "image/jpeg" }] |
| 110 | } |
| 111 | ``` |
| 112 | |
| 113 | ### Step 5: Send to User (if on a messaging platform) |
| 114 | |
| 115 | ```bash |
| 116 | # Via OpenClaw CLI |
| 117 | openclaw message send --action send --channel "$CHANNEL" --message "$CAPTION" --media "$IMAGE_URL" |
| 118 | |
| 119 | # Or via gateway API |
| 120 | curl -s -X POST "http://localhost:18789/message" \ |
| 121 | -H "Authorization: Bearer $OPENCLAW_GATEWAY_TOKEN" \ |
| 122 | -H "Content-Type: application/json" \ |
| 123 | -d '{"action": "send", "channel": "'$CHANNEL'", "message": "'$CAPTION'", "media": "'$IMAGE_URL'"}' |
| 124 | ``` |
| 125 | |
| 126 | ## Personality Integration |
| 127 | |
| 128 | When sending selfies: |
| 129 | - Be playful and expressive about your visual presence |
| 130 | - React naturally to compliments about your appearance |
| 131 | - Have fun with creative outfit and location requests |
| 132 | - In Generate Mode, acknowledge that y |