videogen/docs/reelforge/NEXT_PHASES.md
caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

123 lines
9.3 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# ReelForge — Next Phases
Phases 1–3 + Sprint-4 monetization are built, hardened (two adversarial-review rounds, 18 defects fixed), and green under the local gate (**1709 passed, 3 skipped**). This plan sequences what remains, grounded in [`PLAN_COVERAGE.md`](./PLAN_COVERAGE.md). Phases 4–5 need **no API keys**; Phase 6 is config/ops; Phase 7 is growth.
---
## Phase 4 — Pipeline fidelity (key-free) — completes the "Partial" stages to spec
Goal: make the render pipeline production-faithful to CTO §5. All verifiable with synthetic fixtures + real ffmpeg.
| # | Item | Spec ref | Acceptance |
|---|---|---|---|
| 4a | Smart screen-recording handling in `compose_ffmpeg`: `ffprobe` pre-analysis, `freezedetect` leading-frame trim, `setpts` speed-ramp (≤1.6×), blur-pad fallback | build §3.5 / CTO S5 | unit + real-ffmpeg tests: over-long input ramps to fit; static lead trimmed; odd aspect blur-padded to 1080×1920 |
| 4b | Audio finishing: bg-music `sidechaincompress` ducking (assets in `resource/songs/`) + `loudnorm` −3 LUFS | CTO S5 | ffprobe/loudness assertion; voiceover ducks music |
| 4c | Curated `voices.yaml` (3 TR + 3 EN verified voice IDs); `GET /v1/voices` serves it | CTO §4/§5.2 | endpoint returns curated list; schema test |
| 4d | Avatar drift policy to spec (`Δ<0.15s` → fail+retry, not just warn) + force green-screen bg in HeyGen call | CTO §5.3 | `stage_avatar` fails/retries on drift; test both branches |
| 4e | TR-glyph **render** QA: upgrade `test_fonts.py` cmap check to rendered-frame pixel-diff non-tofu (CI, libass) | CTO §5.4 | renders İĞÜŞÖÇ, asserts glyph ink vs tofu box |
| 4f | Result-URL 7-day presign + configurable expiry | CTO §5.6 | `stage_compose`/`get_job` presign GET for 7d |
**Exit:** every §5 stage matches spec; new tests green under the local gate; `PLAN_COVERAGE.md` §5 flips Partial→Implemented.
---
## Phase 5 — Product completeness (key-free)
| # | Item | Spec ref | Acceptance |
|---|---|---|---|
| 5a | **Batch variants N=1..3** — `POST /v1/jobs {variants}`, temperature-0.9 multi-script, N outputs per run | build §1/§6, CTO §4 | one job → N distinct scripts/videos; credits × N |
| 5b | **Per-job USD cost telemetry** — record LLM-token / TTS-char / avatar-second cost to `job_events` | build §8.7, CTO §0 | `GET /v1/jobs/{id}` exposes cost; unit-econ test |
| 5c | **Golden regression gate (local)** — promote `tests/golden/` to a required step in the local `make -f Makefile.reelforge gate` (no GitHub Actions — CI intentionally omitted) asserting drift ≤50ms, res, bitrate, Δ≤150ms on fixtures | CTO §8.1, S3 | the local gate fails if any acceptance threshold regresses |
| 5d | ToS / AI-disclosure toggle in compose/upload (YouTube synthetic-media flag already set) | build §7, CTO S4 | per-job flag; disclosure metadata on publish |
| 5e | Physically remove/disable Pexels/Pixabay in `material.py` + strip stock keys from config | build §8.1 | stock path deleted; import-graph test |
| 5f | Clerk→API JWT bridge — verify Clerk JWT in FastAPI middleware (today: `x-api-key`) | CTO §4 | JWT-authed requests map to user; auth test |
| 5g | Doc drift — refresh `STATUS.md` (Sentry now wired), regen `PLAN_COVERAGE.md` | — | docs match code |
**Exit:** DoD §1 golden gate live in the local gate; batch A/B testing usable; unit economics visible from job #1.
---
## Phase 6 — Launch readiness (config + ops; needs accounts, no new code)
1. Provision + fill `config.toml`/env: Anthropic, ElevenLabs, HeyGen, R2 (+ `public_base_url`), Neon, Clerk, Stripe, iyzico, RunPod, Sentry DSN.
2. License 8–10 HeyGen avatar presets; seed `avatar_presets`.
3. Run the **10-video golden set** (5 TR + 5 EN) against live providers in the local gate; measure **p95 ≤5 min** on Hetzner CPX41 (DoD §1–2).
4. Fresh-box `docker compose up` deploy verified **≤30 min** (DoD §4).
5. Live payments smoke (Stripe + iyzico Checkout + webhooks); confirm Sentry ingest.
6. Deploy web → Cloudflare Pages; mobile → EAS build.
**Exit:** a stranger can pay and generate a posted-quality TR/EN reel end-to-end.
---
## Phase 7 — Scale & growth (post-launch)
- **Margin:** productionize self-hosted **LatentSync/RunPod** at volume (autoscale, warm pool) → target ≤$0.30/60s; A/B cost vs HeyGen.
- **Power users:** job-completion **webhook API** (vs polling); public API keys + quotas.
- **Custom avatars:** user photo → HeyGen talking-photo create flow (studio endpoint scaffolded) end-to-end.
- **Distribution:** publish scheduling + multi-account (upload-post); calendar.
- **Growth loop:** A/B hook-performance analytics (which hooks convert), referral credits, team/multi-tenant accounts.
- **Mobile:** EAS store submission (iOS/Android).
- **Observability:** cost/funnel dashboard from `job_events`.
---
## Suggested execution order
Phase 4 → 5 can run now as parallel workflows (path-isolated builders + adversarial verify + real-ffmpeg anchors), same method as Phases 1–3. Phase 6 unblocks once keys exist. Phase 7 is prioritized per traction after launch.
---
## Roadmap
> Status reconciled against the code as of 2026-08-13. Suite: **1709 passed, 3 skipped**
> (see [`STATUS.md`](./STATUS.md), [`FEATURES.md`](./FEATURES.md)).
### Phases 4–7 — status
| Phase | Scope | Status | Notes |
|---|---|---|---|
| **Phase 4** | Pipeline fidelity (key-free) | ✅ **DONE** | Smart screen handling, audio ducking + `loudnorm`, curated `voices.yaml`, strict `<0.15s` avatar-drift gate, TR-glyph render QA, 7-day presigned result URLs — all landed in code and covered by tests. |
| **Phase 5** | Product completeness (key-free) | ✅ **DONE** | Batch variants (N=1..3), per-job USD cost telemetry, Clerk→JWT bridge, ToS/AI-disclosure toggle, golden local acceptance gate — landed; adversarial verify fixed 3 defects. |
| **Phase 7** | Scale & growth surfaces | ✅ **Mostly DONE (in code)** | Referrals, insights dashboard, notifications, teams/workspaces + shared pool, scheduled publishing, dubbing distribution, custom photo avatars, completion webhooks, and self-hosted LatentSync/RunPod (Tier B) all shipped ahead of schedule. Remaining: public API keys + quotas (in progress), autoscale warm-pool cost tuning, cost/funnel BI dashboard. |
| **Phase 6** | Launch readiness (config + ops) | ⏳ **Gated on live accounts** | No code work left. Needs provisioned keys (Anthropic/ElevenLabs/HeyGen/R2/Neon/Clerk/Stripe/iyzico/RunPod/Sentry), the **real** 10-video golden set, and the **p95 ≤5 min** benchmark on a deployed worker. Honest: not verifiable without credentials. |
### 16 shipped features — DONE
Every feature below is live in the codebase and cited in [`FEATURES.md`](./FEATURES.md):
| # | Feature | Anchor |
|---|---|---|
| 1 | ✅ Batch variants (A/B, N=1..3) | `jobs.py::create_job`, `_MAX_VARIANTS` |
| 2 | ✅ Dubbing (multi-language fan-out) | `jobs.py::dub_job`, `translate.py` |
| 3 | ✅ Brand Voice cloning (ElevenLabs IVC) | `voices.py`, `tts/voice_clone.py` |
| 4 | ✅ Bring-Your-Own-Voiceover (faster-whisper) | `reelforge._stage_tts_byov`, `transcribe.py` |
| 5 | ✅ Spark idea engine | `ideas.py`, `controllers/v1/ideas.py` |
| 6 | ✅ AI B-roll suggestions | `broll.py::suggest_broll` |
| 7 | ✅ Social caption / hashtags | `llm.py::generate_social_metadata`, `social.py` |
| 8 | ✅ Custom photo avatar (HeyGen talking-photo) | `studio.py::create_avatar` |
| 9 | ✅ AI music generation (ElevenLabs Music / Sonilo) | `bgm_ai.py`, `elevenlabs_music.py` |
| 10 | ✅ Music library + sidechain ducking | `music.py`, `compose/compose_ffmpeg.py` |
| 11 | ✅ Cover / thumbnail generator | `cover.py`, `controllers/v1/covers.py` |
| 12 | ✅ Brand watermark (per-user + per-job) | `brand.py`, `stage_compose` |
| 13 | ✅ Completion webhooks (signed, SSRF-guarded) | `webhooks.py`, `reelforge._fire_completion_webhook` |
| 14 | ✅ Referrals (append-only ledger) | `referrals.py`, `me.py` |
| 15 | ✅ Workspaces / teams + shared credit pool | `workspaces.py`, `CreditRepository.workspace_debit` |
| 16 | ✅ Scheduled auto-publishing | `scheduler.py`, `controllers/v1/schedule.py` |
(Plus supporting surfaces already shipped: caption presets, re-run-with-tweaks,
studio previews, batch review, insights dashboard, notifications, saved presets /
shared brand kits.)
### Fresh next ideas
Prioritize per post-launch traction; none require re-architecting the pipeline.
1. **Analytics dashboard** — surface `job_events` cost/funnel + per-hook engagement in the web app (data already recorded via `telemetry/cost.py` and `insights.py`).
2. **Direct-publish account-connect** — OAuth account linking so creators connect TikTok/IG/YT once instead of relaying through Upload-Post; store per-user tokens and publish natively.
3. **A/B hook-performance loop** — feed real post-performance back onto the batch-variants system so winning hooks are learned and re-suggested by the Spark idea engine.
4. **Template marketplace** — let creators publish/clone shareable job templates (extends `templates.py` + shared brand kits into a browsable, ratable catalog).
5. **Public API for power users** — first-class API keys with quotas + a webhook-first job flow (WF35, in progress) so integrators skip the web UI entirely.
6. **RunPod warm-pool autoscaling** — productionize Tier B LatentSync for margin (target ≤$0.30/60s) with an autoscaled warm pool and HeyGen cost A/B.
7. **Mobile store submission** — EAS build → App Store / Play Store for the Expo client.