Home/Twitter/X B2B
Twitter/X B2B

X Algorithm GitHub: What the Code Actually Tells You

The black box is open. Most people still haven't read it. Here's what matters.

X Algorithm Score Calculator
Which post actually wins the algorithm?
Enter the engagements for two posts. See the real algorithmic score - based on the actual weights from the open-source code.
Compare two posts
Post A
Post B
Post A Score
0
Post B Score
0
Score breakdown - Post A vs Post B
Author replies back
-
Replies (no resp.)
-
Bookmarks
-
Reposts
-
Likes
-

Why the X Algorithm GitHub Release Is a Big Deal

For years, growing on X (Twitter) was a guessing game. You'd post, watch the numbers, form theories, and adjust. Nobody actually knew how the ranking worked. Then X did something almost no major social platform has ever done - they published the source code.

The original open-source push happened at github.com/twitter/the-algorithm. It was partial, curated, and eventually stopped getting updates. Then xAI went further - releasing the complete Grok-powered replacement at github.com/xai-org/x-algorithm with a commitment to public updates every four weeks. The most significant update to the repository landed in May, adding 187 files and over 18,000 lines of new code. The black box is now open. Most creators still haven't read it.

I'm not a machine learning engineer, but I run multiple businesses that depend on B2B distribution - and X is one of the channels I use to generate inbound leads and build audiences for cold outbound follow-up. So I spent time going through what the code actually says. What follows are the parts that matter for anyone trying to grow on X for business purposes.

One thing worth flagging upfront: the exact production weights are not fully published. xAI has released the architecture and a smaller mini Phoenix checkpoint, but the 2023 weights from the original release are widely treated as directionally accurate for the current system. The structural logic - how the algorithm values different signals relative to each other - is what you can actually act on. Keep that context in mind throughout.

The Two Repositories Worth Knowing

Before getting into the signals, let's establish what we're actually working with, because there are two distinct codebases and they're not the same thing.

The architectural difference matters. The legacy system still relied on manually coded rules. The new Phoenix-based system is a fully learned model - it adapts based on real user behavior rather than engineer-defined heuristics. That's a meaningful shift for anyone trying to understand what actually drives distribution today.

How the Algorithm Actually Works: The Pipeline

The X recommendation system is a multi-stage funnel. Every time someone opens their For You feed, here's roughly what happens:

The out-of-network sourcing is what makes this interesting for B2B growth. The algorithm can surface your content to people who've never heard of you, as long as your existing audience's engagement signals are strong enough to justify expanding reach into adjacent clusters.

Free Download: Best Lead Strategy Guide

Drop your email and get instant access.

By entering your email you agree to receive daily emails from Alex Berman and can unsubscribe at any time.

You're in! Here's your download:

Access Now →

The Engagement Weights From the Code

This is where it gets specific. The open-source code reveals that not all engagement is equal - the algorithm assigns different numerical weights to different actions. Based on analysis of the ranking model and the weights documented in the original 2023 release (which are widely cited as directionally accurate for the current system):

SignalWeightRelative to a Like
Reply that the author replies back to+75150x more valuable
Reply (no author response)+13.527x more valuable
Profile click with engagement+1224x more valuable
Conversation click with engagement+1122x more valuable
Bookmark+1010x more valuable (some sources cite 5x)
Repost (Retweet)+1.02x more valuable
Like+0.5Baseline
Block-3.06x more negative than a like is positive

The practical implication 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 author-replies-back signal four times. That single dynamic should reframe how you think about content strategy on X entirely.

The block penalty matters a lot too. The algorithm heavily penalizes content that makes people want to block or mute you. X is optimizing for long-term user retention, not cheap short-term clicks. Rage-bait gets people blocked, and the algorithm treats that as a strong negative signal for your account.

The practical implication: if you're posting on X for B2B lead generation, you want content that starts genuine conversations. Questions, strong opinions, counterintuitive takes, and practical tips all perform better than broadcast-style promotional content - not because it "sounds nice," but because the code literally weights replies higher than anything else.

