ComfyUI Node

PromptDecode

Write your prompts as a TOML file and roll them with a seed

By morino-kumasan·Created 2 years ago·Updated a day ago· 1
PromptDecode
  • toml
  • STRING
  • STRING
  • STRING
  • INT
  • STRING
  • STRING
key_name_list
seed0

This is the node the pack is named after, and the reason to install it. PromptDecode takes a TOML prompt file, a list of key names like base.girl, and a seed, and hands you a positive prompt, a negative prompt, a LoRA tag list, plus a summary you can paste back later to reproduce the whole thing.

What that buys you: a prompt library where a base block sets the model-flavoured preamble and sub-blocks add a character, a pose, a setting - each of which can randomly pick a hair colour or an outfit. Roll the seed, get a new variation of the same recipe. Keep the summary, get that variation back.

One warning before the syntax: this pack has no wiki and essentially no footprint in the usual places - no tutorial videos, no forum threads I could find. The README plus the author's sample workflows are the documentation, and the README covers the TOML side better than anything else here. Read prompts/prompt.sample.toml; that's the real reference.

How it works

PromptLoader supplies the parsed file. Then the node builds a seeded Python Random and walks your key_name_list, resolving each key against the TOML tree and collecting the text it finds. Because every random choice - which sub-block, which hair colour, which {a|b} branch - draws from that seeded generator in a fixed order, the same seed and key list always produce the same prompt. That determinism is the whole trick, and it's why the seed comes out as an output you can store alongside the image.

The TOML side is where the pack gets opinionated. A few things worth knowing before you write one:

  • _t inside a table is that table's text; a bare key = "value" is a leaf. Tables nest, and base.girl means "the girl table inside base", which also pulls in base's own _t.
  • $name inside a string is substituted with another key's value, $::name with a root-level one. So shiny hair, $color hair picks up a color list from wherever you scoped it.
  • _k / _w / _r control random selection: a list of candidate keys, weights for choosing one, or per-key inclusion chances.
  • The key list itself has syntax: base, quality concatenates, {base | quality} picks one, base.girl+boy combines, base.? picks among children and .?? goes deeper. LoRA tags inline as <lora:name:strength>; the node strips them into the LoRA output and swaps in any prompt text you defined for them under ["<lora>"].
  • //, # and /* */ comments are stripped, so you can keep a commented-out key list.
  • Instruction tags cover the rest: <raw>/<neg> for literal text, <case>/<random> for conditional inclusions, and <?route?>, <?set?>, <?grep?>, <?export?>, <?lora name 0.8?>/<?lora_low ...?> for pinning choices, injecting values and exporting settings.

The outputs: Positive, Negative, LoRA name list (wire it to LoadLoraFromLoraList or MultipartCLIPTextEncode), seed, Summary (a formatted text block - paste it into a string node or a note), and Exports, a JSON object built from the file's [_exports] table plus the seed. That exports JSON is the pack's config bus: drop a couple of JsonExtractString/JsonExtractInt nodes on it and your steps, cfg, sampler, scheduler, clip and checkpoint name all come out of the prompt file.

The inputs that matter

toml is a PROMPT_FILE - it needs PromptLoader upstream, a plain string won't connect. key_name_list is your selection; it's a multiline text input, but treat it as one key per line, not prose. seed drives every random choice and has the usual control_after_generate dropdown - set it to randomize when you're exploring, fixed the moment you like something.

Install

Manager search for the pack, or:

cd ComfyUI/custom_nodes
git clone https://github.com/morino-kumasan/comfyui-toml-prompt

restart ComfyUI. No pip install (empty requirements.txt), but you do need Python 3.11+ for the stdlib tomllib that parses your files. The README's install block is stale - old comfyui-utils name, SSH clone URL - so use the HTTPS clone above.

Where people get burned

The seed is used twice, and that's fine. People panic when they see randomize on a node feeding a sampler. Here randomize is what makes the prompt roll differently each queue while still being recorded - the summary and the exports both carry the seed, so you can fix it later and get the same text back.

A typo in the key list is quiet. A key that doesn't resolve contributes nothing to the prompt. You don't get an error, you get a thinner prompt. If a whole block seems to be missing from your output, check how you spelled it in key_name_list rather than assuming the TOML is wrong.

BREAK and weighting ride along as literal text. If your library still has (detailed:1.3) and BREAK in it, this node delivers them faithfully - and on a 2026 LLM-encoded model that punctuation reaches the encoder as literal characters, which is worse than deleting it. The deterministic machinery is great on the SD 1.5/SDXL lineage; on a Qwen3/Mistral-encoded model, prune the CLIP-era syntax out of the TOML first.

Categoryutils

Inputs (3)

NameTypeDefaultDescription
key_name_listSTRINGSelect Key Name
seedINT00–18446744073709550000Random seed.
tomlPROMPT_FILETOML format prompt.

Outputs (6)

NameTypeDescription
STRINGSTRINGPositive prompt
STRINGSTRINGNegative prompt
STRINGSTRINGLoaded LoRA name list
INTINTRandom seed
STRINGSTRINGSummary
STRINGSTRINGExports