Every month I read the code that decides who sees your posts on X. That's only possible because of something that happened more than three years ago, so this is where the story starts.
What happened on March 31, 2023?
On March 31, 2023, Twitter published the source code for its recommendation algorithm on GitHub. It went into a public repository called twitter/the-algorithm, with a second repository holding some of the machine learning models behind it. Anyone with a browser could read it.
It didn't come out of nowhere. Elon Musk had owned Twitter for about five months, and he'd promised a few weeks earlier that the code that recommends posts would be made public by the end of March. Twitter kept that date.
Why did Twitter open-source its algorithm?
The reason Twitter gave was transparency. The company said it wanted people to be able to see how its systems decide what shows up in their timeline. Musk went further. He said he wanted Twitter to be the most transparent system on the internet, that most of the algorithm was being released that day with the rest to follow, and that people would find embarrassing things in it that would then get fixed.
He was right about that part. Within days, people reading the code were posting what they'd found, and the company was answering questions about pieces it hadn't explained.
What did the 2023 code show?
The 2023 For You timeline worked in three steps:
- Gather. It pulled candidate posts from several sources: accounts you follow, accounts similar to ones you engage with, and posts popular with people like you.
- Rank. A machine learning model scored those candidates.
- Filter. Rules removed posts from accounts you'd blocked or muted, balanced the mix, and applied the platform's visibility rules.
A lot of it was hand-built. Engineers had spent years writing rules and features on top of each other, and you could see it in the code.
Is the 2023 code still how X works?
No, and this matters if you're reading advice online. Much of what gets passed around about "the X algorithm" still comes from the 2023 code, and that code doesn't run the feed anymore.
In January 2026, X replaced it with a new system built around one trained model. The code that runs the feed today is at xai-org/x-algorithm. I covered that switch in X published a new For You algorithm in January 2026.
Every value I use comes from the current code, and every one of them is on The numbers.
What to do about it is in the book. Updates say what changed. The book explains how the feed works and what to do, and it's revised every month from X's code.
See what it costs