Nodes/IAMCCS-nodes/IAMCCS PromptQ21Enh
ComfyUI Node

IAMCCS PromptQ21Enh

It writes your prompt with the encoder you already loaded

By IAMCCS·Created about a year ago·Updated 8 days ago· 118
IAMCCS PromptQ21Enh
  • clip
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • image_7
  • image_8
  • image_9
  • image_10
  • positive_prompt
  • negative_prompt
  • wh_ratio
  • ratio_follow
  • thinking
  • parse_ok
  • generator_image_1
  • generator_image_2
  • routing_info
  • generator_image_3
◄taskt2i►
◄prompt►
◄extra_instructions►
◄missing_image_policyerror►
◄reference_modeauto►
◄temperature1.00►
◄top_p0.95►
◄top_k20►
◄presence_penalty-1.0►
◄max_new_tokens0►
◄rerun_each_queuetrue►
◄seed42►
◄generation_profileofficial►

Most prompt enhancers in ComfyUI are a second model bolted onto your graph - an 8B abliterated LLM behind Ollama or a GGUF loader, VRAM juggling included. Prompt-enhancer mentions went up twentyfold between 2023 and 2026, and nearly all those nodes ship their own small model.

IAMCCS PromptQ21Enh doesn't. No key, no server, no second checkpoint - it calls generate() on the CLIP object you hand it, the Qwen-Image 2.1 text encoder you already loaded to run the model. Same weights, second job. That's the "fast local generation" in its description, and it's also the catch: no encoder, no enhancer.

It routes your reference images too, which is the part worth the install.

What it actually does

In t2i mode it's the familiar trick: your rough idea goes in as a chat message, the encoder writes back a production-ready prompt, and you feed that to your text-encode node. The system prompt is strict - preserve subjects, counts, actions, quoted text and style; add composition and lighting detail only when it helps; return strict JSON {"rewritten_prompt":"…","wh_ratio":""}.

Because that answer is parsed rather than trusted, you dodge the classic enhancer failure where chat scaffolding lands in your conditioning as literal tokens. The parser scans for JSON objects, tries json.loads, falls back to json_repair if that module is installed, and accepts rewrited_prompt as an alias for rewritten_prompt. If nothing parses, you get the de-fenced raw text and parse_ok goes False.

In edit mode the images go to the encoder as well, each wrapped in Qwen's vision tokens with an <imageN> label, so the VLM is actually looking at your references. A batch counts as multiple references: eight frames is eight images.

The inputs you'll actually touch

clip is required and must be your Qwen-Image 2.1 encoder. task switches t2i / edit. prompt is your idea. Then image_1 through image_10, all optional. extra_instructions is appended to the system prompt as "Additional constraints" - that's where "keep it under 60 words, no extra people" belongs.

reference_mode has five values:

  • general - every connected image goes downstream in slot order; the default nobody chooses.
  • pose_text_only - the encoder sees image_2 only as a pose description; only image_1 goes to the generator, any <image2> mention is scrubbed from the rewritten prompt, and ratio_follow is forced to <image1>. It exists because the editor's favourite failure is quietly blending two people into one hybrid, or handing you a diptych. Want "keep this person, take that pose"? This is the mode that stops it.
  • subject1_on_canvas2 - the reverse: image_2 becomes the canvas (pose, background, camera and lighting preserved), image_1 the appearance donor. The node re-tags references, so your prompt still means what you wrote.
  • pose_multiref - both full photos go downstream. The author's own tooltip calls it less robust, and routing_info says so out loud. Treat it as the experiment.
  • auto - only fires for edit with two or more images, and it reads keywords rather than analysing: pose words (English or Italian - the author is Carmine Cristallo Scalzi, so "posa" counts) pick pose_text_only; asking to keep image 2's background picks subject1_on_canvas2; otherwise general. When the result surprises you, set the mode yourself.

