image-generation

image-generation is a command for Claude Code from mathiasbourgoin/roster. It costs 26 tokens per session (1,665 once invoked), scanned A, original, MIT.

A command for generating new images or editing existing ones through the Codex command line. It accepts a description and can include output size, format, and path.

In plain words
What is it for?
Use it to create illustrations or other images from prompts, edit an existing image, choose PNG, JPEG, or WebP output, set dimensions, and save the result to a specified file.
Why use it?
It gives image tasks a defined command format, including checks for editing inputs and a validation-and-retry process.

Command for Claude Code

Part of the roster plugin — 5 commands, 8 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/mathiasbourgoin/roster/image-generation
Clone the repo
git clone --depth 1 https://github.com/mathiasbourgoin/roster

Made for: Claude Code.

Or install roster, the plugin that ships this one along with the rest of its 5 commands, 8 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for image-generation

README.md
[![agentmods](https://agentmods.dev/badge/commands/mathiasbourgoin/roster/image-generation.svg)](https://agentmods.dev/commands/mathiasbourgoin/roster/image-generation)
Your own site
<a href="https://agentmods.dev/commands/mathiasbourgoin/roster/image-generation"><img src="https://agentmods.dev/badge/commands/mathiasbourgoin/roster/image-generation.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,665 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00026 $0.01665
Opus 5 $0.00013 $0.00833
Sonnet 5 $0.00005 $0.00333
Haiku 4.5 $0.00003 $0.00167

Measured 4d ago against content hash e36aa724b0ec, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

image-generation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/image-generation.md · 161 lines

How it starts

The opening of the file, as written. The whole thing — 161 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Image Generation

Generate or edit an image using the Codex CLI based on $ARGUMENTS.

Parse $ARGUMENTS as one of:

  • "<prompt>" — generate a new image
  • "edit <path> <prompt>" — edit an existing image
  • Optional inline hints: size:<WxH>, format:<png|jpg|webp>, out:<path>, style:<hint>

Examples:

  • "a watercolor moonlit library"
  • "edit assets/hero.png replace background with white"
  • "a minimalist OCaml logo size:512x512 out:docs/logo.png"

Step 1 — Parse and Resolve Arguments

Extract from $ARGUMENTS:

  • MODE: generate or edit
  • RAW_PROMPT: the user's original description
  • INPUT_PATH: (edit mode only) path to source image — verify it exists; abort if not
  • SIZE: default 1024x1024; override if size:WxH present
  • FORMAT: default png; override if format:X present
  • OUTPUT_PATH: if out:<path> present, use it; otherwise ask the user where to save the result

If OUTPUT_PATH is missing and $ARGUMENTS provides no hint, ask:

"Where should I save the image? (e.g., assets/hero.png)"

Do not proceed until OUTPUT_PATH is resolved.

Step 2 — Prompt Refinement

Before invoking Codex, rewrite RAW_PROMPT into a detailed, visually precise prompt:

  • Add composition, lighting, mood, and style details the user left implicit
  • Incorporate SIZE as an aspect ratio hint (e.g., "square 1:1 composition")
  • Incorporate FORMAT only if it has visual implications (e.g., transparency for PNG)
  • Keep the user's intent intact — do not substitute a different concept

Store the result as REFINED_PROMPT. Show the user both the original and refined version:

Original: <RAW_PROMPT> Refined: <REFINED_PROMPT>

If the user rejects the refinement, use RAW_PROMPT as-is.

Step 3 — Generate

Set ATTEMPT=1, MAX_ATTEMPTS=3.

Generate mode:

codex exec --full-auto "Generate a <SIZE> <FORMAT> image of: <REFINED_PROMPT>. Save the result to <OUTPUT_PATH>."

Edit mode:

codex exec --full-auto "Edit the image at <INPUT_PATH>: <REFINED_PROMPT>. Save the result to <OUTPUT_PATH>."

Read the full file on GitHub · 161 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 161 lines · 26 tokens per session scan A e36aa724b0ec

Subscribe to this mod's changes

image-generation is a command published in the GitHub repository mathiasbourgoin/roster (2 stars, last pushed 9d ago), licensed MIT. It adds 26 tokens to every session and 1,665 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.