1实现原理 · 为什么它能做到
能力的内核是「把风格编号化」:261 条风格记录(编号 + 原参考名 + 生图名 + 核心视觉特征)从根目录 styles_200_reorganized.md 解析生成 references/styles.json,再由 build_library.py 生成离线可搜索的画廊 HTML。
Users can browse `gallery/index.html` for the numbered contact sheets. The authoritative style content is `../styles_200_reorganized.md`; `references/styles.json` is a generated index and must be refreshed with `python scripts/build_library.py` after the Markdown changes.
输出契约极简且严格:固定四段输出(选中风格 / 中文 prompt / 英文 prompt / 一句说明),并要求 prompt 正文以 `风格名称:#{编号} · {generation_name}。` 与 `Style name: #{number} · {generation_name}.` 开头。
For a valid request, return these four parts: 1. Selected style: number and generated style name. Do not output a core-visual-traits field by default for ordinary prompt-only requests. 2. Chinese prompt: begin the copyable prompt itself with `风格名称:#{编号} · {generation_name}。`; describe only the user's theme and constraints explicitly provided by the user, and always include the indexed author/style name as a short `参考作者/风格名称` label. Do not append core traits, the fixed style anchor, extra style adjectives, generic composition advice, quality claims, or negative prompts. 3. English prompt: begin the copyable prompt itself with `Style name: #{number} · {generation_name}.`; describe only the same theme and user-provided constraints, and always include the indexed author/style name as `Reference author/style name`. Do not append visual-trait prose, generic composition advice, quality claims, negative prompts, or the fixed style anchor. 4. A brief note: the prompt can be pasted into any image AI; generation is controlled by that AI.
默认不生图;只有用户明确要求生成/渲染/预览时才进入生图模式,且先用「完整发送文本」(索引作者名 + 生图风格名)去解析当前图像模型的能力,而不是依据作者名气或在世状态。
When the user explicitly requests image generation, first resolve the current image model (or model family) against `references/model_capabilities.json` or the equivalent runtime capability metadata. The decision uses the complete text that will be sent to the model: the indexed author name plus the generated style name. It is not based on the author's fame or life status.
能力清单是数据而非硬编码:references/model_capabilities.json 用 schema_version/description/default/models 结构描述「某模型能否仅凭名称激活某编号」,默认值强制 unknown + 必须传图。
"description": "Model-specific ability to activate a numbered style from its name. Unknown models must use the image fallback.", "default": { "name_activation": "unknown", "use_reference_image": true, "note": "No verified model capability is available. Pass the numbered image."
决策逻辑由脚本落地并可复现:resolve_reference.resolve() 校验编号范围与取值域(ALLOWED = strong/weak/none/unknown),输出 activation_source(name+style / name+style+traits / reference-image)与过滤后的 prompt_traits。
return ";".join(kept) def get_reference_path(number: str) -> str: reference_grid = grid_path(number) return str(reference_grid if reference_grid.exists() else single_path(number)) def resolve(model: str, style: str, policy: dict | None = None) -> dict:
传参考图时必须注入「参考图隔离块」:中英双语写明只提取线条/笔触/媒介/材质/色彩倾向等风格特征,不得复制主体、人物、服装、道具、动作、场景、构图、文字或故事,主题才是内容唯一来源。
- When an image is passed, inject the following reference-isolation block into the actual image-generation prompt. It is required for every reference-image generation and is not added to ordinary prompt-only output: Chinese: `所附图片仅用于参考画风。只提取参考图的风格特征,例如线条、笔触、媒介、材质、色彩倾向和整体视觉语言;不要使用、复制或延续参考图中的任何主体、人物、动物、服装、道具、动作、姿态、场景、背景、构图、布局、文字或故事。最终画面内容完全以用户提供的主题为准。` English: `Use the attached image only as a style reference. Extract only its stylistic qualities, such as linework, brushwork, medium, material texture, color tendencies, and overall visual language. Do not use, copy, or carry over any subject, person, animal, clothing, prop, action, pose, setting, background, composition, layout, text, or story from the reference image. The user's written theme is the sole source for the image content.` - The user's theme is the sole source for subjects and narrative; the reference image must never override or add content to the theme.
会话初始化靠宿主 MCP:在 Codex 任务/线程首次调用时打开本地画廊(file:///E:/handraw-style/handdraw-style-prompter/gallery/index.html)作为视觉索引,失败则给本地链接回退,且不重复打开、不写状态文件。
1. If this task has not already displayed the gallery, call `mcp__codex_app__open_in_codex` with `target: { type: "browser", url: "file:///E:/handraw-style/handdraw-style-prompter/gallery/index.html" }` so the rendered gallery opens in the in-app browser. 2. Continue with the user's request after the browser call; opening the gallery must not block prompt generation or an explicitly requested image-generation follow-up. 3. Do not repeat the browser call on later turns in the same task/thread. Use the conversation context (not a persistent state file) to determine whether initialization already happened. 4. If the browser call is unavailable or fails, provide this fallback link: [打开手绘风格编号画廊](file:///E:/handraw-style/handdraw-style-prompter/gallery/index.html), then continue normally.
资源定位规则内建:同编号的四宫格参考图优先于单图,路径按每 200 编号分桶(如 201-400),缺图时报告限制并退回纯文本 prompt,绝不臆造或替代参考图。
- If the numbered image is missing or cannot be passed, report that limitation and provide the normal text prompts; never invent or substitute a reference image.
2核心能力
3外部依赖
| 类型 | 依赖 |
|---|---|
| api | 宿主 MCP 工具 mcp__codex_app__open_in_codex(在 Codex 应用内浏览器打开本地 file:// 画廊;skill 自身不含网络调用) |
| api | 外部图像生成工具(由宿主/用户提供;传参考图时使用其 referenced_image_paths 参数)——skill 只产出提示词与路径建议,不调用任何图像 API |
| cli | python3(运行 build_library.py / prompt_style.py;split_contact_sheets.py 另需 Pillow/PIL) |
| package | Pillow(PIL)——仅 split_contact_sheets.py 用于切分拼图为编号单图;非运行提示词所需 |
4风险提醒 风险提醒:蓝色 · 知晓即可
- 文档命令与仓库结构脱节(已实证) — resolve_reference.py / split_contact_sheets.py / validate_library.py 依赖 <repo>/scripts/{style_asset_paths,contact_sheet_registry}.py,这两个模块不在仓库中,SKILL.md「Utilities」的命令当前不可运行;自动化校验与「确定性决策检查」实际不可用,需人工按 SKILL.md 文字规则执行。
- Windows 绝对路径写死 — SKILL.md 中参考图根与画廊链接均写死 E:\handraw-style\…(file:///E:/…),非 Windows 或非该目录布局的环境需改写;缺失路径时 SKILL.md 只要求「报告限制」,不保证自动定位仓库内资产。
- 主题文本无清洗,直接入 prompt — 与同批 hand-drawn 的 35 词注入过滤不同,本 skill 对用户主题不做任何过滤/转义;若主题含指令式文本,会被原样送入下游图像模型。
- 无 LICENSE,商用授权不明 — 仓库未提供许可文件、GitHub API license=null;图像资产约 99MB 且包含以真实创作者(含在世与已故)为索引的风格条目,商用/再分发前需自行确认授权与合规。
- 宿主强绑定 Codex — 会话初始化直接调用 mcp__codex_app__open_in_codex,agents/openai.yaml 又开启 allow_implicit_invocation(模型可自动触发);在非 Codex 宿主中该初始化步骤会失败(有本地链接回退,但「自动开画廊」的体验缺失)。
- 资产体积影响安装 — images/ 约 99MB,README 因此要求安装仓库根 `.`;若只装子目录,画廊与参考图会全部失效。
5第二遍独立确认
- [ok] style 索引与编号连续性 — styles.json 261 条,首条 001 Gemma Correll / Playful Deadpan Doodle,末条 261 OscarAI;validate_library.py 亦硬断言 [number] == 连续 001–261 且 018 必须映射 'Minimal Deadpan Dialogue Cartoon'。
- [ok] 画廊离线自足 — gallery/index.html 中 http(s):// 字面量 0 命中,img/button data-src 全部为 ../../images/<sheet>.png 相对路径,无 CDN/字体/统计外链。
- [discrepancy] SKILL.md 的 Utilities 命令可运行性 — `python scripts/resolve_reference.py --model <model> --style <number>` 实跑报 ModuleNotFoundError: No module named 'style_asset_paths'(脚本把仓库根 <repo>/scripts 插入 sys.path,但该目录与模块不存在,git ls-tree 全仓库无该文件)。同一缺失还被 split_contact_sheets.py 与 validate_library.py 引用(后者另需 contact_sheet_registry)。故 SKILL.md「Utilities」5 条命令中,仅 build_library.py 与 prompt_style.py 当前可运行;这是仓库在 pin commit 上的真实缺陷,非本报告的定位问题。
- [ok] 模型能力清单的覆盖面 — model_capabilities.json 仅 gpt-image-2 一轮清单、123 条编号条目(strong 78 / none 45);未列编号走 resolve() 的 entry 继承 default(unknown + 传图),即保守回退。SKILL.md 第 12-19 行的三级决策与代码分支逐条对应(name+style / name+style+traits / reference-image)。
- [ok] 「与作者名气无关」的声明与代码一致 — 决策只读 name_activation/traits_activation 两个字段,代码中不存在任何依赖 attribution.json(名气/在世状态)的分支;attribution 仅被 validate_library.py 用于「deceased 必须带 source」的完整性断言。
- [discrepancy] 图片资产覆盖与文档一致性 — 实跑 find 统计:images/ 下 19 张分组拼图 + 单图 200 张(001–200 桶)+ 61 张(201–400 桶 = 201–261)+ 45 张 *_grid.jpg(编号 217–261),合计 325 个受控图片文件=git ls-files 中 images/ 的条目数。但 MANIFEST.md 的「已收录图片」只登记 16 张拼图(止于 G_201-216.png),且仍写「images/individual/201-400/201.png–217.png:201–217 的编号单图」「风格编号覆盖:001–217」「当前无缺失编号段」,README/SKILL.md 已按 001–261 描述。判定:MANIFEST.md 为滞后文档,能力面以 261 为准。
- [discrepancy] 路径可移植性 — SKILL.md 第 21 行把参考图根写死为 `E:\handraw-style\images\individual\{bucket}\{number}.png`,第 37/40 行画廊链接为 `file:///E:/handraw-style/...`;这两处只在作者本机成立(本仓库实际位置为 <repo>/images/individual/...)。跨平台使用需按仓库根改写这三处。
- [ok] 无网络外发与凭证读取 — 对 5 个脚本与 SKILL.md/agents/openai.yaml 扫描 http/fetch/requests/urllib/socket/api_key/token/secret:脚本侧 0 命中;SKILL.md 唯一外部动作为宿主 MCP 打开 file:// 本地文件与把路径交给图像工具。resolve_reference 的能力数据来自本地 JSON,不需要联网查询模型能力。
6结论
b025e1b5b2a3616d…70bf51d6b4