A small, growing collection of ComfyUI custom nodes. Plain Python, no extra dependencies.
| Node | Category | What it does |
|---|---|---|
Structured Prompt Batch (OKP_StructuredPromptBatch) |
OKP/prompt |
Reads a structured JSON prompt file and outputs one prompt per queued run — groups, per-item steps/size, live progress, resumable cursor. |
cd ComfyUI/custom_nodes
git clone https://github.com/okingjo/okingjo-node-pack.gitRestart ComfyUI. Nodes appear under the OKP/* categories.
Feed one structured prompt per queued run, pick which groups to run, and resume a batch after a restart. All node text is English; prompt content can be any language.
One format only: JSON. The file extension does not matter (.json / .txt / .yaml are all
parsed the same way). Parsing is deliberately relaxed: comments, trailing commas, unescaped \(
and a missing outer brace are accepted.
[
"1girl, solo, robin \\(honkai: star rail\\), harmony dress, full body",
{
"positive": "1girl, solo, robin \\(honkai: star rail\\), cowboy shot",
"steps": 30
}
]- Every element of the array is one image. A string means "positive only"; an object overrides whatever keys you want.
- Every field is optional. Without
steps/width/heightthe node outputs-1(= not specified, keep whatever your graph uses).
{
"defaults": {
"positive_prefix": "highres, absurdres",
"negative": "lowres, worst quality, jpeg artifacts"
},
"groups": [
{
"name": "white dress stage",
"items": [
"1girl, solo, robin \\(honkai: star rail\\), harmony dress, full body, stage lights",
{
"positive": "1girl, solo, robin \\(honkai: star rail\\), harmony dress, cowboy shot, singing",
"steps": 30,
"size": "1024x1536"
}
]
},
{
"name": "summer beach",
"defaults": { "negative": "lowres, bad hands" },
"items": [
"1girl, solo, robin \\(honkai: star rail\\), summeretto bikini, beach, sunset",
{
"positive": "1girl, solo, robin \\(honkai: star rail\\), summeretto bikini, sitting, waves",
"width": 832,
"height": 1216,
"seed": 12345
}
]
}
]
}That is 3 images in 2 groups; the written order is the generation order.
| Key | Meaning |
|---|---|
positive / pos / prompt |
positive prompt; replaces the inherited value, never concatenated |
negative / neg |
negative prompt, same rule |
positive_prefix / positive_suffix |
explicit concatenation: prefix, body, suffix |
negative_prefix / negative_suffix |
same for the negative |
steps |
sampling steps |
width / height |
resolution |
size |
"1024x1536" string, split automatically |
seed |
only copied into meta, not a separate output |
| any other key | passed through to meta.extra (e.g. "lora": "styleA:0.8") |
Precedence: item > group defaults > file defaults.
| What you write | What happens |
|---|---|
whole-line // comment or # comment |
ignored (inline // / # are kept, prompts are never rewritten) |
trailing comma before } / ] |
removed |
\( \) not escaped as \\( |
fixed automatically, output still contains a single \( |
missing outer { } |
added |
| UTF-8 BOM / CRLF | handled |
| really broken | JSON parse error: … (line N, column M); the node outputs an empty item and keeps the queue alive |
" inside a prompt. It is the JSON
delimiter — use '…' or no quotes at all.
| Input | Meaning |
|---|---|
file_path |
absolute path, or a path relative to the ComfyUI input directory |
groups |
all / 1,3 / -2 (exclude group 2) / group name (substring allowed); ticking boxes in the panel writes this |
label |
state slot name; empty = file name. Each slot keeps its own cursor |
start_from |
beginning / continue / custom (see below) |
start_index |
1-based item index used when start_from = custom |
order |
sequential / shuffle inside groups / shuffle all (reproducible with seed) |
on_end |
stop / loop / stay on last |
seed |
shuffle seed |
| Output | Type | Notes |
|---|---|---|
positive |
STRING | with prefix/suffix applied |
negative |
STRING | may be empty |
steps width height |
INT | -1 = not specified |
meta |
STRING | JSON: file/slot/group/group_index/item_index/group_total/index/total/start_from/groups/extra |
index total |
INT | current item (1-based) / number of selected items — handy for Image Saver numbering |
group_name |
STRING | usable as an output sub-directory |
| Value | Behaviour |
|---|---|
beginning |
seek to item 1 once (when the mode is selected), then keep advancing across queued runs — a 10-run queue with beginning renders items 1→10 |
continue |
resume the saved cursor, never seek |
custom |
seek to start_index once (when the mode or the index changes), then keep advancing |
↺ Back moves the cursor back one item, Reset clears the cursor and the seek, so the next run
seeks again.
Read lists the groups with their item counts, the checkboxes write groups, the progress bar shows
3 / 4 done · group 1/2 live (server push + 2.5 s polling fallback), and it turns green when the
selected items are exhausted.
State lives in state/spb/<slot>.json: file path, selected groups, cursor and a content anchor
(sha1 of positive + negative).
- restart ComfyUI / the container → continues at the next item
- file edited (items inserted, removed or moved) → the anchor finds the position again
- different file or different group selection → starts at item 1
| Route | Purpose |
|---|---|
GET /okp/spb/read?path= |
parse a file, return groups + item count |
GET /okp/spb/state?label= |
read one slot |
GET /okp/spb/reset?label= / GET /okp/spb/back?label= |
clear / step back one item |
GET /okp/spb/files |
list json/txt files in the input directory |
GET /okp/spb/debug |
state directory + files (troubleshooting) |
# parser (inside the container, use ComfyUI's own interpreter)
docker exec comfyui-cu130 bash -lc "cd /root/ComfyUI/custom_nodes/okingjo-node-pack && /usr/bin/python3.13 tests/test_parser.py"
# end to end (host, ComfyUI on 8188, queue idle)
python3 tests/test_server.py
# resume across a restart (a -> restart -> b)
python3 tests/test_restart.py a && docker restart comfyui-cu130 && python3 tests/test_restart.py b
# re-anchoring after the file was edited
python3 tests/test_restart.py edit
# check any file without ComfyUI
python3 tools/validate.py tests/fixtures/sample_relaxed.txtVerified on ComfyUI 0.44.0: 20 parser checks, 23 end-to-end checks, restart resume and content re-anchoring all pass.
-1means "not specified" — do not wire it straight into an input that requires a positive number.- A node cannot stop the queue: with
on_end=stopthe remaining queued runs output empty strings. - The cursor advances even if the run fails — use
↺ BackorReset. - Do not put an English double quote
"inside a prompt.
skill/SKILL.md is a ready-made instruction file for an LLM (Claude skill format): schema, hard
rules (escaping, no " in prompts), prompt-writing conventions, a five-step workflow and a checklist.
skill/templates/character-groups.json is a fill-in-the-blanks example. tools/validate.py is the
self-check the skill asks the model to run before handing the file over.
nodes/<name>/node.py # exposes NODE_CLASS_MAPPINGS / NODE_DISPLAY_NAME_MAPPINGS
nodes/<name>/parser.py # optional helpers
web/<name>_ui.js # optional front-end panel (served from web/)
The pack loader in __init__.py discovers every package under nodes/ and merges its mappings; a
node that fails to import only prints a traceback and does not break the rest.
.
├── __init__.py # pack loader (auto-discovers nodes/) + WEB_DIRECTORY
├── nodes/
│ └── spb/ # Structured Prompt Batch
│ ├── parser.py # relaxed JSON -> groups/items
│ └── node.py # node, state, HTTP routes
├── web/spb_ui.js # group checkboxes / progress bar / buttons
├── tools/validate.py # standalone file checker
├── skill/ # AI instructions + template
├── tests/ # parser / end-to-end / restart
├── docs/screenshot.png
└── state/ # runtime cursors (git-ignored)
MIT
