MOSS 标准提示词 · 导入 / 整理 / 导出
The one node in the pack the model ever sees
- prompt
- standard_prompt
The other two nodes in this pack are editors. This one is the compiler, and it's the only output that reaches the model. Wire prompt straight into the positive CLIPTextEncode.text and MOSS-Image reads a compact JSON blob: a summary caption plus items with centre-origin pixel boxes. Two minutes of dragging, one string of JSON, no coordinate arithmetic.
It's node three of three - Canvas → Elements → StandardPrompt → CLIPTextEncode - and it needs the first two wired in or you're compiling an empty layout.
What it takes and what it gives back
layout, elements and character_boxes mirror the outputs of the two upstream nodes; wire them one-to-one. state is the hidden layout widget that saved with your workflow. That's the whole input list.
If elements arrives as valid JSON, the node uses your element list in place of the one riding inside the layout - that's how table edits beat raw canvas data. Malformed, or not an array, and it throws rather than quietly compiling the old version.
prompt is the model-facing string: minified JSON with summary, items, bbox_coord_space: "abs_centralized" and bbox_format: "yxyx". standard_prompt is the same data as pretty-printed moss-layout/v1 - the one you copy into a note, diff, or paste back later. Two audiences: machine and human.
How the compile actually works
The interesting part is the coordinate translation. You drew in percent, top-left origin; MOSS wants integers, centre origin, [y_min, x_min, y_max, x_max]. So the compiler multiplies percent against the canvas, converts to centre-origin, then snaps both edges to whole pixels while still enclosing sub-pixel boxes. That snapping is why 1.3.0 raised internal precision from 0.1% to 0.01%: before it, bboxes drifted 0–1px from OpenMOSS's own reference compiler. Compare the two now and they match value for value.
A few rules the compiler enforces, all worth internalising:
- The background and empty text boxes never become items. Only foreground elements with real content get compiled.
- The caption is assembled, not copied. Your global prompt and the background description are joined into
summary.caption, duplicate segments dropped, so writing the same sentence twice doesn't double it. - Text items carry their
textfield. No text, no item - the box stays in the layout. - Optional fields stay out unless you fill them.
summary.meta,summary.canvas(single/multi_panel/collage) andsummary.palettego in when non-empty, as do per-elementtagsandpalette. - No foreground boxes means no JSON. With nothing to place,
promptcollapses to the plain merged caption. That surprises people; it's correct - a layout prompt with zero items is just a sentence.
Importing and exporting, which is half the value
This node is also where you move layouts in and out. It accepts three paste formats: the pack's own moss-layout/v1, an official draft (width/height plus bbox_coord_space: "abs" and bbox_format: "xyxy"), and - since 1.3.1 - a genuine model-facing layout prompt using abs_centralized + yxyx, as printed in OpenMOSS's user guide. That last one carries no canvas size, so it gets reverse-mapped onto whatever your canvas currently is. Useful trick, real trap: if the prompt was generated for a different aspect ratio the coordinates are reinterpreted, not scaled back. Paste a 1:1 layout onto a 9:16 canvas and every box stretches.
"Merge and keep my edits" applies an import without wiping work done since; "Export standard JSON" gives you the readable layout, and "Export official draft" emits the abs/xyxy form the official tooling ingests.
There's also a template library - movie poster, e-commerce promo, magazine cover, character intro card - plus save/update/delete for your own. Templates live in the browser's localStorage keyed to that ComfyUI address, so export before you change ports or machines, and remember applying one replaces the current layout.
Installing it
One pack, three nodes, no separate install. ComfyUI Manager → search MOSS Layout UI, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MIKOU306/ComfyUI-MOSS-Layout-UI.git comfyui-moss-layout-ui
Restart, then Ctrl+F5 - the panels are frontend JavaScript and a cached copy will look like a bug. No pip dependencies (pyproject.toml declares an empty array; it uses ComfyUI's own torch/numpy/Pillow), but it needs a build with the new comfy_api.latest node API. The repo ships no weights: the example workflow expects an INT8 diffusion model in models/diffusion_models, a Qwen3.5 INT8 text encoder in models/text_encoders and a Flux2 small VAE in models/vae.
Where people get burned
Latent size must equal canvas size. Boxes are absolute pixels against the canvas, so a 768×1344 layout sampled at 1024×1024 isn't a scaled image, it's a different coordinate space. The node's diagnostics do read the latent feeding your sampler and flag the mismatch - but it won't fix it for you.
Hand-typed character_boxes. Only a bare 1, 3 list is honoured; anything else is ignored and your would-be character compiles as an object, with no warning. Let the Elements node produce it.
Wiring something that isn't a layout. The pack only treats genuine layout outputs as layout inputs, so a mis-wire reads as "not connected" rather than mangling your prompt. Confusing symptom, sensible design.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| layout | STRING | — | |
| elements | STRING | — | |
| character_boxes | STRING | Item positions to compile as characters, e.g. "1, 3". Empty keeps the element types. | |
| state | STRING | Layout JSON written by the node UI and saved with the workflow. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| prompt | STRING | — |
| standard_prompt | STRING | — |