Founder's Assistant: Agentic OS

India-Native Autonomous Multi-Agent Marketing Operating System

Brief in. Polished content out. No humans in the loop. Founder's Assistant: Agentic OS replaces a human marketing agency with a coordinated crew of AI agents for Indian SMBs and creator-founders. Submit one brief and the system classifies the job, runs a multi-agent pipeline, and delivers: rendered 9:16 reels, Multilingual WhatsApp outreach messages, competitor research reports, or full multi-channel campaign plans. All at near-zero API cost using a local Ollama backbone.

Built - Operational 8 Subsystems 4 Job Type Pipelines 25/25 E2E Tests Passing Internal System
Status
Built - Operational. Closed beta. Targeting Indian SMBs, D2C brands, wellness coaches, and creator-founders.
Stack
FastAPI (Python 3.10+) React 18 + TypeScript Node.js + Fastify Remotion 4.0 Redis + BullMQ PostgreSQL (Neon) Supabase + 16 Edge Functions Docker + Nginx + Hetzner LangChain Firecrawl fal.ai (Kling + Veo3) ElevenLabs TTS Whisper.cpp (captions) Instagram Graph API YouTube Data API v3 Resend (email) Razorpay Billing Ollama (local LLM, zero cost) Playwright E2E Tests
My role
Solo Architect and Lead Engineer - Full system design, all 8 subsystems, DAG orchestrator, all 7 Apex agents, video pipeline, CRM frontend (22 pages + 26 hooks), lead scraping, billing integration
Revenue model
Agency Mode (operator runs for clients, 20,000-80,000 per month retainer) - SaaS Mode (self-serve SmartPitch, 499-3,999 per month) - White-label (future, Year 2)

The Gap This Fills

  • No India-native AI agentic OS exists. Platforms like HubSpot, Apollo, and Later are priced in USD, built for US B2B, have zero Multilingual support, and no integrations with Indian platforms like IndiaMART or Justdial. WhatsApp-first workflows do not exist in any of them.
  • Indian founders, D2C brands, and wellness coaches need consistent reel output, targeted outreach to new customers, competitor tracking, and analytics - all in Hindi/English/Multilingual, not Silicon Valley corporate tone.
  • Founder's Assistant: Agentic OS is the answer: An India-native, AI-first operating system that accepts a job brief and fully automates the entire content production and lead acquisition chain - from scraping to publishing - with a single human review gate before delivery.

4 Job Type Pipelines - How a Brief Becomes Output

The ACE orchestrator classifies every incoming brief into one of four job types. Each type spawns a different agent crew and produces a different output artifact:

PIPELINE 01

CONTENT Job

Reels, scripts, blog posts, ad copy
  • Brief submitted with brand, topic, language, tone
  • Research & Extraction Engine scrapes competitors, scores what is working
  • Apex 7-agent pipeline: the Research Agent gathers facts, the Design System Agent defines visual guidelines, the Scriptwriting Agent drafts copy, the Compliance Agent audits, the Visual Prompt Agent refines prompts, the Rendering Agent adds direction, and the Final Approval Agent gives greenlight
  • Programmatic Video Engine renders 9:16 MP4 via Remotion with auto-captions
  • Social Publisher schedules to Instagram and YouTube
  • Client portal: "Your 3 reels are ready - review and approve"
Hindi / English / Multilingual output
PIPELINE 02

OUTREACH Job

Lead scraping, enrichment, personalized outreach messages
  • Brief: "Find 50 yoga coaches in Mumbai and send outreach"
  • Lead sources: IndiaMART scraper, Justdial scraper, Instagram business profile scraper, LinkedIn export parser, CSV import
  • Research & Extraction Engine enriches each lead: website analysis, Instagram profile audit, Google Business data
  • Leads saved to CRM with hot/warm/cold score
  • SmartPitch Outreach Layer generates personalized message per lead with a specific opener referencing a real business detail
  • Output per lead: WhatsApp, LinkedIn, Email, Instagram DM variants
  • CRM pipeline: new - contacted - replied - booked - closed
  • Follow-up suggestions based on reply pattern analysis
