comfy-optimizer

comfy-optimizer is an agent for Claude Code from sandyup/comfyui-mcp. It costs 18 tokens per session (2,243 once invoked), scanned A, a copy of comfy-optimizer, MIT.

An analysis agent for ComfyUI, a visual tool for building image-generation workflows. It examines workflows for slow steps, wasted graphics memory, repeated operations, and incorrect model settings.

In plain words
What is it for?
Use it to review ComfyUI workflows, find performance bottlenecks and VRAM waste, compare the current and improved setup, and get suggested fixes.
Why use it?
It helps explain why a workflow is inefficient and turns that analysis into specific changes, using information about the workflow, computer resources, and installed models.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

Part of the comfy plugin — 32 skills, 11 commands, 4 agents, 2 hooks shipped together

Good fit Use it to review ComfyUI workflows, find performance bottlenecks and VRAM waste, compare the current and improved setup, and get suggested fixes.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/sandyup/comfyui-mcp/optimizer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/sandyup/comfyui-mcp

Made for: Claude Code.

Or install comfy, the plugin that ships this one along with the rest of its 32 skills, 11 commands, 4 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for comfy-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/agents/sandyup/comfyui-mcp/optimizer/github.svg)](https://agentmods.dev/agents/sandyup/comfyui-mcp/optimizer)
Your own site
<a href="https://agentmods.dev/agents/sandyup/comfyui-mcp/optimizer"><img src="https://agentmods.dev/badge/agents/sandyup/comfyui-mcp/optimizer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for comfy-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/agents/sandyup/comfyui-mcp/optimizer"><img src="https://agentmods.dev/badge/agents/sandyup/comfyui-mcp/optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,243 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 97% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00018 $0.02243
Opus 5.5 $0.00007 $0.00897
Sonnet 5.5 $0.00004 $0.00449
Haiku 4.5 $0.00002 $0.00224

Measured 3mo ago against content hash 731a439a31dd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

comfy-optimizer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

97% identical to comfy-optimizer — 28 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugin/agents/optimizer.md · 197 lines

How it starts

The opening of the file, as written. The whole thing — 197 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an autonomous optimization agent that analyzes ComfyUI workflows for performance issues, VRAM waste, and suboptimal configurations. You have access to ComfyUI MCP tools (mcp__comfyui__*) for inspecting workflows, system stats, node schemas, and model inventories.

Your Mission

Given a ComfyUI workflow, analyze it for performance bottlenecks, redundant operations, VRAM waste, and model-specific misconfigurations. Produce a concrete optimization report with before/after comparisons and actionable fixes.

Optimization Workflow

Step 1: Load and Understand the Workflow

  1. Visualize the workflow: Use visualize_workflow to generate a mermaid diagram and understand the pipeline structure
  2. Identify the model family: Determine if the workflow uses SD 1.5, SDXL, Flux, SD3, or a video model
  3. Count nodes: Catalog all nodes by type to spot redundancies
  4. Trace the data flow: Follow MODEL, CLIP, VAE, CONDITIONING, LATENT, and IMAGE paths

Step 2: Check System Resources

  1. Get system stats: Use get_system_stats() to determine:
    • Total VRAM and current usage
    • GPU model and capabilities
    • PyTorch version and CUDA version
  2. Check installed models: Use list_local_models to see what's available
  3. Estimate VRAM needs: Based on the model, resolution, and batch size:
Configuration Estimated VRAM
SD 1.5 FP16, 512x512 ~3GB
SD 1.5 FP16, 768x768 ~4GB
SDXL FP16, 1024x1024 ~7GB
SDXL FP16, 1536x1536 ~12GB
Flux FP16, 1024x1024 ~24GB
Flux FP8, 1024x1024 ~12GB
Flux FP8, 2048x2048 ~18GB
LTXV FP8, 512x512, 16 frames ~8GB

Step 3: Check for Redundant Nodes

Look for these common redundancies:

Duplicate VAE Operations
  • Multiple VAEDecode → VAEEncode pairs: If the workflow decodes to pixels and immediately re-encodes, this wastes time and quality. Work in latent space instead.
  • Multiple VAELoaders: Loading the same VAE multiple times wastes VRAM. Connect one VAELoader to all consumers.

Read the full file on GitHub · 197 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 197 lines · 18 tokens per session scan A 731a439a31dd

Subscribe to this mod's changes

comfy-optimizer is an agent published in the GitHub repository sandyup/comfyui-mcp (1 stars, last pushed 4mo ago), licensed MIT. It adds 18 tokens to every session and 2,243 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 97% identical to comfy-optimizer, differing in 28 lines, and is treated as a copy.

Related

comfy-optimizer compared with agents from other repositories

comfy-optimizer next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
comfy-optimizersandyup/comfyui-mcpAgent14mo agoMITA18Claude Code
playwright-test-generatormicrosoft/playwrightAgent101ktodayApache-2.0A151Claude Code
AVM Owner Triagegithub/awesome-copilotAgent42ktodayMITA61Claude Code
Pimcore Expertgithub/awesome-copilotAgent42ktodayMITA26Claude Code
Ultimate Transparent Thinking Beast Modegithub/awesome-copilotAgent42ktodayMITA11Claude Code
WinForms Expertgithub/awesome-copilotAgent42ktodayMITA19Claude Code
azure-iac-exportergithub/awesome-copilotAgent42ktodayMITA70Claude Code