setup

A one-time setup command that checks whether the Codex command-line tool is installed and signed in, then tests image generation.

In plain words
What is it for?
Installing Codex when needed, checking sign-in, and confirming that the image-generation pipeline works.
Why use it?
It identifies missing installation or authentication before image-generation work begins.

Command

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/colin-automates/codex-imagegen--claude-code/setup
Clone the repo
git clone --depth 1 https://github.com/colin-automates/Codex-ImageGen--Claude-Code
Per session 38 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,311 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 2 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.00038 $0.01311
Opus 5 $0.00019 $0.00656
Sonnet 5 $0.00008 $0.00262
Haiku 4.5 $0.00004 $0.00131

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

Security

Grade C, and why

setup scanned grade C with 2 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 2d 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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

> "Auto-install needs elevated permissions. Open a terminal as Administrator (Windows) or run `sudo npm install -g @openai/codex` (macOS/Linux), then re-run `/imagegen setup`."

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

- Copy the entries from this plugin's `settings.json` into their `~/.claude/settings.local.json`.
plugins/imagegen/commands/setup.md · 103 lines

How it starts

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

The user invoked /imagegen:setup (also reachable as /imagegen setup). Run these steps in order, reporting clearly at each one:

Step 1 — Codex on PATH (auto-install if missing)

Run codex --version via Bash.

  • If it succeeds, note the version and continue to Step 2.
  • If it fails with "command not found" / ENOENT, try to install Codex automatically.

Before attempting auto-install, verify npm is available. Run command -v npm (or npm --version). If npm is missing, tell the user: "I need Node.js + npm to install Codex CLI. Install Node 18+ from https://nodejs.org, then re-run /imagegen setup." Stop.

If npm is present, tell the user one short sentence ("Codex CLI not found — installing it via npm now, this takes 30–90 seconds…") and run, with timeout_ms = 300000 (5 minutes):

npm install -g @openai/codex 2>&1

After it returns:

  • Success path: re-run codex --version. If it now succeeds, note the version and continue to Step 2.
  • Permission error — output contains EACCES, permission denied, Access is denied, or similar: tell the user:

    "Auto-install needs elevated permissions. Open a terminal as Administrator (Windows) or run sudo npm install -g @openai/codex (macOS/Linux), then re-run /imagegen setup." Stop.

  • Other failure (network error, registry timeout, etc.): surface the relevant tail of the npm output verbatim, suggest manual install, and stop.

Step 2 — Codex auth

Run codex login status via Bash.

If output contains "Logged in" (any form): note the auth method ("ChatGPT" or "API key") and continue to Step 3.

If output is "Not logged in": auto-launch the sign-in flow in a new terminal window and poll for completion. Tell the user one short sentence first ("Opening a browser sign-in window — complete it and I'll continue automatically"), then run this one Bash command with timeout_ms = 240000 (4 minutes):

# Spawn codex login in a new visible terminal so the user can interact with it
OS=$(uname -s 2>/dev/null || echo unknown)
case "$OS" in
  MINGW*|MSYS*|CYGWIN*)
    powershell -NoProfile -Command "Start-Process cmd -ArgumentList '/k','codex','login'" ;;
  Darwin)
    osascript -e 'tell application "Terminal" to do script "codex login"' >/dev/null ;;
  Linux)
    (x-terminal-emulator -e codex login &) 2>/dev/null \
      || (gnome-terminal -- codex login &) 2>/dev/null \
      || (xterm -e codex login &) 2>/dev/null \
      || (codex login &) ;;
  *)
    codex login & ;;
esac

# Poll codex login status every 5s for up to 3 minutes.
# Anchor on start-of-line so "Logged in" doesn't false-match inside "Not logged in".
for i in $(seq 1 36); do
  status=$(codex login status 2>&1)
  if echo "$status" | grep -qiE '^[[:space:]]*Logged in'; then
    echo "AUTH_COMPLETE"
    echo "$status"
    exit 0
  fi
  sleep 5
done
echo "AUTH_TIMEOUT"
codex login status

Read the full file on GitHub · 103 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. 2d ago First seen · 103 lines · 38 tokens per session scan C b6500c588743

Subscribe to this mod's changes

setup is a command published in the GitHub repository colin-automates/Codex-ImageGen--Claude-Code (2 stars, last pushed 4mo ago), licensed MIT. It adds 38 tokens to every session and 1,311 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 2 findings (asks for root, reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.