ComfyUI Node

Role Saver

The Role Saver

By laolaoruqin·Created 9 months ago·Updated 9 months ago· 0
Role Saver
    • status
    role_name
    role_content
    overwrite_existingfalse
    save_triggertrue

    Role Saver is the half of ComfyUI-Role-Master that actually gets your prompts into the library. The loaders give you the dropdown; this is how the dropdown got stuff in it. It's a write-node: you type a name and a prompt, queue the graph, and the text is permanently parked in the pack's roles.json file for every future workflow to pick up. No retyping, no digging through old workflow PNGs for the prompt you know you wrote somewhere.

    The important thing to understand is that nothing happens when you type. This is a trigger-based node - it does its work when you queue the prompt, and only if you've flipped save_trigger to Save (it defaults to On). Flip it to Wait and it just reports "Waiting for save trigger..." and moves on. That's the safety rail: you don't commit anything until you deliberately run the graph.

    Four inputs, and honestly only three matter on a normal day:

    • role_name - single-line text, the key your role is stored under. The node trims leading/trailing spaces automatically, which sounds trivial until you've fat-fingered " portrait " and spent ten minutes wondering why the dropdown shows two entries.
    • role_content - the multiline box where the prompt itself goes.
    • overwrite_existing - the overwrite protection. Off by default, and with it off, saving a name that already exists returns an error instead of clobbering your old text. Flip it on only when you mean to replace something.
    • save_trigger - described above; think of it as the "write to disk" button.

    The single output is a status string - "Successfully saved role: X", or an error like "Name or Content is empty." It's an output node, so it runs every time, but you don't wire that status anywhere; it's just your confirmation that the save actually landed.

    Install is the same for the whole pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/laolaoruqin/ComfyUI-Role-Master.git
    

    Restart, or grab it from ComfyUI Manager by searching "Role Master". No dependencies, no models, no keys - the node just writes one JSON file. MIT license, works offline.

    Two gotchas worth internalizing. First, the data lands in roles.json inside the pack's folder - that file is tracked by git and not in the ignore list, so an update via git pull can theoretically overwrite your saved library. A one-line backup habit fixes that. Second, like every node in this pack, the roles are per-machine: they live on disk, not embedded in the workflow, so they won't follow you to someone else's install. The trade is that one saved prompt becomes available across every workflow you'll ever make on this box - which, once you have a library of a dozen, is exactly the feature you wanted.

    CategoryRole Master

    Inputs (4)

    NameTypeDefaultDescription
    role_nameSTRING
    role_contentSTRING
    overwrite_existingBOOLEANfalse
    save_triggerBOOLEANtrue

    Outputs (1)

    NameTypeDescription
    statusSTRING