Bookmarks: The Most Underrated Signal in the Stack

Most people tracking their X performance focus on likes and impressions. They're optimizing for the two signals the algorithm cares least about. Bookmarks are worth roughly 10x more than a like in the ranking model - and the reason matters.

Bookmarks are a private action. When someone bookmarks your post, they're telling the algorithm they want to come back to it - without any social performance involved. There's no public pressure to bookmark something. It's a clean signal of genuine perceived value.

The content formats that generate bookmarks are specific: reference material, data breakdowns, numbered frameworks, actionable checklists, and posts that teach something worth saving. Contrast that with content that generates likes - emotional resonance, humor, relatability. Likes are cheap. Bookmarks mean someone thought your post was worth returning to.

For B2B specifically, this is a real advantage. If you're posting specific, tactical content about your industry - things your target audience actually wants to save and apply - you're generating the highest-value engagement signal in the system. Build a content mix with some percentage dedicated purely to bookmark-worthy reference material.

Dwell Time: The Invisible Ranking Driver

Dwell time - how long someone stops scrolling to read your post - carries a weight of +10 in the ranking system. That's the same weight as a bookmark. If people scroll past your post in one second, the algorithm treats it as low quality regardless of how many followers you have.

Dwell time on long-form content exceeding two minutes is an even stronger positive signal. This is one reason X Premium accounts have an advantage - they can post up to 25,000 characters, enabling long-form content that drives extended dwell time. But even at standard post lengths, you can engineer dwell time with structure: use line breaks to create visual pacing, open with a hook that forces the reader to slow down, and build posts that can't be consumed in a single glance.

The first line of your post appears in the preview before users click to expand. That line determines whether they stop or scroll. Curiosity gaps, surprising statistics, and bold claims increase the expand rate - and expanded posts generate more engagement across every signal type.

Need Targeted Leads?

Search unlimited B2B contacts by title, industry, location, and company size. Export to CSV instantly. $149/month, free to try.

Try the Lead Database →

Time Decay Is Brutal for Late Posters

The algorithm applies a steep time decay function. A post loses approximately half its potential visibility score every six hours. After 24 hours, even a high-performing post gets minimal algorithmic push - unless someone with a large following engages with it and briefly re-amplifies it.

This means when you post matters almost as much as what you post. Early engagement in the first 30 to 60 minutes is the single biggest distribution lever in the entire system. The algorithm evaluates posts most aggressively in that first window - a post that gets 20 replies in the first 30 minutes will dramatically outperform one that gets 50 replies spread over 24 hours. If your first hour is quiet, the algorithm largely writes off that post.

For B2B creators, this changes the strategy. You need to either post when your specific audience is active (check your analytics), or engineer early engagement by responding to every reply fast in that first window. Your own replies to commenters count as engagement signals too - and if they reply back to your reply, you've just triggered the highest-value signal in the entire scoring model.

TweepCred: Your Account's Underlying Reputation Score

Every X account carries a reputation score calculated using a weighted PageRank approach. Factors include account age, follower-to-following ratio, engagement quality, and interaction patterns with high-quality users. Based on the legacy codebase (which documented this system explicitly), there's a critical threshold - accounts below a certain score have only a small number of their posts even considered for distribution, while accounts above it have all posts eligible. Premium subscribers get a boost to this score as well.

This explains something I've seen firsthand: two accounts posting identical content can get radically different reach. The one with a better reputation score starts every post with more baseline distribution.

The takeaway for B2B accounts: your follow-to-following ratio matters. Don't mass-follow hoping for follow-backs and then ignore your feed. Interact with high-quality accounts in your niche consistently. The algorithm tracks who you engage with and what those people's own scores are. Interactions from low-quality accounts can actually reduce your own reputation score - so be selective about where your engagement goes.

