Show it a video you love. Get a new video in the same style. An AI crew (Claude Code or Codex) plans, builds and reviews it with you.
JavaScript 2d-animationai-agentsai-videoanimationclaude-codecodexmulti-agentstyle-transfervideo-generation
English by default: README.md and docs/ are English; 繁體中文 in README.zh-TW.md and docs/zh-TW/
許元豪aea43d597601
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 7a5f69d..666a4d5 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -1,26 +1,36 @@+<p align="right"><b>English</b> · <a href="docs/zh-TW/CONTRIBUTING.md">繁體中文</a></p>+# Contributing-感謝你想一起改進 ReelMimic!+Thanks for wanting to help make ReelMimic better!++## Setup-## 開發環境-依 README 安裝後:+Install it as described in the [README](README.md), then:```bashcd app-npm run server # 後端(改 server/ 後:bash app/restart.sh)-npm run web # 前端熱更新 http://localhost:5173-npm run doctor # 環境檢查+npm run server # backend (after editing server/, restart with: bash app/restart.sh)+npm run web # UI with hot reload at http://localhost:5173+npm run doctor # environment check```-架構說明在 `docs/ARCHITECTURE.md`,擴充方式在 `docs/EXTENDING.md`。+How it works is in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md), and how to extend it is in [docs/EXTENDING.md](docs/EXTENDING.md).++## Good first contributions++- **A new style**: add `.claude/skills/video-clone/styles/<name>.md`, with a short description of the reference you+ tested it on (please don't attach copyrighted video files).+- **Known pitfalls**: problems you ran into while making a video and how you fixed them. Add them to the matching+ style file or the engine's `SKILL.md`.+- **A new rendering engine**: an agent skill folder. For third-party skills, include the source and license and update+ `THIRD_PARTY_NOTICES.md`.+- **Pipeline and prompts**: if you change `app/server/prompts.mjs` or `jobs.mjs`, say which video you tested with and+ include a before/after timing from `timeline.py`.-## 最常見的貢獻-- **新風格**:`.claude/skills/video-clone/styles/<name>.md`,附一段你用來測試的參考片描述(不要附上受版權保護的影片檔)。-- **「已知的坑」**:做片時踩到的問題與解法,補進對應風格檔或引擎的 SKILL.md。-- **新製作引擎**:一個 agent skill 資料夾;第三方 skill 請附上來源與授權,並更新 `THIRD_PARTY_NOTICES.md`。-- **流程與指令**:改 `app/server/prompts.mjs` 或 `jobs.mjs` 時,請說明用哪支片驗證、`timeline.py` 的前後時間比較。+## Before you open a PR-## 提交前-- `npm run build` 能過,`node --check` 過 `app/server/*.mjs`。-- 不要提交 `projects/`、金鑰(`~/.reelmimic/secrets.json`)、參考影片或任何你沒有授權的素材。-- 程式碼註解與文件用繁體中文或英文皆可,保持和周圍一致。+- `npm run build` passes, and `node --check` passes for `app/server/*.mjs`.+- Don't commit `projects/`, API keys (`~/.reelmimic/secrets.json`), reference videos, or any asset you don't have the+ rights to.+- Comments and docs can be in English or Traditional Chinese. Match what's around them.diff --git a/README.en.md b/README.en.mddeleted file mode 100644index 53fcb93..0000000--- a/README.en.md+++ /dev/null@@ -1,117 +0,0 @@-<div align="center">--<img src="docs/assets/logo.svg" width="76" alt="ReelMimic">--# ReelMimic--**Show it a video you love. Get a new video in the same style.**--[](LICENSE)-[](https://docs.anthropic.com/en/docs/claude-code)-[](https://github.com/openai/codex)----[繁體中文](README.md) · **English** · [简体中文](README.zh-CN.md)--<picture>- <source media="(prefers-color-scheme: dark)" srcset="docs/assets/home-en-dark.png">- <img src="docs/assets/home-en-light.png" alt="ReelMimic home page" width="860">-</picture>--</div>--## What is this?--Ever watched a video and thought "I want one in that style, but completely my own"?--Just drop it into ReelMimic. A file, a phone recording or a YouTube link all work. Then tell it what you want to make.--First it takes the reference apart: editing rhythm, shot lengths, transitions, framing, colors and camera moves. Then-it puts together a plan for you to check. You can chat right next to it, change settings or add assets, and start-when you're happy.--Once production starts, the work is split across several AI agents. Different parts of the video are made at the same-time, and every shot is handed to a different agent to check. If something's wrong it goes back to be fixed, so it's-not a one-shot generate-and-done.--ReelMimic learns how the reference was made. It doesn't carry over the original footage, characters or assets.--The whole thing runs on your own computer, with your own Claude Code or Codex.--<p align="center">-<picture>- <source media="(prefers-color-scheme: dark)" srcset="docs/assets/flow-en-dark.png">- <img src="docs/assets/flow-en-light.png" alt="How ReelMimic works" width="860">-</picture>-</p>--## What it does--- **Breaks down the reference.** Shot count, shot lengths, BPM, transitions, colors, framing and camera moves.-- **Shows you the plan first.** Storyboard, characters, assets and a few style frames. Chat about it until you like it, then approve.-- **Several AI agents share the work.** Up to 6 work on different parts of the video. Each finished shot goes to a new agent for review, so nobody grades their own work.-- **Fixes need proof.** Every fix comes with before and after screenshots, and the reviewer checks them.-- **You can see what it's doing.** What each agent is thinking, what it ran, which frames it looked at. The full log is there too.-- **Comment right on the video.** When it's done, scrub to any second and type a note. Send them all at once.-- **New styles are just Markdown.** One file per style, no code.-- **Three languages.** 繁體中文, English and 简体中文, switch in the top right.--How long it takes depends on the video's length, style and complexity. For a short video of around 60 seconds, it-usually takes one to two hours after you approve the plan.--## Getting started--You'll need Node.js 20+, Python 3.10+, FFmpeg, Chrome, and either-[Claude Code](https://docs.anthropic.com/en/docs/claude-code) or [Codex CLI](https://github.com/openai/codex) (logged in).--```bash-git clone https://github.com/edenfunf/reelmimic.git && cd reelmimic-./install.sh # on Windows, double-click install.bat-./start.sh # on Windows, double-click start.bat-```--Then open <http://localhost:4318>. The install script checks your setup and tells you if anything's missing. You can run-the check again any time with `cd app && npm run doctor`. Claude Code picks up the skills in this repo on its own, and-Codex reads `AGENTS.md`, so there's nothing else to set up.--### Your first video--1. On the home page, drop in a reference video or paste a link, say what you want, and pick Claude Code or Codex.-2. Wait for the breakdown and the plan. If you want changes, say so in the chat on the right. Screenshots work too.-3. If the plan asks you for something (lyrics, say), add it or skip it, then hit **Approve and start**.-4. The **Production line** tab shows where each character and each part of the video is, with the review screenshots.-5. When it's done, leave a note at whatever second looks off.--## Settings--API keys and a few paths go in `~/.reelmimic/secrets.json`. That file lives outside the repo, so it never gets-committed. See [`secrets.example.json`](secrets.example.json) for the format.--| Key | What it's for |-|---|---|-| `YATING_KEY` | Yating's Taiwanese Mandarin voices, for narration |-| `PIXABAY_KEY`, `FREESOUND_KEY` | More images, music and sound effects you're allowed to use (optional, Openverse works without a key) |-| `FFMPEG_DIR`, `CHROME_PATH`, `CODEX_BIN`, `PYTHON` | Where to find these tools if they're not on your PATH |-| `BUILDERS`, `MAX_AGENTS` | How many agents work on one video at once (default 6), and the limit across all projects (default 12) |-| `PORT` | Web port (default 4318) |--## Docs--- [Architecture](docs/en/ARCHITECTURE.md): how the whole thing runs, where files go, how the AI plugs in-- [Extending](docs/en/EXTENDING.md): adding styles, rendering engines, or another AI-- [Contributing](CONTRIBUTING.md)--## Ground rules--- It learns technique from the reference (pacing, framing, transitions, how the jokes land). It never reuses the- footage, characters, logos or assets.-- Characters are original unless you bring your own designs, in which case it follows yours.-- Anything it finds online gets logged with its source, author and license. Unclear licenses are flagged.-- Lyrics only come from text you give it. It won't download commercial songs.-- What you do with the videos is up to you, so make sure you have the rights.--## License--The code is [MIT](LICENSE). Third-party skills and assets bundled here keep their own licenses, listed in-[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).diff --git a/README.md b/README.mdindex b6c078c..66b08f1 100644--- a/README.md+++ b/README.md@@ -4,7 +4,7 @@# ReelMimic-**丟一支你喜歡的影片,做一支一樣風格的新影片。**+**Show it a video you love. Get a new video in the same style.**[](LICENSE)[](https://docs.anthropic.com/en/docs/claude-code)@@ -12,96 +12,106 @@-**繁體中文** · [English](README.en.md) · [简体中文](README.zh-CN.md)+**English** · [繁體中文](README.zh-TW.md) · [简体中文](README.zh-CN.md)<picture>- <source media="(prefers-color-scheme: dark)" srcset="docs/assets/home-zh-TW-dark.png">- <img src="docs/assets/home-zh-TW-light.png" alt="ReelMimic 首頁" width="860">+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/home-en-dark.png">+ <img src="docs/assets/home-en-light.png" alt="ReelMimic home page" width="860"></picture></div>-## 這是什麼+## What is this?-看到一支很喜歡的影片,想做一支同樣風格、但內容完全是自己的?+Ever watched a video and thought "I want one in that style, but completely my own"?-把影片丟進 ReelMimic 就好。檔案、手機錄影或 YouTube 連結都可以,再告訴它你想做什麼。+Just drop it into ReelMimic. A file, a phone recording or a YouTube link all work. Then tell it what you want to make.-它會先把參考片拆開來看,像是剪輯節奏、鏡頭長度、轉場、構圖、配色和運鏡,再整理成一份企劃給你確認。你可以直接在旁邊聊天、改設定、補素材,覺得可以了再開始做。+First it takes the reference apart: editing rhythm, shot lengths, transitions, framing, colors and camera moves. Then+it puts together a plan for you to check. You can chat right next to it, change settings or add assets, and start+when you're happy.-真正開始製作後,工作會拆給多個 AI 分工。不同段落可以同時進行,每一鏡做完也會交給另一個 AI 檢查,有問題就退回去改,不是生成一次就直接交差。+Once production starts, the work is split across several AI agents. Different parts of the video are made at the same+time, and every shot is handed to a different agent to check. If something's wrong it goes back to be fixed, so it's+not a one-shot generate-and-done.-ReelMimic 學的是參考片的做法,不是把原本的畫面、角色或素材搬過來。+ReelMimic learns how the reference was made. It doesn't carry over the original footage, characters or assets.-整套流程都跑在你自己的電腦上,用你自己的 Claude Code 或 Codex。+The whole thing runs on your own computer, with your own Claude Code or Codex.<p align="center"><picture>- <source media="(prefers-color-scheme: dark)" srcset="docs/assets/flow-zh-TW-dark.png">- <img src="docs/assets/flow-zh-TW-light.png" alt="ReelMimic 流程" width="860">+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/flow-en-dark.png">+ <img src="docs/assets/flow-en-light.png" alt="How ReelMimic works" width="860"></picture></p>-## 可以做到什麼+## What it does-- **拆解參考片**:鏡頭數量、鏡頭長度、BPM、轉場、配色、構圖和運鏡都會整理出來。-- **先給你看企劃**:分鏡、角色、素材、定調畫面都在裡面。想改就在旁邊聊,改到滿意再按核准。-- **多個 AI 分工**:最多 6 個同時做不同段落。每做完一鏡就換一個新的 AI 來審,不會自己審自己。-- **說修好要拿圖來看**:每個修正都附修改前後的截圖,審查的人對過才算數。-- **看得到它在幹嘛**:每個 AI 正在想什麼、跑了什麼、看了哪幾格,畫面上都有,也能打開完整 log。-- **直接在影片上留言**:成片出來後,拉到哪一秒就在那一秒打字,寫完一起送出。-- **加新風格不用寫程式**:一種風格就是一個 Markdown 檔。-- **三種語言**:繁中、英文、簡中,右上角切換。+- **Breaks down the reference.** Shot count, shot lengths, BPM, transitions, colors, framing and camera moves.+- **Shows you the plan first.** Storyboard, characters, assets and a few style frames. Chat about it until you like it, then approve.+- **Several AI agents share the work.** Up to 6 work on different parts of the video. Each finished shot goes to a new agent for review, so nobody grades their own work.+- **Fixes need proof.** Every fix comes with before and after screenshots, and the reviewer checks them.+- **You can see what it's doing.** What each agent is thinking, what it ran, which frames it looked at. The full log is there too.+- **Comment right on the video.** When it's done, scrub to any second and type a note. Send them all at once.+- **New styles are just Markdown.** One file per style, no code.+- **Three languages.** 繁體中文, English and 简体中文, switch in the top right.-實際生成時間會跟影片長度、風格和複雜度有關。以 60 秒左右的短片來說,企劃核准後通常需要一到兩小時。+How long it takes depends on the video's length, style and complexity. For a short video of around 60 seconds, it+usually takes one to two hours after you approve the plan.-## 開始用+## Getting started-先裝好這些:Node.js 20 以上、Python 3.10 以上、FFmpeg、Chrome,還有 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 或 [Codex CLI](https://github.com/openai/codex) 其中一個(要先登入)。+You'll need Node.js 20+, Python 3.10+, FFmpeg, Chrome, and either+[Claude Code](https://docs.anthropic.com/en/docs/claude-code) or [Codex CLI](https://github.com/openai/codex) (logged in).```bashgit clone https://github.com/edenfunf/reelmimic.git && cd reelmimic-./install.sh # Windows 直接點兩下 install.bat-./start.sh # Windows 直接點兩下 start.bat+./install.sh # on Windows, double-click install.bat+./start.sh # on Windows, double-click start.bat```-打開 <http://localhost:4318> 就能用了。安裝腳本會順便檢查環境,少了什麼會跟你說;之後想再檢查一次,跑 `cd app && npm run doctor`。-Claude Code 會自己讀到 repo 裡的 skills,Codex 會讀 `AGENTS.md`,不用另外設定。+Then open <http://localhost:4318>. The install script checks your setup and tells you if anything's missing. You can run+the check again any time with `cd app && npm run doctor`. Claude Code picks up the skills in this repo on its own, and+Codex reads `AGENTS.md`, so there's nothing else to set up.-### 做第一支影片+### Your first video-1. 在首頁丟參考影片或貼連結,寫你想做什麼,選要用 Claude Code 還是 Codex。-2. 等它拆解完、寫好企劃。有意見就在右邊聊天框講,也可以貼截圖。-3. 企劃裡如果有要你給的東西(像歌詞),給它或跳過,然後按「核准並開始生成」。-4. 「生產線」分頁可以看到每個角色、每一段做到哪、審查截圖長怎樣。-5. 做好之後覺得哪裡不對,就直接在那一秒留言。+1. On the home page, drop in a reference video or paste a link, say what you want, and pick Claude Code or Codex.+2. Wait for the breakdown and the plan. If you want changes, say so in the chat on the right. Screenshots work too.+3. If the plan asks you for something (lyrics, say), add it or skip it, then hit **Approve and start**.+4. The **Production line** tab shows where each character and each part of the video is, with the review screenshots.+5. When it's done, leave a note at whatever second looks off.-## 設定+## Settings-金鑰跟一些路徑放在 `~/.reelmimic/secrets.json`。這個檔在 repo 外面,不會被 commit,格式可以照 [`secrets.example.json`](secrets.example.json)。+API keys and a few paths go in `~/.reelmimic/secrets.json`. That file lives outside the repo, so it never gets+committed. See [`secrets.example.json`](secrets.example.json) for the format.-| 鍵 | 用來做什麼 |+| Key | What it's for ||---|---|-| `YATING_KEY` | 雅婷的台灣華語語音,拿來配旁白 |-| `PIXABAY_KEY`、`FREESOUND_KEY` | 可以找到更多能合法使用的圖片、音樂、音效(沒有也行,會用 Openverse) |-| `FFMPEG_DIR`、`CHROME_PATH`、`CODEX_BIN`、`PYTHON` | 這些工具不在 PATH 上的話,在這裡指定位置 |-| `BUILDERS`、`MAX_AGENTS` | 一支片同時幾個 AI 在做(預設 6)、所有專案加起來最多幾個(預設 12) |-| `PORT` | 網站用的埠號(預設 4318) |+| `YATING_KEY` | Yating's Taiwanese Mandarin voices, for narration |+| `PIXABAY_KEY`, `FREESOUND_KEY` | More images, music and sound effects you're allowed to use (optional, Openverse works without a key) |+| `FFMPEG_DIR`, `CHROME_PATH`, `CODEX_BIN`, `PYTHON` | Where to find these tools if they're not on your PATH |+| `BUILDERS`, `MAX_AGENTS` | How many agents work on one video at once (default 6), and the limit across all projects (default 12) |+| `PORT` | Web port (default 4318) |-## 文件+## Docs-- [架構](docs/ARCHITECTURE.md):整個流程怎麼跑、檔案怎麼放、怎麼接 AI-- [擴充](docs/EXTENDING.md):怎麼加風格、加製作引擎、接別的 AI-- [參與開發](CONTRIBUTING.md)+- [Architecture](docs/ARCHITECTURE.md): how the whole thing runs, where files go, how the AI plugs in+- [Extending](docs/EXTENDING.md): adding styles, rendering engines, or another AI+- [Contributing](CONTRIBUTING.md)-## 使用原則+## Ground rules-- 參考片只學手法,像節奏、構圖、轉場、笑點怎麼安排;畫面、角色、Logo、素材都不會拿來用。-- 角色預設是原創的。你有自己的角色設計圖,就照你的做。-- 網路上找來的素材會記下來源、作者跟授權,授權不清楚的會特別標出來。-- 歌詞只用你給的文字,不會自己去下載商業歌曲。-- 做出來的影片要怎麼用,請自己確認有沒有權利。+- It learns technique from the reference (pacing, framing, transitions, how the jokes land). It never reuses the+ footage, characters, logos or assets.+- Characters are original unless you bring your own designs, in which case it follows yours.+- Anything it finds online gets logged with its source, author and license. Unclear licenses are flagged.+- Lyrics only come from text you give it. It won't download commercial songs.+- What you do with the videos is up to you, so make sure you have the rights.-## 授權+## License-程式碼用 [MIT](LICENSE) 授權。裡面附的第三方 skill 和素材照它們原本的授權,細節在 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。+The code is [MIT](LICENSE). Third-party skills and assets bundled here keep their own licenses, listed in+[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).diff --git a/README.zh-CN.md b/README.zh-CN.mdindex 3af8f6f..e4dd00f 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -12,7 +12,7 @@-[繁體中文](README.md) · [English](README.en.md) · **简体中文**+[English](README.md) · [繁體中文](README.zh-TW.md) · **简体中文**<picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/home-zh-CN-dark.png">diff --git a/README.zh-TW.md b/README.zh-TW.mdnew file mode 100644index 0000000..91213cb--- /dev/null+++ b/README.zh-TW.md@@ -0,0 +1,107 @@+<div align="center">++<img src="docs/assets/logo.svg" width="76" alt="ReelMimic">++# ReelMimic++**丟一支你喜歡的影片,做一支一樣風格的新影片。**++[](LICENSE)+[](https://docs.anthropic.com/en/docs/claude-code)+[](https://github.com/openai/codex)++++[English](README.md) · **繁體中文** · [简体中文](README.zh-CN.md)++<picture>+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/home-zh-TW-dark.png">+ <img src="docs/assets/home-zh-TW-light.png" alt="ReelMimic 首頁" width="860">+</picture>++</div>++## 這是什麼++看到一支很喜歡的影片,想做一支同樣風格、但內容完全是自己的?++把影片丟進 ReelMimic 就好。檔案、手機錄影或 YouTube 連結都可以,再告訴它你想做什麼。++它會先把參考片拆開來看,像是剪輯節奏、鏡頭長度、轉場、構圖、配色和運鏡,再整理成一份企劃給你確認。你可以直接在旁邊聊天、改設定、補素材,覺得可以了再開始做。++真正開始製作後,工作會拆給多個 AI 分工。不同段落可以同時進行,每一鏡做完也會交給另一個 AI 檢查,有問題就退回去改,不是生成一次就直接交差。++ReelMimic 學的是參考片的做法,不是把原本的畫面、角色或素材搬過來。++整套流程都跑在你自己的電腦上,用你自己的 Claude Code 或 Codex。++<p align="center">+<picture>+ <source media="(prefers-color-scheme: dark)" srcset="docs/assets/flow-zh-TW-dark.png">+ <img src="docs/assets/flow-zh-TW-light.png" alt="ReelMimic 流程" width="860">+</picture>+</p>++## 可以做到什麼++- **拆解參考片**:鏡頭數量、鏡頭長度、BPM、轉場、配色、構圖和運鏡都會整理出來。+- **先給你看企劃**:分鏡、角色、素材、定調畫面都在裡面。想改就在旁邊聊,改到滿意再按核准。+- **多個 AI 分工**:最多 6 個同時做不同段落。每做完一鏡就換一個新的 AI 來審,不會自己審自己。+- **說修好要拿圖來看**:每個修正都附修改前後的截圖,審查的人對過才算數。+- **看得到它在幹嘛**:每個 AI 正在想什麼、跑了什麼、看了哪幾格,畫面上都有,也能打開完整 log。+- **直接在影片上留言**:成片出來後,拉到哪一秒就在那一秒打字,寫完一起送出。+- **加新風格不用寫程式**:一種風格就是一個 Markdown 檔。+- **三種語言**:繁中、英文、簡中,右上角切換。++實際生成時間會跟影片長度、風格和複雜度有關。以 60 秒左右的短片來說,企劃核准後通常需要一到兩小時。++## 開始用++先裝好這些:Node.js 20 以上、Python 3.10 以上、FFmpeg、Chrome,還有 [Claude Code](https://docs.anthropic.com/en/docs/claude-code) 或 [Codex CLI](https://github.com/openai/codex) 其中一個(要先登入)。++```bash+git clone https://github.com/edenfunf/reelmimic.git && cd reelmimic+./install.sh # Windows 直接點兩下 install.bat+./start.sh # Windows 直接點兩下 start.bat+```++打開 <http://localhost:4318> 就能用了。安裝腳本會順便檢查環境,少了什麼會跟你說;之後想再檢查一次,跑 `cd app && npm run doctor`。+Claude Code 會自己讀到 repo 裡的 skills,Codex 會讀 `AGENTS.md`,不用另外設定。++### 做第一支影片++1. 在首頁丟參考影片或貼連結,寫你想做什麼,選要用 Claude Code 還是 Codex。+2. 等它拆解完、寫好企劃。有意見就在右邊聊天框講,也可以貼截圖。+3. 企劃裡如果有要你給的東西(像歌詞),給它或跳過,然後按「核准並開始生成」。+4. 「生產線」分頁可以看到每個角色、每一段做到哪、審查截圖長怎樣。+5. 做好之後覺得哪裡不對,就直接在那一秒留言。++## 設定++金鑰跟一些路徑放在 `~/.reelmimic/secrets.json`。這個檔在 repo 外面,不會被 commit,格式可以照 [`secrets.example.json`](secrets.example.json)。++| 鍵 | 用來做什麼 |+|---|---|+| `YATING_KEY` | 雅婷的台灣華語語音,拿來配旁白 |+| `PIXABAY_KEY`、`FREESOUND_KEY` | 可以找到更多能合法使用的圖片、音樂、音效(沒有也行,會用 Openverse) |+| `FFMPEG_DIR`、`CHROME_PATH`、`CODEX_BIN`、`PYTHON` | 這些工具不在 PATH 上的話,在這裡指定位置 |+| `BUILDERS`、`MAX_AGENTS` | 一支片同時幾個 AI 在做(預設 6)、所有專案加起來最多幾個(預設 12) |+| `PORT` | 網站用的埠號(預設 4318) |++## 文件++- [架構](docs/zh-TW/ARCHITECTURE.md):整個流程怎麼跑、檔案怎麼放、怎麼接 AI+- [擴充](docs/zh-TW/EXTENDING.md):怎麼加風格、加製作引擎、接別的 AI+- [參與開發](docs/zh-TW/CONTRIBUTING.md)++## 使用原則++- 參考片只學手法,像節奏、構圖、轉場、笑點怎麼安排;畫面、角色、Logo、素材都不會拿來用。+- 角色預設是原創的。你有自己的角色設計圖,就照你的做。+- 網路上找來的素材會記下來源、作者跟授權,授權不清楚的會特別標出來。+- 歌詞只用你給的文字,不會自己去下載商業歌曲。+- 做出來的影片要怎麼用,請自己確認有沒有權利。++## 授權++程式碼用 [MIT](LICENSE) 授權。裡面附的第三方 skill 和素材照它們原本的授權,細節在 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。diff --git a/app/README.md b/app/README.mdindex 2c6f5a2..90d1657 100644--- a/app/README.md+++ b/app/README.md@@ -1,9 +1,9 @@-# app/ — ReelMimic 網站+# app/ — the ReelMimic web app-安裝與啟動見根目錄 [README](../README.md);架構見 [docs/ARCHITECTURE.md](../docs/ARCHITECTURE.md)。+Install and start it as described in the root [README](../README.md); how it works is in [docs/ARCHITECTURE.md](../docs/ARCHITECTURE.md).```-server/ index.mjs(HTTP/SSE)· jobs.mjs(流程與生產線)· prompts.mjs(agent 指令)· agents/(Claude Code / Codex 轉接)· env.mjs(金鑰)-web/ React 前端:App.jsx(首頁)· Project.jsx(專案頁)· Chat.jsx(對話與思考過程)· ui.jsx(元件)· styles.css-scripts/ doctor.mjs(環境檢查)+server/ index.mjs (HTTP/SSE) · jobs.mjs (workflow and production line) · prompts.mjs (agent instructions) · agents/ (Claude Code / Codex adapters) · env.mjs (keys)+web/ React UI: App.jsx (home) · Project.jsx (project page) · Chat.jsx (chat and live agent steps) · ui.jsx (components) · i18n.js (languages) · styles.css+scripts/ doctor.mjs (environment check)```diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex f2c22e2..ad8bf99 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -1,143 +1,160 @@-<p align="right"><b>繁體中文</b> · <a href="en/ARCHITECTURE.md">English</a> · <a href="zh-CN/ARCHITECTURE.md">简体中文</a></p>+<p align="right"><b>English</b> · <a href="zh-TW/ARCHITECTURE.md">繁體中文</a> · <a href="zh-CN/ARCHITECTURE.md">简体中文</a></p>-# 架構+# Architecture-ReelMimic 由三層組成:**網站**(React)、**伺服器**(Node,負責流程與派工)、**agent 工作區**(repo 根目錄,Claude Code 或 Codex 在這裡讀 skill、寫檔、渲染)。-三層之間只透過**檔案**溝通:agent 照 `CONTRACT.md` 寫檔,伺服器用「該寫的檔案有沒有更新」判斷每一步是否完成,網站直接讀這些檔案畫畫面。-所以換 agent、加引擎、改前端都不需要動到其他層。+ReelMimic has three layers: the **web app** (React), the **server** (Node — runs the workflow and dispatches+agents) and the **agent workspace** (the repo root, where Claude Code or Codex read skills, write files and render).+The layers talk only through **files**: agents write files as specified in `CONTRACT.md`, the server decides whether a+step is done by checking whether the files it must produce were updated, and the web app renders those files directly.+So you can swap the agent, add an engine or change the UI without touching the other layers.```-瀏覽器(app/web,React + Vite)+Browser (app/web, React + Vite)│ REST + Server-Sent Events▼-伺服器(app/server)- ├─ index.mjs HTTP API、上傳、SSE、提供專案檔案(/files/:id/*)- ├─ env.mjs 啟動時載入 ~/.reelmimic/secrets.json- ├─ jobs.mjs 流程狀態機 + 生產線排程(誰先誰後、平行幾個、何時暫停)- ├─ prompts.mjs 每個步驟給 agent 的指令(改檔後下一輪就生效,不用重啟)- └─ agents/index.mjs agent 轉接層:Claude Code / Codex → 統一事件- │ spawn(stdin 給指令,stdout 串流事件)+Server (app/server)+ ├─ index.mjs HTTP API, uploads, SSE, project files (/files/:id/*)+ ├─ env.mjs loads ~/.reelmimic/secrets.json at startup+ ├─ jobs.mjs workflow state machine + production scheduling (order, parallelism, pausing)+ ├─ prompts.mjs the instructions each step gives its agent (edits apply on the next turn, no restart)+ └─ agents/index.mjs agent adapters: Claude Code / Codex → one event stream+ │ spawn (prompt on stdin, events streamed on stdout)▼-agent 工作區(repo 根目錄)- ├─ .claude/skills/video-clone/ 核心 skill(流程、合約、風格表、工具)- ├─ .claude/skills/<engine>/ 製作引擎 skill- └─ projects/<id>/ 這支影片的所有檔案+Agent workspace (repo root)+ ├─ .claude/skills/video-clone/ core skill (workflow, contract, style registry, tools)+ ├─ .claude/skills/<engine>/ production engine skills+ └─ projects/<id>/ every file for one video```-## 1. 流程(一支影片的一生)+## 1. Workflow (the life of one video)```new → analyzing → styling → planning → plan_review ⇄ replanning- │ 核准(required_inputs 都已提供或略過)+ │ approve (every required input provided or skipped)▼- producing ──→ needs_input(只有使用者能給的東西 / 審查多輪未過)+ producing ──→ needs_input (something only the user can give / repeated review failures)│▼- critiquing ⇄ revising → done ⇄(使用者回饋)revising+ critiquing ⇄ revising → done ⇄ (user feedback) revising```-| 階段 | 誰做 | 必須寫出的檔案 |+| Stage | Who | Files it must write ||---|---|---|-| analyzing | `scripts/analyze.py`(不是 agent) | `analysis/report.json`、`sheet_1fps.jpg`、`sheet_scenes.jpg` |-| styling | 導演 agent | `analysis/STYLE.md`、`analysis/route.json`(風格 → 製作引擎) |-| planning | 導演寫企劃核心 → 每個角色一個 agent、素材一個 agent 同時做 → 導演整合並畫定調畫面 | `plan.json`、`STORYBOARD.md`(逐鏡對照參考片、素材與授權、定調畫面、required_inputs)、角色定義檔草稿 |-| replanning | 導演 agent | `plan.json`(依使用者意見修改) |-| producing | 生產線(見下節) | `build/production.json` … `out/video.mp4` |-| critiquing | 獨立評審(全新對話) | `out/check/critique.json` |-| revising | 導演 agent | `out/video.mp4`、`out/check/fixes.json`(每項附修改前後截圖) |+| analyzing | `scripts/analyze.py` (not an agent) | `analysis/report.json`, `sheet_1fps.jpg`, `sheet_scenes.jpg` |+| styling | director agent | `analysis/STYLE.md`, `analysis/route.json` (style → production engine) |+| planning | director writes the plan core → one agent per character and one for assets work in parallel → director merges and paints style frames | `plan.json`, `STORYBOARD.md` (shots mapped to the reference, assets with licenses, style frames, required_inputs), character definition drafts |+| replanning | director agent | `plan.json` (revised from the user's comments) |+| producing | the production line (next section) | `build/production.json` … `out/video.mp4` |+| critiquing | independent critic (fresh conversation) | `out/check/critique.json` |+| revising | director agent | `out/video.mp4`, `out/check/fixes.json` (before/after crops for every fix) |-**完成的判準是檔案**:`turn()` 記下必須檔案的修改時間,agent 回合結束後檢查它們有沒有被更新;沒有就停在 `error`,可以「重試這一步」。-伺服器重啟時,還標在工作中的專案會被標成「已中斷」(`recoverOrphans`),重試會從目前的檔案接著做。+**Files decide completion**: `turn()` records the modification time of the required files and checks after the agent+turn whether they were updated; if not, the job stops in `error` and the step can be retried.+On server start, jobs still marked as working are flagged as interrupted (`recoverOrphans`); a retry continues from the+current files.-## 2. 生產線(核准之後)+## 2. Production line (after approval)```-setup(導演):共用素材、每個角色一個定義檔、角色設定圖、分段(build/production.json)+setup (director): shared assets, one definition file per character, character sheets, segments (build/production.json)│- ├──────────────── 角色關(與做鏡頭同時進行)────────────────┐- │ 每個角色:審查員(全新對話)⇄ 修正 agent,最多 3 輪 │- │ 要改共用骨架的項目 → 導演統一改 → 相關角色重審 │- │ 全部通過 → 並排檢查(比例、互動) │- │ │- ├── 分段製作:最多 BUILDERS 個製作 agent 平行,每段 1–4 鏡 │- │ 每做完一鏡就寫 <shot>.done.json → 立刻派一個鏡頭審查員(全新對話)│- │ 審查等角色關通過才開始 ←──────────────────────────────┘- │ → 沒過的鏡頭交回同一個製作 agent 修正 → 只重審沒過的鏡頭,最多 3 輪- │ → 需要改共用檔:導演當場改(一次一個,只做加法),製作 agent 同一輪套用+ ├──────────────── cast gate (runs alongside shot building) ─────────────┐+ │ per character: reviewer (fresh) ⇄ fixer agent, up to 3 rounds │+ │ items that need the shared rig changed → director fixes → re-review │+ │ all passed → line-up check (relative scale, interactions) │+ │ │+ ├── segments: up to BUILDERS builders in parallel, 1–4 shots each │+ │ each finished shot writes <shot>.done.json → a fresh shot reviewer │+ │ is dispatched at once; reviews wait for the cast gate ←────────────┘+ │ → failing shots go back to the same builder → only those are re-reviewed, up to 3 rounds+ │ → shared-file problems: the director fixes them on the spot (one at a time, additive only),+ │ the builder applies them in the same round▼-assemble(導演):組裝、混音、全片輸出+assemble (director): assembly, mix, full render▼-最後評審(全新對話):只看跨段的接縫、連戲、節奏、字幕一致;先核對之前每一個「已修正」 ⇄ 導演修改(最多 2 輪)+final critic (fresh): only what spans segments — seams, continuity, pacing, consistent captions; verifies every+earlier "fixed" first ⇄ director revises (up to 2 rounds)```-設計重點:-- **缺陷在哪產生就在哪攔**:角色在做鏡頭前審、每段做完立刻審,不堆到最後。-- **審查員永遠是全新對話**:沒有參與製作,不會替自己的作品辯護;製作 agent 則保留自己的對話,修正時記得細節。-- **兩級問題**:`blocker`(正常觀看就看得出來)才會退回;`polish`(要放大才看得到)記下來交給後面順手處理。-- **修正要有證據**:每個「已修正」都附同一秒、同一位置的前後截圖,下一輪審查先核對。-- **needs_user**:歌詞、自家角色設計圖這類只有使用者能給的東西不算缺陷,系統暫停請使用者提供或略過,不會一直重修。-- **排程**:全域 agent 名額(`MAX_AGENTS`);審查與修正優先於新的製作,缺陷趁製作 agent 還記得細節時修掉。-- **引擎快照**:核准時把製作引擎 skill 複製到 `build/engine/<engine>/`,之後改 skill 不會影響進行中的專案。--## 3. 檔案合約--完整格式在 `.claude/skills/video-clone/CONTRACT.md`,重點:+Design points:+- **Catch defects where they are made**: characters are reviewed before shots, every shot as soon as it is built —+ problems don't pile up at the end.+- **Reviewers are always fresh conversations**: they did not build the work and have nothing to defend; builders keep+ their own conversation so they remember the details when fixing.+- **Two severities**: only `blocker` (visible at normal viewing) sends work back; `polish` (visible only when zoomed)+ is recorded and handled along the way.+- **Fixes need evidence**: every "fixed" item carries before/after crops of the same moment and region; the next+ review checks those first.+- **needs_user**: lyrics, your own character designs and similar are not defects — the job pauses and asks you to+ provide or skip them instead of looping.+- **Scheduling**: a global agent budget (`MAX_AGENTS`); reviews and fixes jump ahead of new builds so defects are+ fixed while the builder still has the details in mind.+- **Engine snapshot**: at approval the engine skill is copied to `build/engine/<engine>/`, so improving a skill never+ changes a job mid-flight.++## 3. File contract++The full format is in `.claude/skills/video-clone/CONTRACT.md`. In short:```projects/<id>/- job.json 伺服器管理:階段、session id、對話、事件紀錄(最近 600 筆)、生產線狀態- logs/events.jsonl 完整事件紀錄(不截斷)- brief.md / inputs/ 使用者的需求原文與上傳的素材- analysis/ report.json、STYLE.md、route.json、lyrics/subs.lrc|json- plan.json 前製企劃(網站的主要畫面)- build/ 引擎專案:production.json、角色定義、每鏡一個檔、engine 快照- out/check/ cast/(設定圖、審查、修正)、shots/(每段 done/review/fixes/shared、每鏡截圖)、critique.json、fixes.json- out/video.mp4 成片+ job.json managed by the server: stage, session ids, chat, event log (latest 600), production state+ logs/events.jsonl complete event log (never truncated)+ brief.md / inputs/ the user's brief and uploaded inputs+ analysis/ report.json, STYLE.md, route.json, lyrics/subs.lrc|json+ plan.json the pre-production plan (the web app's main view)+ build/ engine project: production.json, character definitions, one file per shot, engine snapshot+ out/check/ cast/ (sheets, reviews, fixes), shots/ (per-segment done/review/fixes/shared, per-shot frames), critique.json, fixes.json+ out/video.mp4 the film```-## 4. Agent 轉接層+## 4. Agent adapters-`agents/index.mjs` 把兩種 CLI 統一成同一組事件:`session`、`text`、`thinking`、`tool`、`error`、`done`。+`agents/index.mjs` turns both CLIs into the same events: `session`, `text`, `thinking`, `tool`, `error`, `done`.| | Claude Code | Codex ||---|---|---|-| 指令 | `claude -p --output-format stream-json --verbose --permission-mode acceptEdits --allowedTools …` | `codex exec --json -c sandbox_mode=workspace-write -c approval_policy=never …` |-| 接續對話 | `--resume <session>` | `exec resume <thread>` |-| 指令傳遞 | stdin | stdin |+| Command | `claude -p --output-format stream-json --verbose --permission-mode acceptEdits --allowedTools …` | `codex exec --json -c sandbox_mode=workspace-write -c approval_policy=never …` |+| Resume | `--resume <session>` | `exec resume <thread>` |+| Prompt | stdin | stdin |-伺服器記下每個角色的 session:導演一條(整支片共用,討論有上下文)、每個製作 agent 各一條(跨修正輪保留)、審查員每次都是新的。+The server keeps one session per role: the director (shared for the whole video, so discussion keeps context), one per+builder (kept across fix rounds); reviewers always start fresh.-## 5. 網站+## 5. Web app-- `App.jsx`:首頁(輸入卡片、專案列表)、路由、語言選單。-- `Project.jsx`:專案頁,分頁為成品/生產線/企劃/參考片拆解;暫停卡、錯誤卡、必要素材與歌詞對時、影片時間點留言。-- `Chat.jsx`:對話與「思考」:把 `job.chat` 與事件紀錄合併,工作中的 agent 顯示成即時卡片(白話步驟、計時、看過的影格縮圖),完成的回覆收成「思考了 N 秒 · M 個步驟」;另有原始紀錄分頁。-- `i18n.js`:介面語言(繁體中文為原文、English 對照表、简体中文由 OpenCC 轉換)。-- 即時更新:`GET /api/projects/:id/events`(SSE)。+- `App.jsx`: home (composer card, project list), routing, language menu.+- `Project.jsx`: project page with tabs Final / Production line / Plan / Reference analysis; pause and error cards,+ required inputs and lyric timing, time-stamped notes on the video.+- `Chat.jsx`: conversation and "thinking": merges `job.chat` with the event log; working agents show as live cards+ (plain-language steps, timers, thumbnails of frames they looked at); finished replies collapse into+ "Thought for N s · M steps"; plus a raw log tab.+- `i18n.js`: interface language (繁體中文 source, English table, 简体中文 via OpenCC).+- Live updates: `GET /api/projects/:id/events` (SSE).## 6. HTTP API-| 方法 | 路徑 | 用途 |+| Method | Path | Purpose ||---|---|---|-| GET | `/api/agents` | 偵測已安裝的 agent CLI |-| GET/POST | `/api/projects` | 列表/建立(multipart:reference 或 url、brief、agent、lang、inputs) |-| GET | `/api/projects/:id` | 專案快照(網站需要的所有資料) |-| POST | `/api/projects/:id/message` | 對導演說話(企劃討論、成片修改、暫停時的指示;附件放 `meta.attachments`) |-| POST | `/api/projects/:id/approve` | 核准企劃(有未提供的必要素材會回 409) |-| POST | `/api/projects/:id/lyrics` | 貼歌詞文字 → 自動對時 |-| POST | `/api/projects/:id/inputs` · `/waive` | 補上傳素材(`?to=attachments` 為對話附件)· 略過某項必要素材 |-| POST | `/api/projects/:id/resume` · `/accept` · `/retry` · `/cancel` | 暫停後繼續 · 接受目前結果 · 重試失敗步驟 · 停止 |-| GET | `/api/projects/:id/events` | SSE 事件流 |-| GET | `/files/:id/*` | 專案內的檔案(影片、截圖) |--## 7. 工具(`.claude/skills/video-clone/scripts/`)--| 工具 | 用途 |+| GET | `/api/agents` | detect installed agent CLIs |+| GET/POST | `/api/projects` | list / create (multipart: reference or url, brief, agent, lang, inputs) |+| GET | `/api/projects/:id` | project snapshot (everything the web app needs) |+| POST | `/api/projects/:id/message` | talk to the director (plan feedback, film revisions, instructions while paused; attachments in `meta.attachments`) |+| POST | `/api/projects/:id/approve` | approve the plan (409 while a required input is missing) |+| POST | `/api/projects/:id/lyrics` | paste lyric text → automatic timing |+| POST | `/api/projects/:id/inputs` · `/waive` | upload more inputs (`?to=attachments` for chat attachments) · skip a required input |+| POST | `/api/projects/:id/resume` · `/accept` · `/retry` · `/cancel` | continue after a pause · accept current results · retry a failed step · stop |+| GET | `/api/projects/:id/events` | SSE event stream |+| GET | `/files/:id/*` | files inside a project (video, frames) |++## 7. Tools (`.claude/skills/video-clone/scripts/`)++| Tool | Purpose ||---|---|-| `analyze.py` | 下載(yt-dlp)與量測參考片:鏡頭、節奏、BPM、配色、每秒一格總覽 |-| `compare.py` | 成片與參考片逐鏡並排比較 |-| `hf_frames.py` | HyperFrames 專案截圖:一次呼叫多個時間點、PIL 裁切、依內容快取、全機並行上限 |-| `fetch_assets.py` | 授權安全素材搜尋與下載(Openverse、Pixabay、Freesound),自動寫 ASSETS.md |-| `align_lyrics.py` | 使用者提供的歌詞文字 × 音檔 → 每句時間(faster-whisper 只當量尺) |-| `yating_tts.py` | 雅婷台灣華語語音 |-| `timeline.py` | 分析一支片的生產時間:每個階段、每個 agent、時間花在哪 |+| `analyze.py` | download (yt-dlp) and measure the reference: shots, pacing, BPM, palette, camera moves, contact sheets |+| `compare.py` | shot-by-shot side-by-side comparison of the film and the reference |+| `hf_frames.py` | frame grabs for HyperFrames projects: many moments per call, PIL crops, content-hash cache, machine-wide concurrency limit |+| `fetch_assets.py` | license-safe asset search and download (Openverse, Pixabay, Freesound), writes ASSETS.md |+| `align_lyrics.py` | user-provided lyric text × audio → per-line timing (faster-whisper only as a ruler) |+| `yating_tts.py` | Yating Taiwan-Mandarin voices |+| `timeline.py` | where a video's production time went: per stage, per agent, per activity |diff --git a/docs/EXTENDING.md b/docs/EXTENDING.mdindex 8433f2e..4c9b5c7 100644--- a/docs/EXTENDING.md+++ b/docs/EXTENDING.md@@ -1,128 +1,149 @@-<p align="right"><b>繁體中文</b> · <a href="en/EXTENDING.md">English</a> · <a href="zh-CN/EXTENDING.md">简体中文</a></p>+<p align="right"><b>English</b> · <a href="zh-TW/EXTENDING.md">繁體中文</a> · <a href="zh-CN/EXTENDING.md">简体中文</a></p>-# 擴充指南+# Extending ReelMimic-ReelMimic 的擴充點由淺到深:+Extension points, from shallow to deep:-| 想做的事 | 改哪裡 | 要改程式嗎 |+| You want to | Change | Code? ||---|---|---|-| 加一種影片風格 | `.claude/skills/video-clone/styles/<name>.md` | 不用 |-| 加一個製作引擎(新的畫法/渲染方式) | `.claude/skills/<engine>/`(一般 agent skill) | 不用 |-| 調整 agent 在某一步怎麼做 | `app/server/prompts.mjs` | 只改文字,下一輪就生效 |-| 加新工具給 agent 用 | `.claude/skills/video-clone/scripts/` | 寫腳本,再在 prompt/SKILL.md 提到它 |-| 接另一種 AI 導演(新的 agent CLI) | `app/server/agents/index.mjs` | 要 |-| 改生產線的步驟或順序 | `app/server/jobs.mjs` + `prompts.mjs` + `CONTRACT.md` | 要 |+| Add a video style | `.claude/skills/video-clone/styles/<name>.md` | No |+| Add a production engine (a new drawing / rendering method) | `.claude/skills/<engine>/` (an ordinary agent skill) | No |+| Change how an agent handles a step | `app/server/prompts.mjs` | Text only, applies on the next turn |+| Give agents a new tool | `.claude/skills/video-clone/scripts/` | Write the script, then mention it in a prompt / SKILL.md |+| Plug in another AI director (a new agent CLI) | `app/server/agents/index.mjs` | Yes |+| Change the steps or order of the production line | `app/server/jobs.mjs` + `prompts.mjs` + `CONTRACT.md` | Yes |----## 1. 加一種風格+## 1. Add a style-風格=「看到什麼樣的參考片 → 用哪個引擎、用什麼預設去做」。導演在 styling 步驟會讀 `styles/` 底下所有檔案,用「辨識特徵」比對參考片,-挑出最符合的一個寫進 `analysis/route.json`。+A style = "for this kind of reference → use this engine with these defaults". During the styling step the director+reads every file in `styles/`, matches the reference against each file's recognition cues and writes the best match+into `analysis/route.json`.-1. 複製 `styles/_TEMPLATE.md` 成 `styles/<name>.md`。-2. 填 frontmatter:+1. Copy `styles/_TEMPLATE.md` to `styles/<name>.md`.+2. Fill in the frontmatter:```yaml---- name: lofi-anime-loop # 唯一代號,和檔名相同- engine: hyperframes # .claude/skills/ 底下的資料夾名- medium: 2d-vector # 2d-painted · 2d-vector · 3d-stylized · 3d-photoreal(選引擎的硬條件)- priority: 60 # 兩種風格都符合時,大的優先+ name: lofi-anime-loop # unique id, same as the file name+ engine: hyperframes # folder name under .claude/skills/+ medium: 2d-vector # 2d-painted · 2d-vector · 3d-stylized · 3d-photoreal (hard constraint when picking an engine)+ priority: 60 # when two styles match, the higher one wins---```-3. 寫三段:- - **辨識特徵**:畫面、剪接、聲音、文字各一兩句,寫「看得到、量得到」的東西(例:平均鏡頭 2–3 秒、切點跟旁白不跟拍子)。- - **製作預設**:比例、長度、fps、角色怎麼做(例:2D 向量角色一律用 `assets/vector_rig`)、字幕規格。- - **已知的坑**:做過之後踩到的問題與解法。每次製作學到新東西就補在這裡,下一支片會自動避開。-4. 用一支代表性的參考片建專案,確認 `analysis/route.json` 選到你的風格。+3. Write three sections:+ - **Recognition cues**: a sentence or two each for picture, editing, sound and text — things you can see or+ measure (e.g. average shot 2–3 s, cuts follow the narration, not the beat).+ - **Production defaults**: aspect ratio, length, fps, how characters are made (e.g. 2D vector characters always use+ `assets/vector_rig`), caption spec.+ - **Known pitfalls**: problems hit in earlier productions and their fixes. Add to it whenever a production teaches+ something new; the next video avoids it automatically.+4. Create a project with a representative reference and check that `analysis/route.json` picks your style.-不想讓某個風格參與選擇時,把檔案移到 `styles/_disabled/`。+To take a style out of selection, move the file to `styles/_disabled/`.-## 2. 加一個製作引擎+## 2. Add a production engine-引擎就是一般的 agent skill:一個資料夾,裡面有 `SKILL.md`(給 agent 的使用說明)和它需要的腳本、範本。+An engine is an ordinary agent skill: a folder with a `SKILL.md` (instructions for the agent) and the scripts and+templates it needs.```.claude/skills/my-engine/- SKILL.md frontmatter(name、description)+ 怎麼建專案、怎麼預覽單格、怎麼輸出 MP4、規則與已知的坑- scripts/ … 渲染、預覽工具- template/ … 新專案骨架(選配)+ SKILL.md frontmatter (name, description) + how to create a project, preview a frame, export MP4, rules and pitfalls+ scripts/ … render and preview tools+ template/ … new-project skeleton (optional)```-讓它能接進生產線,`SKILL.md` 要講清楚這幾件事(setup 步驟的導演會照著建 `build/production.json`):+For it to plug into the production line, `SKILL.md` must make these clear (the director follows it in the setup step+to build `build/production.json`):-- **每個鏡頭一個檔案**:多個製作 agent 平行時只改自己的檔,不會互相衝突。-- **共用檔**:角色定義、配色、字幕層、音訊放在共用檔;鏡頭只呼叫、不重畫角色的身體部位。-- **預覽指令**:怎麼快速渲染某個時間點的單格與裁切(審查全靠它)。HyperFrames 專案可直接用 `scripts/hf_frames.py`。-- **輸出指令**:怎麼渲染整支 MP4、怎麼混音。-- **確定性**:每一格都只由時間決定(不要用 `Math.random()` 或跨格狀態),才能平行渲染、跳格審查。+- **One file per shot**: parallel builders each edit only their own files, so they never collide.+- **Shared files**: character definitions, palette, caption layer and audio live in shared files; shots call+ characters, they never redraw body parts.+- **Preview command**: how to quickly render a single frame and a crop at a given time (all review depends on it).+ HyperFrames projects can use `scripts/hf_frames.py` directly.+- **Export command**: how to render the full MP4 and mix audio.+- **Determinism**: every frame depends only on time (no `Math.random()`, no cross-frame state), so frames can be+ rendered in parallel and reviewed out of order.-然後寫一個指向它的風格檔(上一節)。第三方 skill 放進來前,請先看過它的腳本,並把授權補進 `THIRD_PARTY_NOTICES.md`。+Then write a style file pointing to it (previous section). Before adding a third-party skill, read its scripts and add+its license to `THIRD_PARTY_NOTICES.md`.-### 角色系統+### Character systems-- `assets/vector_rig/`:2D 向量角色,骨架(脖子、肩、肘、腕、髖、膝)+每個深度層只描一次外框,四肢永遠接在身上。用法見其 README。-- `assets/cast_rig.js`:painted-animation(水彩手繪)用的角色骨架。+- `assets/vector_rig/`: 2D vector characters — a skeleton (neck, shoulders, elbows, wrists, hips, knees) with one+ outline per depth layer, so limbs are always attached. See its README.+- `assets/cast_rig.js`: character skeleton for painted-animation (hand-painted watercolor).-新引擎若有自己的角色做法,請一樣遵守「角色定義在共用檔、每個角色一個檔、鏡頭只給姿勢參數」,角色關才能平行審查與修正。+If a new engine has its own way of making characters, keep the same rule — "characters defined in shared files, one+file per character, shots only pass pose parameters" — so the cast gate can review and fix them in parallel.-## 3. 調整 agent 的做法(prompts.mjs)+## 3. Tune agent behaviour (prompts.mjs)-`app/server/prompts.mjs` 每個鍵對應生產線的一步:+Each key in `app/server/prompts.mjs` is one step of the pipeline:-| 鍵 | 誰 | 做什麼 |+| Key | Who | Does ||---|---|---|-| `style` · `plan` · `replan` | 導演 | 選風格、寫企劃核心、依意見修改 |-| `pre_cast` · `pre_assets` · `plan_frames` | 角色 · 素材 · 導演 | 前製平行:每個角色的草稿、抓素材、整合並畫定調畫面 |-| `setup` | 導演 | 建引擎專案、共用檔、角色、分段 |-| `cast_qa` · `cast_fix` | 審查員 · 修正 | 角色關 |-| `build_chunk` · `shot_qa` · `fix_chunk` | 製作 · 審查員 · 製作 | 分段製作;每一鏡做完由一個審查員審(`shots`/`out` 參數指定鏡頭與輸出檔) |-| `shared_fix` | 導演 | 製作 agent 回報的共用檔問題 |-| `assemble` · `critique` · `revise` | 導演 · 評審 · 導演 | 組裝、最後評審、修改 |+| `style` · `plan` · `replan` | director | pick the style, write the plan core, revise from feedback |+| `pre_cast` · `pre_assets` · `plan_frames` | character · assets · director | parallel pre-production: per-character drafts, asset search, merge and paint style frames |+| `setup` | director | engine project, shared files, characters, segments |+| `cast_qa` · `cast_fix` | reviewer · fixer | cast gate |+| `build_chunk` · `shot_qa` · `fix_chunk` | builder · reviewer · builder | segment production; each finished shot gets its own reviewer (`shots` / `out` select the shots and output file) |+| `shared_fix` | director | shared-file problems reported by builders |+| `assemble` · `critique` · `revise` | director · critic · director | assembly, final critique, revisions |-共用片段:`RULES`(內容與授權原則)、`SPEED`(效率規則)、`EYE`(人眼檢查清單)、`QA_OUT`(審查輸出格式與 blocker/polish 定義)。-伺服器每次派工前都會檢查這個檔有沒有改過,**改完下一輪 agent 就用新指令,不用重啟**。+Shared fragments: `RULES` (content and licensing), `SPEED` (efficiency rules), `EYE` (human-eye checklist), `QA_OUT`+(review output format and the blocker/polish definitions).+The server checks this file for changes before every dispatch — **edits apply from the next agent turn, no restart**.-建議做法:先用 `python .claude/skills/video-clone/scripts/timeline.py projects/<id>` 看時間花在哪、哪一關反覆退回,再決定改哪段指令。-把「最後評審常退回的東西」往前移到 setup 或 build 階段定成規格,是最有效的提速方式。+Suggested approach: run `python .claude/skills/video-clone/scripts/timeline.py projects/<id>` to see where time went+and which gate kept sending work back, then decide what to change. Moving "what the final critic keeps rejecting"+forward into the setup or build specs is the most effective speed-up.-## 4. 接另一種 AI 導演+## 4. Plug in another AI director-在 `app/server/agents/index.mjs`:+In `app/server/agents/index.mjs`:-1. 寫一個 `xxxArgs(sessionId, cwd)`:無互動、自動核准檔案修改、可接續 session 的命令列參數。-2. 寫一個 `parseXxx(obj, emit, st)`:把 CLI 的 JSON 串流轉成統一事件:- `session {id}`、`text {text}`、`thinking {text}`、`tool {name, detail}`、`error {text}`,最後 `done {ok, text}`。-3. 在 `runAgent` 與 `agentStatus` 加上新的 `kind`,前端 `App.jsx` 的選擇器加一個選項。+1. Write `xxxArgs(sessionId, cwd)`: command-line arguments for a non-interactive run that auto-approves file edits+ and can resume a session.+2. Write `parseXxx(obj, emit, st)`: turn the CLI's JSON stream into the common events:+ `session {id}`, `text {text}`, `thinking {text}`, `tool {name, detail}`, `error {text}`, and finally `done {ok, text}`.+3. Add the new `kind` to `runAgent` and `agentStatus`, and an option to the picker in the web app's `App.jsx`.-agent 需要能:讀寫 repo 內檔案、執行 shell(python、node、ffmpeg)、看圖片(審查靠它)、接續對話。+The agent must be able to: read and write files in the repo, run a shell (python, node, ffmpeg), look at images+(review depends on it) and resume a conversation.-## 5. 改生產線+## 5. Change the production line-`app/server/jobs.mjs` 的主要函式:+Main functions in `app/server/jobs.mjs`:-- `production()`:setup → `castGate()`(與分段製作同時跑)→ `runChunk()` × N → assemble。-- `castGate()` / `castSerial()`:每個角色平行審查修正;一個角色或共用檔時走序列版。-- `finalPanel()`:最後評審 ⇄ 修改。-- `turn()`:派一次 agent 回合(session 管理、全域名額、必須檔案檢查)。+- `production()`: setup → `castGate()` (runs alongside segment building) → `runChunk()` × N → assemble.+- `castGate()` / `castSerial()`: per-character parallel review and fixing; the serial version is used for a single+ character or shared-file work.+- `finalPanel()`: final critic ⇄ revise.+- `turn()`: dispatches one agent turn (session handling, global slots, required-file check).-改步驟時三個地方要一起改:`jobs.mjs`(流程)、`prompts.mjs`(指令)、`CONTRACT.md`(新檔案的格式),前端要顯示的話再改 `Project.jsx`。-參數(平行數、每關輪數)在 `CONFIG`,也可以用環境變數調整。+When changing a step, change three places together: `jobs.mjs` (flow), `prompts.mjs` (instructions) and `CONTRACT.md`+(format of any new file); plus `Project.jsx` if the web app should show it.+Parameters (parallelism, rounds per gate) are in `CONFIG` and can also be set through environment variables.-## 6. 介面文字與翻譯+## 6. Adding UI text / translations-元件裡的介面文字一律寫繁體中文。`app/web/src/i18n.js` 在執行時翻譯整個頁面:英文來自 `EN` 對照表(含數字的字串用 `EN_RE` 樣式),簡體中文由 OpenCC 自動轉換。-新增文字時請在 `EN` 補上英文;不該被翻譯的元素(使用者內容、檔名)加 `data-no-i18n`。+Interface strings are written in Traditional Chinese in the components. `app/web/src/i18n.js` translates the page at+runtime: English comes from the `EN` table (plus `EN_RE` patterns for strings with numbers), Simplified Chinese is+converted automatically with OpenCC. When you add a new string, add its English entry to `EN`; mark elements that must+never be translated (user content, file names) with `data-no-i18n`.-## 7. 開發+## 7. Development```bashcd app-npm run server # 只跑後端(改 server/ 後重啟:bash app/restart.sh)-npm run web # 前端開發伺服器 http://localhost:5173(熱更新,/api 轉到 4318)-npm run build # 輸出 app/dist,給 npm start / start.sh 用-npm run doctor # 環境檢查+npm run server # backend only (after editing server/, restart with: bash app/restart.sh)+npm run web # UI dev server http://localhost:5173 (hot reload, /api proxied to 4318)+npm run build # build app/dist for npm start / start.sh+npm run doctor # environment check```-小型測試:`_smoke/`(本機,不進版本控制)放過單一元件的驗證頁;完整驗證就是實際跑一支 30 秒短片,然後用 `timeline.py` 看時間、逐格看成片。+Small tests: `_smoke/` (local, not version-controlled) holds single-component check pages; the full check is to+produce a real 30-second video, then look at the time breakdown with `timeline.py` and inspect the film frame by frame.diff --git a/docs/en/ARCHITECTURE.md b/docs/en/ARCHITECTURE.mddeleted file mode 100644index d5e380e..0000000--- a/docs/en/ARCHITECTURE.md+++ /dev/null@@ -1,160 +0,0 @@-<p align="right"><a href="../ARCHITECTURE.md">繁體中文</a> · <b>English</b> · <a href="../zh-CN/ARCHITECTURE.md">简体中文</a></p>--# Architecture--ReelMimic has three layers: the **web app** (React), the **server** (Node — runs the workflow and dispatches-agents) and the **agent workspace** (the repo root, where Claude Code or Codex read skills, write files and render).-The layers talk only through **files**: agents write files as specified in `CONTRACT.md`, the server decides whether a-step is done by checking whether the files it must produce were updated, and the web app renders those files directly.-So you can swap the agent, add an engine or change the UI without touching the other layers.--```-Browser (app/web, React + Vite)- │ REST + Server-Sent Events- ▼-Server (app/server)- ├─ index.mjs HTTP API, uploads, SSE, project files (/files/:id/*)- ├─ env.mjs loads ~/.reelmimic/secrets.json at startup- ├─ jobs.mjs workflow state machine + production scheduling (order, parallelism, pausing)- ├─ prompts.mjs the instructions each step gives its agent (edits apply on the next turn, no restart)- └─ agents/index.mjs agent adapters: Claude Code / Codex → one event stream- │ spawn (prompt on stdin, events streamed on stdout)- ▼-Agent workspace (repo root)- ├─ .claude/skills/video-clone/ core skill (workflow, contract, style registry, tools)- ├─ .claude/skills/<engine>/ production engine skills- └─ projects/<id>/ every file for one video-```--## 1. Workflow (the life of one video)--```-new → analyzing → styling → planning → plan_review ⇄ replanning- │ approve (every required input provided or skipped)- ▼- producing ──→ needs_input (something only the user can give / repeated review failures)- │- ▼- critiquing ⇄ revising → done ⇄ (user feedback) revising-```--| Stage | Who | Files it must write |-|---|---|---|-| analyzing | `scripts/analyze.py` (not an agent) | `analysis/report.json`, `sheet_1fps.jpg`, `sheet_scenes.jpg` |-| styling | director agent | `analysis/STYLE.md`, `analysis/route.json` (style → production engine) |-| planning | director writes the plan core → one agent per character and one for assets work in parallel → director merges and paints style frames | `plan.json`, `STORYBOARD.md` (shots mapped to the reference, assets with licenses, style frames, required_inputs), character definition drafts |-| replanning | director agent | `plan.json` (revised from the user's comments) |-| producing | the production line (next section) | `build/production.json` … `out/video.mp4` |-| critiquing | independent critic (fresh conversation) | `out/check/critique.json` |-| revising | director agent | `out/video.mp4`, `out/check/fixes.json` (before/after crops for every fix) |--**Files decide completion**: `turn()` records the modification time of the required files and checks after the agent-turn whether they were updated; if not, the job stops in `error` and the step can be retried.-On server start, jobs still marked as working are flagged as interrupted (`recoverOrphans`); a retry continues from the-current files.--## 2. Production line (after approval)--```-setup (director): shared assets, one definition file per character, character sheets, segments (build/production.json)- │- ├──────────────── cast gate (runs alongside shot building) ─────────────┐- │ per character: reviewer (fresh) ⇄ fixer agent, up to 3 rounds │- │ items that need the shared rig changed → director fixes → re-review │- │ all passed → line-up check (relative scale, interactions) │- │ │- ├── segments: up to BUILDERS builders in parallel, 1–4 shots each │- │ each finished shot writes <shot>.done.json → a fresh shot reviewer │- │ is dispatched at once; reviews wait for the cast gate ←────────────┘- │ → failing shots go back to the same builder → only those are re-reviewed, up to 3 rounds- │ → shared-file problems: the director fixes them on the spot (one at a time, additive only),- │ the builder applies them in the same round- ▼-assemble (director): assembly, mix, full render- ▼-final critic (fresh): only what spans segments — seams, continuity, pacing, consistent captions; verifies every-earlier "fixed" first ⇄ director revises (up to 2 rounds)-```--Design points:-- **Catch defects where they are made**: characters are reviewed before shots, every shot as soon as it is built —- problems don't pile up at the end.-- **Reviewers are always fresh conversations**: they did not build the work and have nothing to defend; builders keep- their own conversation so they remember the details when fixing.-- **Two severities**: only `blocker` (visible at normal viewing) sends work back; `polish` (visible only when zoomed)- is recorded and handled along the way.-- **Fixes need evidence**: every "fixed" item carries before/after crops of the same moment and region; the next- review checks those first.-- **needs_user**: lyrics, your own character designs and similar are not defects — the job pauses and asks you to- provide or skip them instead of looping.-- **Scheduling**: a global agent budget (`MAX_AGENTS`); reviews and fixes jump ahead of new builds so defects are- fixed while the builder still has the details in mind.-- **Engine snapshot**: at approval the engine skill is copied to `build/engine/<engine>/`, so improving a skill never- changes a job mid-flight.--## 3. File contract--The full format is in `.claude/skills/video-clone/CONTRACT.md`. In short:--```-projects/<id>/- job.json managed by the server: stage, session ids, chat, event log (latest 600), production state- logs/events.jsonl complete event log (never truncated)- brief.md / inputs/ the user's brief and uploaded inputs- analysis/ report.json, STYLE.md, route.json, lyrics/subs.lrc|json- plan.json the pre-production plan (the web app's main view)- build/ engine project: production.json, character definitions, one file per shot, engine snapshot- out/check/ cast/ (sheets, reviews, fixes), shots/ (per-segment done/review/fixes/shared, per-shot frames), critique.json, fixes.json- out/video.mp4 the film-```--## 4. Agent adapters--`agents/index.mjs` turns both CLIs into the same events: `session`, `text`, `thinking`, `tool`, `error`, `done`.--| | Claude Code | Codex |-|---|---|---|-| Command | `claude -p --output-format stream-json --verbose --permission-mode acceptEdits --allowedTools …` | `codex exec --json -c sandbox_mode=workspace-write -c approval_policy=never …` |-| Resume | `--resume <session>` | `exec resume <thread>` |-| Prompt | stdin | stdin |--The server keeps one session per role: the director (shared for the whole video, so discussion keeps context), one per-builder (kept across fix rounds); reviewers always start fresh.--## 5. Web app--- `App.jsx`: home (composer card, project list), routing, language menu.-- `Project.jsx`: project page with tabs Final / Production line / Plan / Reference analysis; pause and error cards,- required inputs and lyric timing, time-stamped notes on the video.-- `Chat.jsx`: conversation and "thinking": merges `job.chat` with the event log; working agents show as live cards- (plain-language steps, timers, thumbnails of frames they looked at); finished replies collapse into- "Thought for N s · M steps"; plus a raw log tab.-- `i18n.js`: interface language (繁體中文 source, English table, 简体中文 via OpenCC).-- Live updates: `GET /api/projects/:id/events` (SSE).--## 6. HTTP API--| Method | Path | Purpose |-|---|---|---|-| GET | `/api/agents` | detect installed agent CLIs |-| GET/POST | `/api/projects` | list / create (multipart: reference or url, brief, agent, lang, inputs) |-| GET | `/api/projects/:id` | project snapshot (everything the web app needs) |-| POST | `/api/projects/:id/message` | talk to the director (plan feedback, film revisions, instructions while paused; attachments in `meta.attachments`) |-| POST | `/api/projects/:id/approve` | approve the plan (409 while a required input is missing) |-| POST | `/api/projects/:id/lyrics` | paste lyric text → automatic timing |-| POST | `/api/projects/:id/inputs` · `/waive` | upload more inputs (`?to=attachments` for chat attachments) · skip a required input |-| POST | `/api/projects/:id/resume` · `/accept` · `/retry` · `/cancel` | continue after a pause · accept current results · retry a failed step · stop |-| GET | `/api/projects/:id/events` | SSE event stream |-| GET | `/files/:id/*` | files inside a project (video, frames) |--## 7. Tools (`.claude/skills/video-clone/scripts/`)--| Tool | Purpose |-|---|---|-| `analyze.py` | download (yt-dlp) and measure the reference: shots, pacing, BPM, palette, camera moves, contact sheets |-| `compare.py` | shot-by-shot side-by-side comparison of the film and the reference |-| `hf_frames.py` | frame grabs for HyperFrames projects: many moments per call, PIL crops, content-hash cache, machine-wide concurrency limit |-| `fetch_assets.py` | license-safe asset search and download (Openverse, Pixabay, Freesound), writes ASSETS.md |-| `align_lyrics.py` | user-provided lyric text × audio → per-line timing (faster-whisper only as a ruler) |-| `yating_tts.py` | Yating Taiwan-Mandarin voices |-| `timeline.py` | where a video's production time went: per stage, per agent, per activity |diff --git a/docs/en/EXTENDING.md b/docs/en/EXTENDING.mddeleted file mode 100644index 28e45f6..0000000--- a/docs/en/EXTENDING.md+++ /dev/null@@ -1,149 +0,0 @@-<p align="right"><a href="../EXTENDING.md">繁體中文</a> · <b>English</b> · <a href="../zh-CN/EXTENDING.md">简体中文</a></p>--# Extending ReelMimic--Extension points, from shallow to deep:--| You want to | Change | Code? |-|---|---|---|-| Add a video style | `.claude/skills/video-clone/styles/<name>.md` | No |-| Add a production engine (a new drawing / rendering method) | `.claude/skills/<engine>/` (an ordinary agent skill) | No |-| Change how an agent handles a step | `app/server/prompts.mjs` | Text only, applies on the next turn |-| Give agents a new tool | `.claude/skills/video-clone/scripts/` | Write the script, then mention it in a prompt / SKILL.md |-| Plug in another AI director (a new agent CLI) | `app/server/agents/index.mjs` | Yes |-| Change the steps or order of the production line | `app/server/jobs.mjs` + `prompts.mjs` + `CONTRACT.md` | Yes |-------## 1. Add a style--A style = "for this kind of reference → use this engine with these defaults". During the styling step the director-reads every file in `styles/`, matches the reference against each file's recognition cues and writes the best match-into `analysis/route.json`.--1. Copy `styles/_TEMPLATE.md` to `styles/<name>.md`.-2. Fill in the frontmatter:-- ```yaml- ---- name: lofi-anime-loop # unique id, same as the file name- engine: hyperframes # folder name under .claude/skills/- medium: 2d-vector # 2d-painted · 2d-vector · 3d-stylized · 3d-photoreal (hard constraint when picking an engine)- priority: 60 # when two styles match, the higher one wins- ---- ```-3. Write three sections:- - **Recognition cues**: a sentence or two each for picture, editing, sound and text — things you can see or- measure (e.g. average shot 2–3 s, cuts follow the narration, not the beat).- - **Production defaults**: aspect ratio, length, fps, how characters are made (e.g. 2D vector characters always use- `assets/vector_rig`), caption spec.- - **Known pitfalls**: problems hit in earlier productions and their fixes. Add to it whenever a production teaches- something new; the next video avoids it automatically.-4. Create a project with a representative reference and check that `analysis/route.json` picks your style.--To take a style out of selection, move the file to `styles/_disabled/`.--## 2. Add a production engine--An engine is an ordinary agent skill: a folder with a `SKILL.md` (instructions for the agent) and the scripts and-templates it needs.--```-.claude/skills/my-engine/- SKILL.md frontmatter (name, description) + how to create a project, preview a frame, export MP4, rules and pitfalls- scripts/ … render and preview tools- template/ … new-project skeleton (optional)-```--For it to plug into the production line, `SKILL.md` must make these clear (the director follows it in the setup step-to build `build/production.json`):--- **One file per shot**: parallel builders each edit only their own files, so they never collide.-- **Shared files**: character definitions, palette, caption layer and audio live in shared files; shots call- characters, they never redraw body parts.-- **Preview command**: how to quickly render a single frame and a crop at a given time (all review depends on it).- HyperFrames projects can use `scripts/hf_frames.py` directly.-- **Export command**: how to render the full MP4 and mix audio.-- **Determinism**: every frame depends only on time (no `Math.random()`, no cross-frame state), so frames can be- rendered in parallel and reviewed out of order.--Then write a style file pointing to it (previous section). Before adding a third-party skill, read its scripts and add-its license to `THIRD_PARTY_NOTICES.md`.--### Character systems--- `assets/vector_rig/`: 2D vector characters — a skeleton (neck, shoulders, elbows, wrists, hips, knees) with one- outline per depth layer, so limbs are always attached. See its README.-- `assets/cast_rig.js`: character skeleton for painted-animation (hand-painted watercolor).--If a new engine has its own way of making characters, keep the same rule — "characters defined in shared files, one-file per character, shots only pass pose parameters" — so the cast gate can review and fix them in parallel.--## 3. Tune agent behaviour (prompts.mjs)--Each key in `app/server/prompts.mjs` is one step of the pipeline:--| Key | Who | Does |-|---|---|---|-| `style` · `plan` · `replan` | director | pick the style, write the plan core, revise from feedback |-| `pre_cast` · `pre_assets` · `plan_frames` | character · assets · director | parallel pre-production: per-character drafts, asset search, merge and paint style frames |-| `setup` | director | engine project, shared files, characters, segments |-| `cast_qa` · `cast_fix` | reviewer · fixer | cast gate |-| `build_chunk` · `shot_qa` · `fix_chunk` | builder · reviewer · builder | segment production; each finished shot gets its own reviewer (`shots` / `out` select the shots and output file) |-| `shared_fix` | director | shared-file problems reported by builders |-| `assemble` · `critique` · `revise` | director · critic · director | assembly, final critique, revisions |--Shared fragments: `RULES` (content and licensing), `SPEED` (efficiency rules), `EYE` (human-eye checklist), `QA_OUT`-(review output format and the blocker/polish definitions).-The server checks this file for changes before every dispatch — **edits apply from the next agent turn, no restart**.--Suggested approach: run `python .claude/skills/video-clone/scripts/timeline.py projects/<id>` to see where time went-and which gate kept sending work back, then decide what to change. Moving "what the final critic keeps rejecting"-forward into the setup or build specs is the most effective speed-up.--## 4. Plug in another AI director--In `app/server/agents/index.mjs`:--1. Write `xxxArgs(sessionId, cwd)`: command-line arguments for a non-interactive run that auto-approves file edits- and can resume a session.-2. Write `parseXxx(obj, emit, st)`: turn the CLI's JSON stream into the common events:- `session {id}`, `text {text}`, `thinking {text}`, `tool {name, detail}`, `error {text}`, and finally `done {ok, text}`.-3. Add the new `kind` to `runAgent` and `agentStatus`, and an option to the picker in the web app's `App.jsx`.--The agent must be able to: read and write files in the repo, run a shell (python, node, ffmpeg), look at images-(review depends on it) and resume a conversation.--## 5. Change the production line--Main functions in `app/server/jobs.mjs`:--- `production()`: setup → `castGate()` (runs alongside segment building) → `runChunk()` × N → assemble.-- `castGate()` / `castSerial()`: per-character parallel review and fixing; the serial version is used for a single- character or shared-file work.-- `finalPanel()`: final critic ⇄ revise.-- `turn()`: dispatches one agent turn (session handling, global slots, required-file check).--When changing a step, change three places together: `jobs.mjs` (flow), `prompts.mjs` (instructions) and `CONTRACT.md`-(format of any new file); plus `Project.jsx` if the web app should show it.-Parameters (parallelism, rounds per gate) are in `CONFIG` and can also be set through environment variables.--## 6. Adding UI text / translations--Interface strings are written in Traditional Chinese in the components. `app/web/src/i18n.js` translates the page at-runtime: English comes from the `EN` table (plus `EN_RE` patterns for strings with numbers), Simplified Chinese is-converted automatically with OpenCC. When you add a new string, add its English entry to `EN`; mark elements that must-never be translated (user content, file names) with `data-no-i18n`.--## 7. Development--```bash-cd app-npm run server # backend only (after editing server/, restart with: bash app/restart.sh)-npm run web # UI dev server http://localhost:5173 (hot reload, /api proxied to 4318)-npm run build # build app/dist for npm start / start.sh-npm run doctor # environment check-```--Small tests: `_smoke/` (local, not version-controlled) holds single-component check pages; the full check is to-produce a real 30-second video, then look at the time breakdown with `timeline.py` and inspect the film frame by frame.diff --git a/docs/zh-CN/ARCHITECTURE.md b/docs/zh-CN/ARCHITECTURE.mdindex abe10d4..a480f1e 100644--- a/docs/zh-CN/ARCHITECTURE.md+++ b/docs/zh-CN/ARCHITECTURE.md@@ -1,4 +1,4 @@-<p align="right"><a href="../ARCHITECTURE.md">繁體中文</a> · <a href="../en/ARCHITECTURE.md">English</a> · <b>简体中文</b></p>+<p align="right"><a href="../ARCHITECTURE.md">English</a> · <a href="../zh-TW/ARCHITECTURE.md">繁體中文</a> · <b>简体中文</b></p># 架构diff --git a/docs/zh-CN/EXTENDING.md b/docs/zh-CN/EXTENDING.mdindex 8c86540..5bad2d1 100644--- a/docs/zh-CN/EXTENDING.md+++ b/docs/zh-CN/EXTENDING.md@@ -1,4 +1,4 @@-<p align="right"><a href="../EXTENDING.md">繁體中文</a> · <a href="../en/EXTENDING.md">English</a> · <b>简体中文</b></p>+<p align="right"><a href="../EXTENDING.md">English</a> · <a href="../zh-TW/EXTENDING.md">繁體中文</a> · <b>简体中文</b></p># 扩充指南diff --git a/docs/zh-TW/ARCHITECTURE.md b/docs/zh-TW/ARCHITECTURE.mdnew file mode 100644index 0000000..5a5ab4e--- /dev/null+++ b/docs/zh-TW/ARCHITECTURE.md@@ -0,0 +1,143 @@+<p align="right"><a href="../ARCHITECTURE.md">English</a> · <b>繁體中文</b> · <a href="../zh-CN/ARCHITECTURE.md">简体中文</a></p>++# 架構++ReelMimic 由三層組成:**網站**(React)、**伺服器**(Node,負責流程與派工)、**agent 工作區**(repo 根目錄,Claude Code 或 Codex 在這裡讀 skill、寫檔、渲染)。+三層之間只透過**檔案**溝通:agent 照 `CONTRACT.md` 寫檔,伺服器用「該寫的檔案有沒有更新」判斷每一步是否完成,網站直接讀這些檔案畫畫面。+所以換 agent、加引擎、改前端都不需要動到其他層。++```+瀏覽器(app/web,React + Vite)+ │ REST + Server-Sent Events+ ▼+伺服器(app/server)+ ├─ index.mjs HTTP API、上傳、SSE、提供專案檔案(/files/:id/*)+ ├─ env.mjs 啟動時載入 ~/.reelmimic/secrets.json+ ├─ jobs.mjs 流程狀態機 + 生產線排程(誰先誰後、平行幾個、何時暫停)+ ├─ prompts.mjs 每個步驟給 agent 的指令(改檔後下一輪就生效,不用重啟)+ └─ agents/index.mjs agent 轉接層:Claude Code / Codex → 統一事件+ │ spawn(stdin 給指令,stdout 串流事件)+ ▼+agent 工作區(repo 根目錄)+ ├─ .claude/skills/video-clone/ 核心 skill(流程、合約、風格表、工具)+ ├─ .claude/skills/<engine>/ 製作引擎 skill+ └─ projects/<id>/ 這支影片的所有檔案+```++## 1. 流程(一支影片的一生)++```+new → analyzing → styling → planning → plan_review ⇄ replanning+ │ 核准(required_inputs 都已提供或略過)+ ▼+ producing ──→ needs_input(只有使用者能給的東西 / 審查多輪未過)+ │+ ▼+ critiquing ⇄ revising → done ⇄(使用者回饋)revising+```++| 階段 | 誰做 | 必須寫出的檔案 |+|---|---|---|+| analyzing | `scripts/analyze.py`(不是 agent) | `analysis/report.json`、`sheet_1fps.jpg`、`sheet_scenes.jpg` |+| styling | 導演 agent | `analysis/STYLE.md`、`analysis/route.json`(風格 → 製作引擎) |+| planning | 導演寫企劃核心 → 每個角色一個 agent、素材一個 agent 同時做 → 導演整合並畫定調畫面 | `plan.json`、`STORYBOARD.md`(逐鏡對照參考片、素材與授權、定調畫面、required_inputs)、角色定義檔草稿 |+| replanning | 導演 agent | `plan.json`(依使用者意見修改) |+| producing | 生產線(見下節) | `build/production.json` … `out/video.mp4` |+| critiquing | 獨立評審(全新對話) | `out/check/critique.json` |+| revising | 導演 agent | `out/video.mp4`、`out/check/fixes.json`(每項附修改前後截圖) |++**完成的判準是檔案**:`turn()` 記下必須檔案的修改時間,agent 回合結束後檢查它們有沒有被更新;沒有就停在 `error`,可以「重試這一步」。+伺服器重啟時,還標在工作中的專案會被標成「已中斷」(`recoverOrphans`),重試會從目前的檔案接著做。++## 2. 生產線(核准之後)++```+setup(導演):共用素材、每個角色一個定義檔、角色設定圖、分段(build/production.json)+ │+ ├──────────────── 角色關(與做鏡頭同時進行)────────────────┐+ │ 每個角色:審查員(全新對話)⇄ 修正 agent,最多 3 輪 │+ │ 要改共用骨架的項目 → 導演統一改 → 相關角色重審 │+ │ 全部通過 → 並排檢查(比例、互動) │+ │ │+ ├── 分段製作:最多 BUILDERS 個製作 agent 平行,每段 1–4 鏡 │+ │ 每做完一鏡就寫 <shot>.done.json → 立刻派一個鏡頭審查員(全新對話)│+ │ 審查等角色關通過才開始 ←──────────────────────────────┘+ │ → 沒過的鏡頭交回同一個製作 agent 修正 → 只重審沒過的鏡頭,最多 3 輪+ │ → 需要改共用檔:導演當場改(一次一個,只做加法),製作 agent 同一輪套用+ ▼+assemble(導演):組裝、混音、全片輸出+ ▼+最後評審(全新對話):只看跨段的接縫、連戲、節奏、字幕一致;先核對之前每一個「已修正」 ⇄ 導演修改(最多 2 輪)+```++設計重點:+- **缺陷在哪產生就在哪攔**:角色在做鏡頭前審、每段做完立刻審,不堆到最後。+- **審查員永遠是全新對話**:沒有參與製作,不會替自己的作品辯護;製作 agent 則保留自己的對話,修正時記得細節。+- **兩級問題**:`blocker`(正常觀看就看得出來)才會退回;`polish`(要放大才看得到)記下來交給後面順手處理。+- **修正要有證據**:每個「已修正」都附同一秒、同一位置的前後截圖,下一輪審查先核對。+- **needs_user**:歌詞、自家角色設計圖這類只有使用者能給的東西不算缺陷,系統暫停請使用者提供或略過,不會一直重修。+- **排程**:全域 agent 名額(`MAX_AGENTS`);審查與修正優先於新的製作,缺陷趁製作 agent 還記得細節時修掉。+- **引擎快照**:核准時把製作引擎 skill 複製到 `build/engine/<engine>/`,之後改 skill 不會影響進行中的專案。++## 3. 檔案合約++完整格式在 `.claude/skills/video-clone/CONTRACT.md`,重點:++```+projects/<id>/+ job.json 伺服器管理:階段、session id、對話、事件紀錄(最近 600 筆)、生產線狀態+ logs/events.jsonl 完整事件紀錄(不截斷)+ brief.md / inputs/ 使用者的需求原文與上傳的素材+ analysis/ report.json、STYLE.md、route.json、lyrics/subs.lrc|json+ plan.json 前製企劃(網站的主要畫面)+ build/ 引擎專案:production.json、角色定義、每鏡一個檔、engine 快照+ out/check/ cast/(設定圖、審查、修正)、shots/(每段 done/review/fixes/shared、每鏡截圖)、critique.json、fixes.json+ out/video.mp4 成片+```++## 4. Agent 轉接層++`agents/index.mjs` 把兩種 CLI 統一成同一組事件:`session`、`text`、`thinking`、`tool`、`error`、`done`。++| | Claude Code | Codex |+|---|---|---|+| 指令 | `claude -p --output-format stream-json --verbose --permission-mode acceptEdits --allowedTools …` | `codex exec --json -c sandbox_mode=workspace-write -c approval_policy=never …` |+| 接續對話 | `--resume <session>` | `exec resume <thread>` |+| 指令傳遞 | stdin | stdin |++伺服器記下每個角色的 session:導演一條(整支片共用,討論有上下文)、每個製作 agent 各一條(跨修正輪保留)、審查員每次都是新的。++## 5. 網站++- `App.jsx`:首頁(輸入卡片、專案列表)、路由、語言選單。+- `Project.jsx`:專案頁,分頁為成品/生產線/企劃/參考片拆解;暫停卡、錯誤卡、必要素材與歌詞對時、影片時間點留言。+- `Chat.jsx`:對話與「思考」:把 `job.chat` 與事件紀錄合併,工作中的 agent 顯示成即時卡片(白話步驟、計時、看過的影格縮圖),完成的回覆收成「思考了 N 秒 · M 個步驟」;另有原始紀錄分頁。+- `i18n.js`:介面語言(繁體中文為原文、English 對照表、简体中文由 OpenCC 轉換)。+- 即時更新:`GET /api/projects/:id/events`(SSE)。++## 6. HTTP API++| 方法 | 路徑 | 用途 |+|---|---|---|+| GET | `/api/agents` | 偵測已安裝的 agent CLI |+| GET/POST | `/api/projects` | 列表/建立(multipart:reference 或 url、brief、agent、lang、inputs) |+| GET | `/api/projects/:id` | 專案快照(網站需要的所有資料) |+| POST | `/api/projects/:id/message` | 對導演說話(企劃討論、成片修改、暫停時的指示;附件放 `meta.attachments`) |+| POST | `/api/projects/:id/approve` | 核准企劃(有未提供的必要素材會回 409) |+| POST | `/api/projects/:id/lyrics` | 貼歌詞文字 → 自動對時 |+| POST | `/api/projects/:id/inputs` · `/waive` | 補上傳素材(`?to=attachments` 為對話附件)· 略過某項必要素材 |+| POST | `/api/projects/:id/resume` · `/accept` · `/retry` · `/cancel` | 暫停後繼續 · 接受目前結果 · 重試失敗步驟 · 停止 |+| GET | `/api/projects/:id/events` | SSE 事件流 |+| GET | `/files/:id/*` | 專案內的檔案(影片、截圖) |++## 7. 工具(`.claude/skills/video-clone/scripts/`)++| 工具 | 用途 |+|---|---|+| `analyze.py` | 下載(yt-dlp)與量測參考片:鏡頭、節奏、BPM、配色、每秒一格總覽 |+| `compare.py` | 成片與參考片逐鏡並排比較 |+| `hf_frames.py` | HyperFrames 專案截圖:一次呼叫多個時間點、PIL 裁切、依內容快取、全機並行上限 |+| `fetch_assets.py` | 授權安全素材搜尋與下載(Openverse、Pixabay、Freesound),自動寫 ASSETS.md |+| `align_lyrics.py` | 使用者提供的歌詞文字 × 音檔 → 每句時間(faster-whisper 只當量尺) |+| `yating_tts.py` | 雅婷台灣華語語音 |+| `timeline.py` | 分析一支片的生產時間:每個階段、每個 agent、時間花在哪 |diff --git a/docs/zh-TW/CONTRIBUTING.md b/docs/zh-TW/CONTRIBUTING.mdnew file mode 100644index 0000000..8a95bc9--- /dev/null+++ b/docs/zh-TW/CONTRIBUTING.md@@ -0,0 +1,28 @@+<p align="right"><a href="../../CONTRIBUTING.md">English</a> · <b>繁體中文</b></p>++# 參與開發++感謝你想一起改進 ReelMimic!++## 開發環境+依 [README](../../README.zh-TW.md) 安裝後:++```bash+cd app+npm run server # 後端(改 server/ 後:bash app/restart.sh)+npm run web # 前端熱更新 http://localhost:5173+npm run doctor # 環境檢查+```++架構說明在 [ARCHITECTURE.md](ARCHITECTURE.md),擴充方式在 [EXTENDING.md](EXTENDING.md)。++## 最常見的貢獻+- **新風格**:`.claude/skills/video-clone/styles/<name>.md`,附一段你用來測試的參考片描述(不要附上受版權保護的影片檔)。+- **「已知的坑」**:做片時踩到的問題與解法,補進對應風格檔或引擎的 SKILL.md。+- **新製作引擎**:一個 agent skill 資料夾;第三方 skill 請附上來源與授權,並更新 `THIRD_PARTY_NOTICES.md`。+- **流程與指令**:改 `app/server/prompts.mjs` 或 `jobs.mjs` 時,請說明用哪支片驗證、`timeline.py` 的前後時間比較。++## 提交前+- `npm run build` 能過,`node --check` 過 `app/server/*.mjs`。+- 不要提交 `projects/`、金鑰(`~/.reelmimic/secrets.json`)、參考影片或任何你沒有授權的素材。+- 程式碼註解與文件用繁體中文或英文皆可,保持和周圍一致。diff --git a/docs/zh-TW/EXTENDING.md b/docs/zh-TW/EXTENDING.mdnew file mode 100644index 0000000..664f947--- /dev/null+++ b/docs/zh-TW/EXTENDING.md@@ -0,0 +1,128 @@+<p align="right"><a href="../EXTENDING.md">English</a> · <b>繁體中文</b> · <a href="../zh-CN/EXTENDING.md">简体中文</a></p>++# 擴充指南++ReelMimic 的擴充點由淺到深:++| 想做的事 | 改哪裡 | 要改程式嗎 |+|---|---|---|+| 加一種影片風格 | `.claude/skills/video-clone/styles/<name>.md` | 不用 |+| 加一個製作引擎(新的畫法/渲染方式) | `.claude/skills/<engine>/`(一般 agent skill) | 不用 |+| 調整 agent 在某一步怎麼做 | `app/server/prompts.mjs` | 只改文字,下一輪就生效 |+| 加新工具給 agent 用 | `.claude/skills/video-clone/scripts/` | 寫腳本,再在 prompt/SKILL.md 提到它 |+| 接另一種 AI 導演(新的 agent CLI) | `app/server/agents/index.mjs` | 要 |+| 改生產線的步驟或順序 | `app/server/jobs.mjs` + `prompts.mjs` + `CONTRACT.md` | 要 |++---++## 1. 加一種風格++風格=「看到什麼樣的參考片 → 用哪個引擎、用什麼預設去做」。導演在 styling 步驟會讀 `styles/` 底下所有檔案,用「辨識特徵」比對參考片,+挑出最符合的一個寫進 `analysis/route.json`。++1. 複製 `styles/_TEMPLATE.md` 成 `styles/<name>.md`。+2. 填 frontmatter:++ ```yaml+ ---+ name: lofi-anime-loop # 唯一代號,和檔名相同+ engine: hyperframes # .claude/skills/ 底下的資料夾名+ medium: 2d-vector # 2d-painted · 2d-vector · 3d-stylized · 3d-photoreal(選引擎的硬條件)+ priority: 60 # 兩種風格都符合時,大的優先+ ---+ ```+3. 寫三段:+ - **辨識特徵**:畫面、剪接、聲音、文字各一兩句,寫「看得到、量得到」的東西(例:平均鏡頭 2–3 秒、切點跟旁白不跟拍子)。+ - **製作預設**:比例、長度、fps、角色怎麼做(例:2D 向量角色一律用 `assets/vector_rig`)、字幕規格。+ - **已知的坑**:做過之後踩到的問題與解法。每次製作學到新東西就補在這裡,下一支片會自動避開。+4. 用一支代表性的參考片建專案,確認 `analysis/route.json` 選到你的風格。++不想讓某個風格參與選擇時,把檔案移到 `styles/_disabled/`。++## 2. 加一個製作引擎++引擎就是一般的 agent skill:一個資料夾,裡面有 `SKILL.md`(給 agent 的使用說明)和它需要的腳本、範本。++```+.claude/skills/my-engine/+ SKILL.md frontmatter(name、description)+ 怎麼建專案、怎麼預覽單格、怎麼輸出 MP4、規則與已知的坑+ scripts/ … 渲染、預覽工具+ template/ … 新專案骨架(選配)+```++讓它能接進生產線,`SKILL.md` 要講清楚這幾件事(setup 步驟的導演會照著建 `build/production.json`):++- **每個鏡頭一個檔案**:多個製作 agent 平行時只改自己的檔,不會互相衝突。+- **共用檔**:角色定義、配色、字幕層、音訊放在共用檔;鏡頭只呼叫、不重畫角色的身體部位。+- **預覽指令**:怎麼快速渲染某個時間點的單格與裁切(審查全靠它)。HyperFrames 專案可直接用 `scripts/hf_frames.py`。+- **輸出指令**:怎麼渲染整支 MP4、怎麼混音。+- **確定性**:每一格都只由時間決定(不要用 `Math.random()` 或跨格狀態),才能平行渲染、跳格審查。++然後寫一個指向它的風格檔(上一節)。第三方 skill 放進來前,請先看過它的腳本,並把授權補進 `THIRD_PARTY_NOTICES.md`。++### 角色系統++- `assets/vector_rig/`:2D 向量角色,骨架(脖子、肩、肘、腕、髖、膝)+每個深度層只描一次外框,四肢永遠接在身上。用法見其 README。+- `assets/cast_rig.js`:painted-animation(水彩手繪)用的角色骨架。++新引擎若有自己的角色做法,請一樣遵守「角色定義在共用檔、每個角色一個檔、鏡頭只給姿勢參數」,角色關才能平行審查與修正。++## 3. 調整 agent 的做法(prompts.mjs)++`app/server/prompts.mjs` 每個鍵對應生產線的一步:++| 鍵 | 誰 | 做什麼 |+|---|---|---|+| `style` · `plan` · `replan` | 導演 | 選風格、寫企劃核心、依意見修改 |+| `pre_cast` · `pre_assets` · `plan_frames` | 角色 · 素材 · 導演 | 前製平行:每個角色的草稿、抓素材、整合並畫定調畫面 |+| `setup` | 導演 | 建引擎專案、共用檔、角色、分段 |+| `cast_qa` · `cast_fix` | 審查員 · 修正 | 角色關 |+| `build_chunk` · `shot_qa` · `fix_chunk` | 製作 · 審查員 · 製作 | 分段製作;每一鏡做完由一個審查員審(`shots`/`out` 參數指定鏡頭與輸出檔) |+| `shared_fix` | 導演 | 製作 agent 回報的共用檔問題 |+| `assemble` · `critique` · `revise` | 導演 · 評審 · 導演 | 組裝、最後評審、修改 |++共用片段:`RULES`(內容與授權原則)、`SPEED`(效率規則)、`EYE`(人眼檢查清單)、`QA_OUT`(審查輸出格式與 blocker/polish 定義)。+伺服器每次派工前都會檢查這個檔有沒有改過,**改完下一輪 agent 就用新指令,不用重啟**。++建議做法:先用 `python .claude/skills/video-clone/scripts/timeline.py projects/<id>` 看時間花在哪、哪一關反覆退回,再決定改哪段指令。+把「最後評審常退回的東西」往前移到 setup 或 build 階段定成規格,是最有效的提速方式。++## 4. 接另一種 AI 導演++在 `app/server/agents/index.mjs`:++1. 寫一個 `xxxArgs(sessionId, cwd)`:無互動、自動核准檔案修改、可接續 session 的命令列參數。+2. 寫一個 `parseXxx(obj, emit, st)`:把 CLI 的 JSON 串流轉成統一事件:+ `session {id}`、`text {text}`、`thinking {text}`、`tool {name, detail}`、`error {text}`,最後 `done {ok, text}`。+3. 在 `runAgent` 與 `agentStatus` 加上新的 `kind`,前端 `App.jsx` 的選擇器加一個選項。++agent 需要能:讀寫 repo 內檔案、執行 shell(python、node、ffmpeg)、看圖片(審查靠它)、接續對話。++## 5. 改生產線++`app/server/jobs.mjs` 的主要函式:++- `production()`:setup → `castGate()`(與分段製作同時跑)→ `runChunk()` × N → assemble。+- `castGate()` / `castSerial()`:每個角色平行審查修正;一個角色或共用檔時走序列版。+- `finalPanel()`:最後評審 ⇄ 修改。+- `turn()`:派一次 agent 回合(session 管理、全域名額、必須檔案檢查)。++改步驟時三個地方要一起改:`jobs.mjs`(流程)、`prompts.mjs`(指令)、`CONTRACT.md`(新檔案的格式),前端要顯示的話再改 `Project.jsx`。+參數(平行數、每關輪數)在 `CONFIG`,也可以用環境變數調整。++## 6. 介面文字與翻譯++元件裡的介面文字一律寫繁體中文。`app/web/src/i18n.js` 在執行時翻譯整個頁面:英文來自 `EN` 對照表(含數字的字串用 `EN_RE` 樣式),簡體中文由 OpenCC 自動轉換。+新增文字時請在 `EN` 補上英文;不該被翻譯的元素(使用者內容、檔名)加 `data-no-i18n`。++## 7. 開發++```bash+cd app+npm run server # 只跑後端(改 server/ 後重啟:bash app/restart.sh)+npm run web # 前端開發伺服器 http://localhost:5173(熱更新,/api 轉到 4318)+npm run build # 輸出 app/dist,給 npm start / start.sh 用+npm run doctor # 環境檢查+```++小型測試:`_smoke/`(本機,不進版本控制)放過單一元件的驗證頁;完整驗證就是實際跑一支 30 秒短片,然後用 `timeline.py` 看時間、逐格看成片。