Nodes/comfyui-ap-wildcards/AP Wildcards Processor
ComfyUI Node

AP Wildcards Processor

Random prompt variation with a category picker you'll actually use

By Snoopick·Created 5 months ago·Updated 5 months ago· 2
AP Wildcards Processor
    • STRING
    text_input

    AP Wildcards does one thing: it takes a prompt, swaps in random values from your own JSON files, and hands you a finished string. That's the whole deal - one input, one output, no API, no key, no model download. The hook is the frontend: a searchable tree picker on the node itself that turns "drop __category__ into your prompt" from a memory exercise into a click. If you've ever eyeballed a grid of 32 near-identical images and wished some of them had different hair, different lighting, or a different subject, this is the node for it.

    It's old A1111 syntax wearing a ComfyUI costume. Everything inside __double_underscores__ is looked up in a category and replaced with a random pick; everything inside {this|that|the other} picks one option per run. It's the same bracket trick the community has used for years to batch-character-reference without touching a training script. The difference here is the ergonomics.

    How it actually works

    All your wildcards live in JSON files under the pack's own wildcards/ folder (custom_nodes/comfyui-ap-wildcards/wildcards). A file looks like:

    {
      "hair_colors": ["brown", "blonde", "black", "red"]
    }
    

    The category path is built from folder + filename + key. Drop a file at ap/person/face_types.json containing "face_shapes": [...], and you get a category called ap/person/face_types/face_shapes. That's how nested folders become a searchable hierarchy in the picker. On first run it auto-creates wildcards/example.json, so there's always something to click.

    When you queue a prompt, the backend does two passes: it resolves every __category__ (leaving unknown ones untouched - silently, which is the one behavior that'll bite you), then processes {a|b} braces from the innermost pair out. The suffix trick works: {A|B, common suffix} becomes A, common suffix or B, common suffix, which is handy when the tail of an option is fixed ("in the rain", "at night"). The node's IS_CHANGED returns random.random(), so it always re-executes - you never fight a cached output while batching.

    The inputs that matter

    Honestly, there's one: text_input (a multiline string). Type a prompt, click categories in the tree to insert __path/to/category__, then wire the single STRING output into any text input on your graph - usually the positive prompt of a CLIPTextEncode, or a text node feeding a workflow that builds prompts dynamically. Templates (save/load/delete) live in templates.json in the node folder and let you stash full prompt drafts instead of retyping them.

    Installing it

    Clone into custom_nodes and restart:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Snoopick/comfyui-ap-wildcards
    

    ComfyUI Manager users can search "comfyui-ap-wildcards" instead. There are no pip dependencies beyond what ComfyUI already ships (it leans on aiohttp, which is already in the tree) and no model files - this is a pure text node. One genuine trap: the README's clone command literally says yourusername in the URL. That's a copy-paste leftover from the template; use the real repo URL above or you'll clone nothing.

    Where people get burned

    The usual failure is an empty category list - check that JSON actually exists in wildcards/, and peek at the browser console (F12) and the ComfyUI console if nothing shows. A single malformed JSON file gets skipped with a console error, and since unknown __categories__ are passed through verbatim, a typo in a category name won't error out - it'll just render __typo__ literally into your prompt. Templates not saving usually means write permissions on the node folder.

    Worth knowing before you commit: this pack keeps its wildcard files in its own folder, not a shared directory. If you already run Impact Pack's WildcardProcessor with an existing wildcard library, AP Wildcards won't read it - you'd be maintaining a second set of JSONs. For a fresh setup, though, the picker makes it the least-fiddly option around. If your wildcards live in a shared folder, the pack's a no. Otherwise it's a genuinely nice way to add variety without leaving the graph.

    Categoryap/utils

    Inputs (1)

    NameTypeDefaultDescription
    text_inputSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING