ComfyUI Node

State Manager

A character & prompt library that lives on disk, not in your workflow JSON

By xmarre·Created 7 months ago·Updated 8 days ago· 13
State Manager
    • dora_state
    • positive_prompt_template
    • negative_prompt_template
    • settings_json
    • selected_lora_stack
    • state_settings
    • seed
    • state_control
    • character_image
    • fileimage_prefix
    state_json{"version":1,"kind":"dora_state_manager_binding"}
    ui_state_json{"version":2}
    selected_character_iddefault_character
    selected_prompt_iddefault_prompt

    The State Manager is the pack's front-end for reusable characters and prompt presets, and its whole bet is that your workflow JSON shouldn't be where your prompts and LoRA stacks live. You build a character once - a face LoRA here, an outfit stack there, the positive/negative prompt templates, a seed, even a reference thumbnail - and from then on the workflow only stores a small UUID binding. Selecting a character tile or prompt preset just changes the selection; the actual data stays in a persistent per-user library on disk:

    <ComfyUI user directory>/<active user id>/dora_state_manager/state-library.json
    

    It's the same idea as a primitive value node (one source, many consumers, from the plumbing playbook), scaled up to whole character bundles - and it keeps the graph readable instead of one giant prompt blob per character.

    How it works

    The UI opens library-first: an All presets grid showing prompt presets from every character, a Characters pane for the LoRA-state library, and search that matches character names, preset names, filename prefixes, and saved LoRA filenames. Four graph-editing actions do the real work: Save connected, Load connected, Save selected, and Apply selected. Saving captures state from nodes downstream of state_control; loading pushes the selected character/preset back into them. Nothing mutates other nodes until you click load or apply.

    On the storage side it's careful: writes use a lock, optimistic revisions, and atomic os.replace(), malformed files get quarantined as state-library.json.corrupt-<timestamp> instead of overwritten, and a stale write from another browser tab is rejected (hit Reload library to resync). Export/import give you portability: character exports for one character, library exports for the whole thing.

    Wiring it up

    The README's recommended shape is worth copying exactly:

    1. Add the State Manager.
    2. Add State Text Box nodes for editable positive and negative prompt templates.
    3. Add State Seed for an editable seed value.
    4. Add one or more DoRA Power LoRA Loader nodes, each with a unique State slot - face, outfit, style, refiner.
    5. Connect state_control from the manager to each node's state_control input.
    6. Connect text from each text box into the prompt/wildcard path; connect seed from State Seed only to the sampler seed input.
    State Manager.state_control → State Text Box.state_control
    State Text Box.text → Wildcards Processor → CLIP Text Encode
    

    With several DoRA loaders, each loader's State slot matches one saved loader_stacks entry, so Save connected captures all stacks separately and Load connected pushes each back to the right loader. The required inputs (state_json, ui_state_json, selected_character_id, selected_prompt_id) are hidden binding widgets - the frontend fills them.

    The trap to avoid

    Don't wire wildcard-processed or other runtime text back into the manager. It has no runtime capture inputs - that feedback shape isn't part of the design. Store the raw template in the text box and let your wildcard node expand it downstream. And if a selected preset reports "unavailable," it means the UUID isn't on this machine; it won't silently substitute another character.

    Install

    Search ComfyUI-DoRA-Dynamic-LoRA-Loader in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/xmarre/ComfyUI-DoRA-Dynamic-LoRA-Loader
    

    Restart and you're done - no model downloads, no pip dependencies. If you have a workflow that still uses the old DoRA State Manager alias, that node is the same engine under its legacy name.

    Categorystate managers

    Inputs (4)

    NameTypeDefaultDescription
    state_jsonSTRING{"version":1,"kind":"dora_state_manager_binding"}
    ui_state_jsonSTRING{"version":2}
    selected_character_idSTRINGdefault_character
    selected_prompt_idSTRINGdefault_prompt

    Outputs (10)

    NameTypeDescription
    dora_stateDORA_STATE
    positive_prompt_templateSTRING
    negative_prompt_templateSTRING
    settings_jsonSTRING
    selected_lora_stackDORA_LORA_STACK
    state_settingsDORA_STATE_SETTINGS
    seedINT
    state_controlSTATE_MANAGER_CONTROL
    character_imageIMAGE
    fileimage_prefixSTRING