missing_image_policy decides whether edit mode with no images throws (error) or passes your prompt through untouched. max_new_tokens at 0 runs the fast preset - 768 tokens for T2I, 1024 for edit, capped at 4096 - and presence_penalty at -1 means "author's auto": 0.0 in edit, 1.5 in T2I.

Outputs that matter

positive_prompt goes to your Qwen text-encode node; generator_image_1 and generator_image_2 go into that same node's image inputs instead of your raw loaders, because the node - not your wiring - decides which references the generator sees. wh_ratio and ratio_follow carry ratio strings out of the JSON, parse_ok is your health check, routing_info is a plain sentence about which mode ran and which image went where, and thinking is scratch text (usually empty).

negative_prompt is always an empty string. Wire it for symmetry if you like; don't expect anything from it.

Install

ComfyUI Manager, search IAMCCS Nodes, install, restart, hard-refresh the browser. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes

One install trap from the README: keep exactly one copy in custom_nodes. Duplicates load old node definitions and double frontend routes, which reads as a broken node rather than a stray folder.

No requirements.txt, no declared pip dependencies - this node imports nothing beyond stdlib. Optional: json_repair, worth dropping into ComfyUI's Python environment if parse_ok comes back False a lot. The pack ships no weights, so the encoder behind clip is on you.

Where it goes wrong

"Prompt references image 2 but image_2 is not connected." The node rewrites <imageN>, image N and imageN into routed reference tags and raises rather than silently dropping your instruction. Fix the wiring or the wording.

Wrong encoder. clip.generate() only exists for encoders ComfyUI can run as a text generator; a plain SDXL CLIP won't write you anything. This node is built around the Qwen-Image 2.1 encoder.

Refusals. The encoder is a Qwen VL instruct model, so it carries assistant habits - the same reason captioners reach for abliterated builds. A softened rewrite means the encoder balked, not that your prompt was malformed.

rerun_each_queue. On by default, implemented as IS_CHANGED returning NaN - the standard always-dirty trick, so the enhancer re-runs on every Queue press. Turn it off and the output is cached between queues: that's how you lock a prompt you liked and iterate on the image instead of the wording. And log positive_prompt once or twice: the first time an enhancer invents a detail you never asked for, you want to see it in a text box, not in a 20-step render.

CategoryIAMCCS/Prompting

Inputs (24)

NameTypeDefaultDescription
clipCLIP—
taskCOMBOt2i2 options: t2i, edit
promptSTRING—
image_1optIMAGE—
image_2optIMAGE—
image_3optIMAGE—
image_4optIMAGE—
image_5optIMAGE—
image_6optIMAGE—
image_7optIMAGE—
image_8optIMAGE—
image_9optIMAGE—
image_10optIMAGE—
extra_instructionsoptSTRING—
missing_image_policyoptCOMBOerror2 options: error, pass_through
reference_modeoptCOMBOautopose_text_only analyzes image_2 in the PE but routes only image_1 to the generator. subject1_on_canvas2 routes original image_2 as generator canvas and original image_1 as donor. pose_multiref passes both and is less robust.
temperatureoptFLOAT1.000–2—
top_poptFLOAT0.950–1—
top_koptINT201–200—
presence_penaltyoptFLOAT-1.0-1–5—
max_new_tokensoptINT00–327680 = selected generation profile. Explicit values override the profile.
rerun_each_queueoptBOOLEANtrue—
seedoptINT420–4294967295—
generation_profileoptCOMBOofficialOfficial uses Qwen's 16256 T2I / 24000 Edit limits. Balanced uses 8192; Fast uses 4096.

Outputs (10)

NameTypeDescription
positive_promptSTRING—
negative_promptSTRING—
wh_ratioSTRING—
ratio_followSTRING—
thinkingSTRING—
parse_okBOOLEAN—
generator_image_1IMAGE—
generator_image_2IMAGE—
routing_infoSTRING—
generator_image_3IMAGE—