Conversational warm-tone, not Silicon Valley cold email
PIPELINE 03

RESEARCH Job

Market analysis, competitor reports, structured insight docs
  • Brief: "Analyse D2C supplement market in India - competitors, pricing, gaps"
  • Research & Extraction Engine: multi-provider concurrent web search (SerpAPI, Tavily, Brave, DuckDuckGo with failover)
  • Competitor pages scraped via Firecrawl for content strategy signals
  • Each source scored: authority (1-10), relevance (1-10), sentiment
  • Minimum 5 unique sources, relevance greater than 7 for top 3
  • Agentic Intelligence synthesizes findings into structured report with PRD-style formatting
  • Output: downloadable PDF or markdown report with citations
  • Results cached for 24h for repeat queries (zero cost on cache hit)
Returns results under 60 seconds
PIPELINE 04

CAMPAIGN Job

Full multi-channel campaign: content + outreach + scheduling
  • Combines CONTENT and OUTREACH pipelines into a coordinated campaign
  • Generates 7-day content calendar with scheduled reel slots
  • Runs parallel lead scraping for outreach campaign
  • Coordinates comment-to-DM automation tied to published reels
  • A/B variant generation: 2-3 script variants for hook testing
  • Email campaign via Resend (free tier, 3,000 emails per month)
  • Analytics dashboard shows unified funnel: reach - leads - conversions - ROI
  • Performance feedback feeds into next campaign cycle automatically
Full funnel: content to closed deal

Architecture: The 8 Subsystems ("Core Subsystems")

  • Founder's Assistant: Agentic OS is not a monolith. It is 8 independent subsystems communicating via HTTP REST calls, a shared Redis queue, and a unified PostgreSQL database. The ACE orchestrator is the central coordinator - all briefs enter via ACE and are routed to the correct subsystem crew.

Founder's Assistant: Agentic OS - Full System Architecture

Subsystem Explorer - Click to inspect each engine

01 - Core Orchestrator (DAG Engine) - Orchestration Backbone

  • Custom DAG Workflow Executor using Kahn's Algorithm: Every agent pipeline is a Directed Acyclic Graph. Nodes are agents. Edges are dependencies. The engine topologically sorts all nodes and executes them in strict mathematical dependency order. The Creator Agent cannot run until both the Research Agent and Strategy Agent have committed their outputs.
  • Job Classification at Intake: Incoming briefs are classified into CONTENT, OUTREACH, RESEARCH, or CAMPAIGN types. The classifier extracts: brand name, topic, target audience, language preference (Hindi/English/Multilingual), tone, output format, deadline, and reference links. This manifest controls which subsystems are activated and in what order.
  • Disk-Persistent Run State (Crash Recovery): Every run is persisted to disk as a JSON file. If the server restarts mid-run, any run still in "running" status is automatically marked "interrupted" with an error message instead of silently disappearing. Jobs are never lost to crashes - they can be retried from the last completed step.
  • Redis + BullMQ Async Decoupling: The API gateway saves job metadata to PostgreSQL, publishes the Job ID to a Redis BullMQ queue, and immediately returns HTTP 202 Accepted. A separate background worker listens on the queue and executes agent steps asynchronously. The dashboard client never blocks on a long-running pipeline.
  • SSE with Reconnect-Replay Ring Buffer: Agent build steps stream to the dashboard via Server-Sent Events. Every run maintains a ring buffer of its last 50 events. When a dashboard client drops its SSE connection and reconnects (mobile network blip, WiFi handoff), the server replays all missed events from the ring buffer. The UI never shows a stale or frozen state.
  • Per-API-Key Sliding-Window Rate Limiting: Each tenant gets a configurable hourly request cap enforced with a rolling time window. Not a fixed bucket - abuse cannot burst and then wait for a bucket reset. The counter uses the last N seconds of timestamps, continuously sliding forward.
  • Background GC Sweeper: A background sweeper runs every 30 minutes, removing runs older than 24 hours from RAM (disk files retained for audit), garbage-collecting empty SSE subscriber lists, and clearing stale rate-limit timestamp entries. Prevents unbounded memory growth under sustained load.
  • Razorpay Billing + Quota Enforcement Middleware: A FastAPI dependency injection class intercepts every build request, checks PostgreSQL for active subscription tier and monthly usage count, and returns HTTP 402 Payment Required with a dynamic upgrade URL if the user has exhausted their monthly quota. Webhook verification uses SHA-256 HMAC. Multi-currency (INR/USD) auto-detected via IP geolocation.
  • Circuit Breakers on All External Calls: Every external API call (LLM providers, Firecrawl, Instagram, YouTube) is wrapped in a circuit breaker. If error rate exceeds a threshold in a rolling window, the circuit opens and immediately redirects to the next fallback. Transitions CLOSED - OPEN - HALF_OPEN. Token usage and USD cost tracked in real-time per provider per job.
