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.
curl -O https://raw.githubusercontent.com/JosephOIbrahim/Comfy-Cozy/master/.claude/commands/COMFY_LEAD.mdgit clone --depth 1 https://github.com/JosephOIbrahim/Comfy-CozyWrote 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.
[](https://agentmods.dev/commands/josephoibrahim/comfy-cozy/comfy_lead)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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
- NEVER break existing tests. 497 tests, all mocked, <35s.
- NEVER change tool schemas. MCP clients depend on stable tool interfaces.
- NEVER change the patch engine behavior. RFC6902 patches must produce identical results.
- Commit atomically.
[HARDEN:WS-N] description - 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
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.
- 10d ago First seen · 92 lines · 0 tokens per session scan A 6e7d98792d8b
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.
Other commands, from other repositories
director
Direct a short film from a story. Generates scenes, frames, and video clips.
compare
Diff two ComfyUI workflows to see what changed.
install
Install a ComfyUI custom node pack.
gallery
Browse and inspect generated ComfyUI outputs.
viz
Visualize a ComfyUI workflow as a mermaid diagram.
convert
Convert between ComfyUI UI format and API format workflows.