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.
11 KiB
Menivor wave 2 - close the Arcads / Creatify / Relay Studio / Pamba gaps (2026-10-06)
Branch menivor-wave2-2026-10-06 from main f2ec9ffc. Code and tests only: no deploy,
no push, $0 (every paid model call is behind an injectable seam and mocked in tests),
no sign-ups, no secrets in code or logs.
Source of the gap list: BRAND-AGENT-2026-10-06.md section 3 item 10 (P2, "still missing
after this branch") and INTEGRATIONS-2026-10-06.md (connected ad-account metrics).
0. Rules that apply to every feature
- Spending always waits for a human. A paid step is a row in an existing approval
system first: the approvals feed (
approval_items, new sources below) or the Brand Agent gate (agent_actions). Approve in the app is the only path that spends. - Reuse, do not rebuild: Ad Clone engines (
adclone.kling.KlingClient,adclone.engine_clients), ElevenLabs Voice Design (adclone.elevenlabs), Relay LLM (adclone.relay_writer.relay_llm), local Whisper (adclone.vision.transcribe), caption burn (adclone.captions), premium credits (services.billing.premium_credits), integrations scope + metrics, Brand Agent gate / memory / library / routines. - Copy rules: no emoji glyphs, no "indie" audience wording, calm UI, one primary action.
1. Swipe-to-approve (Relay Studio parity) - app/domains/creative_review/
- Generated creatives (Brand Agent library items) become approval items of the new source
creative_review(adapterscan= library items without a decision), so they also show in/approvalsand Rally's approvals hub. creative_reviewstable: one row per library item (status, reason chip, note, regenerate action id). Reason chips are a fixed list (approve: On brand, Strong hook, Ready to post; reject/regenerate: Off brand, Weak hook, Visual issue, Wrong product, Text error, Too long).POST /review/{item_id}/decide{decision: approve|reject|regenerate, reason, note}: approve/reject go throughapprovals.service.decide(idempotent, guarded claim); regenerate rejects and creates a Brand Agent gate action with the reason as the change request. The Regenerate button shows its credit price; pressing it is the approval (confirm_spend: true), without it the action waits in the Agent queue.- Web
/review: one card at a time, keyboard (Right/A approve, Left/X reject, R regenerate, 1-6 reason chips, U undo-free skip) and touch swipe; counts and a reason row.
2. Competitor ad tracker (Creatify Competitor Tracker / Arcads spy) - app/domains/competitors/
- Official sources only:
- Meta Ad Library API
GET graph.facebook.com/<v>/ads_archive(search_page_idsorsearch_terms,ad_reached_countries,ad_active_status=ALL, fieldsid, page_id, page_name, ad_creation_time, ad_delivery_start_time, ad_delivery_stop_time, ad_creative_bodies, ad_creative_link_titles, ad_snapshot_url, publisher_platforms, languages). Token:META_AD_LIBRARY_TOKEN(identity-verified Meta account; non-political ads are returned for ads delivered in the EU/UK, so the default countries are EU). - TikTok Commercial Content API
POST open.tiktokapis.com/v2/research/adlib/ad/query/(client-credentials token fromTIKTOK_COMMERCIAL_CLIENT_KEY/SECRET; access is approved per app; EU ads). Creative Center has no official API and is not used. - No scraping, no logged-in pages, no browser automation. A source without keys reports "not connected" with the owner step.
- Meta Ad Library API
- Tables
competitor_brands(tracked brand: Meta page ids, TikTok advertiser ids, search terms, countries) andcompetitor_ads(normalized ad, first/last seen, start/stop,is_new). - Longevity is the winner signal: days running (start -> stop or today);
winner>= 30 days and still active,proven>= 14, elsetesting;scaled= same copy in 3+ ads. - New-ad alerts: ads first seen on the latest refresh; dismissable. Daily beat refresh.
- "Clone this":
POST /competitors/ads/{id}/clonebuilds a clone brief from the tracked ad (copy-structure brief; media analysis when the API gave a video on an allowlisted official CDN host) viaadclone.tracked_source, saves an Inspiration, and the web opens Ad Clone at step 2 with that brief.
3. Ad-fatigue analytics (Creatify AdMax) - app/domains/ad_fatigue/
- Reads
integration_ad_metrics(same scope/brand-space visibility as Integrations). New nullablereachcolumn (Meta reports it) -> frequency = impressions / reach. - Per creative over the window: frequency (last 3 days), CTR decay (early CTR vs last 3
days), CPA drift (last 3 days vs earlier), fatigue score 0-100 (weights 35/35/30,
re-normalized when a metric is not reported), status
fresh/watch/fatigued/not_enough_data(< 4 days or < 1,000 impressions). Never invents a 0. - "Make variations" proposes a Brand Agent
routine_batchaction (3 variations, pending).
4. AI actors library (Arcads actors) - app/domains/actors/
- Only original synthetic actors: built-in presets in code + user-made actors. Each has a
look prompt, a voice-design prompt, a product-holding shot template and a provenance
record (generator, model, prompt, seed, image sha256,
synthetic: true) plus a consent field (synthetic_no_real_person, who attested, when). likeness_guard: block-list of real-person names (policy/real-person-blocklist.json) and lookalike / impersonation phrases, checked on name, look prompt, voice prompt and shot template; the existingipguard.check_voice_descriptionrefuses voice cloning.- Product-holding shot: plan = first frame (actor still or uploaded composite) + template
-> Kling image-to-video. Paid run =
studio_rendersrow + approvals sourcestudio_render; approve debits AI-video credits and queues the worker; failure refunds.
5. Lip-sync translation (Arcads 30+ languages) - app/domains/lipsync_translate/
- transcript (local Whisper, or given) -> translate (Relay LLM only) -> TTS in the target language with the actor's designed ElevenLabs voice (voice id must belong to a designed actor voice; reference audio is never accepted) -> lip-sync (Kling lip-sync by video URL, or InfiniteTalk on RunPod) -> burned captions (ffmpeg, our caption style).
- Same
studio_renders+ approval flow as actor shots; plan shows price per language.
6. Workflow canvas (Creatify AdFlow / Arcads Workflows) - app/domains/workflows/
agent_workflows(graph JSON + schedule) andworkflow_runs. Node types: brief, script, images, video, captions, approve, publish. Validation: one chain from brief, no cycles, publish needs an approve upstream, spend nodes need a brief upstream.- Run: free steps run now (brief from Brain, script via the Agent writer), spend/publish
steps become pending Agent gate actions. Schedule (weekday/hour UTC) runs through Celery
beat (
workflows.tasks, 15 min tick) and only queues pending actions. - Web
/workflows: React Flow (@xyflow/react, MIT) node editor, palette, inspector, Save, Run now, Schedule.
7. Hosted MCP connector - app/domains/mcp_hosted/
POST /mcpstreamable HTTP (JSON-RPC 2.0, protocol 2025-06-18 / 2025-03-26 / 2024-11-05),initializereturnsMcp-Session-Idbound to the bearer (HMAC),DELETE /mcpends it,GET /mcpis 405. Same shape as Scribase's hosted MCP.- Auth: workspace token
mnv_mcp_...(mcp_tokens: SHA-256 digest only, scopes, expiry, revoke, last used). Minted/revoked by a signed-in user (workspace owner/admin for workspace tokens) in Settings > MCP; shown once. - Tools:
brand_memory_get,brand_memory_update,ad_clone_brief,ad_clone_plan,generate_image,generate_video,approvals_list,analytics_report,ad_fatigue,competitor_winners. Generate tools only create pending approvals and return the link; no tool can approve a spend.
8. Order and tests
TDD per feature (tests/reelforge/test_wave2_*.py, in-memory SQLite, fake engines,
fake transports), then web (vitest per feature) and Playwright screenshots of every new
screen with mocked API responses. One additive, idempotent migration for all tables.
9. Owner items (cannot be done in code)
- Meta Ad Library API token (
META_AD_LIBRARY_TOKEN): identity confirmation at facebook.com/ID and a Meta app with Ad Library API access. - TikTok Commercial Content API (
TIKTOK_COMMERCIAL_CLIENT_KEY/SECRET): apply at developers.tiktok.com (Research / Commercial Content API product, approval per app). - Existing paid-engine keys for real renders (Kling, ElevenLabs, RunPod) and
ADCLONE_PAID_RENDER=1; Relay for translation.
10. Built on this branch
- API domains
creative_review,competitors(+sources/meta_ad_library.py,sources/tiktok_commercial.py),ad_fatigue,actors,studio_render,lipsync_translate,workflows,mcp_hosted, the shareddomains/_http.py,adclone/tracked_source.py; migrationb2d4f6a8c0e1(one additive, idempotent migration;reachadded tointegration_ad_metrics, Meta connector now pulls it). - Approvals feed sources
creative_reviewandstudio_render; beat modulescompetitors.tasks(hourly tick, refresh every ~20 h),workflows.tasks(15 min),studio_render.tasks(worker + 10 min reconcile: re-queues lost tasks, fails and refunds renders stuck over 3 h). real-person-blocklist.jsoninpolicy/for the likeness guard.- Web:
/review,/competitors,/ad-fatigue,/actors,/translate,/workflows(React Flow),/settings/mcp; Ad Clone opens at the product step from "Clone this"; nav entries; Agent's Workflow tab points at/workflows. API paths use theapiPathtagged template (src/shared/api/path.ts). - API surface allowlist regenerated (36 new client routes +
/mcpas a third-party route). - Screenshots (mocked API):
docs/plans/wave2-screens/.
Route allowlist (follow-up, branch menivor-allowlist-dub-2026-10-06): the audit tool now parses
template paths (${encodeURIComponent(id)}, nested templates, apiPath, a leading ${API_BASE}, comments
skipped, test files ignored, the shared packages/api-contract paths included). 165 more routes are
reachable; each keeps its own auth (tests/reelforge/test_api_surface_auth.py: every allowlisted route
authenticates or is listed as public by design, and an anonymous request to every private one is refused).
Prod check 2026-10-06 (read-only GETs against api.menivor.com, deployed allowlist at dcf62532): 162
routes that shipped screens call were staff-only there. 55 of the 57 GET ones answered 404 to anonymous
calls (the other 2, SSO, answer 501), while allowlisted controls answered 401. So on prod today these
flows fail for every user: share links (create + public share page), retry/rerun, exports, cover, dub,
publish to a provider; notifications; workspace members, invites, credits, plans, billing changes, SSO,
SCIM, webhooks, retention; film projects; design docs; characters and canon; marketplace template pages;
creator profiles, follow and leaderboard; render jobs; repurpose and clipping results; series runs;
social inbox threads and autopilot approvals; ad studio catalog import, tests and variants; ad budget
proposals; motion presets; template instantiate; uploads and voice delete; mobile credit-pack checkout;
legal report form. The fix needs a deploy (owner).
Not verified live: every external call (Meta Ad Library, TikTok Commercial Content API, Kling, ElevenLabs,
RunPod InfiniteTalk worker infra/render-workers/infinitetalk (tasks infinitetalk and infinitetalk_dub, image not built), Relay) is mocked in tests.