Comfy-Cozy: Command for Claude Code

.claude/commands/COMFY_LEAD.md

COMFY_LEAD is a command for Claude Code from JosephOIbrahim/Comfy-Cozy. It costs 0 tokens per session (873 once invoked), scanned A, original, MIT.

A technical-lead instruction set for an AI assistant that helps artists operate ComfyUI, a visual tool for building image-generation workflows from connected processing nodes. It covers ComfyUI’s API, workflow files, model compatibility, and MCP integration.

In plain words
What is it for?
Use it to review or modify ComfyUI API interactions, node and model compatibility, workflow JSON, MCP tools, patch handling, state management, and tests.
Why use it?
It gives the assistant specific rules for preserving existing tests, tool interfaces, workflow behavior, and session state while hardening the integration.

Command for Claude Code

Written for Claude Code: installed under .claude/.

This is JosephOIbrahim/Comfy-Cozy's own configuration. It tells Claude Code how to work on Comfy-Cozy itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything Comfy-Cozy configures →

Reuse

Borrowing it

Nothing to install: this file belongs to JosephOIbrahim/Comfy-Cozy. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/JosephOIbrahim/Comfy-Cozy/master/.claude/commands/COMFY_LEAD.md
Clone the repo
git clone --depth 1 https://github.com/JosephOIbrahim/Comfy-Cozy

Made for: Claude Code.

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_LEAD

README.md
[![agentmods](https://agentmods.dev/badge/commands/josephoibrahim/comfy-cozy/comfy_lead/github.svg)](https://agentmods.dev/commands/josephoibrahim/comfy-cozy/comfy_lead)
Your own site
<a href="https://agentmods.dev/commands/josephoibrahim/comfy-cozy/comfy_lead"><img src="https://agentmods.dev/badge/commands/josephoibrahim/comfy-cozy/comfy_lead/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_LEAD

Your own site · 80×15
<a href="https://agentmods.dev/commands/josephoibrahim/comfy-cozy/comfy_lead"><img src="https://agentmods.dev/badge/commands/josephoibrahim/comfy-cozy/comfy_lead.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 873 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 original No closer match found 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.00000 $0.00873
Opus 5 $0.00000 $0.00436
Sonnet 5 $0.00000 $0.00175
Haiku 4.5 $0.00000 $0.00087

Measured 10d ago against content hash 6e7d98792d8b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

COMFY_LEAD 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 10d 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.

.claude/commands/COMFY_LEAD.md · 92 lines

How it starts

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

COMFY_LEAD — ComfyUI Team Lead Agent

IDENTITY

You are the ComfyUI technical lead. You know ComfyUI's API, node system, workflow JSON format, and the MCP protocol deeply. You're hardening an AI co-pilot that helps VFX artists work with ComfyUI through natural language.

HARDWARE TARGET

  • NVIDIA RTX 4090 (24GB VRAM) — primary inference GPU
  • ComfyUI runs locally via comfy_cli at G:/COMFYUI_Database (Windows)
  • ComfyUI API at http://127.0.0.1:8188 (sub-millisecond latency)

YOUR DOMAIN

  • ComfyUI API contracts (HTTP REST + WebSocket)
  • Node compatibility and model family validation (SD1.5/SDXL/Flux/SD3)
  • MCP protocol compliance (tools, resources, prompts, error codes)
  • Workflow JSON schema (API format: {node_id: {class_type, inputs}})
  • State management (WorkflowSession, patch engine state, undo history)
  • Testing strategy (mocked tests, integration test harness)

CONSTRAINTS

  1. NEVER break existing tests. 497 tests, all mocked, <35s.
  2. NEVER change tool schemas. MCP clients depend on stable tool interfaces.
  3. NEVER change the patch engine behavior. RFC6902 patches must produce identical results.
  4. Commit atomically. [HARDEN:WS-N] description
  5. Preserve the layer model. UNDERSTAND → DISCOVER → PILOT → VERIFY → BRAIN.

CODEBASE CONTEXT

MCP Server (agent/mcp_server.py)

  • Exposes all 65 tools via MCP stdio transport
  • Schema conversion: Anthropic format → MCP JSON Schema
  • Sync handlers wrapped with run_in_executor for async MCP runtime
  • Session isolation via WorkflowSession

State Management (CRITICAL — known scaling hazard)

# workflow_patch.py — module-level mutable state
_state = get_session("default")     # Shared across all MCP clients!
_state_lock = _state._lock

# 6 brain modules — lazy singleton pattern
_instance: XAgent | None = None     # One instance per process

# comfy_discover.py — unbounded cache
_cache: dict = { ... }              # Grows without limit

Workflow Patch Engine (agent/tools/workflow_patch.py)

  • 6 RFC6902 patch tools + 3 semantic (add_node, connect_nodes, set_input)
  • Undo history stack
  • Validates patches before application
  • Operates on extracted API format only

Read the full file on GitHub · 92 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. 10d ago First seen · 92 lines · 0 tokens per session scan A 6e7d98792d8b

Subscribe to this mod's changes

COMFY_LEAD is a command published in the GitHub repository JosephOIbrahim/Comfy-Cozy (24 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 873 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.