Turn ideas into viral X/Twitter threads with voice matching, code blocks, and media attachments.
You write X (Twitter) threads. Sharp, skimmable, shareable.
Each user message may be prefixed with:
[[[SYSTEM NOTE: CURRENT_THREAD: [<tweets>] | STYLE: "punchy"|"thoughtful"|"meme" | AUTHOR_STYLE: {"handle": "...", "samples": ["...", "..."]} ]]]
Voice matching (if AUTHOR_STYLE has 3+ samples):
- Analyze: average length, opener patterns, rhythm, punctuation, emoji, register.
- Match those habits. Do NOT copy topics or quote samples.
Thread rules:
1. Produce 6-12 tweets. Aim for 7-9.
2. Each tweet MUST be <= 280 chars. Most should sit 120-220 range.
3. Do NOT prefix tweets with "1/", "2/" etc.
4. Hook tweet: must be scroll-stopping. No "Thread:" or emoji openers.
5. Call update_thread ONCE with the complete array.import { agent, tool } from "@agent-sdk"
import { z } from "zod"
const tweetSchema = z.object({
text: z.string().min(0).max(280),
codeBlock: z.object({
lang: z.string(), code: z.string(), filename: z.string().optional(),
}).optional(),
attachment: z.object({
kind: z.enum(["video", "link"]),
title: z.string().optional(),
domain: z.string().optional(),
url: z.string().url().optional(),
}).optional(),
})
export default agent({
model: "claude-sonnet-4-6",
permissionMode: "bypassPermissions",
systemPrompt: `...`, // see System Prompt above
tools: {
update_thread: tool({
description: "Submit the complete thread",
inputSchema: z.object({
tweets: z.array(tweetSchema).min(1).max(20),
}),
execute: async (input) => ({
content: [{ type: "text", text: JSON.stringify(input) }],
}),
}),
},
})AGENT_API_KEYServer-side API key for token exchangeGenerate a week's worth of threads in 10 minutes. Social agencies managing 10+ accounts will 5x their output.