comfy-prompt-studio: Instructions file for Claude Code

CLAUDE.md

comfy-prompt-studio CLAUDE.md is an instructions file for Claude Code from yxhpy/comfy-prompt-studio. It costs 3,592 tokens per session, scanned A, original, MIT.

A project instruction file for an AI image-generation application built with Flask, Ollama, ComfyUI, and WebSockets. It records the current architecture, startup steps, workflows, and rules for keeping project documentation accurate.

In plain words
What is it for?
Use it to understand the application’s modules, configure environment variables, start the required services, choose image workflows, and keep CLAUDE.md, README.md, and AGENTS.md aligned with the code.
Why use it?
It gives coding agents a shared description of how the project is organised and how it should be maintained. This reduces confusion when fixing bugs or adding features.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions AGENTS.md.

This is yxhpy/comfy-prompt-studio's own configuration. It tells Claude Code how to work on comfy-prompt-studio 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-prompt-studio configures →

Reuse

Borrowing it

Nothing to install: this file belongs to yxhpy/comfy-prompt-studio. 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/yxhpy/comfy-prompt-studio/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/yxhpy/comfy-prompt-studio

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-prompt-studio CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/yxhpy/comfy-prompt-studio/claude-md/github.svg)](https://agentmods.dev/instructions/yxhpy/comfy-prompt-studio/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/yxhpy/comfy-prompt-studio/claude-md"><img src="https://agentmods.dev/badge/instructions/yxhpy/comfy-prompt-studio/claude-md/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-prompt-studio CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/yxhpy/comfy-prompt-studio/claude-md"><img src="https://agentmods.dev/badge/instructions/yxhpy/comfy-prompt-studio/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,592 This file is loaded in full into every session.
When invoked 3,592 The same file — it is already loaded in full.
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.03592 $0.03592
Opus 5 $0.01796 $0.01796
Sonnet 5 $0.00718 $0.00718
Haiku 4.5 $0.00359 $0.00359

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

Security

Grade A, and why

comfy-prompt-studio CLAUDE.md 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 9d 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.md · 317 lines

How it starts

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

CLAUDE.md

  • 本文件为 CLAUDE 记忆文件,只记录最新的项目状态,保持文件内容的准确性,避免历史记录的干扰
  • 使用中文
  • 项目必须工程化,方便维护,永远保持文件位置正确
  • 永远保证 CLAUDE.md, README.md, AGENTS.md 的内容是准确的,文档和代码一致
  • 使用设计模式,保持代码结构清晰,方便维护
  • 修复 bug 请先 debug 确认问题所在,再进行修复
  • 新增功能先验证功能是否正常,再进行新增
  • windows 下必须使用 utf-8 编码,避免中文乱码问题
if sys.platform == 'win32':
    sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
  • 根目录 CLAUDE.md, README.md, AGENTS.md 禁止删除

AI 图像生成 Web 应用:Ollama 提示词增强 + ComfyUI 工作流 + Flask WebSocket 实时更新

架构设计

数据流: 用户输入 → Ollama(提示词增强)→ ComfyUI(图像生成)→ WebSocket → 前端展示

核心模块:

  • src/cli/run.py - 应用启动入口
  • src/cli/serve.py - Flask 服务器
  • src/app/__init__.py - Flask 应用工厂
  • src/core/prompt/ - 提示词生成服务(Ollama/Gemini)
  • src/core/comfyui/ - ComfyUI API 集成,自动选择工作流
  • src/core/history/ - SQLite 历史记录管理服务

工作流系统:

  • config/workflows/flowv_normal.json - 普通文生图工作流
  • config/workflows/flow_face.json - 人脸替换工作流
  • 自动选择逻辑:有 image_path 参数时使用人脸工作流

快速启动

前置要求: ComfyUI (127.0.0.1:8188) + Ollama (localhost:11434)

环境配置:

# 1. 复制环境变量模板
cp .env.example .env

# 2. 编辑 .env 文件,填入你的 API 密钥等敏感信息
# 注意:.env 文件包含敏感信息,已在 .gitignore 中忽略

# 3. 安装依赖
pip install -r requirements.txt

启动应用:

python -m src.cli.run

访问: http://localhost:5000

目录结构(工程化)

comfyui/
├── .github/                    # GitHub 配置
│   ├── ISSUE_TEMPLATE/        # Issue 模板
│   │   ├── bug_report.md     # Bug 报告模板
│   │   └── feature_request.md # 功能请求模板
│   ├── PULL_REQUEST_TEMPLATE.md # PR 模板
│   └── workflows/             # GitHub Actions(待添加)
├── src/                        # 源代码目录
│   ├── app/                    # Flask 应用模块
│   │   ├── __init__.py        # 应用工厂
│   │   ├── config.py          # 应用配置
│   │   ├── extensions.py      # Flask 扩展
│   │   ├── routes/            # 路由蓝图
│   │   │   ├── api.py         # API 路由
│   │   │   └── web.py         # Web 路由
│   │   ├── services/          # 业务服务
│   │   │   └── generation.py # 图像生成服务
│   │   └── events/            # WebSocket 事件
│   │       └── generation.py  # 生成事件处理
│   ├── cli/                    # 命令行工具
│   │   ├── run.py             # 应用启动入口
│   │   ├── serve.py           # Flask 服务器
│   │   ├── check_import.py    # 导入验证工具
│   │   └── migrate_to_sqlite.py  # 数据迁移工具
│   ├── core/                   # 核心业务逻辑
│   │   ├── comfyui/           # ComfyUI 集成
│   │   │   └── client.py      # ComfyUI 客户端
│   │   ├── history/           # 历史记录管理
│   │   │   └── manager.py     # 历史记录管理器
│   │   └── prompt/            # 提示词生成
│   │       └── generator.py   # 提示词生成器
│   ├── legacy/                 # 向后兼容代码
│   ├── models/                 # 数据模型
│   ├── routes/                 # 路由模块(待迁移)
│   ├── services/               # 业务服务(待迁移)
│   │   └── prompt_service.py  # 提示词服务(单例)
│   ├── utils/                  # 工具函数
│   └── workers/                # 后台任务
├── config/                     # 配置文件
│   ├── workflows/             # ComfyUI 工作流
│   │   ├── flowv_normal.json # 普通文生图
│   │   └── flow_face.json    # 人脸替换
│   └── settings.py           # 全局配置类
├── templates/                  # Jinja2 模板
│   ├── layouts/               # 布局模板
│   │   └── base.html         # 基础布局
│   ├── partials/              # 组件模板
│   │   ├── gallery.html      # 图片画廊
│   │   ├── history_panel.html # 历史面板
│   │   └── ...               # 其他组件
│   └── index.html            # 主页
├── static/                     # 静态资源
│   ├── css/                   # 样式文件
│   │   └── index.css         # 主样式
│   ├── js/                    # JavaScript 文件
│   │   └── index.js          # 主逻辑
│   └── generated/             # 生成图片(旧,向后兼容)
├── data/                       # 数据目录
│   ├── generated/             # 生成的图片(不提交)
│   ├── upload/                # 上传的图片(不提交)
│   └── history.db             # SQLite 历史记录(不提交)
├── tests/                      # 测试文件
├── .env                        # 环境变量(不提交,敏感信息)
├── .env.example               # 环境变量模板
├── .gitignore                 # Git 忽略配置
├── requirements.txt           # Python 依赖
├── LICENSE                     # MIT 许可证
├── CHANGELOG.md               # 版本更新日志
├── CONTRIBUTING.md            # 贡献指南
├── CLAUDE.md                   # 项目技术文档(本文件)
├── README.md                   # 快速开始指南(用户文档)
└── AGENTS.md                   # AI 代理配置说明

Read the full file on GitHub · 317 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. 9d ago First seen · 317 lines · 3,592 tokens per session scan A 72ca3c344e28

Subscribe to this mod's changes

comfy-prompt-studio CLAUDE.md is an instructions file published in the GitHub repository yxhpy/comfy-prompt-studio (85 stars, last pushed 5mo ago), licensed MIT. It adds 3,592 tokens to every session, about $0.0180 per session on Opus 5. 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.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 3,735 tokens