Nodes/ComfyUI-Role-Master/Role Loader (A-Z)
ComfyUI Node

Role Loader (A-Z)

The Role Loader (A-Z) dropdown

By laolaoruqin·Created 9 months ago·Updated 9 months ago· 0
Role Loader (A-Z)
    • final_prompt
    • role_content
    • user_input
    role
    user_input

    If you've ever pasted the same 200-word prompt into a fresh workflow for the third time this week, this is the node that makes that stop. Role Loader (A-Z) is the main event of the ComfyUI-Role-Master pack: a dropdown full of the prompts you've saved, one click, done. It's not clever and it's not doing anything to your pixels - it's the text-plumbing layer, and it exists to fight exactly the problem every ComfyUI regular hits eventually: repetition and a prompt that refuses to stay in one place.

    Here's the mechanism. The pack keeps your saved prompts in a plain JSON file called roles.json inside the pack's own folder. Every time the loader builds its input schema, it reads that file and puts every role name into a dropdown - sorted A–Z, hence the name. Pick one and the node hands you three strings out the right side:

    • final_prompt - the one you actually wire to your CLIP Text Encode node.
    • role_content - just the saved role text, no additions.
    • user_input - whatever you typed, passed straight through.

    The one that matters is final_prompt. If you leave the user_input box empty, it's just the saved role. Type something in and it becomes role_content, a blank line, then user_input. And that blank-line join is the part that makes this pack feel current: on the LLM-encoded models of the last couple of years (Flux, Z-Image, Klein), your prompt goes through a chat template, and "system prompt, then user message" is exactly the shape it wants. Save your instructions once as the role, type the actual request in user_input each run, and the loader builds the message for you.

    Two inputs, really. The role dropdown is where you pick; user_input is the multiline box where the per-generation request goes. That's the whole node - which is the point.

    Install is the same story for every node in this pack, so let's get it out of the way:

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

    Then restart ComfyUI. Or search "Role Master" in ComfyUI Manager's Custom Nodes Manager and hit install. There's no requirements.txt, no models to download, no API key - it's pure Python that reads and writes one JSON file. It works fully offline and it's MIT licensed.

    Where people get tripped up: the dropdown is built when the node loads, so if you save a new role and it's not showing up, the graph needs a refresh (reload the workflow or restart) - the list isn't live. Second, the roles don't travel with the workflow. Because they live in roles.json on your disk, sharing the PNG or JSON of the workflow shares nothing - the other person gets your dropdown names, not your text. And since roles.json sits inside the pack directory and isn't gitignored, back it up before you git pull an update, or your library can get clobbered. A fresh install ships with one "Example Role" so you can see it working.

    One chicken-and-egg to know up front: this node only has options once something's in the library, and nothing's in the library until you use Role Saver. Loader and Saver are a pair - save first, load forever after.

    CategoryRole Master

    Inputs (2)

    NameTypeDefaultDescription
    roleCOMBO1 options: Example Role
    user_inputSTRING

    Outputs (3)

    NameTypeDescription
    final_promptSTRING
    role_contentSTRING
    user_inputSTRING