This one surprises people. The open-source algorithm confirms that posts containing links to external sites - including news articles, YouTube videos, other social platforms, and yes, your own blog - are penalized in reach. Based on publicly documented observations, non-Premium accounts posting links can see near-zero distribution in some cases, with Premium providing some mitigation. The platform wants users to stay on X.

If you're a B2B marketer dropping links in every post, you're actively suppressing your own distribution. The standard workaround: post the content natively, then drop the link in the first comment. Put your link in a reply instead of the original post - this avoids the external link suppression penalty while still giving your audience access to the resource.

I use X primarily for top-of-funnel awareness and getting people to follow me so they see future content. The actual lead generation happens through cold email and direct outreach - where I control the channel. X is an awareness play, not a direct traffic play. The algorithm design basically forces you into that mindset anyway.

Free Download: Best Lead Strategy Guide

Drop your email and get instant access.

By entering your email you agree to receive daily emails from Alex Berman and can unsubscribe at any time.

You're in! Here's your download:

Access Now →

The Phoenix Model and Cluster Affinity

The Grok-powered Phoenix component is what drives out-of-network distribution. It operates in two stages: first, it efficiently narrows down millions of candidates to hundreds using approximate nearest neighbor search - essentially finding posts whose embeddings are mathematically similar to what you've engaged with. Then it scores and orders those candidates using a more expressive transformer model.

Phoenix analyzes your recent engagement history and builds a real-time model of your current interests. It then routes your content to users whose recent behavior matches the topic signals in your posts. The X algorithm uses community detection and SimClusters - approximately 145,000 topic clusters - to map users. If your content consistently gets engagement from users in the same clusters, the algorithm extends your reach to the rest of those clusters.

This is why niche authority compounds faster than trying to be broadly appealing. Pick a lane, post consistently in it, and the algorithm builds a stronger cluster association for your account over time. For B2B: if you're targeting agency owners or SaaS founders, you want your replies and engagement coming from those people specifically. One strong reply from a 50,000-follower SaaS founder in your niche does more for your distribution than 50 likes from random accounts. Be strategic about whose content you engage with.

The Grox Content Understanding System

The most recent major update to the repository introduced a new component that most coverage has underplayed: Grox. This is a content-understanding pipeline that runs classifiers, embedders, and a task-execution engine for spam detection, post-category classification, and policy enforcement.

Here's what that means practically: while Phoenix decides relevance, Grox decides admissibility. Every post passes through Grox before entering the final ranking - if it's classified as spam or violates a policy, it's removed or demoted in the final score. The system now explicitly filters low-quality and policy-risky posts earlier in the pipeline, before they even get scored for engagement.

The implication for creators: gaming individual engagement weights matters less with every release. What compounds is coherent, genuinely interesting content the model can understand, and clean brand-safety signals. If your content is consistently triggering spam classifiers or policy flags - even in minor ways - Grox is demoting it before Phoenix ever gets to score it. This is why posting cadence, content quality, and avoiding engagement-bait patterns have become more important over time, not less.

A specific note on hashtags: based on analysis of the Grox classifier behavior, using more than one or two niche-relevant hashtags triggers spam detection and reduces reach. The Grok-powered algorithm reads your post content directly - it doesn't need hashtags to understand what your post is about. Excessive hashtag use reads as spam behavior in the model. Stop loading posts with hashtags thinking it helps discoverability. It doesn't, and it may actively hurt distribution.

X Premium and the Algorithmic Boost

The open-source code confirms that X Premium verification acts as a positive signal in content ranking. Premium subscribers receive a measurable boost in the For You feed. Premium replies rank higher in conversation threads, and Premium posts receive a scoring bonus in the algorithmic feed.

That said, Premium amplifies your existing engagement signals - it doesn't replace them. A Premium account posting low-quality content will still underperform a free account posting content that drives genuine engagement. For brands and creators who are serious about X as a distribution channel, the boost is real. But it's a multiplier on good content, not a substitute for it.

Same goes for follower buying. The algorithm now analyzes follower-to-view ratios. An account with inflated followers but low views gets flagged, and suspected follower buying triggers a significant reach reduction. Recovery takes months of clean organic engagement. Not worth it.

