Nodes/ComfyUI-FunPack/FunPack Enhance Prompt
ComfyUI Node

FunPack Enhance Prompt

A language model rewrites your prompt before the encoder ever sees it

By digital-garbage·Created about a year ago·Updated about 14 hours ago· 20
FunPack Enhance Prompt
  • clip
  • image
  • enhanced
  • status
◄text►
◄enabledfalse►
◄instructions►
◄max_length400►
◄greedyfalse►
◄temperature0.70►
◄top_p0.92►
◄top_k50►
◄min_p0.05►
◄repetition_penalty1.30►
◄presence_penalty0.00►
◄seed0►
◄thinkingfalse►
◄encoder_file►
◄encoder_familystable_diffusion►
◄use_imagetrue►
◄shortcuts►
◄lorebooks►
◄reference_intro►
◄chat►

You type "a woman walks through a market at dusk" and get something serviceable and a bit flat. Now imagine a small local LLM reading that, noticing you never said what she's wearing or what the light is doing, and handing back two paragraphs of concrete, filmable prose - with sound described, motion in the present progressive, and no characters you didn't ask for. That's this node. It's the "prompt enhancer" pattern, and FunPack's version has one property that matters more than any of the others: when it fails, your prompt goes through unchanged.

The mechanism, and why it lives on a CLIP

The input that surprises people is clip. This node doesn't talk to an API and needs no key - it runs the language model that's already sitting inside a ComfyUI text encoder, using ComfyUI's generate/decode pair. If you've used that pattern before, you know the constraints: the encoder has to actually be able to generate. Gemma and Qwen encoders can. A plain CLIP cannot, and the node checks for the capability rather than assuming.

The instruction it sends is fixed in the source, and it's a good one. Keep every element the user asked for. Add concrete visual detail where the prompt is vague. Describe motion in the present progressive. Add a matching soundscape. Reproduce quoted speech exactly. Don't invent camera moves, don't invent characters. Output one paragraph of plain prose, no preamble, no markdown. That last clause is doing more work than it looks like - the classic failure of an LLM in a graph is handing you "Here is your enhanced prompt:" as literal conditioning tokens. You can override the instructions through the instructions field; empty means the built-in text.

There's also a caching detail worth knowing because it changes behaviour you'd otherwise find baffling: when enabled is on and seed is 0, the node deliberately reports itself as changed on every run, so you get a fresh rewrite each time instead of ComfyUI handing back the cached one. Set seed to a fixed number and the same prompt gives you the same rewrite, run after run.

The fields a beginner actually sets

enabled - off by default, and off means the model isn't even loaded into a generation. Turn it on when you want it.

text - the finished prompt. The output enhanced is a STRING that goes into your CLIP Text Encode.

max_length - the rewrite's token ceiling, 400 by default. greedy gives you the likeliest word every time and hides the sampling dials; otherwise you get temperature, top_p, top_k, min_p, repetition_penalty and presence_penalty, with the defaults the author chose for a chat encoder. thinking lets a reasoning model think first - the tooltip's warning is exact, the reasoning eats the budget, so raise max_length if you turn it on.

Then the ones you can ignore for a while: encoder_file and encoder_family (a separate encoder just for rewriting - this is the one you need on H3, because H3's own encoder can't write prose and Gemma 4 worked with the default family), image and use_image (show the model a picture alongside the prompt), and shortcuts, lorebooks, reference_intro, chat (reference entries and your own feedback on earlier rewrites, which switches the model into a revision prompt).

Outputs: enhanced and status. Read status - it reports whether it generated, how many characters, and why it didn't.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/digital-garbage/ComfyUI-FunPack
cd ComfyUI-FunPack && pip install -r requirements.txt

Restart, then check Settings ▸ About FunPack in the /funpack/ UI if you installed through ComfyUI Manager - the README notes Manager only serves 5.0 from the Registry once it's published there. The pack pulls comfy-kitchen>=0.2.32 and gguf; the LLM itself is whatever text encoder you already have, so the model download question here is "do you have a Gemma or Qwen encoder in models/text_encoders", not a FunPack-specific download.

Common issues

status says it didn't run. Either enabled is off, or your clip has no generate capability. The node is honest about which, and the prompt went through as typed either way - which is the right default, since an enhancer that empties your prompt renders a blank video and blames the model.

Your weights and timed phrases stopped working. The node scans for markup and logs a warning about exactly this: (word:1.5) and [a@2-4] are read by the model as plain text, so with the enhancer on, markup does not survive a rewrite. Pick one - spell everything out in instructions, or keep the markup and leave the enhancer off.

Every run gives a different prompt. That's seed at 0. Fine for exploring, terrible for reproducing a look you liked.

The rewrite invented a character, or drifted. This is the honest ceiling of the whole approach: an enhancer adds detail, and unconstrained it adds detail you never asked for. Narrow instructions and use chat to correct it, or chain two tightly-scoped steps instead of one open-ended rewrite. It removes the blank-page problem. It is not a writer.

CategoryFunPack/Conditioning

Inputs (22)

NameTypeDefaultDescription
clipCLIPA text encoder that can generate text (Gemma, Qwen...).
textSTRING—
enabledBOOLEANfalseOff: the prompt passes through and the model is not run.
instructionsoptSTRINGWhat the model is told to do. Empty uses the built-in instructions.
max_lengthoptINT40032–4096The longest rewrite, in tokens.
greedyoptBOOLEANfalseAlways the likeliest word. Hides the sampling dials below.
temperatureoptFLOAT0.700–2—
top_poptFLOAT0.920–1—
top_koptINT501–1000top_p and min_p only apply while top_k is above 0.
min_poptFLOAT0.050–1—
repetition_penaltyoptFLOAT1.301–2—
presence_penaltyoptFLOAT0.000–2—
seedoptINT00–184467440737095500000 = a fresh rewrite every run. Any other number repeats the same rewrite.
thinkingoptBOOLEANfalseLet a thinking model reason first. Its reasoning eats the token budget.
encoder_fileoptSTRINGA text encoder file just for rewriting (Gemma, Qwen...). Empty uses the model's own encoder.
encoder_familyoptSTRINGstable_diffusionWhich family that file is for. Only used with an encoder file.
imageoptIMAGEShown to the model alongside the prompt.
use_imageoptBOOLEANtrueSend the picture (when one is connected) to the model.
shortcutsoptSTRINGShortcut names to hand the model as reference, one per line.
lorebooksoptSTRINGPaths to lorebook or shortcuts JSON files, one per line.
reference_introoptSTRINGThe line above the reference entries. Empty uses the built-in one.
chatoptSTRINGYour comments on earlier rewrites (Composer > Chat).

Outputs (2)

NameTypeDescription
enhancedSTRING—
statusSTRING—