---
schema_version: 1
revision: "22ce5d34dbcb5a78"
id: "factory-design-variations-reference-patterns"
title: "Generate to diverge, code to converge — reference patterns"
---

# Generate to diverge, code to converge — reference patterns

Extended explanations, comparisons, experiments, and practical actions for the same operating pattern.

## Abstract

Early design work stalls on the cost of producing options, not on taste. Coding agents that carry an image-generation tool collapse that cost: one prompt can return nine divergent website or mobile mockups in minutes. The results only stay comparable when the subject is held constant and only the visual style varies. With a strict machine-readable status contract, the same pattern runs unattended at two-hundred-style scale, as a deployed gallery project demonstrates. The evidence here covers workflow mechanics from tool contracts, CLI output, pipeline scripts, and prior session records. It does not measure whether any generated direction is aesthetically better — that judgment stays with you.

## Notice where design exploration stalls

You sit down to design a landing page. The usual move is to build one draft and iterate on it. Each iteration costs an hour or more, so you see perhaps three directions before you commit. The mistake is treating that scarcity as a taste problem. It is a production problem: you cannot prefer an option you never saw.

The workshop agenda names image generation as a shared capability of current coding agents and treats prototypes as a compounding asset: the more you build, the deeper the well of examples you can pull from (S1). [1](https://indigo-kayak-2zw8.here.now/#note-1)

1\. The same agenda lists Codex, Grok, and Antigravity as agents that "can all generate images" — this section is where that thread gets demonstrated (S1). [↩](https://indigo-kayak-2zw8.here.now/#note-ref-1)

Prior sessions on this machine show the pattern working in practice: one run produced five bitmap mockup directions for a storefront, collected them into a gallery page, and finished within a single sitting (S5).

From those records, this folio draws its central inference: when a mockup costs a minute instead of an hour, exploring nine directions becomes the cheap default rather than a luxury.

The signal to watch in your own work: if you are polishing draft one before you have seen draft five, you are iterating too early. Diverge first.

## Test one prompt against nine mockups

Two CLIs run this demo. Codex ships an imagegen skill — a packaged instruction set that routes image requests through its built-in `image_gen` tool. The Antigravity CLI (`agy`) exposes a `generate_image` tool the same way. Try both with the same shape of prompt:

``` text
# Codex: 9 wildly different website mockups
./scripts/run-codex-mockups.sh "a landing page for an indie coffee roaster"

# agy: 9 wildly different mobile mockups
./scripts/run-agy-mockups.sh "a mobile app for selling houses"
```

Both scripts expand a prompt that names nine divergent style directions, asks for one image call per mockup, and requires the agent to copy each result into `mockups/` as `mockup-01.png` through `mockup-09.png`. A contact-sheet page in the same folder polls for the files and fills a three-by-three grid as they land.

The imagegen skill contract lists UI mockups, product mockups, and wireframes as intended uses, prefers the built-in tool over its API fallback, and states that a batch request means one built-in call per asset — not a switch to the CLI path (S2). [2](https://indigo-kayak-2zw8.here.now/#note-2)

2\. The fallback path exists but is gated: it requires an API key and an explicit user request. For this workflow you never need it (S2). [↩](https://indigo-kayak-2zw8.here.now/#note-ref-2)

| Concern | Codex `$imagegen` | agy (Antigravity) |
|----|----|----|
| Non-interactive run | `codex exec "<prompt>"` | `agy -p "<prompt>"` |
| Image tool | built-in `image_gen` | `generate_image` (ImageName, Prompt, ImagePaths) |
| Default output location | `$CODEX_HOME/generated_images/` | agent workspace artifact; copy via `run_command` |
| Batch rule | one built-in call per asset (S2) | one `generate_image` call per mockup (S4) |
| Timeout to watch | none specific to images | `--print-timeout`, default 5 minutes (S3) |

Table 1. The two CLI surfaces, side by side. Derived display: reorganized from the imagegen skill contract (S2), `agy --help` output (S3), and pipeline scripts (S4).

Codex saves built-in image output under its own home directory by default, and the skill contract forbids leaving a project-referenced asset there (S2).

**Evidence limit** If your prompt does not say "copy each image into `./mockups/`", the run can succeed while your project folder stays empty. The same trap applies to agy's five-minute default print timeout: nine images take longer, so the demo script raises it to fifteen minutes. Watch for an empty contact sheet as the failure signal.

The test is simple: fire a script, open `mockups/index.html`, and count. Nine tiles filled means the contract held. Fewer means read the run log before blaming the model.

## Compare fairly: hold the subject constant

Nine images are only useful if you can compare them. The likely mistake is letting the subject drift with the style — a coffee site in one tile, a coffee app in the next. Then differences in appeal tell you nothing about the style, because two variables changed at once.

The gallery pipeline enforces this discipline explicitly: a shared subject file defines one fixed cast of seven characters plus a prompt suffix appended to every style prompt, "so you can compare how each visual approach handles" the same material (S4).

A prior session applied the same rule to product work: mock up one constant subject — a mobile app for selling houses — once per visual style, varying nothing else (S5). [3](https://indigo-kayak-2zw8.here.now/#note-3)

3\. That session's record also captures a stronger prompt pattern: each style prompt opens with "STYLE IS PARAMOUNT" and demands the image be instantly recognizable as that style (S4). [↩](https://indigo-kayak-2zw8.here.now/#note-ref-3)

Weak judgment says "make nine cool designs." Strong judgment says "same homepage, same hero, same call to action — nine styles." The first gives you nine incomparable posters. The second gives you a controlled experiment you can read at a glance.

Practice it now: before you run the script, write your subject as one sentence and check that it names the page type and its content. If any mockup back changes the page type, regenerate that one — do not compare it.

## Adjust the trick into an unattended pipeline

Nine mockups is a live demo. Two hundred is a pipeline, and the difference is error handling. The inspiration-board project — the deployed gallery this workshop shows off — generates its images by driving the Antigravity CLI from a bash loop, one style at a time.

Its generator script demands a machine-readable status from every run: plain JSON, no markdown, one of three shapes (S4).

``` text
// Success
{"status": "ok", "path": "<output_path>"}
// Quota exhausted
{"status": "quota_exhausted", "reset_seconds": 3600, "reset_time": "<ISO8601>"}
// Anything else
{"status": "error", "message": "<description>"}
```

The same script controls filenames by passing a fixed image name per style, copies each artifact to a predictable path, and skips any output that already exists above a size threshold, so interrupted runs resume instead of restarting (S4). [4](https://indigo-kayak-2zw8.here.now/#note-4)

4\. The skip guard is one line: if the file exists and exceeds 100 KB, print SKIP and return. Cheap idempotence is what lets a quota-limited loop run for days (S4). [↩](https://indigo-kayak-2zw8.here.now/#note-ref-4)

The instruction suffix also closes escape hatches: on quota errors the agent must return JSON immediately, and it may not reach for scripts, external APIs, downloads, or any workaround (S4).

Scale evidence: the web-design category alone carries 200 named styles with full prompts in its styles file and roughly as many generated images beside it, with sibling categories for app design, branding, editorial, and more (S4).

A prior batch run stalled silently mid-generation, and the operator had to ping the session to ask what was happening; the recorded lesson was to run each image as its own background job and to narrate progress (S5).

**Evidence limit** The quota-handling and skip-guard evidence comes from one project's scripts driving one CLI. The sources do not establish that other agents fail the same way, or how often quota errors occur — only how this pipeline survives them.

When your own loop grows past a handful of images, adjust in this order: fixed output names first, skip-if-exists second, JSON status third, background jobs with progress lines fourth. Each step has a visible test — rerun the loop and watch it skip, resume, or report instead of stalling.

## Choose a winner and converge to real code

The mockups are bitmaps. They are for deciding, not shipping. The loop closes when you pick one tile and hand it back to a coding agent as a reference image.

A prior session shows the full arc: five generated mockup directions went into a gallery page, one winner was selected, and that winner was rebuilt "as actual HTML/CSS instead of an image-backed" page (S5).

The follow-up prompt is one sentence: "Rebuild `mockup-07.png` as a real single-file HTML/CSS page, using the image strictly as a visual reference — real text, real layout, no bitmap backgrounds." Generate to diverge; code to converge.

The variations idea applies twice in the inspiration-board project. The images are style variations, and the gallery pages themselves are twelve layout variations rendering the same image set (S4). [5](https://indigo-kayak-2zw8.here.now/#note-5)

5\. The masonry page even hardcodes its own public URL as a prompt base, so a visitor can copy any style straight into their own agent session (S4). [↩](https://indigo-kayak-2zw8.here.now/#note-ref-5)

- 01 masonry grid
- 02 infinite scroll
- 03 carousel slider
- 04 lightbox thumbnails
- 05 compare split
- 06 magazine editorial
- 07 filmstrip preview
- 08 table list
- 09 mood board
- 10 fullscreen slideshow
- 11 grouped categories
- 12 search-first

**Figure 1.** The twelve gallery layout variations shipped by the inspiration-board project. Derived display: transcribed from the project's variations directory listing (S4); the live masonry page at inspiration-board.pages.dev returned HTTP 200 when checked in the observed snapshot.

Your decision rule: pick the tile you would be embarrassed to lose. If no tile clears that bar, the styles were not divergent enough — widen the directions and rerun, rather than polishing the least-bad option.

## Practical action

Next time a design has no direction, run this sequence in the demo project. Write one constant-subject sentence. Fire `run-codex-mockups.sh` for the website and `run-agy-mockups.sh` for mobile, each in its own pane. Open the contact sheet and wait for nine tiles per run. Success signal: filenames `mockup-01.png` through `mockup-09.png` exist and every tile shows the same subject in a different style. If a run stalls, check the agent's log for a quota status and its reset time before retrying. Then choose one winner and issue the converge prompt to rebuild it as real HTML/CSS. If nothing wins, widen the style directions and regenerate — do not iterate on a weak favorite.

## Original references

- [Prepared module reference](https://indigo-kayak-2zw8.here.now/)
