comfy-prompt-studio: Instructions file for Codex

AGENTS.md

comfy-prompt-studio AGENTS.md is an instructions file for Codex, OpenCode from yxhpy/comfy-prompt-studio. It costs 1,245 tokens per session, scanned A, original, MIT.

Project instructions for configuring AI providers and a prompt-generation service in yxhpy/comfy-prompt-studio. The project can use a locally running Ollama model or a remote Gemini API.

In plain words
What is it for?
Use it to configure the provider, generate expanded Stable Diffusion image prompts, and support English or Chinese input.
Why use it?
It explains which environment settings, models, URLs, and API keys are needed to run the project's AI features.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md.

This is yxhpy/comfy-prompt-studio's own configuration. It tells Codex and OpenCode 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/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/yxhpy/comfy-prompt-studio

Made for: Codex, OpenCode.

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 AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/yxhpy/comfy-prompt-studio/agents-md.svg)](https://agentmods.dev/instructions/yxhpy/comfy-prompt-studio/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/yxhpy/comfy-prompt-studio/agents-md"><img src="https://agentmods.dev/badge/instructions/yxhpy/comfy-prompt-studio/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,245 This file is loaded in full into every session.
When invoked 1,245 The same file — it is already loaded in full.
Security scan A 1 finding. 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.01245 $0.01245
Opus 5 $0.00622 $0.00622
Sonnet 5 $0.00249 $0.00249
Haiku 4.5 $0.00125 $0.00125

Measured 8d ago against content hash 709f979eeb90, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

comfy-prompt-studio AGENTS.md scanned grade A with 1 finding 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 8d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

response = requests.get(f"{OLLAMA_URL}/api/tags")
AGENTS.md · 186 lines

How it starts

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

AGENTS.md - AI 代理配置文档

本文档说明项目中使用的 AI 代理配置和提示词生成服务。

AI 提供商

项目支持两种 AI 提供商,通过环境变量 AI_PROVIDER 配置:

1. Ollama (默认)

配置参数:

AI_PROVIDER=ollama
OLLAMA_MODEL=huihui_ai/qwen3-abliterated:30b
OLLAMA_URL=http://localhost:11434

特点:

  • 本地部署,数据隐私性强
  • 需要本地运行 Ollama 服务
  • 支持多种开源模型
  • 默认端口:11434

使用场景:

  • 对数据隐私有要求的场景
  • 需要离线工作的环境
  • 自定义模型训练

2. Gemini

配置参数:

AI_PROVIDER=gemini
GEMINI_API_KEY=your-api-key-here
GEMINI_MODEL=gemini-2.0-flash-exp
GEMINI_BASE_URL=https://api.laozhang.ai/v1/

特点:

  • 云端 API 服务
  • 响应速度快
  • 需要 API 密钥
  • 支持流式响应

使用场景:

  • 需要快速响应的场景
  • 不便部署本地模型的环境
  • 对最新模型能力有要求

提示词生成服务

核心模块

位置: src/core/prompt/generator.py

主要功能:

  • 增强用户输入的简单提示词
  • 生成详细的 Stable Diffusion 风格提示词
  • 支持中英文输入
  • 自动添加画质关键词

提示词生成流程

用户输入 → AI 代理 → 提示词增强 → 返回优化后的提示词

提示词模板

系统使用固定的提示词模板来指导 AI 生成高质量的图像描述:

PROMPT_TEMPLATE = """
你是一个专业的 Stable Diffusion 提示词专家。
用户会给你一个简单的描述,请帮助扩展成详细的 Stable Diffusion 提示词。

要求:
1. 保持用户原意,不要改变主题
2. 添加详细的画面细节、氛围、光影描述
3. 添加适当的画质关键词(如 masterpiece, best quality, ultra detailed 等)
4. 使用英文逗号分隔的关键词格式
5. 直接输出提示词,不要有其他说明文字

用户输入:{user_prompt}
"""

使用示例

输入:

一个女孩在花园里

输出:

masterpiece, best quality, ultra detailed, 8k wallpaper,
a beautiful girl standing in a lush garden,
surrounded by colorful flowers, soft sunlight filtering through trees,
peaceful atmosphere, detailed facial features, elegant pose,
vibrant colors, professional photography, shallow depth of field

单例模式实现

提示词服务使用单例模式,确保在应用生命周期内只初始化一次:

位置: src/services/prompt_service.py

优势:

  • 避免重复初始化 AI 客户端
  • 减少资源消耗
  • 全局共享配置

使用方法:

from src.services.prompt_service import PromptService

service = PromptService.get_instance()
enhanced_prompt = service.generate_prompt("用户输入")

服务健康检查

在应用启动时,系统会自动检查 AI 服务的可用性:

Ollama 检查:

response = requests.get(f"{OLLAMA_URL}/api/tags")
if response.status_code == 200:
    print("✅ Ollama 服务正常")

Gemini 检查:

client = OpenAI(api_key=GEMINI_API_KEY, base_url=GEMINI_BASE_URL)
# 测试连接

Read the full file on GitHub · 186 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. 8d ago First seen · 186 lines · 1,245 tokens per session scan A 709f979eeb90

Subscribe to this mod's changes

comfy-prompt-studio AGENTS.md is an instructions file published in the GitHub repository yxhpy/comfy-prompt-studio (85 stars, last pushed 5mo ago), licensed MIT. It adds 1,245 tokens to every session, about $0.0062 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). 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

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

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

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

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

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens