DEV Community

Ziwei (Ekko) Yu
Ziwei (Ekko) Yu

Posted on Edited on

I shipped four imagegen-swarm updates from other people's feedback

I published imagegen-swarm as a Claude Code and Codex skill. You give it a list of image jobs, and it feeds six engines at once: Codex, Jimeng, Grok, Gemini, Muse, and Lovart. Most of them use accounts you already have, so you don't need a separate image API key. If one engine hits its quota, the others pick up the work.

I usually build the thing first, then talk about it. The next four releases were not on a plan I already had. They came from a comment on X, a batch I already run, and a security scanner.

What it looks like

Install:

npx skills add https://github.com/Ekko237/imagegen-swarm -a claude-code -a codex
Enter fullscreen mode Exit fullscreen mode

You still need Node.js 18+ and Python 3 with Pillow, and at least one engine logged in.

Or run a batch from the CLI:

cat > jobs.json <<'EOF'
[
  {"id": "lemon",  "prompt": "a lemon slice on a blue background, flat illustration", "aspect": "1:1"},
  {"id": "kite",   "prompt": "a red kite in a clear sky, minimal",                    "aspect": "3:4"},
  {"id": "whale",  "prompt": "a blue whale in the deep ocean, low poly",              "aspect": "16:9"},
  {"id": "night",  "prompt": "the same lemon slice, but at night", "ref": ["out/lemon.png"]}
]
EOF
node skills/imagegen-swarm/scripts/batch.mjs --jobs jobs.json --out out/
Enter fullscreen mode Exit fullscreen mode

In one test run on an 8 GB M1 MacBook Pro, a 50-image batch finished generation in 2.3 minutes. That's generation time only. Screening and any style redos sit outside that clock, and it was a single run, so your numbers will differ.

A reader on X asked for consistent style

If you generate a character, a brand, or a cover set, each engine has its own look. The batch can finish and still not hold together.

A reader on X pointed that out. I shipped series mode as v1.3.0 in PR #25.

When you turn it on, every engine gets the same style guide. Style reference images are attached where the engine has room. After each image, a local Pillow score compares a 64×64 palette histogram and a 4×4 brightness grid. The default threshold is 0.72. Images below that are discarded and put back on the queue, preferring the engine that has been most consistent so far, up to two retries.

The score does not recognize a face, a character, or a logo. I only measured it on solid-color test images: an identical image scores 1, a complementary color scores 0.2. I have not measured a keep rate on a real multi-engine series.

Series mode is off by default. You turn it on with --series --style "..." --style-ref, or in the jobs file:

"series": {"style": "...", "ref": ["style.png"]}
Enter fullscreen mode Exit fullscreen mode
node skills/imagegen-swarm/scripts/batch.mjs --jobs jobs.json --out out/ --series --style "..." --style-ref style.png
Enter fullscreen mode Exit fullscreen mode

Why I didn't flip it on automatically

If people don't know the flag exists, they will miss it. I almost made series mode detect a shared style and turn itself on.

Then I thought about a batch I already run. I generate font images every day, and those images are not supposed to share one style. If the tool had switched series mode on by itself, it would have tried to force one look onto a mixed set. The README now uses "50 font images in different styles" as the example of a batch that should get no reminder.

So v1.3.1, in PR #27, does not enable anything. The tool asks first.

If you mention the same character, brand, mascot, a cover set, or a series, or every task shares the same style reference, the assistant asks: "Should this batch share one style? If so I'll turn on series mode." It turns the mode on only after you agree.

The CLI is quieter still. If you didn't pass --series, the jobs file has no series key, there are at least four jobs, and every job has the same non-empty reference list, it prints one bilingual series_hint event to stderr. That's it. It doesn't wait, and it doesn't change how images are generated.

A scanner found a budget leak

imagegen-swarm has an optional paid last resort: an OpenAI or Gemini API line that only takes jobs no subscription engine can take. It stops at the per-batch and per-month budgets you set.

When I published 1.3.1 to ClawHub, ClawScan, their security scanner, reported that paid image retries could exceed the configured spending cap.

The bug was real. In series mode, a paid image can come back and then get thrown out — a low style score, a wrong aspect ratio, or a discarded duplicate. The old code gave that budget reservation back. Another paid attempt could start, and actual spend could pass budget_per_batch or budget_per_month.

v1.3.2, in PR #28, keeps the reservation for any paid image that was actually returned, even if we later discard the file. Known uncharged failures still release the slot. If the charge is unknown, a timeout or a killed request, the slot stays reserved for the rest of that batch. Before any redo or retry, both caps are checked again. If another paid image would go over and no subscription engine can take the job, it stops with stopped_by_budget.

The tests are hermetic. No real provider was called.

Then the scanner found a loose approval

The next scan, on 1.3.2, flagged something else. Muse approval cards were being accepted by matching keywords in the card's free text. A compound request — save this image and also change another file, or run a command — could have slipped through.

Muse is driven by a headless browser, and some runs show an "Allow once" card before a file is saved. The old filter was too loose.

v1.3.3, in PR #29, only permits a single image-save to this run's exact output path, with the card label exactly "Allow once". Directory creation, extra operations, commands, reads, network access, and mismatched paths are refused. The free text on the card is never what grants permission.

Here is the honest part. I don't have a captured sample of a real Muse approval card, so the extractor currently treats the request as unrecognized. Every live approval card is refused, including legitimate saves, and that Muse job stops. The batch can then retry the job on another engine, up to --tries (default 3). Jobs that never show an approval card still run as before.

I have not tested 1.3.3 in a real Muse session. The tests cover the policy against fixtures, not a live browser. I'll loosen this only after I have a real card to decode against. Until then, fail closed is the right default.

What I learned

Ask before you "help." A consistency feature is useful for a character set and harmful for a mixed batch. The same clues — many jobs, maybe a shared reference — are not enough to decide for the user.

A spending cap that ignores discarded paid images is not a cap. If you generate, screen, and retry, the images you throw away still cost money.

If you can't prove the shape of a permission prompt, don't click it. Breaking Muse auto-approval for now is better than approving the wrong thing.

And ship in public. The comment on X, the mixed-style batch, and the scanner each found a gap I had not put on a list.

The repo is here: https://github.com/Ekko237/imagegen-swarm. If you try it, open an issue and tell me what broke or what you made.

Top comments (0)