Need Targeted Leads?

Search unlimited B2B contacts by title, industry, location, and company size. Export to CSV instantly. $149/month, free to try.

Try the Lead Database →

Video Gets a Real Boost - But Text Is Still King on X

Video posts receive a standalone algorithmic boost, and video completion rate is a ranking factor - videos watched past the 50% mark get an additional signal. For B2B: short-form talking head videos explaining one specific insight work well. No production budget required. The algorithm cares about completion rate, so front-load your hook and keep it tight.

Here's the counterintuitive finding though: unlike TikTok, Instagram, or YouTube, X is fundamentally a text-first platform. 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. And conversation - specifically reply chains with author responses - is the highest-weighted signal in the system.

The practical takeaway: don't abandon text in favor of video just because every other platform rewards video. Run a mix. Text for conversation-starting posts, video for demonstrating expertise, and images when visual context genuinely adds something. The algorithm responds to each differently, and the right format depends on what action you're trying to drive.

What Changed Between the Old and New Algorithm

This comparison matters because a lot of the "X algorithm" advice circulating online is still based on the original codebase. Here's what's structurally different in the current system:

The core ranking logic - prioritizing replies, penalizing negative signals, applying time decay - appears consistent across both releases. But the mechanisms have gotten significantly more sophisticated. You can no longer optimize for one or two surface-level signals and expect results. The model is reading your content semantically and evaluating it holistically against everything in your engagement history.

Common Myths the Code Actually Disproves

A few things people confidently state about the X algorithm that the open-source code contradicts:

"All engagement is equal." It isn't, by a factor of 150. A reply chain with the author is worth approximately 150 times more than a like. Retweets are worth roughly 20x likes. Bookmarks are 10x. If you're optimizing for likes, you're optimizing for the lowest-value signal in the model.

"Posting frequently is what matters most." Frequency without engagement quality actively hurts you. If your posts consistently generate low engagement rates, the algorithm treats future posts as low quality from the jump. Three high-engagement posts per week will outperform daily low-engagement posts every time.

"Only your followers see your tweets." Approximately half of For You feed candidates come from out-of-network sources. The algorithm actively surfaces posts to non-followers based on topic clusters and interest matching. This is the mechanism that makes niche authority compound - your best posts can reach thousands of people who've never heard of you, as long as your existing cluster signals are strong enough.

"You can game the algorithm with engagement pods." The algorithm detects and penalizes artificial engagement patterns. Interactions from low-quality accounts actually reduce your own reputation score. Engagement pods that coordinate likes and replies among low-quality accounts are counterproductive - they generate cheap positive signals while degrading the underlying account health metric that determines baseline distribution.

"Hashtags improve discoverability." The current algorithm reads your post content semantically. It doesn't need hashtags to categorize your post. More than a couple of hashtags triggers spam classifiers. They add noise and can hurt you.

Free Download: Best Lead Strategy Guide

Drop your email and get instant access.

By entering your email you agree to receive daily emails from Alex Berman and can unsubscribe at any time.

You're in! Here's your download:

Access Now →

X Communities and Spaces: Two Under-Used Distribution Surfaces

The algorithm surfaces content through more than just the main For You feed. Two features worth understanding for B2B distribution:

X Communities are topic-based groups. Community posts surface in the For You feed based on topic interest signals, and concentrated engagement within a community can help establish your cluster association with that topic. For B2B, if there's an active community around your niche - SaaS growth, agency operations, cold email, whatever your area is - posting there consistently builds topic authority signals faster than posting in the main feed alone.

X Spaces are live audio discussions that appear in the For You feed. The algorithm surfaces Spaces from accounts you follow or topics you engage with. Real-time content about Spaces updates gets strong algorithmic treatment. For B2B relationship building, running or co-hosting a Spaces on a topic your prospects care about is an under-used move. It builds authority, generates follow signals, and the live format produces the kind of genuine interaction the algorithm is optimizing for.

