ComfyUI Node

String Shelf

Reusable prompt fragments without the wildcard ceremony

By timonknispel·Created 4 months ago·Updated 4 months ago· 0
String Shelf
    • text
    • key
    keydefault
    text
    saved_string_index

    This is the node you'll actually build workflows around. String Shelf holds named, reusable prompt fragments grouped by key - character, style, outfit, scene, negative-prompt bits - and hands you the one you pick as a plain STRING you can wire into a CLIP Text Encode (or a prompt-builder, or anywhere text goes). The pack ships a few example keys (pony_style, character, outfits, scenery) so the pattern is obvious, and you add your own with the String Shelf Editor.

    If you know A1111-style wildcards - the __name__ syntax people still use for character-reference batches - think of the difference here: wildcards randomize a fragment per run, while a String Shelf is deterministic and explicit. You pick the exact fragment, and it arrives in the graph as a first-class value you can inspect, branch on, or feed elsewhere. For "same character, same outfit, different scene" workflows that's usually what you actually want - reproducibility over surprise.

    The inputs that matter:

    • key (default default) - the string group. There's an "Existing keys" dropdown so you don't type group names from memory.
    • text (multiline) - the active text. It's a fallback: whatever you type here is what goes out, unless you pick a saved string from the dropdown or connect an index. You can also tweak the value here per-run without touching your saved strings - the pack's own example workflow calls this out.
    • saved_string_index (optional, INT) - if connected, overrides the dropdown. 0 = first saved under the key, 1 = second, and an index larger than the list clamps to the last entry rather than erroring.

    Outputs: text (STRING) and key (STRING, a pass-through of the group name). The multiline box sits at the bottom of the node precisely so you can see the exact string that's going downstream - good practice when you're splicing five fragments into one prompt.

    Mechanically it's dead simple: if saved_string_index is connected, pull that entry's text from the merged shelf data; otherwise emit whatever the text widget holds. The shelves themselves live in the pack's defaults/strings.json (bundled) merged with user/strings.json (yours), and both the dropdowns and the node refresh live from the server API, so an edit in the editor node shows up here without a restart.

    Install is the one pack install, the easy kind. ComfyUI Manager search for comfyui-prompt-shelf, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/timonknispel/comfyui-prompt-shelf
    

    Restart ComfyUI and refresh the browser; everything appears under the Prompt Shelf category. No requirements.txt, no model downloads - this pack can't break your environment.

    The trap to watch: point key at a group that has nothing saved and the dropdown is empty, so you're quietly just typing into the fallback field. That's not a bug, but it means a mistyped key silently degrades to a manual text box. Check the List Shelf Keys node if you suspect a typo - it shows exactly which keys actually exist.

    CategoryPrompt Shelf

    Inputs (3)

    NameTypeDefaultDescription
    keySTRINGdefault
    textSTRING
    saved_string_indexoptINT

    Outputs (2)

    NameTypeDescription
    textSTRING
    keySTRING