--- name: image-lab-2 license: Apache-2.0 description: "Generate image alternatives with the price shown before any spend. Quick: one finished prompt becomes several alternatives across the 2-3 best-fit image models. Variation: controlled variations (camera, lighting, style, aspect) of a brief, optionally from a reference photo, in an Excel workbook where the user ticks the rows to generate. Creative Direction: several different directions for an open brief, one image each first. Each paid batch shows its total and needs one approval. Triggers include \"generate that with Image Lab 2\", \"8 options of this with Image Lab 2\", \"run Image Lab 2 on this photo\", \"with Image Lab 2, try different lighting and camera angles\", \"with Image Lab 2, explore four creative directions\". It has to be named with its version: a request that only says \"Image Lab\" for a single prompt belongs to the older image-lab skill, and a bare \"generate an image\" to native image generation." --- # Image Lab 2 **See the price. Approve each paid batch. Generate in parallel. Keep a record of everything.** Three modes share one engine (`scripts/image.py`), one ledger and one gate. **Quick**: one finished prompt, spread across the best-fit models, no plan. **Variation** and **Creative Direction** (together "experiment mode"): a `plan.json` becomes `experiment.xlsx`, where the user ticks the rows to generate. Setup: run commands from this folder (the one holding this file; for an installed skill, for example `~/.claude/skills/image-lab-2/`) (`python scripts/image.py `); `pip install -r requirements.txt` (experiment mode; quick mode needs nothing); a gateway key in `LOOMLOOM_TOKEN_COGFOUNDRY` (https://console.cogfoundry.ai/api-keys), needed only for `run`; the loomloom CLI is **not** used. On Windows set `PYTHONUTF8=1` (bash: `PYTHONUTF8=1 python ...`; PowerShell: `$env:PYTHONUTF8=1`). Keep plans and experiments in a folder of your own (`./image-lab-out/`), never inside the skill folder: an update replaces it. Read `./out/` below as that folder. If your packages are in a virtual environment, call its interpreter (`.venv/Scripts/python` on Windows) in place of `python`, with absolute paths for `--plan` and `--out`. Without `AskUserQuestion` or `SendUserFile`, ask in plain chat and give file paths. ## Start here First time? Read [`references/quickstart.md`](references/quickstart.md) (one page): which route to take, the five-command loop, the plan file in 30 seconds, what the checker enforces for you, and what to show the user. Then **copy a complete example plan** and edit it: `references/examples/variation-plan.json` (a variation experiment) or `references/examples/direction-plan.json` (creative directions). Run `check` and the dry run; they say what to fix. Read the rest of this file as you reach each step, not before: "Rules that always apply" always; "Experiment mode" steps 3 to 8 when you get there; `skills/quick.md` only for quick mode; `skills/plan.md` and `skills/direction.md` (about 17 KB each) only for the detail the quickstart points to or when `check` complains. ## Rules that always apply 1. **Each paid batch is approved once, and each approval authorizes exactly one execution snapshot.** A calibration, the main batch and a retry are separate batches, each with its own quote and approval. Nothing is spent before the user approves the numbers you show; `run` needs `--confirm ` and refuses anything else. The fingerprint binds the approval to an immutable snapshot (`snapshots/.json`, the only thing `run` reads). **What the fingerprint covers**, per row: its id (which images), the compiled prompt, model, size, quantity, mode, quality and reference-file hashes, plus the known total and the unverified rows. It does not cover file times. - **The one spend gate:** `run --confirm ` (and a repeat with `--again`) is the only command that spends on images (`review --confirm` spends a few cents on a vision model to read them, see `skills/results.md`). `retry`, `add-takes` and `recover` never spend by themselves: `retry` prepares a new quote for failed rows, `add-takes` adds ticked rows that need their own preflight and approval, `recover` only re-downloads images already billed and sends no new request. They are steps toward a batch, never a way around the approval. - **A calibration batch is approved on its own;** the main batch is quoted and approved again after the user has seen it. - **Editing and locking:** after the plan confirmation the user may keep editing the workbook; a `preflight` freezes a snapshot and the user's yes approves that one. A change after that, even dropping a single image, never alters the approved snapshot: preflight, quote and approve again. - **Edits after an approval are not in that run.** Before it starts, `run` compares the snapshot with a fresh preflight of the workbook **by content** (not file time) and names each differing row and field; after it, it lists the ticked rows that were not approved. - **Say the scope when you ask:** "This approves exactly these N images (about $X, fingerprint ...). It does not approve anything else; the other M ticked rows will be quoted separately." Name the rows from preflight's "Rows in this batch" list. - **Two different "yes" answers:** a *plan confirmation* (the plan or Direction Sheet is what the user wants; spends nothing; "the one confirmation" in `skills/plan.md` and `skills/direction.md`) is not a *spend approval* (a fingerprint). 2. **Show the price honestly.** Quote the *known* total and say how many rows have an unverified price (not in the total). Never invent a number. The balance is "unread"; the gateway confirms. 3. **Unknown is never retried automatically.** A submit with no confirmed reply is `Unknown`: it may or may not be billed. Tell the user, give the submit time and request hash, and let them check the console usage log. Only after they have checked it and accepted the billing risk does `retry --include-unknown` prepare a new quote, which needs its own approval. 4. **Never overwrite the user's cells.** The workbook is regenerated from the ledger (`experiment.prev.xlsx` is kept); if Excel has the file open you get `experiment.refresh-