
X Open-Sourced Its Algorithm on GitHub: Here's What the Code Actually Says
For years, X's recommendation algorithm was a black box. Creators guessed at ranking signals, marketers ran experiments, and everyone argued about what actually drove reach. Then two things happened.
In March 2023, Twitter open-sourced a partial version of its recommendation system. In January 2026, xAI went further — releasing the complete Grok-powered replacement at github.com/xai-org/x-algorithm and committing to public updates every four weeks. On May 15, 2026, the single largest update to the repo landed: 187 files changed, over 18,000 lines of new code.
The black box is now open. Most creators still have not read it.
This post breaks down exactly what the source code reveals about how X ranks your posts, which signals matter most, and what to do about it. Every tactic here is grounded in the actual code — not speculation.
Why This Open-Source Release Is Different
The original 2023 release (twitter/the-algorithm) was a partial, curated dump. It showed parts of the architecture but omitted training data, model weights, the trust and safety pipeline, and roughly 80% of production code.
The 2026 release (xai-org/x-algorithm) is structurally different:
- Written in Rust and Python (62.9% Rust), a full rewrite from the Scala codebase
- Includes a runnable inference pipeline with pre-trained model artifacts
- Eliminates hand-engineered features — the system learns relevance entirely from user engagement sequences
- Updated on a public cadence — the May 2026 commit added the Grox content-understanding system, ads blending, and new candidate sources
Elon Musk framed the transparency goal plainly when announcing it: "The algorithm will literally read every post and watch every video — 100M+ per day — to match users with content they're most likely to find interesting."
The code backs that up. Here is what it reveals.
The Architecture: Three Stages That Decide Your Reach
The algorithm narrows 500 million daily tweets down to roughly 1,500 candidates per user, then ranks those candidates. It runs in under 1.5 seconds per feed refresh. Four components in the new system handle this:
Home Mixer orchestrates the entire pipeline. It handles query hydration, coordinates candidate sources, enforces post-selection rules, and assembles the final feed.
Thunder is an in-memory post store that enables sub-millisecond lookups for in-network content — posts from accounts you follow. It consumes a live Kafka stream of new posts.
Phoenix is the Grok-powered ranker. A two-tower transformer model that produces both a user embedding and a post embedding, computes similarity via dot product, and assigns a final engagement score to every candidate. This replaced the legacy 48-million-parameter MaskNet model.
Candidate Pipeline is a composable framework that pulls posts from multiple sources — the social graph, topic interest clusters, semantic similarity, and others — then passes them to Phoenix for ranking.
The key design decision in Phoenix: during ranking inference, candidates cannot attend to each other in the attention layer. Each post's score is computed entirely from user context, not from what other posts are in the batch. This makes scores consistent and cacheable — a post's rank does not change depending on what else is being considered alongside it.
The Scoring Formula: What the Code Actually Reveals
Phoenix predicts 19 different engagement actions per post. Each gets a probability score. Those probabilities are multiplied by weights and summed into a single final score.
The original 2023 release revealed the exact weights used in the legacy ranker. Here is the breakdown, with the relative value compared to a like:
| Action | Weight | Relative Value |
|---|---|---|
| Author replies back to a reply | +75.0 | 150× a like |
| Direct reply to your post | +13.5 | 27× a like |
| Profile click with engagement | +12.0 | 24× a like |
| Link click (dwell 2+ min) | +10.0–11.0 | 22× a like |
| Bookmark | +10.0 | 20× a like |
| Repost/Retweet | +1.0 | 2× a like |
| Like | +0.5 | baseline |
| Video watch to 50% | +0.005 | negligible |
| Mute/block/"show less" | −74.0 | −148× a like |
| Report | −369.0 | catastrophic |
The practical interpretation here is stark. A post that gets 100 likes has a lower algorithmic score than a post that gets 4 replies — if you reply back to each of those 4 replies, triggering the +75 "author-replies-back" signal four times.
The 2026 Phoenix ranker uses the same formula structure but with learned weights rather than hand-tuned ones. The exact production weights are not published — xAI has only released the architecture and a smaller "mini Phoenix" checkpoint — but the 2023 weights are widely treated as directionally accurate for the current system.
The Five Signals That Actually Move Your Reach
1. Conversation Depth Over Raw Engagement
The most counterintuitive finding in the code: a single two-way reply chain (you reply to someone's reply on your post) is worth approximately 150 likes in the algorithm's scoring model.
This changes the entire frame for how to grow. The goal is not to post content that gets passively consumed. The goal is to post content that starts a conversation — and then actively participate in that conversation within the first hour.
Creators who understand this post specific, opinionated takes that invite disagreement or demand a response. They treat the comment section as part of the post, not an afterthought.
2. TweepCred: The Hidden Reputation Score
The code defines a reputation system called TweepCred — a weighted PageRank score ranging from 0 to 100, recalculated daily from the user interaction graph.
The critical threshold in the code: accounts with a TweepCred score below 65 have only 3 tweets considered for distribution per cycle. At that threshold, the algorithm effectively stops showing your posts to people who do not already follow you.
TweepCred is influenced by account age, the ratio of followers to following, whether you engage with high-credibility accounts, device usage patterns, and your overall engagement quality history. A new account that follows 5,000 people and posts heavily will have a low TweepCred score and wonder why their reach is flat.
The practical implication: follow strategically, engage with credible accounts in your niche, and do not inflate your following count. Let the follower-to-following ratio normalize as you grow.
3. The Six-Hour Decay and the First 30-Minute Window
The code applies time decay aggressively. A post loses roughly half its visibility score every six hours. After 24 hours, the algorithmic push is effectively zero regardless of what it earned in the first day.
But within the first 30 minutes, the dynamics are completely different. A post that accumulates 10 replies in the first 15 minutes triggers a viral amplification cascade — the algorithm infers high engagement velocity and begins distributing the post to out-of-network users.
This is why posting time is not about when you feel like it. It is about when your most engaged followers are actually online and ready to interact. The first window determines everything.
4. Out-of-Network Requires Social Proof
About 50% of the For You feed is content from accounts you do not follow. The algorithm picks this content using SimClusters — a community detection system that identifies 145,000 overlapping interest clusters across all users.
But there is a filter before SimClusters runs: out-of-network posts must have a second-degree connection. Someone the viewer follows must have liked, replied to, or retweeted the post — or must follow the author. Without that social proof, the post does not enter consideration for the out-of-network half of the feed.
The practical implication: getting your followers to engage early is not just about your own reach score. It is what allows the algorithm to distribute your post to people who have never heard of you. One retweet from a respected voice in your niche activates the entire out-of-network pipeline.
5. The Link Penalty Is Real and Getting Worse
The code confirms what many creators have noticed: external links are penalized. The 2023 system applied a 20–30% reach reduction. By 2025 that had grown to 30–50%. In March 2026, non-Premium accounts posting links began seeing median engagement drop to zero.
This is intentional. X wants users to stay on-platform. The architecture explicitly favors content that keeps people in the feed over content that directs them elsewhere.
The workaround documented by creators who track this: post the native content (the take, the insight, the thread) without a link. Reply to your own post with the link. Reach stays intact. Link clicks often increase — because the tweet has already created demand before revealing the destination.
What the May 2026 Update Added
The May 15 commit was the largest single update to the open-source repo. The additions that matter most for creators:
Grox: the content-understanding pipeline. This handles spam detection, post-category classification, and safety enforcement. It includes ASR (speech recognition) processing for video content. What this means: the algorithm now classifies the content of your posts, not just their engagement patterns. A post flagged as spam or off-category by Grox gets deprioritized before it even reaches Phoenix.
Sentiment scoring. The Grox pipeline includes sentiment analysis that affects distribution. Constructive, positive messaging gets wider reach. Negative, combative framing gets reduced reach — even when raw engagement is high. Controversy can drive replies, but the algorithm now discounts reach from posts that generate reports or "show less" signals alongside those replies.
Promptable feeds. Users can now instruct Grok to customize their For You feed with natural language: "more startup content, less politics." This creates a new dimension for creators — topical consistency is no longer just about X's inference from your engagement history. It is about whether your content matches what users actively ask to see.
Follow graph hydrators. The May update added mutual follow graphs and starter packs as new candidate sources. Accounts that appear in curated starter packs relevant to your niche get a meaningful distribution boost.
Content Format Performance by Signal
The code does not directly say "video beats text." What it reveals is which signals different formats generate — and those signals have different weights.
Threads generate the highest dwell time of any format. A reader who works through a 7-tweet thread triggers multiple dwell-time signals across multiple pieces of content. Thread completion rate was added as a ranking signal in 2025. Three to five tweet threads consistently achieve 40–60% more total impressions than equivalent standalone posts.
Native video creates watch-time signals unavailable to any other format. The algorithm tracks whether users watch to 50%, to completion, and whether they replay. Video upload must be native — external links to YouTube generate zero video-watch signals. Optimal length is under 2 minutes 20 seconds. Vertical 9:16 format outperforms horizontal.
Images carry a confirmed 2× multiplier in the 2023 code over text-only posts. The image multiplier appears to persist in the 2026 architecture based on observed performance data.
Plain text remains the highest-engagement-rate format in terms of replies per impression. A well-crafted text post with a strong hook generates more conversation than most video content. It is also the lowest-friction format to produce consistently.
Links are effectively a separate category: the negative signal they generate outweighs almost any positive engagement they could earn, for non-Premium accounts.
One to two niche-relevant hashtags are fine. More than two triggers the spam classifier in Grox and reduces reach by approximately 40%.
How to Use the Algorithm Systematically
Here is what the code-derived strategy looks like in practice:
Optimize for reply velocity, not like volume. Write posts that invite a specific response. Opinionated takes, direct questions, contrarian data points, and specific predictions all outperform general advice. A post that generates 8 replies in 30 minutes outperforms a post that generates 200 likes over two days.
Reply to your replies within the first hour. This is the highest-leverage action available after posting. Each author-reply-back is worth 150 likes in the scoring model. Block off 20–30 minutes after posting to be present in the conversation.
Keep your posting schedule consistent. TweepCred is influenced by engagement quality over time. An account that posts irregularly and gets inconsistent engagement scores lower than an account that posts daily at a consistent quality floor. Consistency is not about frequency for its own sake — it is about maintaining TweepCred above the 65-point threshold.
Use links only in replies. This is not a workaround — it is now the standard operating procedure for any creator who wants reach AND link traffic. Native post for the distribution, reply for the link.
Pick a niche and publish into it consistently. With Grox classifying the category of every post and Promptable Feeds letting users specify what they want to see, topical drift costs you. Accounts that own a clear niche outperform generalists in the For You distribution system.
Warm up each post before the decay kicks in. Post when your audience is active. Reply to early comments immediately. Reshare in Stories or quote-tweet when you have something to add. The first six hours are the only window the algorithm is actively watching.
Where OpenTweet Fits In
The algorithm rewards consistency, timing precision, and active engagement — all of which are hard to maintain manually across a posting schedule.
OpenTweet is built around these exact constraints:
Scheduling for the engagement window. The best-time-to-post analysis uses your audience data to identify the exact windows when your followers are online and most likely to engage in the first 30 minutes. You set the time once; the scheduler handles the rest.
Threads built to drive dwell time. The thread composer lets you build multi-tweet sequences optimized for completion rate — the signal the algorithm added in 2025. Each tweet in the thread gets its own character-count display and preview.
Evergreen queue for TweepCred consistency. The evergreen system recycles your best-performing posts on a cooldown schedule, maintaining posting cadence without requiring you to write new content every day. Consistent posting keeps your TweepCred score healthy.
AI generation grounded in your voice. OpenTweet's AI studio uses your posting history to build a voice profile before generating any content. Posts that sound like you perform better in the algorithm — your engagement history creates an accurate prediction model for what your audience responds to, and posts that match that pattern score higher in Phoenix.
Multi-account scheduling. For creators and agencies managing multiple X accounts, multi-account support lets you schedule across accounts from a single dashboard. Each account maintains its own cadence and TweepCred trajectory.
RSS and SaaS connectors for passive consistency. The RSS-to-X connector and SaaS connector turn external signals (new blog posts, product milestones, GitHub releases) into draft tweets that keep your account active without requiring constant attention.
The open-source code makes one thing clear: reach on X is a function of consistency, timing, and engagement quality — applied repeatedly over time. The accounts that win are not the ones with the cleverest single post. They are the ones who show up at the right moment, start real conversations, and do it again tomorrow.
The Bottom Line
The open-source X algorithm reveals something that most growth advice obscures: the platform is not rewarding content quality in the abstract. It is rewarding behavioral patterns that indicate genuine engagement — conversations, bookmarks, dwell time — and penalizing passive consumption patterns like scroll-past and link clicks out.
The accounts that have adapted to this are posting into specific niches, writing for replies not likes, being present in their comments for the first hour, and building an infrastructure around consistency rather than hoping individual posts go viral.
The code is public. The signals are documented. What separates accounts that grow from those that plateau is whether they use that information systematically — or keep doing what they did in 2022.
Want to put this into practice? OpenTweet handles the scheduling, timing, thread building, and consistency layer so you can focus on the content that starts conversations.
Start Scheduling Your X Posts Today
Join hundreds of creators using OpenTweet to stay consistent, save time, and grow their audience.