Agent skill

Comfyui Node Lifecycle

by jtydhr88 in jtydhr88/comfyui-custom-node-skills

ComfyUI node execution lifecycle - caching, fingerprintinputs/ISCHANGED, validateinputs/VALIDATEINPUTS, checklazystatus, execution order.

MITAuto-check passedAI & LLM Engineering

Install Comfyui Node Lifecycle

skills CLI
$ npx skills add jtydhr88/comfyui-custom-node-skills --skill comfyui-node-lifecycle -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jtydhr88/comfyui-custom-node-skills comfyui-node-lifecycle --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jtydhr88/comfyui-custom-node-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/comfyui-custom-nodes/skills/comfyui-node-lifecycle .claude/skills/comfyui-node-lifecycle && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
comfyui-node-lifecycle
GitHub stars
294
Token cost
~2.9k tokens
SKILL.md length
405 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
MIT

At a glance

ComfyUI node execution lifecycle - caching, fingerprintinputs/ISCHANGED, validateinputs/VALIDATEINPUTS, checklazystatus, execution order.

  • Works in 4 steps: Identifies output nodes… → Builds dependency graph → Topological sort determines execution… → …
  • Debugging execution
  • SKILL.md covers Execution Flow Overview, Execution Order, Cache Control:… and Input Validation:…, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Comfyui Node Lifecycle is an agent skill from jtydhr88/comfyui-custom-node-skills. ComfyUI node execution lifecycle - caching, fingerprintinputs/ISCHANGED, validateinputs/VALIDATEINPUTS, checklazystatus, execution order. Use when debugging execution, implementing caching control, input validation, or understanding execution flow.

Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Diffusion and image models and Caching. It works with ComfyUI. The repository describes itself as: A curated collection of [Claude Code skills](https://docs.anthropic.com/en/docs/claude-code/skills) for developing ComfyUI custom nodes. These skills give Claude comprehensive… The licence is MIT.

When your agent uses it

  • Debugging execution
  • Implementing caching control
  • Input validation
  • Understanding execution flow

Example prompts

  • “/comfyui-node-lifecycle”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Identifies output nodes (is_output_node=True)
  2. Builds dependency graph
  3. Topological sort determines execution order
  4. Only nodes connected to output nodes execute

What it can do on your machine

Read from SKILL.md and the folder at commit 63a78dc. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Comfyui Node Lifecycle loads about 2.9k tokens when it runs. Until then it costs about 69 tokens; SKILL.md has 405 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~69
When it runs · the whole SKILL.md, loaded when a task matches
~2.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jtydhr88/comfyui-custom-node-skills at commit 63a78dc, republished under its MIT licence (© jtydhr88). 405 words, ~2,910 tokens.

Download SKILL.mdSave it as .claude/skills/comfyui-node-lifecycle/SKILL.md (or your agent's skills folder).
name
comfyui-node-lifecycle
description
ComfyUI node execution lifecycle - caching, fingerprint_inputs/IS_CHANGED, validate_inputs/VALIDATE_INPUTS, check_lazy_status, execution order. Use when debugging execution, implementing caching control, input validation, or understanding execution flow.

ComfyUI Node Execution Lifecycle

Understanding the execution lifecycle helps build efficient, correct nodes.

Execution Flow Overview

1. Prompt received from frontend
2. Validation phase
   ├── Look up each node class
   ├── Call INPUT_TYPES() / define_schema() for input specs
   ├── Validate connections and types
   └── Call validate_inputs() for each node
3. Build execution order (topological sort from output nodes)
4. For each node in order:
   ├── Cache check (fingerprint_inputs)
   ├── Input resolution (get upstream values)
   ├── Lazy evaluation (check_lazy_status)
   ├── Execute function
   └── Store outputs in cache
5. Return results to frontend

Execution Order

ComfyUI executes from output nodes backward:

  1. Identifies output nodes (is_output_node=True)
  2. Builds dependency graph
  3. Topological sort determines execution order
  4. Only nodes connected to output nodes execute

Cache Control: fingerprint_inputs (V3) / IS_CHANGED (V1)

Controls when a node re-executes vs uses cached results.

python
class RandomNode(io.ComfyNode):
    @classmethod
    def define_schema(cls):
        return io.Schema(
            node_id="RandomNode",
            display_name="Random Value",
            category="utils",
            inputs=[
                io.Float.Input("min_val", default=0.0),
                io.Float.Input("max_val", default=1.0),
            ],
            outputs=[io.Float.Output("FLOAT")],
        )

    @classmethod
    def fingerprint_inputs(cls, min_val, max_val):
        """Return value compared to last run. Different value = re-execute."""
        # Return unique value each time to always re-execute
        import time
        return time.time()

    @classmethod
    def execute(cls, min_val, max_val):
        import random
        return io.NodeOutput(random.uniform(min_val, max_val))

How caching works:

  • Before execution, fingerprint_inputs() is called with the same args as execute()
  • Return value is compared to the previous run's return value
  • If same → skip execution, use cached output
  • If different → re-execute the node
  • If fingerprint_inputs is not defined → cache based on input values

V1 equivalent (IS_CHANGED):

python
@classmethod
def IS_CHANGED(s, min_val, max_val):
    return time.time()  # always re-execute
not_idempotent Flag

For nodes that should never be cached:

python
io.Schema(
    node_id="AlwaysRunNode",
    not_idempotent=True,  # prevents cache sharing between instances of the same node
    # ...
)

Important: not_idempotent=True does not prevent a node from reusing its own cached output on subsequent runs. It only prevents cache sharing between different instances of the same node type that have identical inputs. To force re-execution every run (e.g., for file-writing nodes), you must also implement fingerprint_inputs (V3) or IS_CHANGED (V1) returning a unique value each time.

has_intermediate_output Flag

For nodes with interactive UI that produce intermediate outputs (e.g., Image Crop, Painter). These behave like output nodes (UI results are cached and resent to the frontend on page refresh) but do NOT automatically get added to the execution list — they only execute if on the dependency path of a real output node.

python
io.Schema(
    node_id="InteractiveCropNode",
    has_intermediate_output=True,
    # ...
)
Show full SKILL.md (173 more words)Show less
External Cache Providers

Share cached node outputs across ComfyUI instances (e.g. a shared network cache) by registering a CacheProvider:

python
from comfy_api.latest import Caching

class MyCacheProvider(Caching.CacheProvider):
    async def on_lookup(self, context):   # context: node_id, class_type, cache_key_hash
        ...  # return Caching.CacheValue(outputs=[...], ui={...}) or None on miss

    async def on_store(self, context, value):
        ...  # store to external storage (dispatched as a background task)

    def should_cache(self, context, value=None) -> bool:
        return True  # return False to skip external caching for a node

    def on_prompt_start(self, prompt_id): ...
    def on_prompt_end(self, prompt_id): ...

# Register in ComfyExtension.on_load():
api = ComfyAPI()
await api.caching.register_provider(MyCacheProvider())

Providers are consulted on local cache miss, in registration order. Exceptions from providers never break execution.

Input Validation: validate_inputs (V3) / VALIDATE_INPUTS (V1)

Validates inputs before execution. Runs during the validation phase.

python
class ValidatedNode(io.ComfyNode):
    @classmethod
    def define_schema(cls):
        return io.Schema(
            node_id="ValidatedNode",
            display_name="Validated Node",
            category="utils",
            inputs=[
                io.Int.Input("width", default=512, min=1, max=8192),
                io.Int.Input("height", default=512, min=1, max=8192),
            ],
            outputs=[io.Image.Output("IMAGE")],
        )

    @classmethod
    def validate_inputs(cls, width, height):
        """Return True if valid, or error string if invalid."""
        if width % 8 != 0 or height % 8 != 0:
            return "Width and height must be multiples of 8"
        if width * height > 4096 * 4096:
            return "Total pixels exceed maximum (4096x4096)"
        return True

    @classmethod
    def execute(cls, width, height):
        import torch
        return io.NodeOutput(torch.zeros(1, height, width, 3))

V1 equivalent:

python
@classmethod
def VALIDATE_INPUTS(s, width, height):
    if width % 8 != 0:
        return "Width must be a multiple of 8"
    return True
Skipping Type Validation

To accept any type (wildcard inputs), include input_types parameter:

python
@classmethod
def validate_inputs(cls, input_types: dict = None, **kwargs):
    # input_types contains the actual types of connected inputs
    # Returning True skips the default type checking
    return True

Lazy Evaluation: check_lazy_status

Controls which lazy inputs actually need evaluation. See comfyui-node-inputs for full details.

python
@classmethod
def check_lazy_status(cls, condition, value_a=None, value_b=None):
    """Called before execute. Return names of inputs that need evaluation."""
    if condition and value_a is None:
        return ["value_a"]
    if not condition and value_b is None:
        return ["value_b"]
    return []

Key behaviors:

  • Only called if the node has lazy inputs
  • May be called multiple times as inputs become available
  • Unevaluated lazy inputs are None
  • Return empty list (or None) when ready to execute
  • Evaluated inputs retain their value across calls

Output Nodes

Nodes with is_output_node=True are execution roots — ComfyUI traces backward from these:

python
class SaveMyData(io.ComfyNode):
    @classmethod
    def define_schema(cls):
        return io.Schema(
            node_id="SaveMyData",
            display_name="Save Data",
            category="output",
            is_output_node=True,  # marks as output node
            inputs=[
                io.String.Input("data"),
                io.String.Input("filename", default="output.txt"),
            ],
            outputs=[],  # output nodes may have no outputs
            hidden=[io.Hidden.prompt, io.Hidden.extra_pnginfo],
        )

    @classmethod
    def execute(cls, data, filename):
        import folder_paths, os
        output_dir = folder_paths.get_output_directory()
        with open(os.path.join(output_dir, filename), 'w') as f:
            f.write(data)
        return io.NodeOutput()

List Processing

Receiving Lists
python
# V3: is_input_list=True in Schema (same as V1 INPUT_IS_LIST)
# All inputs arrive as lists — including widget values like batch_size
# Widget values: use widget_value[0] to get the scalar
# Shorter lists are padded by repeating the last value

# V1: INPUT_IS_LIST = True to receive full lists
class ListNode:
    INPUT_IS_LIST = True
    # Now execute() receives lists instead of individual items
Outputting Lists
python
# V3
io.Image.Output("IMAGE", is_output_list=True)

# V1
OUTPUT_IS_LIST = (True,)  # tuple matching RETURN_TYPES

Error Handling

python
@classmethod
def execute(cls, image, model):
    try:
        result = model.process(image)
    except RuntimeError as e:
        if "out of memory" in str(e):
            import torch
            torch.cuda.empty_cache()
            # Try with smaller batch
            result = process_in_chunks(image, model)
        else:
            raise
    return io.NodeOutput(result)

Server Communication

Send messages to the frontend during execution:

python
from server import PromptServer

@classmethod
def execute(cls, data):
    PromptServer.instance.send_sync(
        "my_extension.status",
        {"message": "Processing complete", "progress": 100}
    )
    return io.NodeOutput(data)

Complete Lifecycle Example

python
import time
import torch
from comfy_api.latest import ComfyExtension, io, ComfyAPISync

class FullLifecycleNode(io.ComfyNode):
    @classmethod
    def define_schema(cls):
        return io.Schema(
            node_id="FullLifecycleNode",
            display_name="Full Lifecycle Demo",
            category="example",
            inputs=[
                io.Image.Input("image"),
                io.Float.Input("threshold", default=0.5, min=0.0, max=1.0),
                io.Image.Input("optional_ref", optional=True, lazy=True),
            ],
            outputs=[
                io.Image.Output("IMAGE"),
                io.Mask.Output("MASK"),
            ],
            hidden=[io.Hidden.unique_id],
        )

    @classmethod
    def validate_inputs(cls, image, threshold, optional_ref=None):
        if threshold == 0.0:
            return "Threshold cannot be exactly 0"
        return True

    @classmethod
    def fingerprint_inputs(cls, image, threshold, optional_ref=None):
        # Re-execute if threshold changed; cache otherwise
        return threshold

    @classmethod
    def check_lazy_status(cls, image, threshold, optional_ref=None):
        # Only request optional_ref if threshold is high
        if threshold > 0.8 and optional_ref is None:
            return ["optional_ref"]
        return []

    @classmethod
    def execute(cls, image, threshold, optional_ref=None):
        node_id = cls.hidden.unique_id

        api = ComfyAPISync()  # use ComfyAPISync in sync execute; ComfyAPI in async
        api.execution.set_progress(0, 2)

        # Generate mask from threshold
        gray = image[:, :, :, 0] * 0.299 + image[:, :, :, 1] * 0.587 + image[:, :, :, 2] * 0.114
        mask = (gray > threshold).float()

        api.execution.set_progress(1, 2)

        # Apply mask
        result = image * mask.unsqueeze(-1)
        if optional_ref is not None:
            result = result + optional_ref * (1 - mask.unsqueeze(-1))

        api.execution.set_progress(2, 2)
        return io.NodeOutput(result, mask)

See Also

  • comfyui-node-basics - Node structure fundamentals
  • comfyui-node-inputs - Input types and lazy evaluation
  • comfyui-node-advanced - Expansion, MatchType, DynamicCombo
  • comfyui-node-outputs - UI outputs and previews

© jtydhr88, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/comfyui-custom-nodes/skills/comfyui-node-lifecycle of jtydhr88/comfyui-custom-node-skills.

Open the folder on GitHubat commit 63a78dc

Compare with similar skills

Comfyui Node Lifecycle next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Comfyui Node Lifecycle compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Comfyui Node Lifecycle this skilljtydhr88/comfyui-custom-node-skills294—~2.9kAutomated safety check: PassMIT
Comfyui AnimatoolShiroEirin/comfyui-good-anima476—~4.6kAutomated safety check: PassGPL-3.0
Comfyui Agent Skill MieMieMieeeee/comfyui-agent-skill116—~3.9kAutomated safety check: PassApache-2.0
Importing SubgraphsComfy-Org/workflow_templates1.3k—~1.5kAutomated safety check: PassMIT
Comfyui Node Addernixified-ai/flake841—~806Automated safety check: PassAGPL-3.0
Managing BundlesComfy-Org/workflow_templates1.3k—~1.2kAutomated safety check: PassMIT

Similar skills

  • Comfyui Animatool

    ShiroEirin/comfyui-good-anima

    Route ALL Anima image generation: validate Danbooru hard anchors, form visual brief, assemble English prompts and args, then load comfyui-manager for workflow execution.

    476 GitHub stars~4.6k tokensUpdated 3 mo ago
    AI & LLM EngineeringAuto-check passed
  • Comfyui Agent Skill Mie

    MieMieeeee/comfyui-agent-skill

    Agent skill for running registered ComfyUI workflows through a stable CLI, and for importing a user's own ComfyUI workflow into their private registry after review.

    116 GitHub stars~3.9k tokensUpdated 3 days ago
    AI & LLM EngineeringAuto-check passed
  • Importing Subgraphs

    Comfy-Org/workflow_templates

    Imports and registers subgraph blueprints into the ComfyUI workflowtemplates repository.

    1.3k GitHub stars~1.5k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Comfyui Node Adder

    nixified-ai/flake

    Adds new custom nodes to the ComfyUI Nix project, including npins fetching, dependency resolution in package.nix, disabling impure pip installs, and verifying the Nix build.

    841 GitHub stars~806 tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Managing Bundles

    Comfy-Org/workflow_templates

    Manages template bundles, categories, and ordering in the ComfyUI template repository.

    1.3k GitHub stars~1.2k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Headroom

    momori777/Artemis

    SmartCrusher + CCR context compression — crunch large JSON arrays, tool outputs, and search results to save tokens.

    377 GitHub stars~562 tokensUpdated 7 days ago
    AI & LLM EngineeringAuto-check passed

More from jtydhr88/comfyui-custom-node-skills

All 9 skills in this repo
  • ComfyUI Advanced Node Patterns

    jtydhr88/comfyui-custom-node-skills

    Reference for ComfyUI V3 node patterns such as MatchType, MultiType, Autogrow and DynamicCombo, used to build nodes with dynamic inputs and type matching.

    294 GitHub stars~3.3k tokensUpdated 2 mo ago
    Auto-check passed
  • ComfyUI Custom Node Basics

    jtydhr88/comfyui-custom-node-skills

    Explains the V3 API for ComfyUI custom nodes: node classes, schema, inputs and outputs, registration and how it differs from the legacy V1 style.

    294 GitHub stars~1.6k tokensUpdated 2 mo ago
    Auto-check passed
  • ComfyUI Node Datatypes

    jtydhr88/comfyui-custom-node-skills

    Lists ComfyUI node data types, from IMAGE, MASK and LATENT tensors to model types, with their V3 classes and formats.

    294 GitHub stars~4.3k tokensUpdated 2 mo ago
    Auto-check passed
  • ComfyUI Frontend Extensions

    jtydhr88/comfyui-custom-node-skills

    Guide to writing JavaScript extensions for the ComfyUI frontend from custom nodes, covering lifecycle hooks, widgets, sidebar tabs, commands, settings, toasts and dialogs.

    294 GitHub stars~3.7k tokensUpdated 2 mo ago
    Auto-check passed
  • Comfyui Node Inputs

    jtydhr88/comfyui-custom-node-skills

    ComfyUI node input types - INT, FLOAT, STRING, BOOLEAN, COMBO widgets, hidden inputs, optional inputs, lazy inputs, forceinput.

    294 GitHub stars~3k tokensUpdated 2 mo ago
    Auto-check passed
  • Comfyui Node Migration

    jtydhr88/comfyui-custom-node-skills

    ComfyUI V1 to V3 node migration - converting legacy nodes to the V3 API.

    294 GitHub stars~3.2k tokensUpdated 2 mo ago
    Auto-check passed

Works with

Questions about Comfyui Node Lifecycle

What does Comfyui Node Lifecycle do?

ComfyUI node execution lifecycle - caching, fingerprintinputs/ISCHANGED, validateinputs/VALIDATEINPUTS, checklazystatus, execution order. Comfyui Node Lifecycle is an agent skill from jtydhr88/comfyui-custom-node-skills. ComfyUI node execution lifecycle - caching, fingerprintinputs/ISCHANGED, validateinputs/VALIDATEINPUTS, checklazystatus, execution order.

When should I use Comfyui Node Lifecycle?

Comfyui Node Lifecycle fits situations like: debugging execution; implementing caching control; input validation; understanding execution flow.

How do I install Comfyui Node Lifecycle in Claude Code?

Run `npx skills add jtydhr88/comfyui-custom-node-skills --skill comfyui-node-lifecycle -a claude-code`. Or copy the skill folder (plugins/comfyui-custom-nodes/skills/comfyui-node-lifecycle in jtydhr88/comfyui-custom-node-skills) into .claude/skills/comfyui-node-lifecycle in your project. Claude Code loads it when a task matches its description.

How do I install Comfyui Node Lifecycle in Codex?

Run `npx skills add jtydhr88/comfyui-custom-node-skills --skill comfyui-node-lifecycle -a codex`. Or copy the skill folder (plugins/comfyui-custom-nodes/skills/comfyui-node-lifecycle in jtydhr88/comfyui-custom-node-skills) into .agents/skills/comfyui-node-lifecycle in your project. Codex loads it when a task matches its description.

Can I use Comfyui Node Lifecycle in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jtydhr88/comfyui-custom-node-skills --skill comfyui-node-lifecycle -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/comfyui-node-lifecycle, .gemini/skills/comfyui-node-lifecycle, .github/skills/comfyui-node-lifecycle and .opencode/skills/comfyui-node-lifecycle in your project.

What does Comfyui Node Lifecycle need to run?

SKILL.md names no scripts, command-line tools or credentials: Comfyui Node Lifecycle is instructions for the agent only. Our summary lists: Python 3.

Does Comfyui Node Lifecycle access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Comfyui Node Lifecycle safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Comfyui Node Lifecycle use?

Comfyui Node Lifecycle is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Comfyui Node Lifecycle use?

About 2.9k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Comfyui Node Lifecycle?

Skills that share tags, products or a category with Comfyui Node Lifecycle: Comfyui Animatool (ShiroEirin/comfyui-good-anima, 476 stars), Comfyui Agent Skill Mie (MieMieeeee/comfyui-agent-skill, 116 stars), Importing Subgraphs (Comfy-Org/workflow_templates, 1.3k stars) and Comfyui Node Adder (nixified-ai/flake, 841 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Comfyui Node Lifecycle?

jtydhr88 (a GitHub user) maintains it in jtydhr88/comfyui-custom-node-skills, which has 294 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on July 27, 2026.

Source: jtydhr88/comfyui-custom-node-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.