def _load_runs() -> Dict[str, Dict[str, Any]]: store: Dict[str, Dict[str, Any]] = {} for f in _RUNS_DIR.glob("*.json"): data = json.loads(f.read_text(encoding="utf-8")) run_id = data.get("run_id") if not run_id: continue # Server restarted while this run was active: mark it explicitly if data.get("status") == "running": data["status"] = "interrupted" data["error"] = "Server restarted while job was running" _persist(data) store[run_id] = data return store
FastAPI + Redis + BullMQ Kahn's Topological Sort Disk-Persistent Crash Recovery SSE Ring Buffer Replay Razorpay Billing

02 - Research & Extraction Engine - Intelligence for All Subsystems

  • Multi-Provider Concurrent Web Search with Failover: Runs concurrent searches across SerpAPI, Tavily, Brave Search, and DuckDuckGo simultaneously. Results are merged and de-duplicated by URL. Provider failover chain means a single API key failure does not interrupt research. The system works fully offline on free DuckDuckGo with no API keys required.
  • Competitor Page Scraping via Firecrawl: Given a competitor URL, Firecrawl extracts structured content including: product descriptions, pricing signals, content strategy patterns (hook types, posting cadence, CTA styles), and customer-facing messaging. This intelligence feeds directly into Apex's directive system for countertactic content generation.
  • Three-Dimension Source Scoring: Every discovered URL is scored on: content relevance to the research goal (keyword density and semantic match), domain authority (TLD scoring, publication date recency, backlink signals), and sentiment polarity (promotional, neutral, or critical). Only sources exceeding minimum composite threshold are admitted to the synthesis context window.
  • LangChain Agent with Tool Use: The research pipeline is a LangChain agent with registered tools: web search (multi-provider), URL content fetcher, domain authority checker, structured JSON extractor, and research topic creator. The agent iteratively calls tools, assembles evidence, and produces a final ResearchReport.
  • Structured Output Contract: All research outputs conform to a strict Pydantic schema: topic, summary, key_findings (list), sources (list with url + authority_score + relevance_score + sentiment), confidence_level (0.0-1.0), and recommended_actions. Schema enforced at LLM output layer. Minimum 5 unique sources, top 3 relevance score greater than 7.
  • Full JWT Auth + SQLite Persistence: Production-ready. Full JWT authentication for multi-tenant API access. SQLite database stores research history and cached results. Results served from cache for repeat queries at zero API cost (24h TTL).
SerpAPI + Tavily + Brave + DuckDuckGo LangChain Agent Firecrawl Competitor Intel Port 8000 - FastAPI

03 - Core Agentic Engine - 7-Agent Content Production Pipeline

Agents run in sequence. Each agent receives all previous agents' outputs as context. Each step is durable, observable, and re-runnable. Agent intermediate files saved to disk for debugging.

00
Research Agent

Gathers relevant facts, scientific studies, audience pain points, content angles, and hook ideas for the topic. Output: structured JSON with facts, angles, keywords, and hook_ideas arrays. Feeds into the Design System Agent and the Scriptwriting Agent.

01
Design System Agent

