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.
1实现原理 · 为什么它能做到
把只有 Codex 内部可调用的生图能力经 `codex app-server`(stdio JSON-RPC)中继出来,再补上让图「能用」的工艺层:24 模板/48 预设/20 Mondo 设计师与一套防编造规则
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.
调用入口有确定优先级:MCP 工具优先,其次本目录 CLI,两者都不可用则引导安装,并明令不得用代码伪造图片
**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.
首次请求必须先给至少四个机制不同的方向(文字主导/平面结构/摄影/产品近摄/材料空间,外加一个 Mondo 设计师方向),且不得把两种机制混进同一张图
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.
海报/封面/卡片/幻灯片必须有排版层:用 exact_short 给出 headline 加 `|` 分隔的成套短文案;只有标题或没有字,得到的是概念图而不是海报
**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.
提示词变量语义被约束:颜色按角色(背景/主色/强调/墨)而非固定 hex;事实与数字只能来自用户,禁止编造价格、统计、人名、日期、二维码、logo
Colours are **roles** (background, primary, accent, ink), not fixed hex values.…No invented facts: prices, statistics, titles, names, dates, weather, quotes, QR codes, logos.
默认每个选定方向各生成一张(最多四张)并行调用,`count` 只用于同方向变体;每次生成消耗用户 Codex 额度,禁止测试性生成
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.
生成后必须逐图对照工具打印的 acceptance_checks 复核(首眼焦点、必须成立的关系、材料位置、文字与身份、无编造),失败只改承载该关系的一句并重生成一次
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.
本地 689 条参考提示词语料只用于学习「一种机制怎么被描述」,禁止把语料提示词原样当用户提示词发送
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.
交付契约要求回报绝对路径、像素尺寸、所用方向(模板/预设或 Mondo 设计师)、假设、验收结果与 prompt sidecar 位置
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.
2核心能力
3外部依赖
| 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 可执行路径与本地语料目录) |
4管控建议与判定依据
- scripts/: 执行本地脚本或命令: node scripts/cli.mjs …(suggest|compose|generate|search|prompt|list,主要入口)
- 网络端点: 声明外部网络访问: 本 skill 目录内无任何 HTTP 请求代码(风险扫描「網路請求」无命中)
- 本地工作目录: 文件读写与工件输出: 图片输出目录(默认 ~/Pictures/qiaomu-codex-imagegen/<日期>,或用户指定 out_dir)
5第二遍独立确认
- [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 可定位值)。
6结论
30d89f420fcbc925…