ComfyUI Node

KV Load from Registry

A dropdown of JSON files, straight from disk

By millerlight·Created about a year ago·Updated about a year ago· 0
KV Load from Registry
    • store
    • path
    file_name(none)

    KV Load from Registry is how KVTools gets its data off the graph and onto disk. Where KV Load Inline makes you paste text into the node, this one gives you a dropdown of JSON files living in <ComfyUI>/custom_kv_stores/ and loads the one you pick as a KV store - plus the file's full path, which the image nodes use to find their pictures.

    That's the whole point of the "registry" idea: your prompt libraries and config data become plain files you can edit with any text editor, share with other people, or swap between projects without rebuilding your graph. Drop millerlight-styles.json into custom_kv_stores/, select it in the dropdown, and every KV Get node pointed at its store updates instantly.

    How it works

    At startup the pack scans custom_kv_stores/ for *.json files, reads the top-level keys from each, and writes the result to web/kv_registry.json (served to the frontend at /extensions/ComfyUI-KVTools/kv_registry.json). That file is the "registry" that populates this node's dropdown and KV Get's key lists. The node itself just re-reads the chosen file and parses it with the same auto-detect parser as KV Load Inline - JSON objects, or key=value lines.

    One structural note: the source uses os.getcwd() as the base, so in a normal install that resolves to your ComfyUI root. If you ever see files not appearing, confirm where ComfyUI's working directory actually is.

    Inputs and outputs

    Just one input that matters:

    • file_name (enum) - the dropdown, populated from JSON files in custom_kv_stores/. The default entry is (none), which loads an empty store.

    Outputs:

    • store (KV) - the parsed data, wired into KV Get Value.
    • path (STRING) - the full path to the JSON file, wired into the registry_path input of the two image nodes.

    Adding a new file

    Drop your JSON into the folder and restart ComfyUI so the registry rebuilds:

    # from your ComfyUI root
    mkdir -p custom_kv_stores
    cp my-styles.json custom_kv_stores/
    

    The frontend also exposes a POST /kvtools/refresh_registry endpoint to rebuild the cache without a full restart, and the pack auto-rebuilds the registry at startup. Keep the JSON flat key/value - arrays and nested objects get stringified as values, which is rarely what you want.

    Gotchas

    • New files don't appear until the registry rebuilds (restart, or hit the refresh endpoint). If the dropdown is stale, restart.
    • Selecting (none) returns an empty store and an empty path - that's a feature, not a bug, but it'll confuse you the first time everything silently goes blank.
    • The pack raises FileNotFoundError if a listed file has vanished - rare, but it means the dropdown and the disk can drift apart.

    Install

    ComfyUI Manager → Install via URL → https://github.com/millerlight/ComfyUI-KVTools, or:

    cd /path/to/ComfyUI/custom_nodes
    git clone https://github.com/millerlight/ComfyUI-KVTools.git
    

    Restart and hard-reload the browser (Ctrl/Cmd+Shift+R) so the frontend registers. No pip dependencies to worry about - requirements.txt is empty.

    CategoryUtils/KV

    Inputs (1)

    NameTypeDefaultDescription
    file_nameCOMBO(none)1 options: (none)

    Outputs (2)

    NameTypeDescription
    storeKV
    pathSTRING