Defines the complete visual identity for the video: layout type (educational, minimal, story, marketing), color palette with hex values, typography choices (heading and body fonts), motion profile (hyper-kinetic, moderate, static), and visual style (cinematic, illustrated, photorealistic). This token set drives all downstream rendering decisions.

02
Scriptwriting Agent

World-class ad copywriter specializing in copywriting and consumer engagement. Writes constraint-satisfying scripts using system brand guidelines: open with a contradiction, include one raw human-voice line, a 2-3 line micro-story, one pattern-interrupt, and 20% leaner than first instinct. Validates hook against 4 mandatory patterns: Identity Break ("You're not lazy... you're overloaded"), Hidden Truth ("No one tells you this about your brain"), Direct Accusation (physical or mental attribute under pressure), and D2C Challenge (rupee amount + days wasted + still no results). Script must pass a 0.65 minimum confidence hook score. If score is too low, the Scriptwriting Agent rewrites - max 3 attempts.

03
Compliance & Quality Auditor Agent

Quality validator. Scores script 0-100 on: brand safety, regulatory compliance, native conversational tone (English/Hindi/Multilingual fluency), factual accuracy, and Performance Score anti-directive filters. If score is below 70 or critical issues found, rejects with structured feedback sent back to the Scriptwriting Agent. Loop runs up to 3 times before pipeline aborts to operator review.

04
Visual Prompt Optimization Agent

AI art specialist. Transforms each scene's raw image_prompt into detailed generation-ready prompts for Flux, fal.ai Kling, or DALL-E. Adds: specific lighting conditions, camera angle and lens type, color grading style, atmosphere and mood, texture and material details, motion direction. These enhanced prompts are what actually get sent to the image/video generation API.

05
Rendering & Audio Agent

Cinematic director. Adds Ken Burns parameters (start and end coordinates, scale values), transition types (cut, fade, zoom), zoom/pan directions, and timing to each scene. In standalone render mode: reads script from Supabase, calls Google Gemini TTS or ElevenLabs per segment, writes audio files and manifest.json to the renderer public folder. The manifest is what Remotion reads to render the final video.

06
Final Approval & Gatekeeper Agent

Final production reviewer. Approves or blocks the entire pipeline. Score below threshold exits with code 1 and blocks render. Cost estimate included in approval output. Typical per-reel cost: $0.002-$0.008 (Gemini 2.5 Flash pricing). If the Final Approval Agent rejects, the entire pipeline output is discarded and the operator is notified.

  • Reel Lifecycle State Machine: Every reel moves through exactly these states in sequence: draft - scripted - audio_generated - rendered - uploaded - published - collecting (48h metric window) - analyzed - archived. State transitions are persisted to Supabase pipeline_runs table. The system is fully resumable: if it crashes at any step, re-running picks up from the last completed state.
  • Performance Prediction Before Publish: The performance analyzer predicts estimated performance before rendering begins. Top-performing historical hook patterns from the directives table are compared against the generated script. Low-scoring scripts are flagged for revision before any compute is spent on rendering or TTS.
  • A/B Variant Generation: Generates 2-3 script variations with different hooks for simultaneous publishing. Performance Score attribution identifies the winning hook within 48 hours of publish. Winning patterns are promoted to the active directive pool automatically.
  • Visual Entropy Scorer and Autonomous Mutator: Before rendering, the timeline JSON is parsed for low-entropy zones (more than 120 consecutive frames of static content). The mutator automatically injects Ken Burns slow-zoom, B-roll overlays, or YouTube-style jump cuts (splitting scene exactly in half while preserving audio sync) - all without any LLM call, at zero cost.
Gemini 2.5 Flash ($0.002-$0.008/reel) 7 Agents in Sequence Hook Validator (4 Patterns) 3-Attempt Retry Loop Visual Entropy Scorer

