Prompt Cache (GeN13)
Stop re-running your LLM every time you tweak the seed
- text
Once you put an LLM in front of your prompt - a local Qwen writing scene descriptions, a vision model captioning a reference - you sign up for a nasty iteration loop. Every queue re-runs the model. Fourteen seconds of prompt generation before you even start sampling, and a different prompt each time unless you've pinned the seed, which means you're no longer iterating on the image, you're iterating on two random variables at once.
Prompt Cache (GeN13) is the fix: it writes the upstream text to a file, and can replay that file later without the upstream model running at all.
The mechanism, which is better than it sounds
Everything lives flat in ComfyUI/output/prompt_cache/:
scene03.txt ← current, written this run
scene03.prev.txt ← the one automatic backup
scene03.fav.20260831-204512.txt ← a favorite, kept forever
save_as is where this run's text lands; .txt is appended if you leave it off; empty falls back to last_prompt.txt. auto_backup copies the existing file to <stem>.prev.txt before overwriting - one generation only, each save replaces the previous backup. Favorites are a separate, unbounded thing, created by a "Save favorite" button the frontend adds to the node (not a widget you'll find in the API), stamped with a timestamp, and never pruned.
read_file is a dropdown of every .txt in that folder, plus a (same as save_as) sentinel which is the default. That sentinel is the good design decision: a file written during a run is readable immediately, without waiting for the dropdown to repopulate.
The modes, and the bit that actually matters
auto(default) - uses upstream text if it comes back, writes it, and falls back to reading the file when the upstream is None or empty. Mute the LLM node (Ctrl+M) and the node keeps working off the cache without you changingmode.1: upstream- always run the LLM, always write.2: cache- read the file and never touch upstream.3: off- output an empty string.
Here's the thing nobody expects: only 2: cache actually saves you the LLM load. auto has to ask whether there's upstream text in order to decide, and asking means running the branch. The source is explicit about this - the lazy input is only pruned in cache mode. So if the whole point is "don't run Qwen for twenty minutes", 2: cache is the mode you want, and auto is the convenience mode for when you're bouncing between live and cached prompts.
One more from the source: cache mode only prunes the branch if nothing else in the graph still needs it. Another live consumer of the LLM output, or an output node inside that branch, pulls it right back in.
Inputs and outputs
Required: mode, save_as, read_file, auto_backup. Optional: text - the upstream source, usually an LLM output. That's the entire input surface, which is why this node drops into an existing graph without rewiring anything; you splice it inline between the LLM and your CLIP Text Encode.
One output: text (STRING) - upstream text in auto and 1, file content in 2, empty in 3. Wire it into CLIP Text Encode's prompt, or into Text Switch / Show Any if you want to read what the model actually wrote before committing.
The workflow it's built for
The pack's framing is "an LLM-written script" - so: LLM node → Prompt Cache → your encode chain. First run in 1: upstream or auto, get a script you like, hit Save favorite, then flip to 2: cache and iterate on the image without paying for the model again. When you want a fresh script, hit Save favorite first so you don't lose the one you had.
Because the file is plain text in output/, you can also edit it in any editor and the next run in cache mode picks it up. There's no format to break and no database to corrupt.
Installing
Manager → search GeN13 → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/heigen13/ComfyUI-GeN13
pip install -r ComfyUI-GeN13/requirements.txt
requirements.txt is one package, nvidia-ml-py, for the pack's monitor strip. Prompt Cache needs nothing beyond the stdlib and what ComfyUI already ships. No model files.
Practical gotchas
The read_file dropdown refreshes after each run, so a file you just created in save_as won't appear as a choice until then - use the (same as save_as) sentinel if you're chicken-and-egging your way through a first setup.
Unchanged text isn't saved again, which is deliberate (no pointless backups churning), but it means a .prev.txt might be older than you assume if you ran the same prompt three times.
And if you're on a shared or multi-user ComfyUI, output/prompt_cache/ is just a folder in your output directory. Everyone's prompts are in there. Nothing in this pack encrypts anything - including the privacy nodes, whose cover hides the preview and nothing else.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | auto | Mode: auto uses and saves upstream text if connected, else reads the file. 1 always runs upstream, 2 reads the file only, 3 outputs nothing. |
| save_as | STRING | last_prompt.txt | Save as: file name in output\prompt_cache\; .txt is added if omitted. Empty saves to last_prompt.txt. |
| read_file | COMBO | (same as save_as) | Read file: follows save_as by default. .prev files are automatic backups, .fav files are favorites; the list refreshes after each run. |
| auto_backup | BOOLEAN | true | Auto backup: before overwriting, the old file is kept as <name>.prev.txt (one generation); unchanged text is not saved again. |
| textopt | STRING | Text: the upstream source, usually an LLM output; upstream runs only in the modes that need it. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | Text: upstream text in auto and 1, file content in 2, empty in 3. |