videogen/docs/plans/BRAND-AGENT-2026-10-06.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

9.5 KiB

Brand Agent (Arcads-style "Agent") - plan 2026-10-06

Branch brand-agent-2026-10-06, based on main dcf62532. Code and tests only: no deploy, no push, $0 spend, no sign-ups, no secrets in code or logs.

1. Research: what the references do

Fetched 2026-10-06 (public pages only; app.arcads.ai shows only a login shell, so the Arcads Agent flow comes from the owner's scribase.com paste plus arcads.ai, agent.arcads.ai, the Arcads MCP help page and github.com/arcads-ai/skills).

Product What it does
Arcads (Agent "Mark") Chat agent that sets up a brand from a website, saves "brand memory" (products, audience, offers, voice, winners) and keeps it across sessions; custom instructions applied to every turn; skills (/spy-competitor-ads, /clone-hook, /clone-static-ad); hosted MCP connector; Meta Ads connect for winning ads; 1,000+ AI actors, product-holding avatars; Seedance/Sora/Kling/Nano Banana models; 30+ language lip-sync; infinite-canvas Workflows; credit plans with a free trial.
Relay Studio Paste a URL, it learns product/audience/tone, asks a few brand questions; generates 40-300 slideshows/videos a month; swipe to approve/reject with edits; approved posts spread over the month and auto-posted to TikTok; viral-format detection in the niche; per-post views dashboard.
Pamba Custom AI avatars ("yapper" talking heads, slideshows); website scan for content ideas; inspiration-account tracking; draft -> generating -> scheduled pipeline with daily auto-posting to TikTok/IG/FB; per-avatar/per-video analytics; managed warmed accounts; credit pricing with 300 free credits; API/MCP.
Creatify URL-to-video, batch variants, AdFlow node editor, Ad Cloner, image ads, avatars; Creative Agent + Performance Agent (chat with ad data); Industry Insights, Competitor Tracker, Winning Ads library; AdMax smart-asset library with auto-tagging and fatigue analytics from Meta; publish to Meta/TikTok/YouTube/Snap/Amazon; brand space; credits with a free tier.

2. What Menivor already has (reuse, do not rebuild)

  • Website brand extraction: app/domains/brand/extract.py (name, tagline, description, logo, colors with origin, fonts with origin, language) behind the Ad Studio SSRF guard app/domains/adstudio/fetch.safe_get.
  • LLM chain through Relay on Anthropic credits: app/services/llm._generate_response (Relay first, free fallbacks, never routes around a spent cap).
  • Generation: POST /api/v1/jobs (app/domains/reels/router.create_job) with atomic credit debit; Ad Studio angles; credit ledger CreditRepository.
  • Scheduler/beat: app/workers/celery_app.py optional task modules with BEAT_SCHEDULE.
  • Approvals feed (app/domains/approvals), multipost publishing, copy denylist policy/copy-denylist.json (rule indie-audience).

3. Gaps (Menivor lacks), in priority order

  1. P0 Brand setup agent: chat that analyzes a site (text, colors, fonts, logo), searches the market, then confirms Positioning / Product / Market / Voice+Audience with Yes/No chips, saving each part to brand memory after Yes.
  2. P0 Versioned brand memory ("Brain") per brand space, editable, with an unseen-updates badge.
  3. P0 Approval gate for every credit-spending or publishing agent action.
  4. P0 Agent sessions + messages, streamed responses (SSE).
  5. P1 Connect Meta Ads step -> top ads become Inspirations; skippable, graceful error with a clear reason and Retry (calls the integrations branch).
  6. P1 Chat tools after setup: scripts + hooks, image/video via existing generation, clone from link (Ad Clone branch), schedule routine, publish.
  7. P1 Routines (e.g. "3 new ad variations every Monday") on beat; they only create pending actions, never spend or publish without approval.
  8. P1 Skills (built-in "UGC script", "Ad clone", "Hook variations", "Image ad", plus user custom skills), Inspirations (saved ads / TikTok links that feed Ad Clone), Library (generated assets), Folders, Recents, Connectors status, free-trial credits meter from the ledger.
  9. P1 Sidebar UI: Studio / Workflow / Agent tabs, New session, Brain badge, Library, Connectors, Routines, Skills, Inspirations, Folders, Recents.
  10. P2 (still missing after this branch): AI actor library and product-holding avatars, lip-sync translation, infinite-canvas workflows, competitor ad tracker/spy feed, ad fatigue analytics, swipe-approve mobile UI, hosted MCP for the agent, managed warmed accounts, viral-format detection.

4. Design

New domain apps/api/app/domains/brand_agent/ (no edits to other domains except one router line and one optional-task-module line):

Module Role
models.py Tables agent_brand_spaces, agent_brand_memory, agent_sessions, agent_messages, agent_actions, agent_routines, agent_inspirations, agent_skills, agent_folders, agent_library_items
site_analysis.py Pure analysis of fixture/real HTML on top of brand.extract (sample lines, features, pricing hook, category, logo <img>/<svg> detection)
memory.py Versioned store: every write appends a version; current = latest per section; Brain edits are versions too; seen-version badge
setup_flow.py Step machine positioning -> product -> market -> voice_audience -> connect_meta -> done
gate.py Approval gate: spend/publish tools only create pending actions; execution only after approve
routines.py + tasks.py Weekly/daily routines, next_run_at, beat tick creates pending actions
agent.py Chat orchestrator: LLM tool-JSON when Relay is configured, deterministic intent router otherwise
copy_rules.py System prompt + indie denylist (stricter than the policy: "indie hackers" only as the site name)
ports/*.py One small module per external interface (below)
router.py /api/v1/agent/... HTTP + SSE

Interfaces to the parallel branches (one module each, merge-clean)

Each port is a Protocol plus a stub. The real implementation is found at runtime from a conventional module path, so the other branches add a file and never edit this one:

Port Module Implemented by Lookup
AdClonePort.clone_from_link ports/ad_clone.py ad-clone-2026-10-06 app.domains.ad_clone.agent_port:PORT (env BRAND_AGENT_AD_CLONE_PORT)
IntegrationsPort (list_connected_accounts, top_performing_creatives, ask_campaign_question, pull_report, propose_optimization) ports/integrations.py integrations-2026-10-06 (Max) app.domains.integrations.agent_port:PORT (env BRAND_AGENT_INTEGRATIONS_PORT)
GenerationPort (image/video) ports/generation.py this branch, over existing POST /jobs built in
SearchPort (market search) ports/search.py this branch: SearXNG (OSS) or DuckDuckGo HTML, opt-in env BRAND_AGENT_SEARCH
LLMPort ports/llm.py this branch, over services.llm (Relay) built in

When a port is missing the stub raises PortUnavailable with a plain reason; the agent shows it and offers Retry/Skip instead of failing.

5. Tests (TDD, written first)

tests/reelforge/test_brand_agent_*.py: site analysis on fixture HTML (colors, fonts, logo, sample lines, pricing hook), each setup step confirm -> memory version, No -> edit path, Meta connect failure + retry + skip, approval gate (no execution before approve, reject never executes, double-approve idempotent), routines next-run + beat tick creates pending actions only, port stubs and runtime lookup, denylist + system prompt, HTTP + SSE. Web: vitest for the agent API client and chips/brain components (no emoji glyphs).

6. Owner rules applied (2026-10-06)

  • Scribase is positioned as "Supabase + Neon in one, drop-in client compatible, flat $25/project, export anytime, agent-first"; its audience is teams already on Supabase and Neon (never maker communities or "indie" labels).
  • Market step: a competitor the brand names (or the user marks with "switch from: X, Y") is relationship: "switch_source", shown as "Where switchers come from". Comparisons must be verifiable from what both sites publish and never imply an affiliation (system prompt + insight text).
  • Every step has "No, change it": the next message rewrites the draft (Relay LLM when configured, deterministic otherwise) and a Yes saves it as a user version. After setup, "change the audience to ..." writes a new version.

7. Built on this branch

  • API domain apps/api/app/domains/brand_agent/ + migration f7b9d1e3a5c8
    • beat module app.domains.brand_agent.tasks (15 min tick).
  • Web /agent (apps/web/src/features/brand-agent/): sidebar with Studio / Workflow / Agent tabs, New session, Chat, Brain (unseen badge, edit = new version), Library, Connectors, Routines, Skills, Inspirations, Folders, Recents and the credits meter; streamed chat with Yes/No and Approve/Reject chips; Send is the only primary action.
  • Demo: apps/api/tools/ops/brand_agent_demo.py (free, local).

Not verified / needs the owner: Relay URL for LLM wording (deterministic now), a search provider (DuckDuckGo HTML is blocked by a bot check from this machine; a self-hosted SearXNG is the free option), real Meta Ads through the integrations branch, Ad Clone through the ad-clone branch, image/video model ids in the media gateway catalog, and a browser pass of /agent.

8. Proof

If it runs locally for free, run the setup flow against https://scribase.com (real fetch, deterministic analysis, no paid LLM) and save docs/plans/brand-agent-demo-scribase.json.