04 - Programmatic Video Engine - Programmatic Video Renderer

  • Core Multilingual Video Templates: All compositions are registered dynamically inside the Remotion engine. The system loads customized templates depending on content style, target brand identity, and language (English, Hindi, or Hinglish). Includes specialized layouts: educational explainer videos (EduReel), creator-focused conversational vlogs (NarrativeReel), product showcases and D2C promotions (ProductReel), technical B2B SaaS briefs (TechReel), and high-entropy hook-focused templates (ViralHookReel) to optimize audience retention.
  • Audio-Driven Temporal Authority Pattern: React cannot await asynchronous audio files. The engine generates TTS audio first, measures exact duration using ffprobe, computes exact frames = Math.ceil(duration_seconds x 30fps), and injects the integer into Remotion as a static prop before rendering begins. React never makes timing decisions. This eliminates all audio-video sync bugs permanently.
  • AST Layout Parser - Recursive React Renderer: Instead of hardcoded switch-case layouts, a component registry maps layout tree JSON nodes (Stack, Grid, Text, Image, Overlay) to functional React 19 components. Static text strings in JSX are banned by custom lint rules - all content flows from the JSON AST generated by the Apex pipeline.
  • Multi-Model AI Asset Generation Pipeline: The Visual Prompt Optimization Agent's enhanced image prompts feed into a fallback chain: Pexels API (free, 200 requests/hour) for stock video matching the visual_directive, fal.ai Kling Video v2.5 Turbo for text-to-video generation (~$0.07/second, production sweet spot), Google Veo3 Fast for premium cinematic scenes (~$0.10/second), Replicate Flux-Pro as fallback for static image generation. Target cost: under $0.10 per reel.
  • Word-Level Animated Captions via Whisper.cpp: Whisper.cpp running the medium.en model locally transcribes TTS audio, extracts word-level timestamps, and generates animated TikTok-style kinetic captions synced word-by-word to the voice-over. Active word highlighted in brand accent color at scale 1.1. Previous words dim to 40% opacity. All subtitle rendering inside the Remotion composition - no post-processing step.
  • Cinematic Motion Layers: Ken Burns pan+zoom on all static images (interpolated from frame 0 to durationFrames), 5 CSS filter color-grade presets (energetic, calm, mysterious, scientific, warm), 6-frame crossfade transitions between scenes, @remotion/three particle systems for hook scenes, and auto-ducked background music when voice plays.
  • Output Specification: MP4, 1080x1920, 9:16, 30fps, render time under 3 minutes per 60-second video. Outputs: MP4 + SRT caption file + first-frame thumbnail. Platform-validated for Instagram Reels, YouTube Shorts, and TikTok spec compliance.

Core Multilingual Video Templates:

EduReel_MultilingualMultilingual explainer (Eng/Hindi/Hinglish)
NarrativeReel_HinglishConversational Hinglish vlogs
ProductReel_HindiHindi product showcase & D2C promos
TechReel_EnglishEnglish technical SaaS briefs
UniversalReelDynamic 4-layout adaptive container
ViralHookReelHigh-entropy hook template for retention
React 19 + Remotion 4.0 fal.ai Kling + Veo3 Whisper.cpp Local Captions Temporal Authority Pattern Under $0.10/reel target

