Tweet optimization agent for Claude Code and OpenClaw. Score, analyze, and craft tweets against the actual X algorithm.
Uses the published production weights from the open-source X algorithm to score tweets against the actual engagement signals the "For You" feed ranks on.
- Score any draft tweet 0-100 against all 19 algorithm signals
- Analyze with full signal breakdown, hook detection, and suggestions
- Compare multiple drafts in one call — ranked by score
- Reply mode —
--replyapplies the algorithm's 0.75x reply discount - Format templates — 8 proven tweet formats with examples
- Media flags —
--imageand--videofor accurate media-aware scoring - Anti-pattern detection — warns about reach-killing mistakes
- Zero dependencies — just clone and run
# From your project
mkdir -p .claude/skills
cd .claude/skills
git clone https://github.com/609NFT/x-algo-skill.git x-algo# From your workspace
mkdir -p skills
cd skills
git clone https://github.com/609NFT/x-algo-skill.git x-algoRequirements: Bun runtime (or Node.js 18+ with tsx)
No API keys. No package.json. No dependencies. Just clone and run.
# Without Bun
npx tsx x-algo.ts analyze "your tweet"- "Optimize this tweet for virality"
- "Score this draft against the algorithm"
- "What tweet format should I use for a product launch?"
- "Rate this tweet: Unpopular opinion — most content strategies are just procrastination"
cd skills/x-algo
# Full analysis — score, signals, hook, suggestions, warnings
bun run x-algo.ts analyze "Unpopular opinion: most content strategies are just procrastination"
# Quick score — one-line 0-100 with format and hook summary
bun run x-algo.ts score "7 things I learned reading the X algorithm source code:"
# Compare multiple drafts — ranked by score, pick the winner
bun run x-algo.ts compare "version A|||version B|||version C"
# Reply scoring — applies the algorithm's 0.75x reply discount
bun run x-algo.ts score "Great point! Here's what I'd add..." --reply
# Signal breakdown — all 19 signals on a 0-10 scale
bun run x-algo.ts signals "What's the most underrated skill in tech right now?"
# Format templates — 8 high-performing tweet formats with examples
bun run x-algo.ts formats
# Algorithm reference — quick lookup on scoring, signals, filters
bun run x-algo.ts reference scoring--image Indicate an image will be attached (boosts photo_expand, dwell, click)
--video Indicate a video will be attached (boosts video_view, dwell, share)
--reply Apply the algorithm's 0.75x reply discount (for reply tweets)
--json Structured JSON output (works with analyze, signals, compare, formats)
The X algorithm has dedicated signals for media — photo_expand and video_quality_view — but text-only analysis can't reach them. These flags tell the engine media is planned.
# Image attached (screenshot, chart, meme)
bun run x-algo.ts analyze "Check out what I built" --image
# Video attached (demo, walkthrough, clip)
bun run x-algo.ts analyze "Watch how this works" --video
# Both
bun run x-algo.ts score "Before and after" --image --videoWhat changes:
| Flag | Signals boosted |
|---|---|
--image |
photo_expand +5, dwell +1, click +1, favorite +1 |
--video |
video_view +7, dwell +2, dwell_time +2, photo_expand +2, share +1, favorite +1 |
The X algorithm applies a 0.75x discount to all reply tweets (source). Use --reply to see the actual discounted score:
bun run x-algo.ts score "Great reply with insight. Here's what I learned — what do you think?" --reply
# ✅ 70/100 (raw: 80) | question | hook: question (8/10) | 68 chars | ↩️ reply (0.75x)Shows both the effective score (with discount) and the raw score (without). Reply-specific suggestions help you write replies strong enough to overcome the 25% penalty.
Score multiple drafts in one call, ranked by score:
bun run x-algo.ts compare "version A|||version B|||version C"
bun run x-algo.ts compare "reply A|||reply B" --reply --jsonSeparate tweets with |||. The winner is highlighted. Supports all flags.
The composite score uses the actual production weights from twitter/the-algorithm (April 2023). These determine how much each engagement type affects ranking:
| Model Head | Weight | What it means |
|---|---|---|
| Reply Engaged by Author | 75.0 | Someone replies AND author engages back |
| Reply | 13.5 | Will they write a reply? |
| Good Profile Click | 12.0 | Will they visit profile AND engage? |
| Good Click V1 | 11.0 | Will they click into convo and like/reply? |
| Good Click V2 | 10.0 | Will they click in and stay 2+ minutes? |
| Retweet | 1.0 | Will they retweet? |
| Like | 0.5 | Will they tap the heart? |
| Video 50% Playback | 0.005 | Will they watch 50%+ of video? |
| Negative Feedback | -74.0 | Will they click "show less", block, or mute? |
| Report | -369.0 | Will they report it? |
Key insight: Likes (0.5x) and retweets (1.0x) barely matter. The algorithm overwhelmingly rewards conversation — a tweet that sparks genuine back-and-forth (75.0x) is worth 150x more than one that gets likes.
The tool maps these to 19 granular display signals (0-10 scale each) for detailed analysis.
x-algo/
├── SKILL.md # Agent instructions (Claude reads this)
├── x-algo.ts # CLI entry point
├── lib/
│ ├── analyze.ts # Tweet analysis engine — 19 signal scoring
│ └── format.ts # Telegram + JSON formatters
├── data/
│ └── .gitkeep
└── references/
└── x-algorithm.md # Distilled X algorithm reference
The composite scoring weights come directly from the published X algorithm source (April 2023 release). The 10 model head weights (0.5 for likes through -369.0 for reports) are the actual production values. Pattern-based heuristics that estimate how well a tweet will trigger each engagement type are approximations — the real model uses 2,176 features including user history, social graph, and real-time engagement data that we can't access from text alone.
- Text-only analysis —
--image/--videoflags indicate media presence but don't analyze the actual media content - Pattern heuristics estimate engagement probabilities from text features; the actual model uses 2,176 features per tweet-user pair
- Cannot predict personalization (the real algorithm personalizes per user)
- Does not account for author reputation, follower count, or posting frequency
- Weights are from April 2023 — X may have adjusted them since
- Scoring is directional, not a guarantee of reach
- Algorithm source + published weights: twitter/the-algorithm
- Skill pattern: rohunvora/x-research-skill
MIT