qiaomu-codex-imagegen
Generate or edit images with Codex's built-in image generation from any agent, through an MCP tool or a plain CLI. For every image request it first proposes at least four divergent style directions (24 distilled templates, 48 presets, 20 Mondo poster artists), lets the user pick, expands the prompt, generates, and checks the result. Scenario craft for 视频封面, 视频海报, 小红书配图, 公众号封面, X 封面, 朋友圈海报, 书籍封面, 专辑封面, 产品海报, 人物写真, 节气海报, 展览海报, PPT 页面, 图生图. Use for 生图, 配图, 海报, 封面, "给我几个风格", "用 Codex 画一张". Excludes: editing photos with local tools, charts or diagrams from data, UI mockups, video generation, or anything that needs an API key-based image service.
1How It Works & Mechanism
Relay Codex's exclusive internal image generation capability via `codex app-server` (stdio JSON-RPC), adding a production-grade craftsmanship layer to ensure practical utility: 24 templates, 48 presets, 20 Mondo artists, and an anti-hallucination rule set.
Codex ships an image generator that other agents cannot call. This package relays to it (`codex app-server`) and adds the craft that makes the pictures usable: a library of 24 templates (48 presets) distilled from 689 reference prompts, Mondo poster techniques, scenario presets, and a rule set for facts, text and identity.
Invocation entry points follow a strict priority: MCP tools first, followed by the local CLI in this directory; if neither is available, guide the user through installation while strictly prohibiting the use of code to fabricate images.
**No MCP**: run the CLI from this skill's folder: `node scripts/cli.mjs suggest|compose|generate|search|prompt|list` (see `--help`).…Neither available: tell the user to install (README). Requires the Codex CLI, logged in. Never fake an image with code.
The initial request must provide at least four mechanically divergent directions (typography-driven, graphic structure, photography, product close-up, material space, plus a Mondo artist direction), strictly prohibiting the mixing of two mechanisms in a single image.
Call `suggest_directions` with the topic, deliverable and any headline/text mode. It returns **four or more directions with different visual mechanisms** (typography-led, graphic structure, photographic, product macro, material/space, plus a Mondo artist option for poster-like work). Never mix two mechanisms into one image.
Posters, covers, cards, and slides must include a typography layer: provide headline and matched short copy separated by `|` via exact_short; a title-only or textless output is classified as a concept art piece rather than a poster.
**Posters, covers, cards and slides need a typographic layer.** A finished poster has a hierarchy: headline, subtitle, one or two info lines, a small tag. With only a headline, or none, the result is concept art, not a poster.
Semantic constraints on prompt variables: colors are assigned by role (background, primary, accent, ink) rather than fixed hex codes; facts and numbers must come exclusively from the user, strictly forbidding fabricated prices, statistics, names, dates, QR codes, or logos.
Colours are **roles** (background, primary, accent, ink), not fixed hex values.…No invented facts: prices, statistics, titles, names, dates, weather, quotes, QR codes, logos.
By default, execute parallel calls generating one image per selected direction (up to four); `count` is reserved solely for variations within the same direction; each generation consumes Codex user quota, strictly prohibiting test runs.
Default **one image per chosen direction**, up to four, each its own `generate_image` call (they can run in parallel). Use `count` only for variants of the same direction.…Each generation spends the user's quota: no test generations, `count` above 3 only if asked.
Post-generation review must rigorously inspect each image against the acceptance_checks printed by the tool (first-glance focal point, essential compositional relationships, material placement, text & identity, no hallucinations); on failure, modify only the single sentence carrying that relationship and regenerate once.
Read each saved image and test it against `acceptance_checks` (the tool prints them): first-glance focus, relations that must hold, materials only where intended, exact text and identity, nothing invented.
The 689 local reference prompt corpora are strictly used to learn "how a mechanism is described"; forwarding raw corpus prompts as user prompts is strictly prohibited.
Reference corpus: `search_prompts` / `get_prompt` read the local pack of 689 reference prompts (installed on the user's machine only). Use them to study how a mechanism is described; never send a corpus prompt unchanged as the user's prompt.
The delivery contract mandates reporting the absolute path, pixel dimensions, direction used (template/preset or Mondo designer), assumptions, acceptance results, and the prompt sidecar location.
Reply with: absolute path(s), pixel size, direction (template/preset or Mondo artist) per image, assumptions made, acceptance result, and where the prompt sidecar is.
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| cli | Codex CLI(`codex app-server --listen stdio://`;需已安装并登录、账号具备图片生成权限) |
| mcp | MCP 客户端(Claude Code / Cursor / Codex 等注册 `scripts/mcp-server.mjs`) |
| env | 环境变量 `QIAOMU_CODEX_BIN` / `QIAOMU_CORPUS_DIR`(Codex 可执行路径与本地语料目录) |
4Recommended Governance & Evidence
- scripts/: Executes local scripts or commands: node scripts/cli.mjs … (suggest|compose|generate|search|prompt|list, primary entry points)
- 网络端点: Declares external network access: Zero HTTP request code within the skill directory (zero hits in network risk scanning)
- 本地工作目录: File I/O and artifact output: Image output directory (defaults to ~/Pictures/qiaomu-codex-imagegen/<date>, or user-specified out_dir)
5Second-Pass Verification
- [ok] 架构陈述与文件清单一致:SKILL.md 说 relay 到 `codex app-server`,§1 有 scripts/lib/codex.mjs(11655B) 与 scripts/mcp-server.mjs(1550B) 支撑 — §3 沙箱条目给出 scripts/lib/codex.mjs:81/87 的 approvalPolicy/ sandboxPolicy 原文,与 agents/interface.yaml:29 的 subprocess 声明互证,relay 说法成立。
- [ok] 「无网络请求」结论:风险扫描「網路請求」标注「無命中」,与 README 大量 https:// 文档链接不矛盾 — URL 命中 26 条全部为文档/作者/上游链接(README、SKILL.md 版权行、manifest/package 的 homepage/repository),无执行期端点;出网只可能发生在 spawn 出的 codex 子进程。
- [ok] 凭证面:只读两个路径类环境变量,不接触任何 key — §3 凭证命中 23 条中与本 skill 相关的是 QIAOMU_CORPUS_DIR / QIAOMU_CODEX_BIN,其余为 mondo 文案里的 credentials 一词与测试用 FAKE_CODEX_MODE / QIAOMU_CORPUS_DIR;无 API_KEY/TOKEN/SECRET 类读取。
- [ok] 写盘面:29 条写盘命中集中在输出目录、sidecar、语言包与测试假图,未触及源文件 — scripts/lib/tools.mjs:144 写 sidecar;scripts/lib/png.mjs:64 写压平 PNG;scripts/build-corpus.mjs 写 ~/.local/share/.../corpus;tests/fake-codex.mjs 写 tmpdir;符合「只写输出目录」的沙箱声明。
- [ok] 判级取样:与站内同类的 codex-image-to-eagle(orange)、ian-xiaohei-illustrations(orange)、baoyu-article-illustrator(orange)口径一致 — 同类「调用外部生图后端并消耗账号额度」均落橙;本 skill 无 red 特征(无逆向/冒充/绕过/任意执行),也无 blue 的可能(自身脚本会触发外部生成)。
- [ok] 第三方语料授权风险已被作者显式隔离,不构成 red — README 明写 689 条语料「没有看到开放授权,所以只做成你本机的数据包,不随仓库分发」,SKILL.md 亦禁止原样转手;仅记为 verdict.risks。
- [ok] meta 核定值核对:license MIT、official_desc 逐字取自 SKILL.md frontmatter、commit 与 audit 一致 — commit=c03a1ccaf77938257bb93f64e09afa9cd08efe29,与骨架 audit.skill_commit 相同;stars/last_push/installs 维持 null(无 per-skill 可定位值)。
6Verdict & Scenarios
30d89f420fcbc925…