05 - SmartPitch Outreach Layer - Lead Scraping and Outreach Generation

  • B2B Directory Scraper (Supabase Edge Function): Input: category, city, keyword. Calls Firecrawl to scrape IndiaMART listings. Returns structured lead JSON: company name, contact person, phone number, business category, location, listing URL. Saves to CRM leads table with auto-scoring. First India-native AI outreach system to target the largest B2B marketplace in India.
  • Local Listings Scraper: Structured scraping of Justdial business listings for local service providers. Used primarily for wellness coaches, yoga studios, fitness trainers, and local D2C sellers. Extracts business name, category, city, phone, and rating where available.
  • Social Media Profile Scraper: Extracts business profile data, post cadence, content style signals, engagement rate, and bio keywords. Used for profiling influencer leads and creator-founders. Output feeds directly into SmartPitch personalization layer.
  • Research & Extraction Engine Lead Enrichment per Profile: For each scraped lead, Research & Extraction Engine performs website analysis (content, pricing signals, technology stack), Instagram profile audit (posting frequency, hook types, engagement patterns), and Google Business data extraction. The enrichment output is what makes each outreach message genuinely specific to that business.
  • SmartPitch Message Generator (Edge Function: generate-outreach): Input: enriched lead profile, channel, language toggle (Hindi/English/Multilingual). Generates 3 message variants per lead: short (WhatsApp), medium (LinkedIn), and long (Email). Each opener references a specific real detail from the lead's profile (a recent post, a product detail, a pain signal) - not a template. Language constraint: warm chai-conversation tone, not Silicon Valley cold email. Multilingual mode reviewed for natural code-mixing patterns.
  • 4 Output Channels per Lead: WhatsApp message (conversational, under 160 characters, safe template for platform compliance), LinkedIn message (professional but warm, references mutual context), Email (long-form, personalized, sent via Resend), and Instagram DM (casual, hook-based, leverages comment-to-DM automation).
  • Comment-to-DM Webhook Automation: Monitors Instagram post comments via Graph API webhooks. Comment text parsed for keyword triggers (heal, grow, code, demo, info, access). Trigger match: fetches commenter's Instagram Scope ID, verifies PG-Crypto HMAC signature, and fires a personalized DM within 60 seconds. Rate-limit queue with exponential backoff prevents platform bans during viral comment spikes.
  • Founder Mode CRM Pipeline: "Today's 10 messages" daily task view for human operators. Kanban pipeline: new - contacted - replied - booked - closed. Lead hot/warm/cold score auto-assigned. Follow-up suggestions generated based on reply pattern analysis. CSV export via PapaParse for offline management.
  • Outreach Campaign Tracker: Tracks sent count, reply count, conversion rate, and average time to reply per campaign. A/B comparison between message variants (short vs long, Hindi vs Multilingual) tracked automatically.
B2B Directory Scraper Local Listings Scraper Social Media Scraper Conversational Tone Engine 4 Output Channels per Lead Comment-to-DM Automation

06 - Agentic CRM Dashboard - 22-Page React Operator Dashboard

  • 22 Live Pages, 26 Custom Hooks, 16 Edge Functions: Full production React 18 + TypeScript dashboard built with shadcn/ui (full Radix UI suite), TanStack Query v5, React Router v6, Recharts, React Hook Form + Zod validation. 25/25 Playwright E2E tests passing.
  • Page Inventory (all 22 live): Dashboard (KPI overview, weekly brief), Leads (management, scoring, pipeline), Analytics (unified ads + funnel), Campaigns, Research (Firecrawl + AI competitor research), Assets (copy and creative library), Automations (workflow automation), Experiments (A/B tracking), LandingPages (builder), Reports (custom report generation), Attribution (UTM + conversion), OfferBlueprint (offer strategy), Onboarding, Admin, Settings, Auth, Apply (client application), Documentation (in-app), Privacy, Terms, Refund, and Pipeline.tsx (6-agent live SSE visualizer with Ctrl+K command console).
  • Pipeline.tsx - Real-Time 6-Agent Job Visualizer: A neon-pulse animated SVG showing all 6 agent stages updating in real-time via Server-Sent Events from the ACE backend. Displays: current agent name, elapsed time per stage, LLM token cost per stage, and job status. Global Ctrl+K keybinding opens a command console for job submission and status queries without leaving the page. Live cost ticker labeled "Estimated burn: X rupees" in JetBrains Mono with tabular number formatting.
  • Research.tsx - Competitor Intelligence Page: Calls Research & Extraction Engine API directly from the Founder CRM interface. Operators submit a competitor URL or research topic and get structured findings with authority scores, sentiment analysis, and actionable insights. Firecrawl integration handles JavaScript-rendered pages.
  • Google Ads + Meta Ads Sync: Full OAuth 2.0 integration with Google Ads (4 Edge Functions: auth-start, auth-callback, list-accounts, sync) and Meta Ads (4 Edge Functions: same pattern). Campaign data pulled into unified Analytics.tsx dashboard showing cross-channel reach, spend, and conversion metrics.
  • Assets.tsx - Creative Asset Library: Displays all Programmatic Video Engine rendered videos with Performance Score performance overlay once metrics are ingested. Operators can drill into any asset to see the source AST, Apex agent logs, audio manifest, and segment attribution map. Download links for MP4, SRT caption file, and first-frame thumbnail.
  • Brand Memory System (Brands.tsx): Per-brand visual tokens stored in Supabase: accent color, typography choices, motion profile, particle style, color grade preset. Programmatic Video Engine reads these tokens to auto-apply brand identity to every new render without operator intervention.
  • TopStrip - Live Provider Health Monitor: 44px top bar showing logo, brand selector, and real-time provider health status for all LLM providers (Ollama local, MiniMax, OpenAI, Anthropic) plus cost meter showing total API spend for the session. Provider health polled every 30 seconds via Zustand store.
  • BottomTicker - Live Run Feed: 28px collapsible ticker at the bottom of every page showing the current agent step name, run ID, and elapsed time as a live SSE event feed. The operator can see at a glance if any job is running or has failed without navigating to Pipeline.tsx.
