xAI has made the code powering the X For You feed publicly available on GitHub. We read through it so you do not have to, and what it reveals about how the platform decides what you see is genuinely worth knowing.
Most people who use X every day have a rough intuition about how the platform decides what to show them. Post something that gets a lot of likes and it travels further. Post something that people ignore and it disappears. Beyond that, the details have always been murky, the subject of endless speculation and occasional outrage, but never quite transparent enough to pin down precisely.
That changed when xAI published the source code for the X For You feed algorithm on GitHub in May 2026. The repository, which has already attracted more than 25,000 stars from developers and researchers, contains the full recommendation system that decides what appears in your feed every time you open the app. It is written primarily in Rust and Python, and it is detailed enough that anyone willing to read through it carefully can understand, with genuine precision, how the platform ranks content.
We read through it. Here is what it actually says.
The two pipelines feeding your For You tab
The first thing the algorithm reveals is that your For You feed is assembled from two completely separate sources that are then ranked together.
The first source is called Thunder. This is the in-network pipeline, and it handles posts from accounts you actually follow. Thunder works by maintaining an in-memory store of recent posts from all users, consuming new posts in real time as they are created and making them available for retrieval almost instantly. When you open the app, Thunder pulls recent posts from the accounts in your following list and feeds them into the ranking system. It also automatically trims posts older than a certain retention period, which is why a post from someone you follow that was published several days ago may not appear in your For You feed even if you never saw it.
The second source is called Phoenix Retrieval. This is the out-of-network pipeline, and it is responsible for all the content that appears in your feed from accounts you do not follow. Phoenix works by encoding every user’s engagement history into a mathematical representation called an embedding, doing the same for every post on the platform, and then finding posts whose embeddings are mathematically similar to your engagement history. In plain terms: it builds a model of what you have interacted with in the past and finds new posts that look like those things, even if they come from accounts you have never heard of.
Both pipelines feed into the same ranking system, and the final feed you see is a mixture of content from people you follow and content the algorithm believes you will engage with based on your history.
How everything gets scored
Once the algorithm has assembled a pool of candidate posts from both pipelines, it passes them all through a scoring system called Phoenix, built on a Grok-based transformer model, which is the same underlying AI architecture that powers xAI’s Grok assistant.
What Phoenix does is genuinely interesting. Rather than assigning a single relevance score to each post, it predicts the probability of fifteen different types of engagement for each candidate. The full list, taken directly from the published code, includes the probability that you will like a post, reply to it, repost it, quote it, click on it, click on the author’s profile, watch a video if one is attached, expand a photo, share it externally, dwell on it without taking any action, follow the author, mark it as not interested, block the author, mute the author, or report it.
Each of these predicted probabilities is then multiplied by a weight and summed into a final score. The weights for positive actions — likes, reposts, replies, shares, follows — are positive numbers that push the score up. The weights for negative actions — blocks, mutes, reports, and not interested marks — are negative numbers that push the score down.
The final score for any given post is therefore not simply a measure of how much the algorithm thinks you will enjoy it. It is a weighted calculation across fifteen different dimensions of predicted behaviour, with both positive and negative actions factored in. A post that the algorithm thinks is likely to generate a lot of likes but also a meaningful number of reports will score lower than a post that generates fewer likes but no negative signals at all.
This is one of the most consequential things the published code reveals. The algorithm is not just measuring popularity or engagement in the simple sense. It is measuring the full spectrum of how users are likely to respond, including the ways they respond negatively, and weighting the result accordingly.
What this means for how you should post
Reading the scoring system carefully makes certain things clear about what kinds of posts the algorithm is designed to reward and what kinds it is designed to suppress.
Replies matter more than most people realise. The algorithm tracks the probability of a reply as a separate signal from a like, and the two carry different weights. A post that generates genuine conversation, where people feel compelled to write something in response, sends a stronger signal to the algorithm than a post that people double-tap and scroll past. This is why posts that end with a strong statement or a counterintuitive claim tend to outperform posts that end with a question. A statement invites disagreement and debate. A question invites one-word responses or none at all.
Dwell time is tracked explicitly. The algorithm includes a specific signal called dwell — the probability that a user will pause on a post without taking any other action. This means the algorithm can distinguish between content that people read carefully and content that they scroll past immediately. Writing posts that reward reading, that have a payoff at the end rather than front-loading everything in the first line, is likely to improve this signal.
Reposts and shares carry significant weight. The algorithm treats reposts and external shares as separate positive signals, both of which push a post’s score up. Content that is genuinely worth passing on to someone else, that makes the reader feel they have learned something or seen something they want other people to see, performs better under this system than content that is mildly entertaining but not share-worthy.
Negative signals are expensive. The algorithm assigns negative weights to blocks, mutes, reports, and not-interested marks. A single report or block from a user who sees your post is likely to subtract meaningfully from the post’s score. This has a practical implication that is easy to overlook: posting content that is edgy or provocative enough to generate a small number of negative reactions can significantly undermine the performance of a post that would otherwise have done well. The algorithm does not distinguish between someone blocking you because they strongly disagree and someone blocking you because they find the content harmful. Both subtract from the score.
The out-of-network discovery system and what it means for reach
One of the most practically important things the published algorithm reveals is how out-of-network discovery actually works, because it determines whether posts from smaller accounts can reach people who do not already follow them.
Phoenix Retrieval finds out-of-network content by comparing the mathematical representation of a user’s engagement history with the mathematical representations of posts in the global corpus. The closer a post’s embedding is to a user’s historical engagement patterns, the more likely it is to be surfaced to that user even if they have never encountered the author before.
The practical implication is significant. A post from a small account with few followers can reach a large audience through the For You feed, but only if the early engagement on that post is strong enough to establish a meaningful signal. Because Phoenix Retrieval is looking for posts that match existing engagement patterns, a post that generates immediate strong engagement from the people who do see it first, whether that is from followers or from early discovery, is far more likely to be served broadly than a post that accumulates engagement slowly over time.
This explains something many people have noticed empirically about X: the first hour or two after posting tends to be disproportionately important for a post’s overall performance. The algorithm is making decisions about a post’s distribution potential based in part on early signals, and a slow start is difficult to recover from regardless of how good the content is.
There is also a diversity mechanism built into the scoring system. The algorithm includes what it calls an Author Diversity Scorer, which attenuates the scores of posts from authors who are already heavily represented in the candidate pool. In plain terms, even if you follow an account very closely and engage with everything they post, the algorithm will actively limit how many of their posts appear in a single session to ensure that other content has a chance to appear. This is by design, and it is worth knowing about if you are trying to build an audience: even your most loyal followers will not see every post you publish, because the algorithm is specifically built to ensure they do not.
What the algorithm explicitly filters out
The code also makes clear what the algorithm removes before any post reaches the scoring stage. Posts from accounts you have blocked or muted are filtered out before scoring. Posts containing keywords you have muted are filtered out. Posts you have already seen or that have already been served to you in the current session are filtered out. Posts that are too old are filtered out by an age filter, which explains why content has a relatively short window of opportunity to gain traction before the algorithm stops serving it.
After the scoring and selection stage, there is a second round of filtering that removes posts flagged for spam, violence, or other policy violations. The algorithm publishes the existence of this filter, called VFFilter, but does not detail the specific criteria it applies, which are presumably governed by X’s content moderation policies rather than the recommendation system itself.
The bigger picture
There are a few things worth stepping back to appreciate about what xAI has published here.
The first is how different this algorithm is from the intuitions most people have about social media ranking systems. There are no follower count bonuses. There are no manual boosts for verified accounts or paying subscribers built into the core ranking logic. There is no hand-engineered list of features that a human decided should matter. The algorithm states explicitly that it has eliminated every hand-engineered feature and most heuristics from the system, relying entirely on the Grok-based transformer to learn relevance from engagement history. This is a meaningful philosophical commitment to letting the data speak rather than imposing editorial judgments about what should be important.
The second is that the algorithm is fundamentally personal in a way that is easy to underestimate. Because Phoenix builds a mathematical model of your engagement history and uses that to find content, two people with different engagement histories will see very different For You feeds even if they follow the same accounts. The algorithm is not deciding what is good content in the abstract. It is deciding what is likely to be relevant to a specific person based on what that specific person has done before. This means that the same post can perform very differently for different subsets of users, depending on how well its content matches the engagement histories of the people who encounter it.
The third is that publishing the algorithm creates accountability in a way that has not previously existed for social media platforms. When the ranking logic is a black box, there is no way to verify claims about how the system works or to hold the platform accountable for its design choices. Now that the code is public, researchers, journalists, and developers can examine it directly, identify where the algorithm’s incentives create problematic outcomes, and make those findings public. That is a genuinely positive development for the broader conversation about how social media platforms shape what people see and how they communicate.


