ComfyUI Extension: comfyui_custom_pipe

Authored by julienpmorand

Created

Updated

0 stars

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

ComfyUI Dynamic Pipe is a lightweight custom node extension that lets you bundle multiple arbitrary node connections into a single pipe connection, then unpack them later.

Looking for a different extension?

Custom Nodes (2)

README

ComfyUI Dynamic Pipe

ComfyUI Dynamic Pipe is a lightweight custom node extension for ComfyUI that lets you bundle multiple arbitrary node connections into a single pipe connection, then unpack them later.

It is useful when you want to reduce visual clutter in large workflows, pass a group of values through a reusable section, or create cleaner custom workflow layouts without being limited to model-specific pipe nodes.

Unlike SD-specific pipe nodes, this extension is designed to be generic. It can carry images, masks, latents, strings, models, conditioning objects, numbers, or nearly any other ComfyUI value type.


Features

  • Pack multiple inputs into a single pipe output.
  • Unpack the pipe back into multiple outputs.
  • Works with arbitrary ComfyUI value types.
  • Dynamic number of visible inputs and outputs.
  • slot_count widget controls how many slots are shown.
  • Refresh slots button manually updates the node UI.
  • Auto-refreshes when slot_count changes.
  • Designed for custom workflows, reusable node groups, and cleaner graphs.
  • No external Python dependencies.
  • Minimal backend code.
  • Minimal frontend JavaScript.

Why this exists

ComfyUI workflows can become visually crowded very quickly, especially when the same group of values must travel across a large graph.

For example, you may have several values that logically belong together:

image
mask
prompt
negative prompt
latent
model
vae
metadata

Without a pipe, each value needs its own long connection.

With this extension, you can do this instead:

Dynamic Pipe Pack
    input_1
    input_2
    input_3
    input_4
        ↓
      pipe
        ↓
Dynamic Pipe Unpack
    output_1
    output_2
    output_3
    output_4

This keeps large workflows much cleaner.


Included nodes

Dynamic Pipe Pack

The Dynamic Pipe Pack node collects multiple inputs and bundles them into one pipe.

Inputs:

| Input | Description | | ------------------------- | ---------------------------------------- | | slot_count | Number of input slots to show and pack | | input_1, input_2, ... | Arbitrary values to bundle into the pipe |

Output:

| Output | Description | | ------ | ---------------------------------------------------------- | | pipe | A single bundled pipe containing the selected input values |


Dynamic Pipe Unpack

The Dynamic Pipe Unpack node receives a pipe and exposes the values again as separate outputs.

Inputs:

| Input | Description | | ------------ | --------------------------------------- | | pipe | The pipe created by Dynamic Pipe Pack | | slot_count | Number of output slots to show |

Outputs:

| Output | Description | | --------------------------- | ----------------------------- | | output_1, output_2, ... | Values unpacked from the pipe |


Installation

Manual installation

Clone or copy this repository into your ComfyUI custom_nodes directory.

cd ComfyUI/custom_nodes
git clone https://github.com/YOUR_USERNAME/comfyui-dynamic-pipe.git

Then restart ComfyUI.


Manual copy installation

Create this folder:

ComfyUI/custom_nodes/comfyui_dynamic_pipe/

The final structure should look like this:

ComfyUI/custom_nodes/comfyui_dynamic_pipe/
├── __init__.py
└── js/
    └── dynamic_pipe.js

Restart ComfyUI after copying the files.


Usage

Basic example

  1. Add a Dynamic Pipe Pack node.
  2. Set slot_count to the number of values you want to bundle.
  3. Click Refresh slots if the visible inputs do not update automatically.
  4. Connect your values to input_1, input_2, etc.
  5. Add a Dynamic Pipe Unpack node.
  6. Set the same slot_count.
  7. Connect pipe from Pack to pipe on Unpack.
  8. Connect output_1, output_2, etc. to the rest of your workflow.

Example:

Image node  ───────→ input_1
Mask node   ───────→ input_2
Text node   ───────→ input_3
Latent node ───────→ input_4

              Dynamic Pipe Pack
                      │
                      │ pipe
                      ↓
              Dynamic Pipe Unpack

output_1 ─────→ image input
output_2 ─────→ mask input
output_3 ─────→ text input
output_4 ─────→ latent input

Slot order matters

The pipe stores values by position.

That means this:

input_1 = image
input_2 = mask
input_3 = prompt

will unpack as:

output_1 = image
output_2 = mask
output_3 = prompt

The extension does not attach semantic names to the slots.

You should keep a clear convention in your workflow. For example:

1 = image
2 = mask
3 = positive prompt
4 = negative prompt
5 = latent
6 = metadata

Dynamic slots

The nodes include a slot_count widget.

For example, if slot_count is set to 5, the node will show:

