一键导入
environment-and-models
Environment scanning, caching, and model discovery for installed nodes, packages, and models
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Environment scanning, caching, and model discovery for installed nodes, packages, and models
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Install ComfyUI Assistant as a ComfyUI custom node. Use when performing or troubleshooting installation (clone, Python deps, frontend build, restart).
For complex user requests — evaluate, investigate, ask questions, propose a plan, accept modifications, then execute. Use when the request is multi-step, ambiguous, or high-impact.
Workflow execution and complete workflow generation tools (executeWorkflow, applyWorkflowJson). Use when the user wants to run a workflow or build a complete workflow from a description.
Python backend modules, chat request lifecycle, SSE format, and API endpoints
System prompt assembly from system_context, user_context, and environment sources
Generate a Product Requirements Document (PRD) for a new feature. Use when planning a feature, starting a new project, or when asked to create a PRD. Triggers on: create a prd, write prd for, plan this feature, requirements for, spec out.
| name | environment-and-models |
| description | Environment scanning, caching, and model discovery for installed nodes, packages, and models |
| version | 0.0.1 |
| license | MIT |
The assistant knows what nodes and models are installed by scanning the ComfyUI environment and caching the results. This skill covers how scanning works, where caches live, and how the data is surfaced.
environment_scanner.py Key Functions| Function | Purpose |
|---|---|
scan_environment(output_dir) | Full scan: nodes, packages, models. Writes JSON caches, returns summary dict |
scan_installed_node_types() | Reads nodes.NODE_CLASS_MAPPINGS for all registered node types |
scan_custom_node_packages(custom_nodes_dir) | Walks custom_nodes/ for package metadata (pyproject.toml) |
scan_installed_models() | Uses folder_paths to list models by category |
search_nodes(env_dir, query, category, limit) | Search cached nodes; live API fallback if no results |
fetch_object_info_from_comfyui() | Async GET /object_info from ComfyUI's local server |
fetch_models_from_comfyui() | Async GET /models and /models/{folder} |
get_cached_environment(env_dir) | Read all cached JSONs, return dict |
get_environment_summary(env_dir) | Brief text summary from summary.json |
Stored in user_context/environment/:
| File | Content |
|---|---|
installed_nodes.json | All node types with name, category, package, display_name, description, inputs, outputs |
custom_nodes.json | Custom node packages with name, path, has_agents, has_readme, description, version |
models.json | Dict of category -> list of filenames |
summary.json | Brief counts (packages, node types, models) |
Model categories: checkpoints, loras, vae, controlnet, embeddings, upscale_models, hypernetworks, clip, unet, diffusion_models.
search_nodes() checks cached installed_nodes.json firstfetch_object_info_from_comfyui() (live ComfyUI API)limit results (default 20)Models follow the same pattern: cache first, live API fallback via fetch_models_from_comfyui().
In __init__.py, _auto_scan_environment() runs as a background task 5 seconds after ComfyUI starts:
scan_environment() to populate all cache files| Tool / Endpoint | Purpose |
|---|---|
refreshEnvironment tool | LLM-triggered rescan of nodes, packages, models |
searchInstalledNodes tool | LLM searches installed node types |
getAvailableModels tool | LLM lists models by category |
readDocumentation tool | LLM fetches docs for a node type or topic |
POST /api/environment/scan | HTTP trigger for full scan |
GET /api/environment/summary | Brief text for prompt injection |
GET /api/environment/nodes | Search nodes (?q=&category=&limit=) |
GET /api/environment/models | List models (?category=) |
GET /api/environment/packages | List custom node packages |
GET /api/environment/docs | Fetch docs (?topic=&source=) |
On startup, _auto_scan_environment() scans everything and caches to user_context/environment/. The summary is injected into the system prompt via load_environment_summary(). Tools like searchInstalledNodes and getAvailableModels query the cache (with live fallback).
Edit environment_scanner.py. The three scan functions (scan_installed_node_types, scan_custom_node_packages, scan_installed_models) each write their own JSON cache. Add new scan functions and register them in scan_environment().
Add the folder name to the categories list in scan_installed_models() in environment_scanner.py. The category maps to ComfyUI's folder_paths system.
Either: (1) the LLM calls the refreshEnvironment tool, (2) POST /api/environment/scan, or (3) restart ComfyUI (auto-scan runs after 5s).
system-and-user-context -- how environment summary is injected into the system promptbackend-architecture -- API endpoints for environment queriesbackend-tools-declaration -- environment tool definitions