Open-source project
xai-org/x-algorithm avatar
xai-org/x-algorithm

X's For You algorithm: a transparency tool that shows whether your posts were withheld in a country after a legal demand

Algorithm powering the For You feed on X. **Note:** The transformer implementation is ported from the Grok-1 open source release by xAI, adapted for recommendation system use cases.

34,208 stars5,516 forksRustApache-2.0

At a glance

What is it?
xAI has published the ranking code behind the For You feed on X: a Rust monorepo where two pipelines separate what a model ranks from what the model does not rank, and a transparency tool that reports whether your posts were withheld from a particular country following a legal demand. The repository is Apache-2.0, its transformer implementation is ported from the Grok-1 open source release, and the update log documents a filter that removed posts from accounts reported to Brazil's electoral court unless the viewer followed them, and its removal after the election.
Who is it for?
Use this repository if you want to read the ranking and filtering code behind a large recommendation feed, or if you want to see whether your posts were withheld in a country following a legal demand. Do not treat it as a way to tune a feed, because there is nothing here you can run against a live timeline, and do not read the filtering directories as the whole system, because the README has a section on what is not in the repository.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Rust, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 13, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • xai-org/x-algorithm34,208 ★ · +7,351
Star history
Repository2026-07-282026-11-13
xai-org/x-algorithm26.9k34.2k

7,351 Stars in the last 108 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Two pipelines, and the model is not what decides visibility

The first distinction in the README is the one that explains most of the structure. Ranking sets the order. Whether a post can be shown at all is decided separately, by a directory called visibility-filtering, using the viewer's own actions such as blocks and mutes, and using labels that other systems in the repository attach to posts and accounts.

So a model ranks and a rule set decides eligibility, and those are different code. That is why the repository has a filtering directory, a directory for the systems that produce the labels it consumes, and a separate enforcement service, all sitting beside the ranking code.

Posts also come from two places. In-network content comes from a directory called Thunder, which keeps recent posts from accounts a viewer follows in memory. Out-of-network content comes from Phoenix retrieval and from a directory called SimClusters, which is described as an additional source of posts from accounts the viewer does not follow, called alongside Thunder and Phoenix retrieval during retrieval.

The ranking model itself is Phoenix, and what it does is narrow: it reads the viewer's recent engagement history and predicts, for each post, how likely that viewer is to take each action on it. Those predictions are combined into one score by weights held in the code.

The weight explanation is the most useful paragraph in the file

The August 14th, 2026 update opens by naming a misconception about how action weights work in ranking, and the correction is worth carrying into any reading of this code.

The weights do not scale raw engagement counts. They scale the predicted probabilities of those actions, or predicted continuous values such as dwell time. So it would be incorrect to see that a report carries several hundred times the weight of a like and conclude that one report cancels out several hundred likes. The weight is a multiple on your own predicted probability of liking or reporting, and that probability is substantially driven by your own behaviour.

The repository says it has added comments to a parameter file and to a scoring file so that language models, or people, reading the code are more likely to understand it correctly.

That is a small entry with a large effect on any analysis. The number people usually quote off a ranking system is a ratio between two coefficients, and this entry says the coefficients multiply different quantities from the ones a reader would assume. A recommendation system whose output is dominated by predicted probability rather than observed behaviour is a different kind of system from one that reweights a count.

A country-level removal report, added September 18th 2026

The September 18th update in the log is a transparency tool, and it is a different kind of feature from the rest of the repository.

Reports now include information about whether an account or its posts have had their visibility limited because of required compliance with law. The example given is that you can see whether any of your posts were withheld from showing in a country following a legal demand, and which country.

Read that carefully, because it is a specific claim. It says the tool reports compliance-driven limits at the level of a country, and that it applies to your own account and posts. It is not a general explanation of why a post did not appear in your timeline; that is the ranking and filtering system described elsewhere in the repository. This is a report about removal under legal demand.

The tool sits in a directory called under-the-hood, and an earlier update describes it as a transparency tool that shows aggregate statistics about the labels on an account and posts that can limit visibility. So there are two related things: aggregate statistics about labels, and now the country-level legal report.

Brazilian electoral law runs as a named filter, and the account list is dated

The August 14th update documents a filter with a specific legal trigger, and the framing of it is instructive for anyone reading a recommendation system with compliance requirements.

In accordance with Brazilian electoral law, For You began running Brazil2026ElectionFilter, which removed posts from accounts reported to Brazil's Electoral Court for the 2026 election, unless the viewer explicitly followed the account. The October 26th, 2026 update says the filter was removed after the election, so posts from the accounts it covered are no longer filtered out because of it.

One design choice is visible in that description. The exemption for explicit follows means the rule is not a blanket block of a source; it removes the posts from appearing to people who do not already choose to see them.