input_1
input_2
input_3
input_4
input_5

or:

output_1
output_2
output_3
output_4
output_5

When you change slot_count, the frontend JavaScript extension tries to update the node automatically.

If it does not update immediately, click:

Refresh slots

Important technical detail

The backend declares a maximum number of slots.

By default:

MAX_SLOTS = 64

The frontend then shows or hides slots based on slot_count.

This approach is intentional. It is more stable than trying to create truly unlimited dynamic sockets at runtime, because ComfyUI’s backend needs to know the possible input and output structure for validation and execution.


Changing the maximum number of slots

Open __init__.py and change:

MAX_SLOTS = 64

Open js/dynamic_pipe.js and change:

const MAX_SLOTS = 64;

Both values should match.

For example, to support up to 128 slots:

MAX_SLOTS = 128

and:

const MAX_SLOTS = 128;

Restart ComfyUI and hard-refresh your browser after changing these values.


Wildcard sockets

This extension uses wildcard sockets.

That means the pipe inputs and outputs can connect to many different ComfyUI types.

This is what makes the node generic, but it also means ComfyUI may not prevent invalid connections.

For example, ComfyUI might allow you to connect:

output_3 → IMAGE input

even if output_3 actually contains a string.

If the wrong type is connected, the workflow may fail during execution.


Recommended workflow style

For best results, use a consistent slot convention.

Example:

input_1  / output_1  = source image
input_2  / output_2  = mask
input_3  / output_3  = positive prompt
input_4  / output_4  = negative prompt
input_5  / output_5  = latent
input_6  / output_6  = model
input_7  / output_7  = vae
input_8  / output_8  = metadata

You may also want to add ComfyUI note nodes near your Pack and Unpack nodes to document what each slot means.


Example use cases

Cleaner long-distance wiring

Instead of dragging many connections across a large workflow, pack them near the source and unpack them near the destination.


Reusable workflow sections

If you have a section of your workflow that expects the same group of values every time, pass them through a single pipe.


Custom non-SD workflows

This extension is not limited to standard Stable Diffusion model pipes.

It can be used with arbitrary custom workflows, including:

  • image processing workflows
  • masking workflows
  • metadata routing
  • video workflows
  • control workflows
  • experimental custom-node pipelines
  • reusable graph sections

Passing grouped state

You can use the pipe as a simple grouped state object.

For example:

pipe = image + mask + prompt + latent + metadata

Then later:

unpack pipe → continue workflow

Limitations

The slots are positional

There are no named fields inside the UI.

The first input becomes the first output, the second input becomes the second output, and so on.


The node does not validate individual data types

Because the sockets are wildcard sockets, the extension cannot guarantee that each unpacked output is connected to a compatible input.

You are responsible for keeping track of what each slot contains.


The dynamic behavior is frontend-assisted

The Python backend declares the maximum possible number of slots.

The JavaScript frontend shows or hides slots according to slot_count.

If the UI does not update, use the Refresh slots button.


slot_count should usually match

The Pack and Unpack nodes should usually use the same slot_count.

If Pack uses fewer slots than Unpack, extra outputs may be empty.

If Pack uses more slots than Unpack, only the visible outputs on the Unpack node will be convenient to use.


Troubleshooting

The node does not appear in ComfyUI

Check that the folder is installed here:

ComfyUI/custom_nodes/comfyui_dynamic_pipe/

Make sure the file structure is:

comfyui_dynamic_pipe/
├── __init__.py
└── js/
    └── dynamic_pipe.js

Then restart ComfyUI.


The slots do not update after changing slot_count

Click:

Refresh slots

If that does not work:

  1. Save your workflow.
  2. Restart ComfyUI.
  3. Hard-refresh your browser.
  4. Reopen the workflow.

On most browsers:

Ctrl + Shift + R

On macOS:

Cmd + Shift + R

The Pack node has the wrong number of inputs

Set slot_count to the desired number and click Refresh slots.


The Unpack node has the wrong number of outputs

Set slot_count to the desired number and click Refresh slots.


The workflow errors during execution

Check that each output is connected to the expected type of input.

For example, if:

input_1 = IMAGE

then:

output_1

should be connected to a node expecting an image.


My connections disappeared after reducing slot_count

If you reduce slot_count, extra sockets are removed.

Any links connected to those removed sockets may also be removed.

Increase slot_count again and reconnect the affected links if needed.


Development

Project structure

comfyui_dynamic_pipe/
├── __init__.py
└── js/
    └── dynamic_pipe.js

Backend

The backend is implemented in Python.

It defines:

DynamicPipePack
DynamicPipeUnpack

The Pack node stores values in a simple dictionary:

pipe = {
    "slot_count": slot_count,
    "values": values,
}

The Unpack node reads the dictionary and returns the values in order.


Frontend

