ComfyUI workflow architecture: make routing and dependencies inspectable
A larger workflow becomes maintainable when its inputs, outputs and branch decisions are explicit. This reference treats routing as an engineering interface, not as a memory optimisation, and shows how to preserve a debuggable path through modular ComfyUI graphs.
Write a contract for each module
Identify what each module accepts, what it returns and which settings influence the result. Keep model identity, conditioning and image or latent types explicit. A module named enhancement is too vague if it may resize, regenerate and change colour at the same time.
Use the documented subgraph interface to expose the controls that callers actually need. Keep defaults visible in the project notes and preserve access to the internal graph. A reusable wrapper should reduce navigation effort while allowing a reviewer to trace the data it transforms.
Make branch selection observable
For every optional path, define how the graph selects it and what happens when an input is absent. The rgthree Any Switch chooses the first nonempty input; it does not infer creative intent. Test branch order with distinguishable inputs before relying on it in a complex graph.
Document which nodes belong to an extension rather than ComfyUI core. Record the extension revision and its installation requirements. Keep a simpler fallback where portability matters, and avoid describing a canvas-routing convenience as an undocumented global execution feature.
Debug at the boundaries
When a result changes unexpectedly, inspect the value entering and leaving each module in order. Compare a working baseline with the reorganised graph under the same recorded environment. Keep the first observable difference rather than compensating for it with unrelated sampling changes.
Test missing inputs, wrong model components and disabled optional paths deliberately in a safe copy. The useful result is a clear failure or a documented fallback, not silent selection of an unintended branch. Preserve the test graph and the expected outcome for later maintenance.
Keep architecture claims separate from benchmarks
A shorter wire or a smaller visible canvas does not establish reduced VRAM use. Measure execution costs separately with the actual model, image dimensions and optional stages. If the module performs additional work, include that work in end-to-end timing rather than counting only sampling.
This reference replaces the earlier unverified lab narrative and undocumented sigma claims. It is a design and review method, not a benchmark report. Retain the source workflow, component versions and acceptance checks so another person can distinguish a visual refactor from a change to the generated result.