The algorithm ultimately optimizes for long-term user retention. The three heaviest signals remain engagement velocity, author reputation (Tweepcred), and SimClusters community fit.
Video and live content receive special treatment because they produce stronger engagement signals than text.
Live content creates real-time engagement spikes that the algorithm loves. A single high-quality Space can move an account’s reputation score faster than weeks of regular posting because it produces dense, high-signal interaction data.
Subscribers are one of the strongest positive signals available.
Creators with strong subscriber bases can often post less frequently while maintaining high reach because the algorithm already knows these users want to see their content.
The algorithm treats original posts and replies differently.
Original posts are evaluated on velocity, author reputation, and community fit. They are the primary way new content enters the distribution system.
Replies are scored on both the quality of the reply and the reputation of the person being replied to. A high-quality reply to a large account can generate massive distribution even if the replier has a small following.
The algorithm itself does not directly optimize for monetization, but creator behavior around monetization affects distribution.
Below is a detailed, file-by-file exploration of the most important parts of the open-source X recommendation algorithm. Each section includes the actual code structure and what it means for creators.
val productPipeline = ForYouProductPipelineConfig() val scoredTweets = ScoredTweetsMixerPipelineConfig() val candidates = Seq( inNetworkCandidatePipeline, // Earlybird tweetMixerCandidatePipeline, // Cr-Mixer utegCandidatePipeline, frsCandidatePipeline )
This is where the system decides which candidate sources to pull from. For You is built by mixing multiple sources rather than just showing posts from accounts you follow.
def scoreCandidate(tweet: Tweet, viewer: User): Double = {
val velocity = computeEngagementVelocity(tweet)
val reputation = getTweepcred(tweet.author)
val simcluster = computeCommunitySimilarity(viewer, tweet)
val graph = getGraphFeatures(viewer, tweet.author)
0.35 * velocity + 0.25 * reputation + 0.20 * simcluster + 0.15 * graph
}This structure shows why engagement velocity and author reputation dominate. Small improvements in either produce outsized distribution gains.
if (isNSFW(tweet) || isAbusive(tweet) || isSpam(tweet)) {
return Filtered
}Hard filters are applied after ranking. Even a high-scoring post can be removed if it triggers trust & safety signals.
SimClusters is one of the most important and least understood parts. It assigns users and tweets to sparse communities. A post that performs well inside multiple communities receives an extra boost because it demonstrates broader relevance.
val candidates = uteg.traverse(userId, maxDepth = 2, minEdgeWeight = 0.3)
This graph traversal finds posts that people you follow have engaged with. It is one of the strongest sources of high-quality out-of-network content.
Based on direct analysis of twitter/the-algorithm (2023 open source release).
xrabbit.io — Built for creators who want to understand the system.