The frontend is implemented in JavaScript.

It:

  • detects when a Dynamic Pipe node is created
  • hooks the slot_count widget
  • adds a Refresh slots button
  • adds or removes visible inputs on the Pack node
  • adds or removes visible outputs on the Unpack node
  • resizes the node after changes

Compatibility

This extension is intended for recent versions of ComfyUI that support:

  • Python custom nodes
  • custom frontend JavaScript extensions
  • WEB_DIRECTORY
  • LiteGraph-style node input/output manipulation

If you are using an older ComfyUI version, update ComfyUI before reporting issues.


Updating

To update the extension:

cd ComfyUI/custom_nodes/comfyui-dynamic-pipe
git pull

Then restart ComfyUI and hard-refresh the browser.


Uninstalling

Delete the extension folder:

ComfyUI/custom_nodes/comfyui_dynamic_pipe/

Then restart ComfyUI.

If you open an old workflow that used these nodes, ComfyUI will show them as missing.


Frequently asked questions

Is this the same as Impact Pack pipes?

No.

Impact Pack pipes are very useful, but many of them are designed around common Stable Diffusion workflow objects such as model, CLIP, VAE, positive conditioning, and negative conditioning.

This extension is generic and positional. It is meant for arbitrary custom workflows.


Is this the same as Pack/Unpack from List Utils?

It serves a similar purpose, but the implementation is different.

This extension uses a fixed maximum slot count and a refreshable frontend UI. It does not rely on detecting another node’s connected state to decide the output layout.


Can I use this with images?

Yes.


Can I use this with masks?

Yes.


Can I use this with strings?

Yes.


Can I use this with models, CLIP, VAE, or conditioning?

Usually yes, but remember that the extension uses wildcard sockets. Keep your slot order consistent.


Can I pack a pipe inside another pipe?

In principle, yes. A pipe is just another value passed through ComfyUI.

However, deeply nested pipes may make your workflow harder to understand.


Does this improve performance?

No.

This extension is mainly for workflow organization.

It does not make generation faster, reduce VRAM usage, or optimize model execution.


Does this reduce memory usage?

No.

The pipe stores references to values already being passed through the graph. It is not intended as a memory optimization tool.


Does this work as a reroute replacement?

Partially.

A reroute node lets you clean up one connection.

Dynamic Pipe lets you combine several values into one connection and unpack them later.

They solve related but different problems.


Why not use named fields instead of numbered slots?

Numbered slots are simpler and more generic.

Named fields may be added in a future version, but they require more UI state management.


Why is there a maximum slot count?

ComfyUI’s backend needs to know possible inputs and outputs ahead of execution.

A fixed maximum keeps the node stable while still allowing the UI to feel dynamic.


Roadmap ideas

Possible future improvements:

  • named slots
  • custom labels for each slot
  • automatic slot labels on Pack and Unpack
  • pipe inspector node
  • pipe passthrough/edit node
  • optional strict type checking
  • import/export slot presets
  • better handling of workflow reloads
  • automatic synchronization between Pack and Unpack slot counts

Contributing

Contributions are welcome.

Good contribution ideas include:

  • bug fixes
  • compatibility improvements
  • UI improvements
  • better slot labeling
  • documentation improvements
  • example workflows
  • screenshots
  • tests

Before opening a pull request, please make sure your changes are focused and easy to review.


Reporting issues

When reporting an issue, please include:

  • ComfyUI version or commit hash
  • operating system
  • browser
  • Python version
  • exact error message, if any
  • steps to reproduce
  • screenshot or workflow snippet, if possible

Useful information:

What did you expect to happen?
What actually happened?
Does clicking Refresh slots fix it?
Does restarting ComfyUI fix it?
Does hard-refreshing the browser fix it?

License

Choose a license before publishing.

Common options:

  • MIT License
  • Apache License 2.0
  • GPL-3.0 License

If you are unsure, MIT is a common permissive choice for small ComfyUI custom-node projects.

Example:

MIT License

Copyright (c) YEAR YOUR_NAME

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files...

Replace this section with the full license text if you publish the repository.


Disclaimer

This is an experimental ComfyUI custom node extension.

It is intended to help organize workflows by bundling and unbundling arbitrary values. Because it uses wildcard sockets, it does not guarantee type safety.

Use clear slot conventions and test your workflows carefully.


Credits

Built for the ComfyUI custom-node ecosystem.

ComfyUI is developed by the ComfyUI project and its contributors.


Repository name ideas

Possible repository names:

comfyui-dynamic-pipe
ComfyUI-DynamicPipe
ComfyUI-CustomPipe
ComfyUI-GenericPipe
ComfyUI-MultiPipe

Recommended:

comfyui-dynamic-pipe

Run ComfyUI workflows without the setup

No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.

Learn more