Ollama Prompt Refiner (Nukun)
Your local Ollama, turned into a prompt factory
- positive
- negative
- report
- base_prompt
- foreground_prompt
- background_prompt
- plan_json
- review_json
This is the heavyweight of the pack and the reason a lot of people install it: a local Ollama model that takes your rough "word salad" prompt and rewrites it into a properly split prompt set for a specific base model - Pony v6, Illustrious, Pony v7, Z-Image, Anima, Wan 2.2 video, or Krea 2. No cloud, no API key, no censored frontier model deciding your subject is a problem. If an LLM-in-the-graph prompt enhancer is the thing you've been wanting, this is a well-built, extremely opinionated version of it.
The philosophy here is the right one, and it's the same one the community converged on: don't ask the LLM for one free-form rewrite, give it a tightly scoped job. The node asks for split outputs - base_prompt, foreground_prompt, background_prompt - plus a combined positive and negative, and it validates that the output is actually model-appropriate. For Pony v6 and Illustrious it pre-sorts your random words into fixed/base, foreground, background, style and discarded-noise buckets before the LLM ever sees them. That's the kind of guardrail a plain chat model won't give you.
How it works
You connect word_salad (typically from the pack's Random Vocab String List or Multi Vocab String List), pick target_profile, and the node talks to your local Ollama server at ollama_url (default http://127.0.0.1:11434) using ollama_model. The model dropdown refreshes live from Ollama's /api/tags, so pick the model, not the URL guesswork. Default model is autoren-darkidol-llama-3-1-8b:latest - a small abliterated Llama 3.1 8B, exactly the profile the KB says is right for this job: small, obedient, uncensored. German word_salad input gets translated to English first, which is a nice touch nobody else ships.
The pipeline is where it gets sophisticated. Default pipeline_mode = single is one request plus a JSON-repair retry when output is malformed. plan_compile adds a planner stage that first classifies your noisy input into a fixed JSON plan, then hands both plan and source to the compiler. plan_compile_review adds a semantic reviewer and at most one correction. Each mode costs more Ollama requests - two or three per run plus possible repair - so it's slower, but the review stage genuinely catches the "LLM invented a character you didn't ask for" failure that unconstrained enhancers are famous for.
The inputs worth setting as a beginner:
style_anchor- fixed character names, LoRA triggers, quality tags that must survive the rewrite. Use it; it's the difference between "Ollama kept my character" and "Ollama invented a new one."target_profile- one profile per run. Pony v7 default.style_cluster(default 430) - the Pony v7style_cluster_XXXXheader value.prompt_mode-strictstays grounded in your text;creativelets it invent supporting detail and bumps sampling temperature.fallback_mode-adaptiverebuilds locally when Ollama fails,continuepushes through transport errors,strictstops with a detailed error.adaptiveis the default and the sane one for unattended runs.
Outputs
positive and negative go to your text encoders. base_prompt/foreground_prompt/background_prompt are the split pieces for workflows that feed regional conditioning. report tells you what ran, plan_json and review_json show the planner/reviewer output (empty {} when that stage didn't run).
Installing it
Clone the pack, restart, and you're most of the way there - the node itself has no Python deps beyond the pack's own. The real dependency is Ollama itself:
cd ComfyUI/custom_nodes
git clone https://github.com/OnekoSL/Nukun_ComfyUI_Nodes.git
Then make sure Ollama is running (ollama serve), and pull a model: ollama pull autoren-darkidol-llama-3-1-8b:latest. The default context_length is 4096; the node unloads the model after each run by default to free VRAM for the diffusion pass - leave unload_after_run enabled unless you know why you need it off.
Common issues
Almost every problem is Ollama-side, not node-side. Malformed JSON gets one repair retry, then falls back per fallback_mode - if you see repeated fallbacks, your model is weak at structured output, so try a better one or lower temperature. If the model dropdown is empty, Ollama isn't reachable at ollama_url or /api/tags isn't answering. And a note for Pony v6/Illustrious: this node changed its output contract in newer versions - old workflows that expected separate pony_v6_* outputs need reconnecting to positive and negative. Read the report output when something looks off; it's unusually honest about what happened.
Inputs (19)
| Name | Type | Default | Description |
|---|---|---|---|
| word_salad | STRING | English, German, or mixed random vocabulary. Natural German wording is translated to English automatically before refinement. | |
| ollama_url | STRING | http://127.0.0.1:11434 | Base Ollama URL, usually http://127.0.0.1:11434. |
| ollama_model | COMBO | autoren-darkidol-llama-3-1-8b:latest | Local Ollama model used to rewrite the prompt. The dropdown refreshes from the selected Ollama URL in the browser. |
| target_profile | COMBO | pony_v7 | Prompt profile to generate. Ollama only writes this one split prompt set per run. |
| seed | INT | 00–18446744073709550000 | Seed passed to Ollama for repeatable prompt rewriting. |
| temperature | FLOAT | 0.450–2 | Ollama generation temperature. Lower is more deterministic; Reka Flash 3 recommends 0.60. |
| top_p | FLOAT | 0.900.01–1 | Ollama nucleus sampling value. Reka Flash 3 recommends 0.95. |
| style_cluster | INT | 4300–2048 | Pony v7 style_cluster number used in the structured prompt header. |
| timeout_seconds | INT | 1201–600 | Maximum time to wait for each Ollama request. Use 180 or more for a large reasoning model with plan_compile_review. |
| context_length | COMBO | 4096 | Ollama num_ctx context window. Higher values need more VRAM/RAM and may be limited by the selected model. |
| style_anchoropt | STRING | Optional fixed motifs, character names, LoRA tags, or quality tags to preserve. | |
| leftopt | STRING | Optional English or German creative guidance for the left side of natural-language prompts. | |
| rightopt | STRING | Optional English or German creative guidance for the right side of natural-language prompts. | |
| topopt | STRING | Optional English or German creative guidance for the top area of natural-language prompts. | |
| bottomopt | STRING | Optional English or German creative guidance for the bottom area of natural-language prompts. | |
| fallback_modeopt | COMBO | adaptive | Single mode applies this to natural profiles; pipeline modes use it for every stage and target profile. |
| pipeline_modeopt | COMBO | single | single keeps the classic refiner; plan_compile adds a planner; plan_compile_review also adds semantic review and at most one correction. |
| unload_after_runopt | BOOLEAN | true | Unload the Ollama model after the complete node run so ComfyUI can reclaim RAM and VRAM. |
| prompt_modeopt | COMBO | strict | strict stays close to the input; creative may invent coherent supporting details and uses broader sampling. |
Outputs (8)
| Name | Type | Description |
|---|---|---|
| positive | STRING | — |
| negative | STRING | — |
| report | STRING | — |
| base_prompt | STRING | — |
| foreground_prompt | STRING | — |
| background_prompt | STRING | — |
| plan_json | STRING | — |
| review_json | STRING | — |