Run locally: This is alocally deployedvideo generation project,both frontend and backend run on this machine:
- Backend:
http://localhost:8000- Frontend:
http://localhost:3000- All API calls should request the local server; do not request other addresses!
- Make sure that before calling any API, both the backend and frontend services have been started and are running properly!
Core idea: The Agent should be like a "continuously accompanying intelligent video production assistant". Each time it completes an important user-perceivable task, it should immediately give the user a brief report and wait for user confirmation.
Core principle: The output of each stage must be shown to the user, and it must stop and wait for user confirmation before continuing to the next stage.
Prevent forgetting: Throughout the entire workflow, the Agent may forget previous user input or the output content of previous stages.Whenever entering a new stage, the Agent must reload this SKILL document to ensure it does not forget any details。
Project structure
aigc-director/ ← OpenClaw 调用的 skill 根目录
├── aigc-claw/ ← 前后端项目代码
│ ├── backend/ ← FastAPI 后端(端口 8000)
│ │ └── code/result/ ← 模型生成产物存放目录
│ │ ├── script/ ← 剧本产物
│ │ ├── image/ ← 图片产物(角色、场景、参考图)
│ │ └── video/ ← 视频产物
│ └── frontend/ ← Next.js 前端(端口 3000)
├── references/ ← OpenClaw 调用时的参考文档
│ ├── init_project/ ← 项目初始化
│ ├── run_project/ ← 服务启动
│ ├── workflow/ ← 六阶段工作流 API
│ ├── sandbox/ ← 临时工作台 API
│ └── send_message/ ← 消息发送
└── SKILL.md ← skill 正文
Output storage directory:
aigc-claw/backend/code/result/
script/- Script outputimage/- Image output (characters, scenes, reference images)video/- Video output
Stages and stop points (9 total)
| Stop point | Stage | phase value | Description | Action |
|---|---|---|---|---|
| 1 | Project configuration | - | Confirm configuration options | Show configuration → user confirmation |
| 2 | Script generation | suggest_expand | Suggest expansion | Wait for user confirmation |
| 3 | Script generation | logline_selection | Choose plot | Choose from 3 candidates |
| 4 | Script generation | mode_selection | Choose mode | Movie (4 acts) / Short film (1 act) |
| 5 | Script generation | script_generation | Confirm script | Continue after confirmation |
| 6 | Character/scene design | - | Confirm character/scene images | Continue after confirmation |
| 7 | Storyboard design | - | Confirm storyboard list | Continue after confirmation |
| 8 | Reference image generation | - | Confirm reference images | Continue after confirmation |
| 9 | Video generation | - | Confirm video clips | Continue after confirmation |
Note:
suggest_expandandlogline_selectionmay be skipped based on input quality.
Workflow
1. Local deployment (executed only during initialization)
When the user requests "initialize project", "configure project", or "deploy project", project initialization must be performed first: refer to init_all.md to execute the complete initialization workflow.
Note: Use this only when the user downloads the project for the first time or needs to reconfigure the environment. If the project has already been initialized, skip this step and directly check the service running status.
2. Check local services
Refer to start_backend.md and start_frontend.md to check whether the service is running.
⚠️ Mandatory requirement: If the service is not running, you must start the service before continuing!
2. Routing decision
| The user says | process |
|---|---|
| "generate image" | temporary workspace (sandbox) |
| "generate video" | you must first ask: long video (workflow) or short video (workspace)? |
| "analyze image" | temporary workspace (sandbox) |
| "ask LLM question" | temporary workspace (sandbox) |
| "photo to anime" | temporary workspace (sandbox) |
3. Execution flow
1. 检查后端运行状态 → 未运行则参考 start_backend.md 启动 → 等待3秒 → 再次检查
2. 检查前端运行状态 → 未运行则参考 start_frontend.md 启动 → 等待5秒 → 再次检查
3. 检查 API Key 配置 → 读取 .env 文件,确认所需 API Key 已配置
4. 参考 create_project.md 询问用户项目配置 → 停点1(配置确认)→ 创建项目
5. 参考 create_script.md 执行剧本生成 → 停点2-5
6. 参考 create_character.md 执行角色设计 → 停点6
7. 参考 create_storyboard.md 执行分镜设计 → 停点7
8. 参考 create_reference.md 执行参考图生成 → 停点8
9. 参考 create_video.md 执行视频生成 → 停点9
10. 参考 create_post.md 执行后期剪辑
11. 完成 → 发送最终视频给用户
Note: Be sure to refer to the specific documents under the
references/directory to execute each step. Do not call APIs from memory or assumptions!
Check API Key configuration
Before creating a project, you must check whether the API Key corresponding to the model selected by the user has been configured:
# 读取 .env 文件检查配置
cat aigc-claw/backend/.env | grep -E "API_KEY|KEY"
# 必需的配置(根据选择的模型)
# LLM: DASHSCOPE_API_KEY / DEEPSEEK_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY
# 图片: ARK_API_KEY / DASHSCOPE_API_KEY
# 视频: DASHSCOPE_API_KEY / VOLC_ACCESS_KEY / KLING_ACCESS_KEY
If the API Key is not configured, you need to remind the user:
- Inform them which platform's API Key is missing
- Provide how to obtain it
- Configuration location (
aigc-claw/backend/.envfile) - Wait for the user to complete configuration before continuing
| Platform | API Key variable | Obtaining link |
|---|---|---|
| DeepSeek | DEEPSEEK_API_KEY |
https://platform.deepseek.com/api_keys |
| Alibaba Cloud DashScope | DASHSCOPE_API_KEY |
https://bailian.console.aliyun.com/cn-beijing/?tab=home#/home |
| ByteDance Volcano Ark | ARK_API_KEY or VOLC_ACCESS_KEY/VOLC_SECRET_KEY |
https://www.volcengine.com/product/ark |
| Kuaishou Kling | KLING_ACCESS_KEY/KLING_SECRET_KEY |
https://klingai.com/cn/dev |
🚨 Stop point handling (mandatory rules)
When the query status is stage_completed or waiting_in_stage , you must perform the following steps:
Step 1: Obtain the artifact
curl "http://localhost:8000/api/project/{session_id}/artifact/{stage}"
Step 2: Show it to the user
Display the content in the artifact (option list, suggestions, artifact summary)in fullto the user
Step 3: Ask for a decision
Clearly tell the user:
- What the options are
- The meaning of each option
- What the user needs to choose
Step 4: Wait for the user's reply
Prohibitedto call intervene or continue!
Step 5: Execute after user confirmation
According to the user's choice, call the corresponding API
❌ Incorrect example (the mistake I just made)
收到 suggest_expand 停点 → 直接调用 intervene → 跳过用户确认
✅ Correct example
1. 阶段内部停点触发(如 suggest_expand)
收到 suggest_expand 停点
→ 获取 artifact 查看内容
→ 展示给用户:"系统建议启用创意扩写模式..."
→ 询问:"是否同意?"
→ 用户回复"同意" → 调用 intervene
2. 阶段完成停点触发
收到 stage_completed 停点
→ 获取 artifact 查看产物内容
→ 展示给用户:"第一阶段已完成,生成了剧本内容..."
→ 询问:"是否继续下一阶段?"
→ 用户回复"继续" → 调用 continue
At each stop point, you must:
- show the artifact or options to the user
- ask for confirmation
- continue only after the user confirms
Status determination
| status | Meaning | Operation |
|---|---|---|
| idle | New session | Start project |
| running | Executing | Poll and wait |
| waiting_in_stage | Waiting for user intervention | Call intervene |
| stage_completed | Stage complete | Call continue |
| session_completed | All complete | End |
Note: Intervention is only needed when status changes; do not repeatedly call the artifact API to "confirm"!
Message Sending Channels
Depending on the channel used to send messages to the user (Feishu/WeChat), read the corresponding reference document under references/send_message/ to get precautions and sending methods:
Task Brief Format
After each phase is completed, the brief sent must include:
- What was just completed
- What to do next
- Content requiring user decision
- Web interface link:
http://[本地IP]:3000/?session={session_id}&stage={stage}(Note: use the local IPv4 address here, do not use localhost!) - Artifact images/videos (send the files directly; sending only paths is prohibited)
Web Interface Link Format
# 获取本地 IPv4 地址
import socket
local_ip = socket.gethostbyname(socket.gethostname())
# 构造前端 URL
frontend_url = f"http://{local_ip}:3000/?session={session_id}&stage={stage}"
# 发送给用户
send_to_user(f"📊 查看详情:{frontend_url}")
Important: You must use the local IPv4 address (e.g.
192.168.1.x), do not uselocalhostor127.0.0.1, otherwise users cannot access it from other devices!
Detailed Reference
According to the user's needs and the current phase, refer to the specific documents under the references/ directory to perform the corresponding operations:
references directory
| File | Purpose | When to View |
|---|---|---|
| init_project/ | Project Initialization | When the user downloads for the first time or requests "initialize project" |
| init_all.md | Complete Initialization Process | When the user requests initialization and deployment |
| init_backend.md | Backend Initialization | When configuring the backend environment for the first time |
| init_frontend.md | Frontend Initialization | When configuring the frontend environment for the first time |
| run_project/ | Project Startup | |
| start_backend.md | Starting the backend service | When the service is not running |
| start_frontend.md | Starting the frontend service | When the service is not running |
| workflow/ | Six-Phase Workflow | |
| create_project.md | Create New Project API | When starting a new video project |
| create_script.md | Script Generation API | When executing the first phase |
| create_character.md | Character/Scene Design API | When executing the second phase |
| create_storyboard.md | Storyboard Design API/Plot Continuation API | When executing the third phase/when the user requests plot continuation |
| create_reference.md | Reference Image Generation API | When executing the fourth phase |
| create_video.md | Video Generation API | When executing the fifth phase |
| create_post.md | Post-Production Editing API | When executing the sixth phase |
| modify_character.md | Modify Character Prompts | When the user requests to modify a character |
| modify_storyboard.md | Modify/Continue Storyboard | When the user requests to modify/continue the storyboard |
| modify_reference.md | Modify Reference Image Prompts | When the user requests to modify a reference image |
| modify_video.md | Modify Video Prompts | When the user requests to modify a video |
| sandbox/ | Temporary Workbench | |
| generate_image_t2i.md | Text-to-Image API | When the user requests image generation |
| generate_image_it2i.md | Image-to-Image/Style Transfer API | When the user requests image style transfer |
| generate_video.md | Short Video Generation API | When the user requests to generate a video within 15 seconds |
| send_message/ | Message sending | |
| feishu.md | Feishu sending media files | When a user initiates a conversation through the Feishu channel and an image/video needs to be sent to the user |
| wechat.md | WeChat sending media files | When a user initiates a conversation through the WeChat channel and an image/video needs to be sent to the user |