Write once, post everywhere: an AI-powered content distribution CLI

4 min read
Also available in:中文

Write once, post everywhere: an AI-powered content distribution CLI

Here's what I used to do after finishing a blog post:

  1. Copy it into Juejin, fix the formatting.
  2. Copy it into Zhihu, fix it again.
  3. Rewrite it as a Twitter thread.
  4. Rewrite it as a Xiaohongshu post with emoji and tags.

Thirty to forty minutes per post, every time. The writing was already done — the rest was pure format plumbing.

For a developer, that's unacceptable.

The idea

Write one Markdown file. Let AI rewrite it per platform. Let a CLI handle distribution.

blog-post.md
  → AI rewrite → Twitter thread (8 tweets)
  → AI rewrite → Xiaohongshu post (casual tone + emoji)
  → format adapter → Juejin article
  → format adapter → Zhihu article
  → translate → English blog

Implementation

Parsing

Every post starts with frontmatter:

---
title: "Writing AI agents in Go"
date: 2026-03-01
tags: [ai, golang, agents]
platforms: [twitter, juejin, zhihu, xiaohongshu]
---

platforms tells the tool where this one ships. Standard YAML parser; nothing clever.

AI rewrite

Each platform has its own prompt template.

Twitter: first tweet is a hook, max 280 chars each, 6–10 tweets total, last tweet has a follow CTA.

Xiaohongshu: casual voice, short paragraphs, emoji, 300–500 characters, tag list at the end.

Juejin / Zhihu: keep full technical depth, just adjust formatting and the opening.

The code is dumb: read template, inject content, call an LLM, save output. OpenAI-compatible interface, so Claude, GPT, or any open model works.

Distribution

Platforms with real APIs get hit directly. Twitter v2 sends a thread — each tweet replies to the previous one. The blog is just a git push that triggers a deploy.

Chinese platforms (Juejin, Zhihu, Xiaohongshu) have no official API for posting. So I use a browser extension that ships cookies to the CLI — log in once in your browser, the tool uses your session afterwards.

Glue

One command:

# Rewrite into per-platform versions
distro transform my-post.md

# Ship to Twitter
distro publish output/twitter.md -p twitter

# Preview without posting
distro publish output/twitter.md -p twitter --dry-run

What I learned the hard way

Cookies die. Browser cookies expire every week or two; you have to re-login. Annoying, no clean fix yet.

Rate-limit yourself. Don't fire all platforms at once. Add a 5–10 second delay between calls so nobody flags you as a bot.

AI output needs a human pass. 80% of what the LLM produces is fine. 20% needs editing — usually tone and technical nuance. And the LLM will absolutely hallucinate code examples and statistics that aren't in your original. Lock it down in the prompt: "only use facts and code from the source post."

Every platform has its quirks. Xiaohongshu strips external links. Juejin demands language tags on every code block. Zhihu caps title length. Read each platform's rules before you automate.

Run it manual-first. Use the tool for the AI rewrite, then ship the output by hand. After a few weeks, once you trust the output, flip the switch to full auto.

Cost

About $0.05–$0.10 per post in LLM tokens. At four posts a month, that's under a dollar.

The tool

I call it distro. It's a Go CLI. Besides the rewriting, it also handles Xiaohongshu image generation, Mermaid diagram rendering, and a small "AI smell" detector that flags overly-LLM-ish phrases.

Source: github.com/jiusanzhou/distro

What's next

  • Auto-trigger on git push via GitHub Actions
  • Schedule posts at each platform's peak-engagement window
  • Track per-post status across platforms

Originally written in Chinese. If you build something on top of this, I'd love to hear about it — @jiusanzhou.

Zoe

Written by

Zoe

AI Infra Engineer · LLM Serving · GPU/RDMA · indie hacker, obsessed with shipping tools

Comments