React 18 + TypeScript + shadcn/ui 22 Pages 26 Custom Hooks 16 Edge Functions 25/25 E2E Tests Passing

07 - Social Publisher - Multi-Channel Distribution Layer

  • Instagram Graph API (Posts + Reels): Autonomous video upload and publish pipeline. Reads rendered MP4 from Supabase Storage, calls the Graph API Container Create endpoint, polls for container status, then calls the Media Publish endpoint. Supports post scheduling (queue up to 7 days of content). Failed posts logged and operator notified via BottomTicker SSE feed.
  • YouTube Data API v3: Autonomous upload of rendered video as YouTube Short. Includes auto-generated title (from the Scriptwriting Agent's script title field), description (from full_narration field), tags (from the Research Agent's keywords array), and category. YouTube's 10,000 API units per day free tier is sufficient for 50+ uploads per day.
  • Resend Email Campaigns (free tier, 3,000 per month): Sends personalized email outreach generated by SmartPitch via Resend. Supports HTML templates with brand token styling. Triggered automatically as part of CAMPAIGN job pipelines. Tracks open rate and click-through via Resend webhook events ingested into the Analytics page.
  • WhatsApp (Copy-Paste Mode in v1, API in v2): SmartPitch generates the message. v1: operator copy-pastes from the Outreach.tsx page "Today's 10 messages" view. v2 (at 50+ paying users): WhatsApp Business Cloud API with safe templates at approximately 0.86 rupees per message.
  • Comment-to-DM Automation (Under 60 Seconds): Instagram Graph API webhook configured per business account. Comment events parse keyword triggers. Scope ID fetched, PG-Crypto HMAC verified, personalized DM dispatched. Full pipeline from comment posted to DM received: under 60 seconds. Rate-limit queue with exponential backoff handles viral spikes.
  • Post Scheduling Queue: 7-day content calendar pre-loaded into Supabase with scheduled_at timestamps. A background job checks the queue on a configurable cron interval and fires the publish API calls at the right time. Failed publishes automatically retry up to 3 times before escalating to the operator.
Instagram Graph API YouTube Data API v3 Resend Email Comment-to-DM under 60s 7-Day Content Queue

