Nodes/MOSS Storyboard & Layout/MOSS Prompt Compiler
ComfyUI Node

MOSS Prompt Compiler

No model, no API key, no reason not to use it

By ZenHG·Created about a month ago·Updated 4 days ago· 25
MOSS Prompt Compiler
    • prompt
    • report
    • state
    ◄draft►

    There is no model in this node. No GGUF, no weights, no API key, no llama-server, nothing to download. You paste a JSON blob into one text box and get strings out. That's the whole thing - and if you've ever hand-edited bounding-box coordinates at 1am because the layout draft was almost the right format, it's the node that ends that.

    What a "draft" is, and why it doesn't just work

    MOSS-Image ships with an official prompt-enhancer, and besides a plain caption it can hand you a layout draft: a canvas size, a summary, and a list of items each with a bounding box and a label. That draft is in absolute pixel coordinates in xyxy order - corner to corner.

    MOSS doesn't eat that. It wants canvas-centralised coordinates in yxyx order. Nearly the same thing, and that "nearly" is the problem: feed the wrong space to a layout-driven sampler and you don't get an error, you get a picture where the character is 4% off and the caption describes a box nobody drew in.

    The compiler is the translator. Crack open core/skill_draft.py and the whole node is one function: json.loads, validate, re-emit as a single-line JSON with "bbox_coord_space":"abs_centralized" and "bbox_format":"yxyx". A caption draft takes an even shorter path - it validates {"caption": "..."} and hands the text straight back out.

    Pure Python. No sampling, no model warm-up, no randomness. Same input, same output, every time. That determinism is the point: when a storyboard comes out wrong you can rule this node out in one second instead of wondering whether an LLM hallucinated again.

    The one input and the three outputs

    The only input is draft, a multiline text box. The author's tooltip is blunt about what goes in there: the draft, not an already-compiled prompt. Paste the compiled thing back in and the guards (unknown fields, out-of-range boxes, canvas dimensions that aren't multiples of 16) will bounce it.

    Three outputs, all STRING:

    prompt is the compiled result. Wire it into a CLIPTextEncode (your CLIPLoader set to type=moss_image) or straight into a sampler's positive. For a caption draft it's just your caption.

    report is the sanity check. It prints the draft kind, then for layouts the canvas size, element count and a label breakdown like "object 8, character 3, text 1". Fair warning: it's in Chinese, like the rest of this pack's diagnostics. Don't panic, the numbers are the part you're reading.

    state is the interesting one. From a layout draft it emits an editor state blob you paste into the MOSS Layout Editor's import box, so a draft the enhancer wrote becomes an editable canvas with draggable boxes instead of a wall of JSON. Caption drafts have no geometry, so state comes back empty and the report says so.

    Install

    Through ComfyUI Manager, search MOSS Storyboard and install. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ZenHG/ComfyUI-MOSS-Storyboard
    # restart ComfyUI
    

    You want this line in the startup log, or the pack didn't load at all:

    [MOSS SB] v0.5.3 已加载|节点 7 个(出口 v3)|3/4/6/8/9 宫格
    

    Host requirement is ComfyUI 0.42.0 or newer, because the pack leans on native MOSS-Image support. There are zero pip dependencies for the core nodes - requirements.txt is deliberately nothing but comments so Manager skips the pip step entirely.

    And the nice part for this node: it needs no weights. None of the three MOSS model files, no VAE, no text encoder. Install the pack, drag in examples/moss-prompt-compiler.json, click Run - even on a laptop with no GPU, before you've downloaded a single safetensors. It's a good install smoke test for the pack.

    Where it bites

    The error messages are Chinese too - draft 为空:请粘贴官方 prompt-enhancer 的 caption/layout 草稿 JSON。 means your box was empty, and the README's error table has the full mapping. A box with no caption gets 元素 3 没有描述(caption 不能为空). Labels are restricted to object, character and text; anything else is rejected rather than passed through.

    One structural limit to keep in mind: 256 elements max. For a 9-panel storyboard with a handful of props each, that's plenty. For a "describe this entire poster" draft with forty pieces of type, it isn't, and the honest fix is to simplify the draft upstream rather than fight the validator.

    The real gotcha isn't in the node at all. Enhancers drift - they'll invent a prop, label a character "object", or write a canvas size your grid never agreed with, and this node will compile nonsense faithfully. Read report before you read the picture.

    Categorymoss/storyboard

    Inputs (1)

    NameTypeDefaultDescription
    draftSTRING【填什么】官方 MOSS-Image Prompt Enhancer 产出的**草稿**(不是已编译的提示词)。 caption 草稿:{"caption": "..."}; layout 草稿:width / height / bbox_coord_space="abs" / bbox_format="xyxy" / summary / items。 输出 prompt 可直接接 CLIPTextEncode 或采样器 positive; layout 草稿另出 state(可粘贴到布局编辑器的导入框)。 ⚠ 最多 256 个元素;未知字段、越界、非 16 倍数画布会报错。

    Outputs (3)

    NameTypeDescription
    promptSTRING—
    reportSTRING—
    stateSTRING—