X algorithm open source: what the code shows
X open-sourced the For You feed on GitHub. Here is what is actually in the repo, the real ranking weights, what X held back, and what it means for your posts.
On this page · 10 sections
The short version
- ▸The code is real and public at github.com/xai-org/x-algorithm, Apache 2.0. It replaced the partial 2023 twitter/the-algorithm release with a working Rust and Python rebuild of the For You feed.
- ▸The single most readable file is home-mixer/params/param.rs. It holds the live default scoring weights: reply 5.0, quote 5.0, share 2.0, repost 1.0, like 0.5, dwell 0.05, and negatives like report at -234.0.
- ▸Those weights multiply predicted probabilities, not engagement counts. X added comments to the code in August 2026 specifically to kill the 'one report cancels 468 likes' reading, which is wrong.
- ▸A second system decides if your post can be shown at all. visibility-filtering/ plus the label systems in scarecrow/ and botmaker/ run before ranking ever matters.
- ▸X withheld a short list of files, mainly Grox prompts and some botmaker rules, and paired the release with Under the Hood, a pilot report of the visibility labels on your own account.
Quick answer
Yes, the X algorithm is open source. The code that assembles the For You feed lives at github.com/xai-org/x-algorithm under Apache 2.0. The file worth opening first is home-mixer/params/param.rs, which holds the live default scoring weights: a reply is 5.0, a quote is 5.0, a repost is 1.0, a like is 0.5, and a report is -234.0. Those numbers multiply predicted probabilities, not engagement counts, which is where almost every summary of the repo goes wrong.
Last updated: September 2026
TL;DR
X (formerly Twitter) published a partial, Scala-based snapshot of its recommendation code in 2023 as twitter/the-algorithm. That repo is stale. The current one is xai-org/x-algorithm, a ground-up rebuild in Rust and Python that went public in January 2026 and got two significant expansions on August 13 and 14, 2026. The August release is the one that matters, because it added the scoring parameters, the visibility filtering stack, and the training code for the ranking model.
Most articles about the repo were written in January or May and are describing a smaller codebase than the one on GitHub now. This page maps what is actually in there today, quotes the real numbers, and separates the parts that change how you post from the parts that are only interesting if you write recommender systems for a living.
A map of the repository
Feeds are assembled per request here, and the code is organized around the stages of that request. Here is the practical map.
| Folder | What it does |
|---|---|
home-mixer/ | Orchestrates the whole pipeline and holds the scoring parameters |
thunder/ | In-memory store of recent posts from accounts you follow (in-network) |
phoenix/ | The retrieval and ranking model, plus its training code |
simclusters/ | Clustering that surfaces out-of-network posts |
visibility-filtering/ | Decides whether a post is shown, dropped, or put behind an interstitial |
scarecrow/, botmaker/, botmaker-rules/ | The rule engine that applies safety labels to events |
agatha/, bdsm/, user-cred-v2/ | Models that score accounts for credibility and inauthentic behavior |
grox/, clip/, media-model-proxy/ | Classifiers for text, images, and video |
under-the-hood/ | Builds the per-account label transparency report |
Roughly, the request path runs: hydrate the viewer's context, pull candidates from Thunder and from Phoenix retrieval plus SimClusters, enrich them, apply pre-scoring filters, score with Phoenix, combine those scores in the RankingScorer, rerank for diversity, select the top set, apply visibility filters, then blend in ads and Who to Follow.
If you want the conceptual version of that pipeline without the code, we wrote it up separately in how the X algorithm works. This page is about the source.
The file that actually matters: param.rs
home-mixer/params/param.rs is 1,160 lines of tunable defaults, and X runs cron scripts that keep those defaults synced to production values. That makes it the closest thing to a published scorecard any major platform has ever shipped.
The positive weights, as of the August 2026 release:
| Action | Weight |
|---|---|
| Share via copy link | 20.0 |
| Reply | 5.0 |
| Quote | 5.0 |
| Share via DM | 5.0 |
| Follow the author | 4.0 |
| Share | 2.0 |
| Repost | 1.0 |
| Click | 0.4 |
| Open link | 0.2 |
| Video open | 0.07 |
| Like | 0.5 |
| Photo expand | 0.05 |
| Dwell | 0.05 |
And the negatives:
| Action | Weight |
|---|---|
| Report | -234.0 |
| Mute author | -58.8 |
| Not interested | -43.2 |
| Block author | -31.2 |
| Not dwelled | -0.02 |
There is also BidirectionalFollowReplyWeightBoost, currently 15.0, which amplifies the reply weight when the viewer and the author follow each other. That parameter has a documented history: docs/BIDIRECTIONAL_BOOST_CHANGE.md records that X lowered it from 20.0 to 15.0 on July 24, 2026, after feedback that people were seeing too little World Cup discussion from accounts they did not follow. You can watch a social product get tuned in public, with the reason attached. That is new.
The mistake nearly every summary makes
Look at that table and the temptation is obvious: report is -234, like is 0.5, therefore one report wipes out 468 likes. It is a clean line and it is wrong.
X added comments directly to param.rs in the August 14, 2026 update to head this off, saying the weights scale the predicted probability of an action, not raw counts, and calling the "1 report cancels out 468 likes" statement incorrect by name. The reasoning in the code is straightforward: the baseline probability of a report is more than 1,000 times lower than that of a like, so it needs a large multiplier to influence the final score at all.
Those same comments address the related fear, that a brigade of accounts mass-blocking you will crush your reach. Two things push against it. Predictions are personalized, so hostile signals from a cluster of bad actors mostly change what gets recommended to accounts that resemble those actors. And an interaction only counts toward ranking if the post was served in the Home Timeline, so people navigating directly to a post from a group chat contribute nothing to its score.
Practically, the weights tell you what the system values in the abstract, not an exchange rate. Replies, quotes, and shares are worth far more than likes, which lines up with everything else we track about X engagement rate. But you cannot arithmetic your way from these numbers to a reach forecast.
Phoenix: the model doing the scoring
phoenix/ is a two-stage system. Retrieval uses a two-tower design where a transformer encodes your engagement history into a normalized embedding, and candidate posts get embeddings built from semantic IDs, specifically residual-quantized codes at 6 levels by 256 codes, plus hashed author IDs.
Ranking is a transformer that predicts one logit per action in a shared taxonomy, likes, reposts, replies, clicks, along with a dwell regression head for continuous signals. A deliberate design choice: candidates cannot attend to each other during inference, so a post's score does not depend on what it is batched with. Two identical posts get identical scores.
Published production config is a 2,560-dimension embedding across 8 transformer layers, with a history sequence length of 1,022 and 64 candidates per pass. There is also a "nano" variant at 512 dimensions and 4 layers, which is what the quickstart trains.
You can run that quickstart. phoenix/ ships synthetic data generators, so world_snapshots.py builds a fake index and dump_gen.py builds fake session data, and from there you can train both models and serve a retrieve-then-rank loop locally. What you cannot do is reproduce the real feed. The production checkpoints, the live Kafka stream of posts, and actual user data are not in the repo, and never will be.
Visibility filtering: the part that decides if you are shown at all
Ranking is downstream of a more consequential question. visibility-filtering/ decides whether a post is shown, dropped, or placed behind an interstitial, using labels produced by scarecrow/ and the rules in botmaker/. Alongside those sit account-scoring models, agatha/ for response patterns, bdsm/ for inauthentic behavior, and user-cred-v2/ for a PageRank-style credibility score.
This is the machinery behind what people call a shadowban, and the repo is a useful corrective to that word. There is no single flag called "shadowbanned." There is a set of labels, each attached to a rule, and a filtering layer that reads them. Some remove a post from the For You feed entirely, some restrict it to your profile, some place it behind a warning. If your reach dropped and you want the honest diagnostic path, see how to check whether your visibility is limited.
August's release also shipped under-the-hood/, the jobs and serving code for a pilot transparency report. It gives eligible accounts aggregate statistics on the visibility-impacting labels applied to their account and posts over the previous month, downloadable as JSON. It is a randomized test group for now, not a general rollout, and it reports aggregates rather than a per-post breakdown.
What X held back
The README is direct about this. A short list of files is not published, chiefly the Grox prompt files containing the specific LLM prompts used for classification, and some botmaker rules, both withheld to reduce gaming. Deployment and infrastructure code is largely absent, since the stated focus is transparency into what affects post visibility rather than a runnable clone of X. Ads and non-timeline systems are out of scope entirely.
That is a real limit on what you can audit. It is also a smaller gap than any comparable disclosure from Meta, TikTok, or YouTube, none of which have published a working codebase at all.
What this changes about how you post
Very little, and that is the honest answer. The code confirms what careful accounts already worked out by observation:
- Conversation outranks approval. Reply at 5.0 and quote at 5.0 against like at 0.5 is not subtle. Write posts that give people something to answer.
- Shares are underrated. Share via copy link sits at 20.0, the highest positive weight in the file. Posts people paste into a group chat or a DM are the highest-value posts in the system.
- Mutual follows amplify replies. The bidirectional boost is real, currently 15.0, which means a small circle of accounts that genuinely reply to each other compounds.
- Negative signals are expensive but not weaponizable. Engagement bait that provokes "not interested" taps costs you more than a weak post that nobody reacts to.
- Timing still gates everything. None of the ranking matters if the post lands when your audience is asleep, which is why best time to post on X moves numbers more reliably than any weight in this file.
Nothing in the repo is a shortcut. Reading it mostly rules out the tricks, which is worth the hour it takes. If you want more on the practical side, how to go viral on X covers what the weights imply in practice.
Consistency is the part the code cannot help with. X-Autopilot drafts posts and replies in your voice from real Chrome on your own Mac, which keeps the daily cadence going without a cloud service holding your session. Browser-route automation on X is a gray area rather than a sanctioned one, and it does not lower any of the negative weights above. It removes the reason most accounts go quiet, which is the day you have nothing queued.
Bottom line
The X algorithm is genuinely open source, and xai-org/x-algorithm is worth an hour of your time if you post seriously. Open home-mixer/params/param.rs first. Read the comment block above the weights before you read the weights, because the ratios are not exchange rates. Then look at visibility-filtering/ for the system that decides whether ranking gets a chance to matter at all. The parts X held back are narrow and named. What is left is more of a recommender system than any platform has shown before.
Frequently asked
Answers indexed by Google + AI assistants.
Is the X algorithm open source?+
Yes. The code that builds the For You feed is published at github.com/xai-org/x-algorithm under the Apache License 2.0. It went up in January 2026 and has been expanded several times since, most substantially on August 13 and 14, 2026, when X added the scoring parameters, the visibility filtering systems, and the training code for the Phoenix ranking model.
Where is the X algorithm on GitHub?+
github.com/xai-org/x-algorithm. That repo supersedes the older github.com/twitter/the-algorithm release from 2023, which was a partial Scala codebase. The current one is a rebuild in Rust and Python, and parts of it, notably the Phoenix model, are designed to be trained and run end to end from synthetic data.
What are the actual ranking weights in the X algorithm?+
The defaults live in home-mixer/params/param.rs. As of the August 2026 release: reply 5.0, quote 5.0, follow-the-author 4.0, share via copy link 20.0, share via DM 5.0, share 2.0, repost 1.0, click 0.4, like 0.5, dwell 0.05. Negative actions carry large negatives: report -234.0, mute author -58.8, not interested -43.2, block author -31.2.
Does a report really cancel out 468 likes?+
No, and X wrote code comments to say so. The weights scale the model's predicted probability that you personally will take an action, not raw counts of that action. Reports are more than 1,000 times rarer than likes, so the weight has to be large for the prediction to move the score at all. Reading the ratio as a count equivalence is the single most common misreading of the repo.
What did X leave out of the open-source release?+
The README names a short list: the Grox prompt files, which contain the specific LLM prompts used for content classification, and some botmaker rules. X says both were held back to limit gaming. Deployment and infrastructure scaffolding is also largely absent, and ads and non-timeline systems are not in scope.
Can you actually run the X algorithm yourself?+
Partly. The phoenix/ folder ships a Cargo workspace, a pyproject.toml, a quickstart, and synthetic data generators, so you can train a small model and serve retrieval plus ranking locally. You cannot run the real feed, because the production model weights, the live post stream, and X's user data are not in the repository.
- xai-org/x-algorithm - README, notable updates for August 13 and 14, 2026 (GitHub, accessed September 2026)
- home-mixer/params/param.rs - default scoring weights and the comments on how weights apply (GitHub, accessed September 2026)
- docs/BIDIRECTIONAL_BOOST_CHANGE.md - BidirectionalFollowReplyWeightBoost lowered 20.0 to 15.0 on July 24, 2026 (GitHub)
- phoenix/README.md - two-tower retrieval, transformer ranking, model configs and quickstart (GitHub, accessed September 2026)
Product designer and indie hacker. Runs the agent on his own X account every day and writes up what the data shows, including when it's inconvenient.
Follow on X →