Nodes/ComfyUI-NS-Util/NS Flex Preset
ComfyUI Node

NS Flex Preset

Save and reload whole groups of node settings as YAML presets

By NakamuraShippo·Created about a year ago·Updated 4 months ago· 5
NS Flex Preset
    • auto_setup
    select_yamlNS_workflow.yaml
    select_preset
    input_preset_name

    Every ComfyUI user has the same problem: you finally tune a node's seven knobs to the perfect values, and there's no built-in way to save them. NS Flex Preset is the pack's answer - a YAML-driven preset manager that stores named sets of values (typed as int/float/string/list) and re-applies them on demand. It's the "bookmarks for your settings" node, and it's the most ambitious thing in this pack by a wide margin.

    The name "Flex" is doing a lot of work: this isn't a simple value loader. It reads YAML preset files, exposes their keys as dynamic outputs typed to whatever each value declares, watches those files for changes, and even has an "auto setup" path that imports another node's inputs into a preset. One node, 1000+ lines of code, a web extension, and a file watcher. It's a small framework.

    How it works

    Presets live as YAML files in nodes/presets/ inside the pack. A preset is a named block of key/value entries, each with a declared type:

    NS_Toon_Filter:
      values:
        num_colors:
          type: int
          value: '16'
        bilateral_d:
          type: int
          value: '9'
    

    The stock install ships two files: NS_workflow.yaml (with presets like "Cross-Attention Map Recycler" and "Micro Conditioning Schedule") and sample.yaml (with "NS_Toon_Filter" and "character_design"). The dropdowns you see - select_yaml, then select_preset - are built by scanning those files, and a watchdog thread watches the directory so you can edit YAML live and see it appear without restarting.

    The output (auto_setup) is a wildcard with dynamic typing: the node's outputs change shape based on the selected preset, each key becoming an output of its declared type. There's also an input_preset_name field to override the dropdown selection programmatically.

    The inputs that matter

    • select_yaml - which preset file. Default NS_workflow.yaml.
    • select_preset - which named preset inside it. This is the one you'll actually flip between.
    • input_preset_name - optional free-text override.

    Where it gets fiddly

    This is a heavy node for a simple idea, and it shows. The auto-setup flow - importing a target node's input widgets into a YAML preset - relies on the bundled web extension (ns_flexpreset.js) and is the most fragile part; it's genuinely useful when it works, but it's the first thing to break across ComfyUI frontend updates. And because the output type changes with the preset, your downstream wiring can go stale if you switch presets with incompatible types - the wildcard type keeps the graph connected, but the actual value types must line up.

    Also worth knowing: the migration logic in the code automatically renames an old nodes/yaml/ directory to nodes/presets/ if it finds one, so older workflows keep working. Nice touch, and a hint that this node has been through iterations.

    When you'd reach for it

    Two honest use cases. First, the simple one: you have a handful of "looks" - a toon pass, a cross-attention recycling profile, a micro-conditioning schedule - and you want to flip between them from a dropdown instead of editing widgets by hand. Second, the power one: you want to version-control your node settings in YAML, diff them, and share them as text. For both, this is a real tool, not a toy.

    Installing it

    Part of ComfyUI-NS-Util:

    cd ComfyUI/custom_nodes
    git clone https://github.com/NakamuraShippo/ComfyUI-NS-Util
    

    or ComfyUI Manager → Install via Git URL with the same URL, restart. It needs pyyaml (for the YAML files) and watchdog (for the file watching) - both in the pack's requirements, both bundled with ComfyUI anyway. No model downloads.

    The honest take

    FlexPreset is over-engineered for what most people need, and the dynamic-output complexity is the kind of cleverness that bites you at 2am. But the core idea - named, version-controllable YAML presets for node settings - is solid, and the bundled presets for the pack's own nodes (Cross-Attention Map Recycler, Micro Conditioning Schedule) are a nice demo of the concept. If you're already invested in this pack, it's worth learning; if you just want to save a couple of settings, there are simpler tools.

    CategoryNS/Utility

    Inputs (3)

    NameTypeDefaultDescription
    select_yamlCOMBONS_workflow.yaml2 options: NS_workflow.yaml, sample.yaml
    select_presetCOMBO5 options: , Cross-Attention Map Recycler, Micro Conditioning Schedule, NS_Toon_Filter, character_design
    input_preset_nameSTRING

    Outputs (1)

    NameTypeDescription
    auto_setup*