10 Prompt Critic
A Gemini-powered second opinion on your prompt
- text_agent_config
- json
- revised_prompt
- score
- success
- refresh
Every serious ComfyUI user has stared at a prompt and known it's wrong but not why. Prompt Critic is ZMongo's answer: it hands your prompt to Gemini, asks it to critique it like a professional prompt engineer against a rubric you supply, and gets back a score plus a rewritten prompt that's supposedly ready to drop into a CLIP Text Encode.
The framing matters for what to expect. The critic's own prompt asks for clarity, visual specificity, consistency, contradiction risk, and model fit - the same axes the community actually argues about. Given how much of modern prompting is now "write an instruction, not a tag list" (see the KB's prompt-engineering essay on LLM-encoded models), a model that can restructure a prompt into something structured and specific is genuinely useful when it works.
How it works
The node takes your text_agent_config (from a Text Agent Session node - which means a hosted ZMongo API session, since Gemini calls route through the backend's /api/chat), builds a critique prompt with your target_model, rubric, and optional context_pack, and calls Gemini at a fixed temperature of 0.2 - low, because you want a consistent reviewer, not a creative one. It asks for JSON with a schema: score, per-axis scores, strengths, weaknesses, recommendations, and a revised_prompt.
Then it parses the JSON best-effort, extracts the score and revised prompt, and - if save_to_ledger is on (it is by default) - writes the whole audit into your ledger collection as a prompt_critic record so you keep a history of every critique.
Inputs and outputs that matter
text_agent_config- required; comes from Text Agent Session.prompt- the prompt under review.target_model- what you'll generate with (default "ComfyUI image/video model"), so the critic tailors language appropriately.rubric- what to score. The default covers clarity, specificity, consistency, contradiction risk, and model fit; edit it to match your style.context_pack- optional project memory to include.save_to_ledger- default true; turn off to skip writing the audit record.
Outputs: revised_prompt (STRING - the usable output), score (FLOAT), json (full audit payload including raw Gemini text), success (BOOLEAN), and refresh (bump it to force a re-critique).
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/CentralFloridaAttorney/ComfyUI-ZMongo
Restart ComfyUI or install via ComfyUI Manager ("ComfyUI-ZMongo"). Heavy requirements.txt install regardless of node - pymongo, langchain, sentence-transformers, transformers, FlagEmbedding.
Common issues
- Score 0, but no crash - Gemini returned unparseable text. Check the
jsonoutput; the node falls back to araw_textfield with the score zeroed rather than failing. This usually means the model ignored the JSON schema. successfalse even though it critiqued -save_to_ledgeris on and the ledger write failed (auth/collection issue). Checkjsonfor thesave_payload. If you don't care about the ledger, flipsave_to_ledgeroff.- "Missing ZMongo API session" - the Text Agents family needs a hosted API key session; local file store won't serve
/api/chat. - Revised prompt not usable - it's an LLM's rewrite, not a guarantee. If the model produced
(word:1.4)-style weighting or boilerplate that's inert on modern LLM-encoded models, take the critique, not the rewrite.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| text_agent_config | ZMONGO_TEXT_AGENT_CONFIG | — | |
| prompt | STRING | — | |
| context_packopt | STRING | — | |
| target_modelopt | STRING | ComfyUI image/video model | — |
| rubricopt | STRING | Score clarity, visual specificity, consistency, contradiction risk, and model fit. | — |
| save_to_ledgeropt | BOOLEAN | true | — |
| refresh_tokenopt | STRING | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| json | STRING | — |
| revised_prompt | STRING | — |
| score | FLOAT | — |
| success | BOOLEAN | — |
| refresh | STRING | — |