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.
25 KiB
ReelForge — Roadmap V2 (Phases 8–11)
Forward roadmap succeeding
NEXT_PHASES.md. Grounded in a staff-level read of the actual tree, not the status docs. Where this doc and an older doc disagree, this doc is reconciled against code as of 2026-08-13 and wins. Companion:ARCHITECTURE_NEXT.md(target architecture).
0. Honest current state (one paragraph)
ReelForge is feature-broad and the render DAG (script → tts → {avatar ∥ captions} → compose → upload)
is real, retryable code — not a demo. Six initiatives shipped this phase and are green on main:
Creator Analytics, Template Marketplace, the Hook Performance Loop (feeding the Spark idea engine),
per-API-key quotas + rate limits, OAuth direct-publish account-connect (tokens Fernet-encrypted at
rest), and marketplace win-score ranking. The suite is large (~1709 passing on the canonical
command; note the headline count has drifted across docs — 1632 / 499 / 487 / 490 — and reconciling
it to a single regenerated number is Phase-8 item zero). Two classes of caveat gate "done":
(a) in-memory state — the OAuth CSRF SingleUseStateStore is process-local (breaks behind >1
API replica); per-key quota is already DB-backed and the rate limiter already Redis-backed, so the
real liability is narrower than the old "in-memory quotas" note implied; and (b) live-account
gating — every external provider (HeyGen, RunPod/LatentSync, ElevenLabs, TikTok/IG/YT publish, all
4 billing providers) is behind an injectable client seam that defaults to non-networked, so 100% of
integrations are verified against mocks and nothing has round-tripped a live API. The single biggest
doc-vs-code gap: the docs overclaim a gate — PLAN_COVERAGE.md claims a "REQUIRED CI gate," but
CI/CD was intentionally dropped (no GitHub Actions — cost constraint) and there is no single
local gate command to stand in for it. Fix that first: add a make gate target and correct the docs.
1. CTO §8 Definition-of-Done — reconciled against code
| # | DoD item | Verdict | Evidence / gap |
|---|---|---|---|
| 1 | 10/10 golden jobs (language, hook ≤2.5s, caption drift ≤50ms, avatar/audio Δ≤150ms, 1080×1920, ≥8Mbps, faststart) | Split — thresholds MET in code, real render GATED, gate wiring MISSING | Threshold asserts are real & correct in tests/golden/acceptance.py (assert_caption_drift 50ms, assert_hook_within 2.5s, assert_avatar_audio_delta 0.15s, assert_resolution 1080×1920, moov_precedes_mdat). Manifest is the real 5 TR + 5 EN set (tests/golden/manifest.yaml). BUT ≥8Mbps is downgraded for the synthetic suite, the real render needs live keys + libass, and no single gate command runs any of it (CI intentionally omitted; use a local make gate). |
| 2 | 60s video ≤5min p95 on CPX41 | GENUINELY UNMEASURED | No benchmark harness, no deployed worker. Render is single-pass FFmpeg (hw-accel + libx264 fallback, compose/compose_ffmpeg.py) so plausibly passes — zero evidence. |
| 3 | Any failure → clean failed, retryable, no credit burned |
MET (code) | workers/pipeline.py retry_pipeline/build_retry_chain resume-from-failed_stage; credit debit committed only on success + refund on enqueue failure. Well-structured. |
| 4 | Fresh-machine deploy from README ≤30min (docker compose up) |
MET (docs), UNVERIFIED | docker-compose.reelforge.yml, Dockerfile, Makefile.reelforge, DEPLOYMENT.md present; never run on a clean box. Cloudflare Tunnel is doc-only. |
| 5 | Zero secrets in repo; config via env; Sentry receiving | MET (secrets/config); Sentry wired, un-ingesting | Sentry wired both sides (app/telemetry/sentry.py, init in app/asgi.py + celery_app.py); NO-OP until SENTRY_DSN. All keys externalized (.env.reelforge.example, config.example.toml). |
Net: #3 and #5 truly met. #1 met at the unit-threshold layer but the "gated, on real renders" clause is unmet (no local gate wiring + no live run). #2 and #4 are pure account/ops gates. 2 met, 1 half-met with a real hole (no gate command), 2 account-gated.
2. Do first / critical path
The three items to ship before anything else in Phase 8, in order:
- Local quality gate + a single STATUS number (meta). A
make gatetarget (inMakefile.reelforge): ruffF,E9+ pytest +alembic upgrade head+alembic check+ the golden acceptance gate, plus a step that regenerates the headline test count. ~1 day. CI/CD is intentionally omitted (no GitHub Actions — cost constraint); this is the local stand-in. Gate substrate for everything below — idempotency, guardrails, and the golden gate all run under it. - Idempotency keys on
POST /v1/jobs(B). Money-correctness: today a retry/double-submit double-debits credits and can strand a partially-enqueued batch. Also a hard prerequisite for the embed/SDK surface (R). M effort, high confidence, pure upside. - Redis-back the OAuth CSRF store + token-refresh sweep (A+CC). The one genuine multi-worker
correctness bug in the connect flow; S effort; mirror the existing Redis-backed
ratelimit.pybut fail-CLOSED (reject connect if Redis unreachable) since it guards CSRF.
Critical path (what unblocks what):
Local gate/doc-truth ──► gate substrate for everything
B (idempotency) ──► R (embed/SDK)
A+CC (Redis state) ──► horizontal scale of publish/OAuth ──► AA (live publish)
AA (live publish) ──► BB (metrics ingest) ──► strengthens H, enables M, DD best-time
U (GPU warm-pool + router) ──► X (guardrails), Z (credit econ), accurate Y (margin dash)
N (share pages) + P (referral) ──► T (activation loop)
V (recurring subs) ──► S (team seats)
X / D / G(core) ── independent Phase-8 hardening, parallelizable now
3. Phase 8 — must-do production hardening (next)
GOAL: repair trust (a local make gate + one true test number), close the two money/correctness holes
(idempotency, CSRF state), and lay the guardrail/pooling/observability floor so the product can
scale horizontally without a predictable first incident. All items are code-only (no new accounts)
except the real p95 number in G, which is ops-gated.
| # | Initiative | Why | Effort | Deps | Acceptance |
|---|---|---|---|---|---|
| 1 | Local gate + doc-truth (meta) | Cheapest trust repair; today no single gate command exists and docs overclaim a "REQUIRED CI gate" that was intentionally dropped | S (~1d) | none | make gate runs ruff F,E9 + pytest + alembic upgrade head/check + golden acceptance locally; a step regenerates one canonical test count into STATUS.md; docs corrected to state CI/CD is intentionally omitted |
| 2 | B — Idempotency keys on POST /v1/jobs |
Retry/double-submit double-debits credits today (jobs.py::create_job, no key) |
M | Neon+Alembic, Redis short-lock | Two identical POSTs w/ same Idempotency-Key → exactly one credit + one job; concurrent duplicates resolve to one job (race test); same key + different body → 409; keys GC/expire, table bounded |
| 3 | A+CC — Redis OAuth state store + token-refresh sweep | Only real multi-worker correctness bug: authorize on replica A, callback on B → spurious 400 (connections.py:114) |
S | Redis (present) | issue() on one process, consume() on a second → True exactly once, False on replay; token unusable after oauth_state_ttl_s; Redis down → clean fail-CLOSED 400/503; Celery-beat sweep renews near-expiry tokens; in-memory fallback tests pass unchanged |
| 4 | X — Per-job cost guardrails | Guarantees a margin floor per render; today a pathological script can render at a loss (cost.py estimators used only after the fact) |
M | X keys off measured cost once U lands (estimates until then); retry/refund path (present) | Over-budget job is rejected with estimate OR auto-downgraded to Tier-B per config; mid-render cap trip → clean failed + refund (no burn); guardrail JobEvent written; in-budget happy path unchanged |
| 5 | D — Neon pooling under fan-out | Prevents the first predictable "too many connections" incident: workers × pool_size exceeds Neon's ceiling under chord fan-out (models/db/base.py) |
M | Neon PgBouncer endpoint enabled | Soak test of N concurrent pipelines → zero pool-exhaustion errors; alembic upgrade head/check pass on the direct DSN; connections stay within a documented budget; latency/throughput regress < defined threshold |
| 6 | G(core) — /healthz, /readyz + make bench p95 |
Zero-downtime deploy probes + turns DoD §2 from "unmeasured" into a number | M | CPX41 to run the real bench (ops-gated) | /readyz 503s when Redis/DB/R2 down, 200 otherwise; rolling deploy drops zero in-flight requests; make bench prints p50/p95 for the 10-job golden set |
Do first: items 1 → 2 → 3, in that order. Items 4/5/6 are parallelizable immediately.
4. Phase 9 — margin engine + throughput + reliability at scale
GOAL: realize the unit-economics thesis (~$1 → ~$0.20/video) with a GPU warm-pool + cost-aware avatar router, unlock live distribution, and harden throughput/observability so a paid, scaling product doesn't melt under provider latency.
| # | Initiative | Why | Effort | Deps | Acceptance |
|---|---|---|---|---|---|
| 7 | U (=F) — GPU warm-pool + cost-aware avatar router | THE margin thesis; unblocks accurate X/Z/Y. Account-gated + quality-unverified → confidence 3 | L | Live RunPod endpoint + deployed LatentSync worker; bench harness (G); quality A/B vs ±0.15s gate | Golden set through router reports measured avatar COGS ≤$0.30/60s in job_events (from RunPod executionTime, not the static table); premium→HeyGen, default→LatentSync; forced Tier-B failure falls back to HeyGen exactly once, no double debit; warm-pool cuts Tier-B p95 cold-start |
| 8 | AA — Live TikTok/IG/YT publish | Unblocks the whole distribution + metrics moat; persists external_post_id. Gated on app review |
L | Approved TikTok/Meta/Google apps; SOCIAL_TOKEN_KEY (present) |
A connected test account publishes to each platform via live client; external_post_id+permalink persisted; _UnconfiguredClient stays default when creds absent (fail-closed); refresh renews token mid-publish; IG/YT publishers pass the same seam contract as TikTokPublisher |
| 9 | N — Public watermarked share pages | Self-contained viral acquisition loop; reuses existing watermark filters + poster derivatives. Best growth ROI/effort | M | R2 presign (present); watermark asset; Next.js public route bypassing Clerk middleware | /r/{token} loads with no auth, 404s on unknown/revoked; preview visibly watermarked, never exposes un-watermarked result key; signup via share attributes to sharer's referral code; OG/Twitter card validates |
| 10 | H — Learned hook ranker (RL loop) | Closes performance→Spark loop with a real ranker; byte-identical fallback until data. Stronger once BB lands | L | Accumulated JobPerformance; optional TwelveLabs; no new accounts for inference |
generate_ideas returns ideas ordered by populated predicted_win_score; with no model, output byte-for-byte identical to today; offline Spearman vs held-out win_score beats winners-first baseline; ranking 10 ideas adds zero LLM calls, <50ms |
| 11 | Y — Gross-margin dashboard | Surfaces recorded-but-hidden unit economics (job_events.cost_usd vs CreditLedger); pricing/routing decision surface |
M | Admin role guard; cost_usd populated; plan price table |
GET /v1/admin/margin returns revenue/cogs/margin_pct/margin_per_video; 403 for non-admin; per-tier breakdown separates heygen vs latentsync; matches hand-computed fixture; degrades to 0.0 on legacy rows |
| 12 | C — Async provider webhooks + callback worker | Frees 30-min-parked worker slots (HeyGen/RunPod blocking polls); big throughput win | L | Public callback ingress (Cloudflare Tunnel codified); live HeyGen/RunPod payloads | stage_avatar returns within seconds of submit, holds no slot; signed callback resumes the chord to byte-identical output (golden gate still passes); missed callback caught by reconciliation poller → complete or clean-fail+refund; forged callback rejected |
| 13 | L — Render quality scoring (advisory) | Promotes golden thresholds to runtime QC; single-source-of-truth checks module | M | none required (ffprobe + ctx); TwelveLabs only for optional semantic check | Every completed job gets persisted quality_score + per-check report; a threshold-violating render scores below gate + flagged; tests/golden and runtime import the same checks module; zero LLM cost when semantic check off |
| 14 | E — Celery priority queues + DLQ + backpressure | Tiered SLA (sellable), poison-job DLQ w/ refund, 429 backpressure instead of silent latency | M | Redis (present); autoscale piece needs KEDA/K8s decision | Interactive job jumps ahead of a large batch; retry-exhausted task → DLQ, job failed, credit refunded exactly once; above high-water mark create_job → 429+Retry-After with no debit left; workers scale with queue depth |
| 15 | G(rest) — OTEL tracing + DR/backups | End-to-end per-job traces + Neon PITR/R2 replication with a restore drill | M | OTLP backend; Neon PITR tier + R2 replication (accounts) | One job → one connected trace across API + all Celery stages keyed by job_id; documented restore drill recovers Neon to a point-in-time and re-reads a replicated R2 object |
Do first in Phase 9: U (it gates the accuracy of X/Z/Y and the whole margin story). AA and N are parallel high-value tracks; N has no account gate so it can ship earliest.
5. Phase 10 — growth compounding + AI differentiation + monetization
GOAL: turn win-score into ground truth (real platform metrics), open the first recurring-revenue and API-distribution surfaces, and compound the growth loops (referral, remix, activation).
| # | Initiative | Why | Effort | Deps | Acceptance |
|---|---|---|---|---|---|
| 16 | BB — Auto-ingest real platform metrics | Highest AI value: turns win-score into ground truth. XL + depends on AA + read-scope review → conf 2 | XL | AA (external_post_id); read/insight OAuth scopes approved; Celery beat (present) |
Real views/likes/comments pulled into winning_hooks with no manual entry; platform-sourced rows carry source='platform' and override manual rows; sweep idempotent across T+24h/72h/7d; blocked scope degrades to self-report without erroring |
| 17 | V — Recurring subscriptions (monthly/annual/seat) | First MRR + annual prepay; Stripe-clean, others partial. Substrate for S | L | Live Stripe recurring/metered SKUs; webhook secrets | Monthly plan creates a Stripe subscription; invoice.paid grants credits idempotently (no double-grant on duplicate); annual charges discounted amount + full-period credits; seat plan grants to workspace pool with no cross-workspace leak; list_plans() returns interval+seats |
| 18 | P — Compounding referral engine + attribution fix | Persists User.referred_by, milestones, second-order, leaderboard. Margin-negative → config-cap grants |
M | User.referred_by column (exists); config grant caps |
After redeem, referred_by populated + queryable; crossing a milestone grants exactly one ledger row (never dup on retry); second-order bonus only when a grand-referrer exists, never self; GET /me/referral/leaderboard ranks by lifetime credits, bounded |
| 19 | M — Hook/thumbnail A/B at generation | Depends on H; A/B only the hook clip + Pillow cover over ONE base render to avoid multiplying avatar cost | L | H (ranker) for winner seeding; batch_id+cover.py (present) |
K variants linked under one ab_group_id; log_performance attributes to correct variant, winning_hooks ranks at variant grain; results endpoint returns per-variant win_score + lift with min-sample guard; thumbnail-only A/B adds zero avatar-render cost |
| 20 | R — Embed widget + published SDK | Highest-leverage API distribution; depends on B for untrusted retries + origin allow-list | L | B (idempotency); UserApiKey+apikey_quota.py (present); npm+PyPI tokens |
SDK create+poll round-trips with only x-api-key; same Idempotency-Key debits once; embed endpoint rejects non-allow-listed origins + enforces per-widget cap; widget-generated reel carries share watermark |
| 21 | Z — Credit-economics tuning + reconciliation | Differential credit debit + estimate-vs-billed drift alerts. Depends on U's measured cost | M | U (measured cost); product decision on credit policy | credits_for charges a Tier-A 60s job more than a Tier-B 15s job per config; debit still refunds exact amount on failure; provider-billed units written to record_cost meta; reconciliation flags jobs whose measured cost deviates beyond threshold |
| 22 | O — Marketplace remix trees | Turns flat clones into a creativity graph; needs backfill from opaque source_marketplace_id |
M | Alembic migration (2 cols + self-FK) | Publishing a clone of X sets parent_template_id=X + increments X's remix_count; GET /marketplace/{id}/lineage returns depth-capped ancestors+children; sort=most_remixed deterministic; backfill populates existing clones |
| 23 | T — Onboarding activation loop | Read-only state machine over JobEvent; depends on N + P to nudge toward |
M | N (share) + P (referral) endpoints; Notification model |
GET /me/activation returns stage derived solely from existing rows; first successful reel emits exactly one share-nudge (idempotent); first-share + first-invite each grant reward exactly once (reason-deduped); dashboard checklist advances with real state |
| 24 | W — Usage-based metered billing / enterprise tier | Monetizes overages instead of 429; Stripe-only, must price above COGS | M | Stripe metered product; overage price > COGS (from U) | Key over quota records Stripe usage instead of 429; GET /v1/usage returns included/used/overage/estimated_cost scoped to caller; double flush idempotent; unit test asserts overage price > per-video COGS |
6. Phase 11 — later bets
GOAL: high-ACV expansion, market/format expansion, and creative unlocks — each gated on the substrate Phases 8–10 build and each carrying a real margin or invariant risk to manage.
| # | Initiative | Why | Effort | Deps | Acceptance (headline) |
|---|---|---|---|---|---|
| 25 | S — Team/agency accounts (credit pool + seats) | Highest-ACV expansion; XL, money-correctness-heavy, depends on V. Start pool+seats, defer shared library | XL | V (recurring); live billing for seat proration; Workspace/WorkspaceMember (present) |
Member in a workspace debits the workspace pool under a row lock, no double-debit under concurrency; seat count → correct billed quantity (Stripe sandbox); workspace-scoped API key counts against workspace quota; single-user flows unchanged |
| 26 | GG — i18n beyond TR/EN | Market expansion; needs native hook copy + RTL/libass validation vs golden gates. Roll out lang-by-lang | L | Native hook/persona copy; Arabic+extended-Latin fonts | language='es' (+de/fr/pt) produces native script+hook, no English fallback; Arabic renders RTL and still passes caption-drift + hook-timing gates; web/mobile switch locale; _normalize_language maps unsupported → safe default |
| 27 | J — Multi-shot / multi-avatar scenes | Big creative unlock but XL; directly threatens p95 DoD + margin. Gate behind tier + LatentSync warm-pool | XL | Avatar keys; cost controls + U warm-pool; word-timing authority | 2-shot job → two avatar segments concatenated into one 1080×1920; each shot's avatar matches its audio slice within ±150ms; shot cuts add no caption drift >50ms; single-shot jobs byte-for-byte unchanged |
| 28 | Q — Creator leaderboards + follow graph | Network effect, but discovery value thin until marketplace liquidity exists; self-clone gaming risk | L | Alembic creator_follows; reuse win-score aggregation |
Follow idempotent, unfollow removes exactly one edge; leaderboard deterministic with documented self-clone weighting; feed returns only followed authors, most-recent-first; public profile exposes no private financial fields |
| 29 | DD — Publish calendar + reschedule + best-time | PATCH reschedule is cheap; best-time weak until BB. Do the PATCH early, defer suggestions | M | Existing scheduler; BB for good suggestions | Pending publish drag→PATCH persists, non-pending → 409; calendar renders in creator TZ; best-time overlay only shows past a min sample, never another creator's data |
| 30 | K — Per-segment emotion/prosody | Quality bump, but risks the single-word-timing-authority invariant guarding the drift gate. Contained | M | ElevenLabs key (present); v3 optional | Two emotion maps of same script → different audio, identical transcript; word-timing authority preserved (drift ≤50ms); disabled path byte-for-byte current; unknown emotion → neutral default without failing job |
| 31 | EE — Webhook subscriptions + Zapier/Make | Delivery primitive already solid (deliver_webhook); subscription layer is real work for a niche segment |
L | Zapier/Make dev account (for listing); deliver_webhook (present) |
Creator registers two endpoints for job.completed, both get signed payloads; failing endpoint retried + each attempt logged; Zapier subscribe/unsubscribe works; endpoints owner-scoped + SSRF-guarded |
| 32 | FF — Mobile store submission (EAS) | Needed to ship mobile, but margin-negative; worth it once mobile demand proven | M | Apple ($99/yr) + Play accounts; EAS credits | eas build --profile production → signed iOS+Android; eas submit → TestFlight + Play internal; OTA JS update ships without new submission; no secrets committed |
| 33 | I — Semantic auto B-roll match | Lowest: margin-negative, and it re-activates the Pexels/Pixabay stock path CTO Phase-5e wants removed. Conflicts with tree direction — defer/scope isolated | L | TwelveLabs (opt-in); a clip source; word-timings (present) | Returns non-overlapping in-segment cutaway plan above cosine floor; TwelveLabs off → no-op empty plan (current behavior); composed reel still meets ≤50ms drift gate; sub-floor clips dropped |
Explicit conflict to resolve before scheduling I: initiative I (B-roll) pulls opposite to audit gap #5 (physically delete the MPT stock path). Default recommendation: keep the deletion, drop I unless a first-party clip library replaces Pexels/Pixabay.
7. Dependency graph (major initiatives)
graph TD
CI[Local gate + doc-truth<br/>Phase 8 item 0] --> EVERYTHING((gate substrate<br/>all phases))
B[B Idempotency keys] --> R[R Embed + SDK]
A[A+CC Redis OAuth state] --> SCALE[Horizontal scale<br/>publish/OAuth]
SCALE --> AA[AA Live TikTok/IG/YT publish]
AA --> BB[BB Auto-ingest platform metrics]
BB --> H[H Learned hook ranker]
BB --> DD[DD Best-time scheduling]
BB --> M[M Hook/thumbnail A/B]
U[U GPU warm-pool + router] --> X[X Cost guardrails]
U --> Z[Z Credit economics]
U --> Y[Y Margin dashboard]
N[N Share pages] --> T[T Activation loop]
P[P Referral engine] --> T
N --> R
V[V Recurring subs] --> S[S Team/agency seats]
C[C Async webhooks] -.needs public ingress + live payloads.-> AA
H --> M
D[D Neon pooling] --- G[G Health/bench/OTEL/DR]
classDef p8 fill:#d5efdf,stroke:#2e7d32;
classDef p9 fill:#d6e4ff,stroke:#1565c0;
classDef p10 fill:#fff2cc,stroke:#f9a825;
classDef p11 fill:#f3e5f5,stroke:#6a1b9a;
class CI,B,A,X,D,G p8;
class U,AA,N,H,Y,C p9;
class BB,V,P,M,R,Z,S p10;
class DD,T p10;
8. Known debt to pay down first
Three debts poison trust or block scale; pay them before net-new features.
- Add a local quality gate (
make gate) + collapse the test-count drift.PLAN_COVERAGE.md§0/§8 claim a "REQUIRED CI gate," but CI/CD was intentionally dropped (no GitHub Actions — cost constraint), and the headline count reads 1632 / 499 / 487 / 490 across four sources. Onemake gatetarget + one regenerated number repairs the whole audit trail — and the docs must be corrected to say the gate is local, not CI. (Phase-8 item 0.) - Redis-back the in-memory OAuth CSRF
SingleUseStateStore(connections.py:114,oauth_connect.py:181). This is the only genuine multi-worker correctness bug in the connect path — the rate limiter is already Redis-backed and per-key quota is DB-backed, so the note "the in-memory stores" is really one store. Fail-CLOSED, unlike the rate limiter. Add a token-refresh Celery-beat sweep so scheduled publishes never fire on a stale token. - Provision the live-account gates and run the golden set on real providers. DoD #1's "on real
renders" clause, #2's p95 on CPX41, and live-payments smoke are all account-gated, not code-gated:
real TikTok/Meta/Google apps (slow review), a deployed RunPod LatentSync endpoint, and live
billing SKUs. Until then, "live-verifiable" == everything is proven only against mocks. Also,
physically delete the MPT stock path (
material.pyPexels/Pixabay/Coverr + config keys, Phase-5e, still open) to shrink attack/config surface — and decide the stock stance before scheduling I.
Reconciled against the tree as of 2026-08-13. When this doc and an older status doc disagree on a
number, regenerate the number via make gate and update both — see debt item 1.