How to Use This for B2B Lead Generation

Understanding the algorithm is one thing. Building a repeatable lead generation system is another. X awareness content is a top-of-funnel move. The real money comes from getting prospects off the platform and into a conversation - either through cold email follow-up or a direct offer.

Here's how I think about the full funnel:

X is where I post specific, opinionated content about cold email, agency growth, and B2B sales. The goal is to build cluster authority so the algorithm keeps expanding my reach into adjacent pools of agency owners, SaaS founders, and B2B sales professionals. Every piece of content is engineered for one thing: starting a conversation in the replies. Not broadcasting. Not posting links. Conversations.

When someone engages consistently with my content, that's a warm signal. But I'm not relying on X to convert them. The actual lead generation happens through cold email - where I control the channel, I control the timing, and I'm not penalized for including a link. X warms the lead. Email converts it.

When I'm building prospecting lists for outbound campaigns, I'm not relying on X follower data alone. I use a full B2B lead database to identify and verify contacts by title, company size, and industry. ScraperCity's B2B email database lets you filter prospects by job title, seniority, industry, and company size so you're reaching the right people with your outbound, not just blasting cold lists.

And if you want to find emails for specific individuals who engage with your X content, this email finding tool can bridge the gap between a social follower and a prospect in your CRM. Someone replies to your X post thoughtfully, you find their work email, you follow up with a personalized cold email that references the conversation - that's a warm outbound sequence that closes at a significantly higher rate than cold-from-scratch outreach.

Once you have contact data, you need a sequencing tool that handles delivery properly. Smartlead and Instantly are both solid options for managing multi-step cold email sequences at scale. For the X content scheduling side of the equation, Taplio helps you schedule and analyze X posts specifically, so you can identify which content formats and topics drive the most engagement velocity in your niche.

The Grox Safety Filter and What It Means for Your Content

Most X growth content ignores this, but it's increasingly important: Grox isn't just filtering obvious spam. It runs classifiers for spam, unsafe content, internal policy violations, and topical categorization. Every post passes through Grox before entering the final ranking stage.

What triggers Grox demotions in practice:

The last one is subtle but important. If your posts consistently generate under 1% engagement relative to impressions, the algorithm starts treating future posts as low quality by default. This is a feedback loop: bad posts generate weak engagement, weak engagement trains the model to assume your future posts are low quality, which reduces distribution, which reduces your ability to generate engagement. The only way out is sustained high-quality content that generates strong engagement signals over time.

This is also why buying followers is so destructive. Inflated follower counts with low engagement rates trigger exactly this dynamic - the model sees a large audience generating almost no engagement and interprets that as poor content quality, suppressing distribution even further.

Need Targeted Leads?

Search unlimited B2B contacts by title, industry, location, and company size. Export to CSV instantly. $149/month, free to try.

Try the Lead Database →

The Complete Engagement Scoring Formula

For reference, here is the simplified scoring formula widely cited from the original open-source code and treated as directionally accurate for the current system:

Post Score = (Likes × 0.5) + (Retweets × 20) + (Replies × 13.5) + (Profile Clicks with engagement × 12) + (Conversation clicks with engagement × 11) + (Bookmarks × 10) + (Author replies back to replies × 75)

Run the math on that for a second. A post that gets 10 genuine replies where you respond to each one is generating (10 × 13.5) + (10 × 75) = 135 + 750 = 885 points. A post that gets 200 likes generates 200 × 0.5 = 100 points. The reply-driven post beats the like-driven post by nearly 9x. This isn't theoretical - it's in the code.

The practical playbook follows directly from this math. Every content and engagement decision should be evaluated against this formula. Does this post format invite replies? Am I responding to comments in the first hour? Is this the kind of content someone bookmarks and shares, or just passively likes and scrolls past?

The Practical Playbook

Based on what the code actually says, here's the operating framework I'd use for B2B growth on X:

