X has published the source code behind its “For You” recommendation algorithm, the system responsible for deciding which posts appear at the top of hundreds of millions of feeds every day. The code, hosted in the xai-org/x-algorithm GitHub repository, represents a complete rewrite of the platform’s earlier recommendation engine.

Elon Musk announced on January 10, 2026, that X would open-source the full recommendation algorithm within seven days. The actual release landed on January 20. The repository replaces a partial 2023 open-sourcing of an older Scala-based version with a ground-up rebuild in Rust and Python.

How the algorithm decides what you see

The system works through a multi-stage pipeline. First, it retrieves candidate posts from across the platform, pulling from accounts a user follows, trending topics, and content similar to what the user has previously engaged with. Then a ranking model predicts how likely a user is to interact with each post, sorting them accordingly.

The ranking model prioritizes shares, comments, and other forms of active engagement. Posts that generate replies and reposts get boosted. Posts that attract reports, mutes, or simply fail to hold attention get penalized.