The transformer is a port, and the training code replaced a demo model

The repository description carries a note that shapes how you should read the model code. The transformer implementation is ported from the Grok-1 open source release by xAI, adapted for recommendation system use cases.

So the architecture in this repository did not start here. It came from a language model release and was reshaped for a ranking problem, which means its structure reflects both its origin and its adaptation, and neither is documented in depth in the files listed at the root.

The August 13th update says something about the state of the model code. It replaces the Phoenix demonstration model with the code used to train the models the feed uses, as well as synthetic data generation code, so that someone can run a proof-of-concept training run of Phoenix.

That is a meaningful change in what a reader can do. Before it, the published model was a demonstration. After it, there is training code and a synthetic data generator, which is enough for a proof-of-concept run and not the same as reproducing the production model.

Twenty-nine directories, and a README section on what is missing

The root of the repository lists twenty-nine directories, and reading the names is the fastest way to understand the scope. Beside the ranking and retrieval code there are directories for abuse enforcement, an abuse ledger, adult content, a pnsfwmedia directory, a safety label user aggregation, and takedowns.

Alongside the model directories there is a visibility filtering client as well as the filtering service, a value model for scoring, a top-level candidate pipeline directory, and a home mixer.

And there is a README section on what is not in the repository. That section exists, which means the published tree is a subset, and the honest reading is that the absence of a directory is not evidence that a system does not exist.

Apache-2.0, no releases, and a default branch of main

The licence is Apache-2.0 and the default branch is main. The repository is not archived and the last push was 2026-10-31, so the code is being changed.

There are no GitHub releases; pin a Git commit for a reproducible source snapshot. There is a code of conduct and a licence file at the root, a documentation directory, and no build file at the top level in the entries listed, which is consistent with a repository of many independent services and libraries rather than one program you build.

The daily rhythm is visible instead in the update log, which is organised by date rather than by version: entries for the twenty-sixth, thirteenth and eighth of October, the eighteenth of September, and the fourteenth and thirteenth of August. Six dated entries, each describing what changed in the feed's behaviour and linking the code.

For a reader, that format is both the strength and the limitation. It tells you what changed and when, and it lets you diff a date against a date. What it does not give you is a release you can install, a compatibility statement, or a way to ask what broke.

Editorial conclusion

Use this repository if you want to read the ranking and filtering code behind a large recommendation feed, or if you want to see whether your posts were withheld in a country following a legal demand. Do not treat it as a way to tune a feed, because there is nothing here you can run against a live timeline, and do not read the filtering directories as the whole system, because the README has a section on what is not in the repository. Before you draw conclusions: read the weight explanation, because the weights multiply a model's own predicted probability rather than raw engagement counts, and the common misreading of that is a factor of several hundred; note the transformer is ported from Grok-1 and adapted for recommendation use; and remember this is the core code, not the whole service, and the README has a section on what is not in this repo.

Frequently asked questions

How does the X algorithm work?

The For You feed is assembled per request from two sources. In-network posts come from accounts the viewer follows and are kept in memory by Thunder, out-of-network posts come from Phoenix retrieval and SimClusters, and both are ranked by one model that reads the viewer's recent engagement history and predicts how likely they are to take each action on a post. Whether a post can appear at all is decided separately by visibility filtering, from the viewer's blocks and mutes and from labels attached by other systems.

is x algorithm open source

The ranking and filtering code behind the For You feed is published under the Apache-2.0 licence. The repository is described as the core code, with a section on what is not in the repository, and the transformer implementation is ported from the Grok-1 open source release and adapted for recommendation use cases.

what is the new x algorithm

The latest entry, October 26th, 2026, removes the Brazil 2026 elections filter from For You. Before that, on September 18th, 2026, a transparency tool was added: reports now include whether an account or its posts had visibility limited because of required compliance with law, including whether a post was withheld from showing in a country following a legal demand, and which country. Earlier entries in August describe a weight clarification and an election-related filter for Brazil.

is x algorithm biased

The repository publishes a clarification that action weights multiply a model's own predicted probability of an action rather than raw engagement counts, and that the probability is substantially driven by the viewer's own behaviour. Filtering is described as a separate stage driven by blocks, mutes and labels attached by other systems.

Official sources

  1. Official README
  2. Project repository
  3. README
  4. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/xai-org-x-algorithm.svg)](https://hysenlabs.com/projects/xai-org-x-algorithm)

Weekly Top 10 badge

markdown
[![Hysen Labs](https://hysenlabs.com/badge/xai-org-x-algorithm.svg?metric=rank)](https://hysenlabs.com/projects/xai-org-x-algorithm)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/xai-org-x-algorithm.svg)](https://hysenlabs.com/projects/xai-org-x-algorithm)

Was this useful?