| 1 | # CLAUDE.md |
| 2 | |
| 3 | This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | |
| 5 | ## Project Overview |
| 6 | |
| 7 | Video-Claw is an AI video generation system that transforms user ideas into complete videos through 6 stages: Script → Character/Scene Design → Storyboard → Reference Images → Video Generation → Post-production. |
| 8 | |
| 9 | This repository (`video-claw/`) is an **OpenClaw Agent Skill** that wraps the actual code project: |
| 10 | - **video-claw/**: The actual code project containing the backend (Python FastAPI) and frontend (Next.js) |
| 11 | - **SKILL.md**: Workflow rules for the OpenClaw agent |
| 12 | - **references/**: API documentation |
| 13 | |
| 14 | Both run locally: backend at `http://localhost:8000`, frontend at `http://localhost:3000`. |
| 15 | |
| 16 | ## Commands |
| 17 | |
| 18 | ### Backend |
| 19 | ```bash |
| 20 | cd video-claw/backend |
| 21 | source venv/bin/activate |
| 22 | python api_server.py |
| 23 | ``` |
| 24 | |
| 25 | ### Frontend |
| 26 | ```bash |
| 27 | cd video-claw/frontend |
| 28 | npm install # first time only |
| 29 | npm run build |
| 30 | npm start |
| 31 | ``` |
| 32 | |
| 33 | ### Health Check |
| 34 | ```bash |
| 35 | curl http://localhost:8000/api/health |
| 36 | ``` |
| 37 | |
| 38 | ## Architecture |
| 39 | |
| 40 | ### Backend Core |
| 41 | - **[orchestrator.py](video-claw/backend/core/orchestrator.py)**: Workflow engine managing the 6-stage state machine. Controls session state (pending/running/waiting/completed/completed), persists to `video-claw/backend/code/data/sessions/`, and coordinates agent execution. |
| 42 | |
| 43 | - **[base_agent.py](video-claw/backend/core/agents/base_agent.py)**: Abstract base class for all stage agents. Defines `process(input_data, intervention)` interface that returns `{"payload": ..., "requires_intervention": bool, "completed": bool}`. |
| 44 | |
| 45 | ### 6 Stage Agents |
| 46 | Each agent handles one workflow stage: |
| 47 | | Agent | File | Stage | |
| 48 | |-------|------|-------| |
| 49 | | ScriptWriterAgent | script_agent.py | script_generation | |
| 50 | | CharacterDesignerAgent | character_agent.py | character_design | |
| 51 | | StoryboardAgent | storyboard_agent.py | storyboard | |
| 52 | | ReferenceGeneratorAgent | reference_agent.py | reference_generation | |
| 53 | | VideoDirectorAgent | video_agent.py | video_generation | |
| 54 | | VideoEditorAgent | editor_agent.py | post_production | |
| 55 | |
| 56 | ### Tool Clients |
| 57 | External API integrations in `video-claw/backend/models/`: |
| 58 | - **LLM clients**: llm_dashscope.py, llm_deepseek.py, llm_gpt.py, llm_gemini.py |
| 59 | - **Image clients**: image_dashscope.py, image_client.py (Seedream, Jimeng, Wan) |
| 60 | - **Video clients**: video_dashscope.py, video_kling.py (Wan, Kling) |
| 61 | - **VLM clients**: vlm_dashscope.py, vlm_gemini.py |
| 62 | |
| 63 | ### Data Storage |
| 64 | - Results: `video-claw/backend/code/result/` (image/, video/, script/) |
| 65 | - Session state: `video-claw/backend/code/data/sessions/{session_id}.json` |
| 66 | |
| 67 | ## Workflow (from SKILL.md) |
| 68 | |
| 69 | The system uses **9 stop points** where the agent MUST pause and wait for user confirmation before proceeding: |
| 70 | |
| 71 | 1. Project config confirmation |
| 72 | 2. Script suggest_expand (optional) |
| 73 | 3. Script logline selection |
| 74 | 4. Script mode selection (movie/micro-film) |
| 75 | 5. Script generation confirmation |
| 76 | 6. Character/scene design confirmation |
| 77 | 7. Storyboard confirmation |
| 78 | 8. Reference image confirmation |
| 79 | 9. Video clip confirmation |
| 80 | |
| 81 | After each stage completes, the agent must: |
| 82 | 1. Get artifact via `GET /api/project/{session_id}/artifact/{stage}` |
| 83 | 2. Present results to user |
| 84 | 3. Wait for user confirmation |
| 85 | 4. Call `POST /api/project/{session_id}/continue` to proceed |
| 86 | |
| 87 | ## Key References |
| 88 | |
| 89 | The `references/` folder contains detailed API documentation: |
| 90 | - `run_project/` - Service startup instructions |
| 91 | - `workflow/` - 6-stage workflow API docs |
| 92 | - `sandbox/` - Single-shot tools (image generation, video generation) |
| 93 | - `send_message/` - Feishu/WeChat integration |
| 94 | |
| 95 | Important files: |
| 96 | - [SKILL.md](SKILL.md) - Contains the complete workflow rules for OpenClaw agent execution |
| 97 | - [README.md](README.md) - Full project documentation including model configuration |
| 98 |