Inspiration Content creators on Chinese social media platforms face a grueling, repetitive workflow: crafting AI prompts, generating videos, adapting titles and descriptions for each platform's unique style, designing cover images, timing publications for maximum reach, and then manually posting across Douyin, Xiaohongshu, and more. A single piece of content can take hours to go from idea to live — and that's before you start tracking performance and iterating. We built Claw to eliminate this friction. The vision is simple: describe what you want, and let the system handle everything from generation to distribution to analytics.

What it does Claw is an end-to-end AI video generation and social media matrix distribution system. A user provides a text prompt through any interface — our web app, Feishu, Telegram, or WeCom — and Claw orchestrates the entire pipeline:

AI Video Generation — Submits the prompt to providers like Jimeng (ByteDance), Aliyun Wanx, ComfyUI, or LibLibAI, then downloads and validates the result. Compliance — Automatically adds "AI Generated" watermarks to meet platform regulations. Cover Design — Generates platform-optimized cover images from video frames. Content Adaptation — Uses LLMs to craft platform-specific titles, descriptions, and hashtags tailored to Douyin's and Xiaohongshu's distinct audience expectations. Smart Publishing — Distributes to Douyin via official OAuth APIs and to Xiaohongshu via browser automation, with optimal posting time suggestions based on engagement data. Post-Publish Intelligence — Collects metrics, discovers trending topics, analyzes A/B experiments, performs comment sentiment analysis, and generates optimization suggestions for future content. Beyond the core pipeline, Claw also includes a credit-based billing system, content collection/inspiration scraping from social platforms, a quotation generation system (with PDF/PNG export), license key management, and a full admin CLI.

How we built it Claw is a pnpm + Turborepo monorepo with 16 packages, following a hub-and-spoke architecture:

Gateway (Fastify 5 + SQLite via better-sqlite3) serves as the central API server, task orchestrator, and data store. It manages a PipelineRunner that drives tasks through their lifecycle states and an MCP Registry that starts/stops domain-specific child processes. MCP Servers (Model Context Protocol via stdio) — Each domain (video, content, publishing, billing, collection, quotations) runs as an isolated MCP server process, communicating with the Gateway through internal HTTP APIs. This gives us independent scaling, fault isolation, and the ability to add new capabilities without touching the core. Channel Adapters — Separate Fastify/standalone servers for Feishu (webhook), Telegram (long polling), and WeCom (encrypted XML webhook), all routing through a shared channel-core library. Frontend — React 18 + Vite + Zustand + TanStack React Query, backed by a shared claw-ui component library with dark/light theming. LLM Integration — Anthropic Claude SDK for core intelligence, with fallback support for Volcengine, DashScope, and DeepSeek. Browser Automation — Patchright (a stealth Chromium fork) for Xiaohongshu publishing and content collection, with a 3-tier fallback strategy (cookie injection → persistent profile → manual kit). Validation & Auth — Zod schemas throughout, JWT sessions, HMAC-signed self-contained license/credit codes. Challenges we ran into Xiaohongshu has no public posting API. We had to build robust browser automation with Patchright, implementing a 3-tier fallback strategy and semi-auto publish mode (fill the form, let the user confirm) to balance reliability with platform compliance. Multi-provider video generation is inherently async and flaky. Each AI provider has different APIs, polling intervals, error modes, and output formats. Building a unified pipeline that gracefully handles timeouts, partial failures, and provider-specific quirks required careful state machine design. Platform-specific content adaptation is not one-size-fits-all.-fits-all. Douyin favors short, punchy hooks while Xiaohongshu rewards detailed, aesthetic descriptions with emoji. Training LLM prompts to consistently produce platform-appropriate output took extensive iteration. Stealth collection at scale. Scraping content for inspiration while avoiding detection required randomized delays (15-35 min between visits), browser fingerprint management, and session rotation. Self-contained license codes without a database. We needed offline-verifiable license keys and credit card codes that don't require a central lookup. Designing the HMAC-signed encoding scheme (with tier, expiry, and hardware serial binding) while keeping codes human-readable was a non-trivial cryptographic exercise. Accomplishments that we're proud of Fully automated pipeline from prompt to published content — A user can type a sentence in Feishu and have a watermarked video live on Douyin within minutes, with zero manual intervention. Multi-channel access — The same system works identically whether you're on the web, Feishu, Telegram, or WeCom, thanks to the channel-core abstraction. MCP-based microservice architecture — Each domain server is independently deployable and replaceable. Adding a new AI provider or social platform means writing a new MCP server, not modifying the Gateway. Self-contained cryptographic codes — License keys and credit card codes are HMAC-signed and verifiable offline, eliminating dependency on a central database for authorization. Intelligent post-publish loop — The system doesn't stop at publishing. It collects metrics, discovers trends, analyzes A/B experiments, and feeds optimization suggestions back into the content creation process. What we learned State machines are worth the upfront investment. The task lifecycle (PENDING_GENERATION → GENERATING → PENDING_DOWNLOAD → ... → PUBLISHED) with credit prehold/confirm/refund at each transition would be unmanageable without explicit state modeling. Browser automation is fragile by nature. No matter how clever your selectors, platforms will change their UI. Building multiple fallback strategies and semi-auto modes is essential for production reliability. LLM prompt engineering is the real integration work. Connecting to an LLM API is trivial; getting consistent, platform-appropriate output across diverse content types is where the real effort lies. MCP as an internal protocol works surprisingly well. Originally designed for tool-use in AI agents, MCP's stdio transport and tool registry pattern proved to be an elegant way to structure our backend services with clear contracts and independent lifecycles. What's next for Claw More platforms — Kuaishou, Bilibili, and WeChat Channels are next on the distribution matrix. Multi-modal input — Support image and video references as input (not just text prompts), enabling style transfer and content remixing. Collaborative workspaces — Team-based content calendars, approval workflows, and shared brand kits for agencies managing multiple accounts. Autonomous content agent — An agent that can independently discover trending topics, generate content, publish, monitor performance, and iterate — a full self-driving content loop. Real-time analytics dashboard — Live metrics streaming via WebSocket with anomaly detection and automated performance alerts. Open plugin system — Allow third-party developers to build and distribute their own MCP servers for new AI providers, platforms, or content tools.

Built With

Share this project:

Updates

Submission history