08 - Performance & Attribution Engine - The Closed Learning Loop

  • Performance Scoring Formula - Retention-Weighted Performance: Performance Score = (retention_50% x 0.4) + (saves/views x 0.3) + (comments/views x 0.3). The 50% retention point is weighted highest (0.4) as it is the strongest signal of genuine engagement versus accidental plays or autoplay views. Saves and comments are weighted equally (0.3 each) as both signal strong intent and are heavily favored by platform algorithms.
  • 48-Hour Metric Collection Window: After publishing, reels enter "collecting" state in the pipeline state machine. The orchestrator's findIncomplete() function runs a special query: it selects collecting reels where updated_at is earlier than NOW minus 48 hours. These are added to the actionable set and transition to run_performance_analysis. If 48 hours pass with no platform data, the system warns and advances anyway with a log entry.
  • Script Segment Attribution Map: Every published video is produced with a segment manifest linking frame ranges to the specific script segment, visual node, and content hook. When the Instagram or YouTube retention curve is ingested, Performance Score maps retention drop-off timestamps back to segment frame boundaries. The system identifies exactly which hook line, which B-roll cut, or which script segment caused viewers to stop watching.
  • Apex Directive System - Autonomous Content Evolution: High-performing content patterns (high Performance Score segments, successful hook types) are extracted as structured "directives" - reusable production constraints injected into the Scriptwriting Agent's active directive via the Supabase directives table. Low-performing patterns generate "anti-directives" that the Scriptwriting Agent's validation layer explicitly filters out. One active directive at a time (is_active flag), versioned and tracked by reels_generated count.
  • Lead Attribution Tracking: Tracks which specific content reel generated which lead. When a commenter converts via comment-to-DM automation, their conversion event is linked back to the reel that sourced them. The Analytics page shows: which reel drove the most DMs, which content type converts best, and end-to-end CAC (Customer Acquisition Cost) per lead category.
  • Campaign ROI Analytics: Aggregates: ad spend (from Google/Meta Ads sync) vs organic reach (from Instagram/YouTube API), lead count by source, conversion rate per channel, revenue per client. The OfferBlueprint page uses these metrics to auto-generate offer positioning recommendations for the next campaign.
// Segment attribution: map retention curve to script segments function attributeRetentionToSegments(retentionCurve, segmentManifest) { return segmentManifest.map(segment => { const points = retentionCurve.filter( p => p.frame >= segment.startFrame && p.frame <= segment.endFrame ); const avgRetention = points.reduce((s,p) => s + p.value, 0) / (points.length || 1); return { ...segment, avgRetention, isDropZone: avgRetention < 0.6 }; }); }
Performance Scoring Formula 48h Metric Window Segment Attribution Apex Directive Feedback Loop Lead Attribution CAC

System Performance Metrics

8
Subsystems
7
Apex Agents
16
Video Templates
4
Job Type Pipelines
<200ms
API Latency
$0.00
Critical Path Cost
25/25
E2E Tests Passing
22
CRM Pages
Outreach Engine Simulator
Select a target lead (scraped from IndiaMART / Justdial / Instagram) to generate a hyper-personalized Multilingual outreach message, or simulate an Instagram Comment-to-DM webhook trigger.
Select a lead and click generate...

Engineering Retrospective

  • Disk Persistence over Pure Redis State: The first version used in-memory run state. A server restart during a long pipeline meant the run disappeared without trace. Rebuilt with disk-persistent JSON files. Redis is now used only for pub/sub and ephemeral counters, not authoritative job state. On restart, any run still marked "running" is automatically flagged "interrupted" instead of silently lost.
  • SSE Ring Buffer for Mobile Networks: Early beta testers on mobile data would refresh the page and see a frozen pipeline visualizer because SSE connections do not replay missed events by default. Implemented a 50-event ring buffer per run. Reconnecting clients receive all events they missed since disconnection. The UI always reflects the current state, regardless of how many times the client reconnected.
  • Temporal Authority Discovery: Initially the video engine estimated audio duration from character count. The result was videos that ran out of frames while the voice-over was still playing, or had silent black frames at the end. The only correct architecture: generate audio first, measure with ffprobe, compute integer frame count, inject as static prop. React never guesses at timing.
  • Rate Limit Spike Management: During a viral Instagram post with 300+ comments in one hour, the comment-to-DM pipeline triggered a platform rate-limit block that suspended the API token for 24 hours. Rebuilt dispatch with a Supabase-backed drip queue, configurable send rate, and exponential backoff on 429 responses. A spike detector automatically throttles DM dispatch when comment volume exceeds a safe threshold per hour.
  • Multilingual Tone Calibration Takes Real Iteration: The first SmartPitch output sounded like machine-translated Hindi layered onto English corporate structure. Worked with real Multilingual WhatsApp conversations to identify the natural code-mixing patterns: short Hindi phrases embedded in English sentences, no formal Hindi grammar, casual address forms. The PRD notes that western templates have approximately 3 times lower reply rates in this market.