X Algorithm Open Source Deep Dive 2026: Code Analysis + Shadowban Detection + 6 Optimization Strategies
On August 13, 2026, X (formerly Twitter) significantly expanded its open-source codebase once again, exposing the complete logic of the shadowban mechanism. This marks another major update following the initial open-source release in September 2025 and Elon Muskβs announcement of a new algorithm in January 2026.
In-depth Chinese analysis articles are virtually nonexistentβthis is an excellent opportunity to capture blue-ocean traffic.
I. News Background: X Open-Source Timeline Review
1.1 Key Events Timeline
Xβs open-source journey dates back to 2023, but the real turning points occurred in 2025-2026:
| Date | Event | Significance |
|---|---|---|
| March 2023 | Twitter first open-sourced recommendation algorithm | Partial code released, excluding training data and safety pipeline |
| September 2025 | xAI released Grok-powered replacement | Introduced transformer model, replacing the old 48M parameter MaskNet |
| January 2026 | Musk announced comprehensive algorithm open-sourcing | Committed to public updates every 4 weeks |
| May 15, 2026 | Largest code update | 187 file changes, 18,000+ lines of new code |
| August 13, 2026 | Expanded open-source + shadowban transparency tools | Codebase expanded 10-15x, filtering logic exposed for the first time |
1.2 Core Content of August 13 Update
According to TechCrunch reporting, X VP of Product Keith Coleman revealed:
βYouβll get the core ranking code that pulls posts and ranks them for any given user and assembles the feed. You can see the systems that filter out potentially problematic, rule-violating contentβ¦ And some of those systems, like the ranker and the score, you can even run yourself outside the company.β
Key changes in this update:
- GitHub Repository: github.com/xai-org/x-algorithm (Apache v2 license)
- Code Scale: Expanded 10-15x compared to previous versions
- New Content: Model configuration, filters, core ranking system details, signal weight parameters
- Transparency Tools: Users can view whether their accounts have been impacted by ranking systems
1.3 Why This Open-Source Release Is Different
The 2023 initial release (twitter/the-algorithm) was a βcurated partial dumpββit showed the architecture but omitted training data, model weights, safety pipeline, and approximately 80% of production code.
The 2026 version (xai-org/x-algorithm) is structurally different:
- Includes complete Phoenix scoring system architecture
- Exposes Grok-driven content understanding pipeline
- Provides runnable βmini Phoenixβ checkpoints
- First-time exposure of shadowban and filtering logic
X VP of Product Coleman stated: βOur dream is that anyone in the public can be able to assess how posts are distributed on the platform, vet that itβs a level playing field, and, if they think itβs not, critique it so we can keep improving it and addressing it.β
II. Algorithm Architecture Analysis: How the For You Recommendation System Works
2.1 Overall Architecture Overview
Xβs For You recommendation system is a multi-stage pipeline that completes each feed refresh within 1.5 seconds. It narrows approximately 500 million daily posts down to about 1,500 candidates per user, then ranks them.
Four core components:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Home Mixer (Orchestrator) β
β Handles query hydration, coordinates candidate sources, β
β enforces post-selection rules, assembles final feed β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Thunder (In-Memory Post Store) β
β Enables sub-millisecond lookups, consumes Kafka live stream β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Phoenix (Grok-Powered Ranker) β
β Two-tower transformer model, computes dot product β
β similarity between user and post embeddings β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Candidate Pipeline β
β Pulls posts from social graph, interest clusters, β
β semantic similarity, and other sources β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2.2 Candidate Generation
The candidate generation stage pulls posts from multiple sources:
- Social Graph: Posts from people you follow
- SimClusters Community Detection: 145,000 overlapping interest clusters
- Semantic Similarity: Content embedding-based matching
- Topic Interest Clusters: Inferred from your interaction history
Key limitations:
- Author Diversity Cap: Each feed window allows approximately 3 posts maximum from the same author
- Out-of-Network Content Limit: About 50% of the For You feed comes from accounts you donβt follow, but these posts must have a βsecond-degree connectionββsomeone you follow must have liked, replied to, or retweeted the post
2.3 Ranking Model: Phoenix
Phoenix is the core ranker for 2026, replacing the old MaskNet model. Itβs a Grok-based transformer model:
Architecture Features:
- Two-Tower Model: Simultaneously generates user and post embeddings
- Dot Product Similarity: Calculates similarity between the two via dot product
- Key Design Decision: During ranking inference, candidate posts cannot attend to each otherβeach postβs score is computed entirely from user context
This means: A postβs rank doesnβt change depending on what other posts are being considered alongside itβscores are consistent and cacheable.
Phoenix predicts 19 different engagement actions, each receiving a probability score. These probabilities are multiplied by weights and summed to produce the final engagement score.
2.4 Final Filtering
After ranking, thereβs a series of pre-ranking filters. Posts must pass these filters to be scored:
- Author Diversity Filter: Same authorβs posts appear max ~3 times per feed window
- Negative Feedback Filter: If users blocked, muted, or selected βshow lessβ in the past 30 days, all content from that account is down-weighted
- Sole-Link Post Filter: Posts primarily containing external links lacking original text are throttled
- Out-of-Network Cap: Number of posts from non-followed accounts is capped per feed window
III. Core Ranking Signals: Analysis Based on Open-Source Code
3.1 Engagement Weights: Reply > Retweet > Like
The open-source code reveals the precise weights of different interaction types. The following data comes from the weights first disclosed in 2023 (Phoenix 2026 uses learned weights rather than hand-tuned ones, but the direction is consistent):
| Interaction Type | Relative Weight (vs. Like) | Description |
|---|---|---|
| Author Reply | ~150x | You replying to someoneβs reply on your postβthe strongest signal |
| Reply | ~27x | Regular reply |
| Retweet | ~20x | Repost |
| Profile Click | ~12x | Clicking authorβs avatar |
| Link Click | ~11x | Clicking links in post |
| Bookmark | ~10x | Saving the post |
| Like | 1x | Baseline value |
Key Insight: A post with 100 likes has a lower algorithmic score than a post with 4 repliesβif you reply to all 4 replies, triggering the +75 βauthor-replies-backβ signal 4 times.
Most Counterintuitive Finding: A single two-way reply chain (you replying to someoneβs reply on your post) is worth approximately 150 likes in the algorithmβs scoring model.
3.2 Network Effects: How Social Graph Influences Recommendations
TweepCred Reputation System:
The code defines a reputation system called TweepCredβa weighted PageRank score ranging from 0 to 100, recalculated daily from the user interaction graph.
Critical Threshold: Accounts with a TweepCred score below 65 have only 3 tweets considered for distribution per cycle. Below this threshold, the algorithm effectively stops showing your posts to people who donβt already follow you.
TweepCred is influenced by:
- Account age
- Follower/following ratio
- Whether you engage with high-credibility accounts
- Device usage patterns
- Overall engagement quality history
SimClusters Community Detection:
About 50% of the For You feed comes from accounts you donβt follow. The algorithm uses the SimClusters system to identify 145,000 overlapping interest clusters.
But before SimClusters runs, thereβs a filter: out-of-network posts must have a second-degree connectionβsomeone you follow must have liked, replied to, or retweeted the post, or must follow the author. Without this social proof, posts donβt enter consideration for the out-of-network half of the feed.
3.3 Content Quality Signals
Time Decay:
The code shows time decay is aggressive:
- Posts lose approximately half their visibility score every 6 hours
- After 24 hours, the algorithmic push is effectively zero
But within the first 30 minutes, the dynamics are completely different:
- A post accumulating 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
Dwell Time:
Threads generate the highest dwell time of any format. A reader working 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.
Content Format Weights:
| Format | Weight Multiplier | Description |
|---|---|---|
| Thread | Highest dwell time | 3-5 tweet threads achieve 40-60% more impressions than standalone posts |
| Native Video | Watch-time signals | Optimal length < 2:20, vertical 9:16 outperforms horizontal |
| Image | 2x | Confirmed in 2023 code, appears to persist in 2026 architecture |
| Plain Text | Highest reply rate | Most replies per impression |
| External Link | Negative signal | Non-Premium accounts posting links see median engagement drop to zero |
3.4 Grok AIβs Role in Content Moderation and Recommendation
The May 15, 2026 update introduced Groxβthe content understanding pipeline:
- Spam Detection: Classifies posts before they reach Phoenix
- Post Category Classification: The algorithm now classifies your post content, not just engagement patterns
- Safety Enforcement: Includes ASR (speech recognition) processing for video content
- Sentiment Scoring: Constructive, positive messaging gets wider reach; negative, combative framing gets reduced reach even when raw engagement is high
Key Change: Grok can now βreadβ every post and βwatchβ every videoβ100M+ pieces of content dailyβmatching users with content theyβre most likely to find interesting.
3.5 Ad Posts vs. Natural Posts Mixing Strategy
While the open-source code primarily focuses on natural recommendations, X Premium accounts enjoy the following advantages:
- Higher out-of-network post caps
- Premium replies are surfaced higher in reply threads
- Fewer restrictions on link posts (non-Premium accounts posting links see median engagement drop to zero)
IV. Shadowban Mechanism Revealed
4.1 What Is Shadowban
Shadowban refers to your posts being demoted in visibility or made undiscoverable without explicit notification. You can still post, but your content wonβt appear in:
- Search results
- For You feed
- Reply threads
- Hashtag browsing
4.2 Shadowban Logic in Open-Source Code
The August 13 update exposed the filtering logic for the first time. Based on code analysis, shadowban is primarily implemented through the following mechanisms:
1. TweepCred Threshold Filtering
# Pseudo-code illustration
if user.tweepcred < 65:
candidates_per_cycle = 3 # Only 3 posts considered
else:
candidates_per_cycle = normal_limit
2. Negative Feedback Decay
If an account receivesε€§ι blocks, mutes, or βshow lessβ actions in the past 30 days, all content published by that account is down-weightedβnot just the post that triggered the negative feedback.
3. Grox Content Classification
Posts flagged by Grox as spam or βoff-categoryβ are down-weighted before reaching Phoenix.
4. Link Post Penalty
The 2023 system applied a 20-30% reach reduction. By 2025 this grew to 30-50%. In March 2026, non-Premium accounts posting links saw median engagement drop to zero.
4.3 How to Detect If Youβre Being Throttled
Method 1: Official Transparency Tool (New)
X launched the βUnder the Hoodβ transparency tool in the August 13 update:
- Located in the app settings βUnder the Hoodβ page
- Users who posted 10+ times in the past month can download aggregate statistics (JSON file)
- File shows whether any labels were applied to your account or posts in the past calendar month
Method 2: Third-Party Detection Tools
Multiple free tools can detect shadowban status:
Method 3: Manual Incognito Search Test
- Log out or open a private browser window
- Search for
from:@yourusername - If your posts donβt appear, you may be throttled
4.4 Common Reasons for Being Throttled
Based on open-source code analysis, common behaviors that trigger shadowban:
-
Low TweepCred Score (< 65)
- New accounts following too many people (e.g., following 5,000)
- Imbalanced follower/following ratio
- Interacting with low-credibility accounts
-
Massive Negative Feedback
- Being blocked or muted by multiple people
- Posts receivingε€§ι βshow lessβ actions
-
Publishing Pure Link Posts
- Link posts lacking original text are flagged as βlow-effort distributionβ
-
Violating Content Policies
- Being classified as spam by Grox
- Negative/combatative sentiment scoring
-
Excessive Posting
- Posting 10+ times per hour, most posts filtered at candidate generation
V. Practical Optimization Strategies: 6 Actionable Recommendations
Strategy 1: Posting Time Optimization (Based on Algorithm Preferences)
Core Principle: The first 30 minutes determine everything.
Specific Actions:
- Post when your most engaged followers are online
- Ensure you get at least 10 replies in the first 15 minutes
- Stay online for 20-30 minutes after posting, actively replying to comments
Why It Works:
- Posts lose half their visibility every 6 hours
- High engagement velocity in the first 15 minutes triggers βviral amplification cascadeβ
- The algorithm infers high engagement velocity and begins distributing to out-of-network users
Strategy 2: Engagement Guidance Strategy (Reply > Retweet > Like)
Core Principle: Optimize for reply velocity, not like volume.
Specific Actions:
- Post content that invites specific responses: opinionated takes, direct questions, contrarian data points, specific predictions
- Reply to every reply within 1 hour of postingβthis is the highest-leverage action available after posting
- Each βauthor replyβ is worth 150 likes in the scoring model
Why It Works:
- A post generating 8 replies (within 30 minutes) outperforms a post generating 200 likes (over two days)
- A two-way reply chain (you replying to someoneβs reply on your post) is worth approximately 150 likes
Strategy 3: Content Format Optimization (Image/Video/Poll Weights)
Core Principle: Leverage format weights to maximize signals.
Specific Actions:
- Threads: 3-5 tweet threads achieve 40-60% more impressions than standalone posts
- Native Video: Optimal length < 2:20, vertical 9:16 format
- Images: 2x weight multiplier (confirmed in 2023 code)
- Plain Text: Highest reply rateβwell-crafted text posts generate more conversation than most video content
- Avoid External Links: Place links in replies, not the main post
Why It Works:
- Threads generate the highest dwell time
- Native video creates watch-time signals
- External links generate negative signals (non-Premium accountsβ median engagement drops to zero)
Strategy 4: Hashtag Strategy
Core Principle: Less is more.
Specific Actions:
- Use 1-2 topic-relevant hashtags
- More than 2 hashtags triggers the Grox spam classifier, reducing reach by approximately 40%
Why It Works:
- Grox content understanding pipeline classifies post content
- Excessive hashtags are flagged as spam behavior
Strategy 5: Avoiding Shadowban-Triggering Behaviors
Core Principle: Keep TweepCred > 65.
Specific Actions:
- Strategic Following: Donβt inflate your following count, let the follower/following ratio normalize naturally
- Engage with High-Credibility Accounts: Boost your TweepCred score
- Maintain Consistent Posting Rhythm: TweepCred is influenced by long-term engagement quality
- Avoid Mass Negative Feedback: One or two posts receivingε€§ι negative feedback can sink your reach for weeks
- Add Original Text to Link Posts: Write 100-200 words of original commentary, otherwise the algorithm treats it as link spam
Why It Works:
- Accounts with TweepCred < 65 have only 3 posts considered per cycle
- Negative feedback affects all future posts, not just the post that triggered the feedback
Strategy 6: Leveraging Grok AI for Content Creation
Core Principle: Stay aligned with the algorithmβs content understanding.
Specific Actions:
- Maintain Topic Consistency: Grox classifies every postβs category, topic drift costs you recommendations
- Use Grok to Customize Feeds: Users can now instruct Grok to customize their For You feed with natural language (e.g., βmore startup content, less politicsβ)
- Optimize Content Embeddings: First line should directly address the topic, donβt use vague openers
- β βB2B SaaS pricing models are brokenβ
- β βI learned something interesting todayβ
Why It Works:
- Grox matches posts to user interests based on content embeddings
- If the first line is vague, the embedding wonβt strongly cluster with any interest topic
- Topic consistency gives you an advantage in βpromptable feedsβ
VI. Open-Source Code Navigation
6.1 GitHub Repository Structure
Main Repository: github.com/xai-org/x-algorithm
Main components:
- Home Mixer: Orchestrates the entire pipeline
- Thunder: In-memory post store, enables sub-millisecond lookups
- Phoenix: Grok-powered ranker (two-tower transformer)
- Candidate Pipeline: Composable framework, pulls posts from multiple sources
- Grox: Content understanding pipeline (spam detection, category classification, safety enforcement)
- TweepCred: Reputation scoring system
6.2 Key Code File Interpretation
Weight Files:
scored-tweets.thrift: Contains publicly disclosed engagement weights (2023 version)- Phoenix uses learned weights rather than hand-tuned ones, but 2023 weights are widely considered directionally accurate
Ranker:
- Phoenix ranker code shows the two-tower architecture
- Key design: Candidate posts cannot attend to each other, ensuring score consistency
Filters:
- Author diversity cap (~3/window)
- Negative feedback decay (30-day window)
- Link post throttling
- Out-of-network content cap
6.3 How to Run Algorithm Analysis Yourself
X provides βmini Phoenixβ checkpoints, allowing external researchers to train and run the Phoenix scoring system.
Steps:
- Clone the repository:
git clone https://github.com/xai-org/x-algorithm.git - Install dependencies (refer to README)
- Download mini Phoenix checkpoint
- Run the scoring system (note: you wonβt get exact per-post scores, but you can run the architecture)
Community Derivative Projects:
- x-algo-tweet-scorer: Tweet scoring tool based on open-source signals
- x-score-extension: Chrome extension analyzing timeline tweets based on algorithm weights
VII. Frequently Asked Questions (FAQ)
Q1: Is the X algorithm completely open-source?
A: Partially open-source. The 2026 version includes core ranking code, Phoenix scoring system architecture, filters, and signal weights. But not included: real-time spam classifier using Grok to predict whether posts violate rules, ad targeting system, some safety classifiers. This is to protect X from bad actors using this information to work around rules.
Q2: Are replies really 150x more important than likes?
A: Yes. According to the open-source code, an βauthor replyβ (you replying to someoneβs reply on your post) is worth approximately 150 likes in the scoring model. A regular reply is worth about 27 likes, a retweet about 20 likes. This means a post with 4 replies (if you reply to each one) has a higher algorithmic score than a post with 100 likes.
Q3: How do I detect if Iβm being shadowbanned?
A: Three methods: 1) Use Xβs new βUnder the Hoodβ transparency tool (launched August 13); 2) Use third-party detection tools like shadowban.yuzurisa.com; 3) Manual incognito search testβlog out and search for from:@yourusername, if posts donβt appear you may be throttled.
Q4: Are external links really penalized?
A: Yes. The 2023 system applied a 20-30% reach reduction, 2025 grew to 30-50%, and in March 2026 non-Premium accounts posting links saw median engagement drop to zero. Solution: Place links in replies, not the main post. Publish native content (opinions, insights, threads) in the main post, attach links in replies.
Q5: Is X Premium worth subscribing to?
A: From an algorithmic perspective, Premium accounts enjoy the following advantages: higher out-of-network post caps, replies are surfaced higher in reply threads, fewer restrictions on link posts. If youβre serious about building influence on X, Premium provides significant algorithmic advantages. But for regular users, free accounts can still achieve good exposure by optimizing engagement strategies.
VIII. Summary
The open-sourcing of Xβs recommendation algorithm provides us with an unprecedented window into how social media platforms decide content visibility. Core insights:
- Replies are the strongest signal: Optimize for reply velocity, not like volume
- The first 30 minutes determine everything: Stay online after posting, engage actively
- TweepCred is key: Keep score > 65, follow strategically
- External links are penalized: Place links in replies
- Content format matters: Thread > Video > Image > Plain Text > Link
- Consistency beats frequency: 3-5 high-quality posts per day outperform 15 rushed posts
The open-source code makes one thing clear: influence on X is a function of consistency, timing precision, and engagement qualityβapplied repeatedly over time. The accounts that win are not those with the cleverest single post, but those who show up at the right moment, start real conversations, and then come back tomorrow.
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.
I hope this blog post was helpful to you! If you have more questions about X algorithm optimization, feel free to discuss in the comments.
References:
- X For You Feed Algorithm - GitHub
- TechCrunch: X open sources its ranking algorithm
- OpenTweet: X Algorithm Open Source Analysis
- Publora: X Algorithm Weights Revealed
- Sprout Social: How Twitter Algorithm Works 2026