X for B2B is a long game. You're building an audience that warms to your ideas over time, so when you do make an offer or reach out cold, there's context. The algorithm - now that we can actually read it - rewards exactly the kind of content that builds that trust: specific, opinionated, conversation-starting posts with no fluff.

What the Repository Doesn't Tell You

Worth being honest about the limits here. The code is inspectable but the training dataset is not. The mini Phoenix model shipped in the repository is trained on a subset of user interactions that xAI does not distribute. The production Phoenix model is larger - xAI hasn't specified how much - and is trained continuously on real-time data. What's in the repository is a frozen checkpoint, not the live system.

This means every specific weight cited in this article - and everywhere else - comes from either the original 2023 release or reverse engineering. The signs and order of the signals are reliable. The precise ratios carry more uncertainty. The structural logic (replies beat likes, conversations beat broadcasts, negative signals compound destructively) is what you can confidently act on.

Independent verification of whether what runs in production on X matches what's on GitHub remains impossible without access to the servers. What the open-source release gives you is the best public window into how the system actually works - which is still more than any other major social platform has provided.

Free Download: Best Lead Strategy Guide

Drop your email and get instant access.

By entering your email you agree to receive daily emails from Alex Berman and can unsubscribe at any time.

You're in! Here's your download:

Access Now →

Tying X into a Broader Outbound System

The content strategy side of X is one piece. The other piece is building the outbound infrastructure to actually convert the awareness you're generating.

Here's how that system looks in practice: X builds awareness and warms leads into your cluster. People start recognizing your name and associating it with a specific topic. Cold email converts those leads into actual conversations and sales meetings. The two channels aren't competing - they're complementary. X makes your cold email warmer because there's prior context. Cold email makes your X growth meaningful because you have a conversion mechanism.

For building the prospect list on the outbound side, you need contact data that's filtered, verified, and matched to your ICP. A B2B lead database that lets you filter by job title, industry, company size, and seniority is the foundation. You're not guessing - you know exactly who you're reaching out to and why they're relevant.

If your targets are in a specific vertical - ecommerce brands, local businesses, real estate - there are more targeted data sources worth knowing. For ecommerce prospecting, a store leads scraper can pull verified ecommerce data. For local business outreach, a Google Maps scraper gives you local business data at scale. Match your prospecting tool to your niche instead of relying on one generic database for everything.

For the content side of the equation, tools like Taplio help you schedule and analyze X posts specifically, so you can identify which content formats and topics drive the most engagement velocity in your niche. Pair that with a solid CRM like Close to track where prospects are in your pipeline as they move from X engagement to email conversation to booked call.

If you want to tie your X content strategy into a broader outbound system - where social warms leads that email then converts - that's exactly what I cover inside Galadon Gold.

Where to Find the Code Yourself

The two repositories worth bookmarking:

If you're not a developer, you don't need to run the code - you can't without X's internal infrastructure anyway. Treat it as documentation. The README, the scoring weights, and the candidate pipeline architecture are readable without deep ML knowledge, and they'll tell you more about how X actually works than any "algorithm hack" thread you've ever seen.

The repository is written primarily in Rust and Python, under Apache 2.0 license. That means anyone can fork it, modify it, and use it for their own purposes - an unusual level of transparency for an asset of this scale, and one no other major social platform has matched.

Most people posting on X are still operating on guesses. The code is public. Read it - or at minimum, apply what it says. That alone puts you ahead of most of the accounts you're competing with for the same eyeballs.

For more on building a content and outreach system that compounds over time, check out the Purpose Framework - it's how I think about long-term positioning across every channel, X included. And if you want a structured approach to the content strategy side of this, I lay out the full framework in my Daily Ideas Newsletter - worth bookmarking if you're posting on X consistently.

Ready to Book More Meetings?

Get the exact scripts, templates, and frameworks Alex uses across all his companies.

By entering your email you agree to receive daily emails from Alex Berman and can unsubscribe at any time.

You're in! Here's your download:

Access Now →