Skip to content

Instantly share code, notes, and snippets.

@mshuffett
Created January 28, 2026 09:32
Show Gist options
  • Select an option

  • Save mshuffett/16fe2df6f98192f525526afe5685f3be to your computer and use it in GitHub Desktop.

Select an option

Save mshuffett/16fe2df6f98192f525526afe5685f3be to your computer and use it in GitHub Desktop.
Moltbot Cloud Consumer Product Plan - Gemini 3 Pro

Cloud Consumer Product Architecture for Moltbot

Author: Google Gemini 3 Pro (Preview) Date: 2026-01-28 Status: Proposal


This document outlines the comprehensive plan to transform Moltbot from a self-hosted developer tool into a mass-market cloud messaging product.

1. Cloud Architecture

We will decompose the monolithic daemon into a scalable, event-driven microservices architecture.

Core Services

  1. Gateway Service (The Hub)

    • Role: Replaces the local WebSocket server. Manages persistent WebSocket connections from Client Apps (Mobile/Desktop) and Bridge Nodes (User's Mac/PC).
    • Tech: Node.js/Bun with ws or Go. Scaled horizontally with a Redis adapter for broadcast distribution.
    • Protocol: Retains the existing JSON schema-validated WebSocket protocol but adds authentication (JWT) and routing logic.
  2. API Service

    • Role: REST/RPC API for onboarding, configuration, billing, and history queries.
    • Tech: Hono or Express (migrated from current server-http.ts).
    • Auth: Clerk, Auth0, or Supabase Auth for robust user management.
  3. Channel Workers (The Limbs)

    • Cloud-Native Fleet: Stateless workers handling "Easy" channels (Telegram, Discord, Slack, MS Teams).
      • Ingress: HTTP endpoints for Webhooks (Slack Events, Telegram Webhooks).
      • Egress: Queue consumers (Redis/SQS) picking up "Send Message" jobs.
    • Bridge Routing: Logic to route messages for "Hard" channels (iMessage, WhatsApp) to the specific user's connected Bridge Node (see below).
  4. AI Agent Worker (The Brain)

    • Role: Decoupled execution of the "Pi" agent.
    • Trigger: Listens to message.received events.
    • State: Loads session history from DB + Vector Search from Cloud Vector DB.
    • Tech: Python or Node.js wrapper around pi-agent-core.

Database Design

We migrate from filesystem (JSONL/YAML) to structured cloud data.

  • Primary DB (Postgres):
    • Users: ID, email, subscription tier.
    • Tenants/Teams: Grouping users (for B2B expansion).
    • Channels: Configs (tokens, webhooks) encrypted at rest.
    • Sessions: Conversation metadata (replaces sessions.json).
    • Messages: High-volume storage. Partitioned by Time or Tenant.
  • Vector DB (pgvector / Pinecone):
    • Replaces local sqlite-vec. Stores embeddings of message history for long-term agent memory.
  • Blob Storage (S3):
    • Stores images, voice notes, and attachments.
  • Cache/Queue (Redis):
    • Real-time event pub/sub.
    • Job queues for message delivery and AI processing.

Real-time Event Streaming

  • Client subscriptions: WebSocket connections to Gateway Service subscribe to tenant-scoped event streams.
  • Internal eventing: Redis Pub/Sub (Phase 1) graduating to NATS JetStream or Kafka (Phase 2+) as throughput grows.
  • Event types: message.received, message.sent, message.delivery_updated, channel.status_changed, agent.run_started, agent.run_completed.
  • Resume capability: Events carry monotonic sequence IDs; clients reconnect with since_seq to catch up on missed events.

Media Storage & Delivery

  • Upload flow: Client requests presigned S3 URL, uploads directly, webhook notifies API of completion.
  • Processing: Lambda/Cloud Function pipeline for thumbnails, waveforms, virus scanning.
  • Delivery: CloudFront signed URLs with tenant-scoped access policies.
  • Retention: Free tier = 30 days, Pro = 1 year, Team = unlimited.

Agent/AI Execution Model

  • Stateless job execution: Each message.received event triggers an agent job via queue.
  • Context assembly: Pull recent messages from Postgres + relevant embeddings from pgvector.
  • Budgeted prompting: Per-plan token limits enforced before API call.
  • Tool sandbox: Capability-based tool execution with per-tenant allowlists.
  • Cost tracking: Every run records tokens_in, tokens_out, cost_usd for billing.

2. Onboarding Changes

The goal is "Zero to Hero" in < 2 minutes without touching a terminal.

The New Flow

  1. Web Signup: User visits moltbot.com, signs up with Google/Apple.
  2. Instant Value (Cloud Channels):
    • "Connect Telegram": User enters Bot Token (or clicks "Auth" for Discord/Slack).
    • Result: Immediately functional. They can chat with the bot via the web UI.
  3. The "Bridge" (Optional Power Move):
    • Prompt: "Want iMessage or WhatsApp?"
    • Action: Download Moltbot Bridge app (Mac/Windows) or run curl -sSL https://molt.bot/install | bash.
    • Pairing: Run app -> It displays a QR code. User scans with Mobile App OR enters a code on the Web Dashboard.
    • Result: The local daemon starts in "Bridge Mode" (headless), strictly forwarding traffic to the Cloud Gateway.

Key Changes from Status Quo

  • No Config Files: Config is stored in Postgres. The Bridge Node pulls its config (allowlists, etc.) from the cloud on connection.
  • Hosted Agent: User doesn't need to configure LLM keys. We resell access (or allow BYO Key on Pro tier).

Channel Connection Flows

  • Token-based (Telegram): Paste bot token -> validate -> connected in 30 seconds.
  • OAuth (Discord, Slack, MS Teams): Click "Connect" -> OAuth popup -> authorize -> connected in 2 clicks.
  • QR-based (WhatsApp Web): Click "Connect WhatsApp" -> QR appears in dashboard -> scan with phone -> connected.
  • Device pairing (iMessage): Click "Connect iMessage" -> get pairing code -> enter in Mac app -> WSS tunnel established.

Free vs Paid Onboarding

  • Free: 1 cloud channel, 30-day retention, basic AI. No bridge channels.
  • Paid: Unlock bridge channels, unlimited history, premium AI models, BYOK option.
  • Upsell moments: Adding second channel, enabling AI, connecting iMessage/WhatsApp.

3. App Changes

Mobile Apps (iOS/Android)

  • Before: Connect to local IP/Tailscale.
  • After: Hardcoded to connect to wss://api.moltbot.com/gateway.
  • Auth: Login screen (OIDC) instead of "Enter Gateway Address".
  • Push Notifications: Centralized APNS/FCM service triggered by the Cloud Gateway.
  • Feature parity: Unified inbox, conversation view, real-time streaming, media sharing.

Mac App / Desktop

  • Split Personality:
    1. Client Mode: A rich UI for chatting, viewing conversations, managing settings.
    2. Bridge Mode: A background helper that runs the imessage or whatsapp adapters.
  • UI: "Settings" pane allows toggling "Enable iMessage Bridge".
  • Removed: Gateway hosting, local channel management, local config UI.
  • Added: Cloud auth (JWT), cloud connection indicator, pairing flow.

Web Dashboard (New - Primary Interface)

  • Unified inbox for all channels with search and filters.
  • Channel management (Add/Remove/Reauth with status indicators).
  • Agent configuration (Persona, system prompt, model selection, tool toggles, routing rules).
  • Usage & billing (token consumption graphs, plan management).
  • Bridge status (connected devices, health, troubleshooting).

CLI Tool Changes

# Cloud mode (default)
moltbot login                    # Opens browser for OAuth
moltbot status                   # Cloud status (channels, usage, plan)
moltbot channels list            # Connected channels from cloud
moltbot channels connect telegram # Guided connection flow
moltbot tail                     # Stream events for debugging
moltbot export                   # Download archive

# Self-hosted mode (preserved for power users)
moltbot selfhost start           # Original local gateway

4. Business Model

We shift from "Open Source Tool" to "SaaS with Free Tier".

Tiers

  1. Free / Hobby - $0/mo:

    • Cloud Channels: 1 (Telegram or Discord).
    • AI: Basic model (e.g., Gemini Flash), limited context window. 500 messages/month.
    • Retention: 30 days message history.
    • Storage: 100 MB media.
  2. Pro - $15/mo:

    • Cloud Channels: Unlimited (Slack, Teams, etc.).
    • Bridge Channels: iMessage, WhatsApp, Signal.
    • AI: Premium models (Claude Sonnet, GPT-4o), large context. 5,000 messages/month.
    • Retention: Unlimited history + Vector Search memory.
    • Storage: 10 GB media.
    • Features: Voice transcription, image generation, BYOK (unlimited with own keys).
  3. Team - $12/user/mo (min 3):

    • Shared inboxes (multiple humans + AI agent in same channel).
    • Role-based permissions.
    • SSO (Google Workspace, Okta).
    • Audit log.
    • Everything in Pro.
  4. Enterprise - Custom:

    • Dedicated infrastructure, custom SLA, SOC 2 compliance, on-premise option.

Usage Metering

  • Messages ingested/sent (count)
  • AI tokens (input/output)
  • Media stored (GB-month)
  • Overages: $0.01/message (basic), $0.05/message (premium AI), $0.50/GB storage.

Self-Hosted

  • Continue to support the OSS Docker image.
  • "Bring Your Own Cloud" license keys for enterprise deployments.

5. Migration Strategy

Phased Rollout

  1. Phase 1: Cloud Sync (Hybrid) - Foundation

    • Keep local gateway logic.
    • Add "Sync to Cloud" plugin.
    • Mobile apps connect to Cloud, Cloud proxies to Local Gateway.
    • Value: Solves the "Tailscale/Public IP" headache for users.
  2. Phase 2: Cloud Brain - AI + First Connectors

    • Move the Agent logic to the cloud.
    • Launch Telegram + Discord cloud connectors.
    • Web dashboard with auth + channel management.
    • Local gateway becomes just a "Dumb Bridge".
  3. Phase 3: Full SaaS - Complete Product

    • All cloud integrations (Slack, Teams, etc.).
    • Real-time subscriptions + message search.
    • iMessage edge connector + Mac app refactor.
    • Billing + usage metering (Stripe).
  4. Phase 4: Growth - Polish + Scale

    • Mobile app cloud-native refactor.
    • Push notifications.
    • Team features, analytics, automations.
    • Self-hosted migration tool.

Migrating Existing Self-Hosted Users

  • moltbot cloud migrate command:
    • Exports local JSONL transcripts + session metadata.
    • Creates cloud account, uploads history.
    • Re-authenticates channels in cloud.
    • Verifies message parity.
  • Hybrid mode preserved during transition (local gateway + cloud sync).

Risk Assessment

Risk Impact Likelihood Mitigation
Privacy breach Critical Low E2EE where possible, strict data policies, SOC2
iMessage instability High Medium Keep bridge local (user hardware), graceful degradation
WhatsApp ToS High Medium Bridge model (user-owned), parallel Cloud API option
AI cost overruns Medium Medium Strict per-plan budgets, Haiku/Flash for free tier
Supabase scaling Medium Low Can migrate to dedicated Postgres + custom realtime

6. Consumer Product Considerations

Why This Wins

  • The "One Inbox" Dream: Competitors like Beeper are great, but Moltbot adds a Personal AI Chief of Staff that lives in that inbox.
  • AI-First: Not just "Chat with AI", but "AI reads my chats and drafts replies / reminds me of things".
  • Privacy/Control: The "Bridge" model appeals to privacy-conscious users who don't want a cloud server logging into their iCloud.

Competitive Positioning

Feature Moltbot Cloud Beeper texts.com ChatGPT
AI Agent Core feature No No Destination app
Multi-channel 7+ channels 15+ 5+ 1 (own)
Self-hosted option Yes No No No
BYOK AI Yes N/A N/A N/A
In your existing chats Yes Yes Yes No
Price $0-15/mo $0-5/mo Free $20/mo

Key Differentiators

  • Vs. Beeper: We have the Agent. They are just aggregation.
  • Vs. ChatGPT: We are in your iMessage/Telegram. ChatGPT is a destination app you go to.
  • Vs. Self-Hosted OSS: We "just work". No Docker, no config files, no YAML.

Retention & Engagement Features

  • Morning Briefing: Agent summarizes all missed messages across Telegram/Slack/iMessage every morning.
  • Cross-Platform Search: "What did John say about the project last month?" (Searches across ALL platforms).
  • Smart Reply Drafts: AI drafts replies in your voice for review.
  • Follow-up Reminders: "Nudge me if no response in 2 days."
  • Vacation Mode: Auto-reply across all channels with AI.
  • Contact Intelligence: Lightweight CRM notes per person.

Growth Strategy

  1. Launch on Product Hunt with free tier.
  2. Content marketing: "How I replaced 5 messaging apps with one AI."
  3. Developer community: Open-source channel plugin SDK.
  4. Referrals: "Invite a friend, get 1 month Pro free."
  5. In-app support powered by Moltbot itself.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment