EBU File List Cache
A growing prompt pool that samples itself
- selected_items
- input_items
- combined_items
EBU File List Cache is the most interesting node in the EBU Workflow pack, and it's easy to miss because its name sounds like a caching afterthought. It's actually a persistent, self-maintaining pool: you feed it new lines of text each run, it merges them into a file-based library, and it hands back a random sample from that library. Think of it as a memory for your workflow - you keep dropping prompts (or tags, or seeds) in, and it keeps a deduplicated, capped collection that it samples from on demand.
How it works
The mechanism is worth walking through because it's stateful - this node writes to disk, and understanding the order of operations saves you from surprise. On every run it:
- Loads existing lines from
directory_name/file_name(defaultsstore/output.txt). - Takes your new
input_items(multiline string), strips each line, and merges them into the existing set - deduplicated, since it's a set under the hood. - Shuffles the combined list. If
seedis set, it reseeds the RNG first, so a fixed seed gives reproducible shuffles (and thus reproducible sampling, given the same file contents). - Trims to
limit_list_size(default 100) and rewrites the file, backing up the previous version tooutput.txt.bkfirst. - Samples
num_return_items(default 5) randomly excluding the lines you just fed in, and returns three outputs:selected_items(the sample),input_items(an echo of what you added), andcombined_items(your inputs plus the selection).
The .bk backup is a thoughtful touch - the file is mutated in place, so if a run goes sideways you've got the prior state.
There's a subtle behavior: if input_items is empty, the node doesn't touch the file - it just samples from what's already stored. That means you can run the same workflow repeatedly with a blank input and keep getting fresh random picks from your library, without growing it.
Inputs that matter
- input_items (STRING, multiline) - new lines to add to the pool. Leave empty to just sample.
- directory_name / file_name - where the pool lives. Relative to ComfyUI's working directory.
- num_return_items (INT, default 5) - how many to sample.
- limit_list_size (INT, default 100) - cap on the stored pool.
- seed (INT) - reseeds the shuffle when new items are added.
Outputs: selected_items, input_items, combined_items - all STRING, newline-joined.
Where it fits
The obvious use is a growing prompt library: every run, drop in a couple of new prompt lines (say, from a batch-generation node), and get a random subset back to feed a sampler. Over time the pool accumulates the best of what you've tried, and the sampling means you're not stuck in one pattern. It's also a reasonable poor-man's "LoRA shuffle" - put tag combinations in and let it pick.
Installing
Standard EBU Workflow install - no dependencies beyond Python's standard library. ComfyUI Manager (search "EBU Workflow"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/burnsbert/ComfyUI-EBU-Workflow
then restart ComfyUI.
Gotchas
- It's stateful and mutating: running with new input rewrites your pool file (after backing up to
.bk). That's the feature, but don't point it at a file you care about as a source of truth. - The sample excludes your just-added lines - so a first run with 3 new items and
num_return_itemsof 5 returns at most 0 new items plus whatever was already in the file. If the pool is empty, you get back an empty sample. - Dedup is exact-line matching after stripping whitespace.
"a cat"and"a cat "merge;"A cat"and"a cat"don't. - Relative paths resolve against ComfyUI's working directory, not your workflow folder.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| directory_name | STRING | store | — |
| file_name | STRING | output.txt | — |
| num_return_items | INT | 50–1000 | — |
| input_items | STRING | — | |
| limit_list_size | INT | 1001–10000 | — |
| seed | INT | 0 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| selected_items | STRING | — |
| input_items | STRING | — |
| combined_items | STRING | — |