In the age of AI agents and growth hacking, managing marketing operations across multiple platforms (such as posting content and monitoring conversations on Reddit, Telegram, Facebook, YouTube, and Twitter) has become standard practice for indie developers and startup teams.
However, commercial marketing SaaS tools often present three critical drawbacks:
- Security and Privacy Risks: You are forced to upload your social media API keys and OAuth tokens to a third-party cloud platform.
- Expensive LLM API Bills: Generating high-quality marketing copy via cloud APIs continuously racks up token costs.
- Risk of Account Suspension: Low-authority or newly registered social media accounts are easily flagged and banned if they repeatedly post promotional links.
To address these pain points, I developed a purely local, open-source marketing operations tool built on Composio and the Model Context Protocol (MCP) (composio-marketing-ops).
This system aligns with our previous guides on OpenClaw Local Agent Runtime and the Antigravity Multi-Agent Framework, providing developers with a private, secure, and low-cost growth-hacking setup.
This post details the system's design requirements, tripartite architecture, core data flow, and its unique risk-control strategy engine.
🧭 1. Core Pain Points & The Tripartite Architecture
In traditional marketing tool development, writing individual API adapters and handling authorization for every single platform (Reddit, Telegram, YouTube, etc.) is a massive, redundant engineering task.
By combining Composio and the Model Context Protocol (MCP), we decouple this flow into three clean, specialized layers:
+-------------------------------------------------------------+
| Composio Marketing Ops (This Project) |
| Solves: Campaign Briefs, Content Review, Scheduler Tasks, |
| Anti-Ban Account Strategies, and Local Audit Log |
+-------------------------------------------------------------+
▲
│ MCP (Model Context Protocol)
▼
+-------------------------------------------------------------+
| Composio MCP Client / Gateway |
| Solves: Mapping cloud connections to standardized local |
| JSON-RPC tool interfaces. |
+-------------------------------------------------------------+
▲
│ Secure Tunnel
▼
+-------------------------------------------------------------+
| Composio Connect (Server) |
| Solves: Managing OAuth & API connections for 200+ target |
| social networks and web apps. |
+-------------------------------------------------------------+
- Composio (Server-Side): Solves the API connection and OAuth authentication problems. It securely connects platforms like Telegram, Reddit, Facebook, Twitter, and YouTube, saving us from writing custom API integrations.
- MCP Layer: Solves local-to-cloud communication. It translates the connected platforms on Composio into standard, local tool interfaces.
- This Marketing System (composio-marketing-ops): Solves campaign planning, local content generation, editorial approval, and compliance scheduling. This is where the core business logic lives.
🏗️ 2. Clean Architecture and the "Zero-Cost API" Boundary
The system uses a Local Web UI (Next.js) + CLI (Local Agent Session) architecture. Data is stored in a local better-sqlite3 database, ensuring credentials never leave your machine.
To save API costs and preserve architectural cleanliness, we established these strict boundaries using Next.js App Router:
Web UI Panel (Next.js, :3000) ◄───Shared SQLite───► CLI command (/promo:gen)
[Role]: Syncing outlets, scheduling, [Role]: Reads due tasks -> LLM generates
editorial approval, local history, -> writes draft back
and real-time publishing
│ │
└──────────────────────► data/promo.db ◄────────────────────────┘
(Single Source of Truth)
A. Local Web UI (Next.js)
- Role: Handles everything except content generation—syncing sites, task scheduling, editorial approvals, and audit logging.
- Rule: The Web UI never makes direct calls to external LLMs. This keeps the UI responsive and prevents unexpected API costs.
B. CLI / Slash Command (`/promo:gen`)
- Role: Reads pending content generation tasks from the database, calls the LLM, and writes generated copy back to the database.
- Rule: This command runs inside the developer's interactive terminal session (e.g., using a personal GLM subscription). This brings the cost of bulk content generation down to $0 in API keys. The output is saved to the SQLite database as a
draftfor review.
C. Shared SQLite DB (`data/promo.db`)
- All communication between the Web UI and the CLI happens through a shared SQLite database. This acts as the single source of truth, avoiding memory sync issues.
🔁 3. Core Data Flow & Editorial State Machine
The system's data lifecycle is organized into three distinct loops:
[ connected_sites (Active) ]
▲
│ sync-sites
│
+-------------------------------------------------------+
| 1. Sync Sites (sync-sites) |
| Fetches active outlets via Composio MCP. |
| Mark disconnected ones without deleting history. |
+-------------------------------------------------------+
│
▼
+-------------------------------------------------------+
| 2. Content Generation (gen task) |
| CLI reads tasks -> applies account strategies |
| -> LLM outputs copy. |
+-------------------------------------------------------+
│
▼
[ posts (Draft) ]
│
├─► [ rejected ]
▼
[ posts (Approved) ]
│
▼
+-------------------------------------------------------+
| 3. Scheduled Publishing (publish task) |
| Next.js cron checks approved posts -> runs |
| pre-flight policy checks -> posts via MCP. |
+-------------------------------------------------------+
│
├─► Failure: [ queued + error ] (retry)
▼
[ posts (Posted) ]
│
▼
[ publish_history (Posted) ]
- Syncing Sites (
sync-sites): The scheduler queries connected accounts from Composio, fetching metadata (like Reddit karma, account age, or YouTube subscriber counts). Disconnected accounts are marked asdisconnectedbut never deleted to preserve audit trails. - Content Gen (
gen): The CLI reads pending campaign tasks, grabs the campaign brief, checks the target platform's policies, and passes this context to the LLM to write a draft (status=draft). - Approval & Publishing (
publish): The user reviews drafts in the Web UI. Once approved, the Next.js cron scheduler (/api/cron/run) executes a pre-flight policy check and publishes the posts via Composio MCP.
🛡️ 4. The Smart Anti-Ban Strategy Engine
Social platforms aggressively filter automated posts, especially those containing outbound links from new accounts.
To prevent account suspensions, the system uses a Strategy Engine that evaluates account metadata (connected_sites.meta) against configured rules (strategy_rules):
A. Rules Configuration
We define safety parameters:
- Dimensions:
account_age_days(account age),karma(interaction points),followers(follower count). - Rules:
link_policy:allow(permit links) /deny(strictly forbid links, value-only content) /allow_if_relevant(max 1 contextual link).ad_policy:allow(allow sales-heavy tone) /deny(strictly informative, no promotional jargon).max_per_day: Posting limits to prevent triggering rate limits.
B. Double-Gated Enforcement (Gen + Pre-flight)
Policies are verified at two key stages:
- Generation Gate (System Prompt Injection):
When the CLI invokes the LLM, the system dynamically appends account constraints to the prompt. If the account is a new Reddit profile, the prompt reads:
"This account is new. Do not generate links, call-to-actions, or marketing language. Provide objective, helpful advice." - Pre-flight Gate (Pre-Publish Check):
Right before the Next.js scheduler sends the post payload to the Composio MCP client, a synchronous parser checks the post body. If a link is found on a profile where
link_policyis set todeny, the publish event is blocked, returning the post to the queue with a safety warning.
🚀 5. Open Source Roadmap
This project bridges the gap between secure cloud integrations and cost-efficient, local content scheduling.
With the core SQLite schema, strategy engine, and unit tests implemented, we are planning the next phases before the official public release:
- Comment & Post Discovery (Phase 2): Integrating structured scrapers detailed in our Firecrawl Scraper Guide to track community discussions (like Reddit threads asking about "Which AI coding tool is best") via Composio, drafting replies, and pushing them to the approval queue.
- Rich Media & Video Automation (Phase 3): Integrating local video rendering pipelines to generate shorts and voiceovers based on campaign briefs, publishing them directly to YouTube Shorts and TikTok via Composio.
This architecture offers a secure, zero-overhead growth-hacking framework for independent developers. Stay tuned for the public repository release!