Open-source algorithms
X Algorithm on GitHub: what it does and how to use it with AI agents
The code behind the For You feed on X, published by xAI.
Stars, license and last push from the GitHub API, checked 2026-10-26
| Repo | xai-org/x-algorithm |
|---|---|
| Stars | 33,800+ |
| License | Apache-2.0 |
| Last push | 2026-10-23 |
| Language | Rust, Scala, Python |
What X Algorithm does
This repo holds the ranking code for the For You feed on X. Each post gets a score that adds up predicted actions times a weight (xai-value-model/scoring.rs, weights in home-mixer/params/param.rs). The weights in param.rs as of Oct 26, 2026: share via copy link 20, reply 5, quote 5, share via DM 5, follow author 4, share 2, repost 1, like 0.66, open link 0.2. Negative ones: report -234, mute -58.8, not interested -52.272, block -31.2. A reply between two accounts that follow each other gets a +15 boost on the reply weight (BidirectionalFollowReplyWeightBoost in param.rs). New original posts from accounts with 50,000 followers or fewer can get a cold start slot in their first 2 hours (home-mixer/scorers/author_cold_start.rs). We did not find a link penalty or hashtag penalty in the code. Links just carry a small positive weight.
Who it is for
Anyone running an X account with an agent, and anyone who wants to check X growth advice against the actual code.
How to use X Algorithm with Claude Code, Codex or Cursor
Clone it: git clone https://github.com/xai-org/x-algorithmOpen the folder in Claude Code, Codex or Cursor and ask: "Find every scoring weight in home-mixer/params/param.rs and explain what each one rewards."Ask the agent to turn the weights into posting rules for your account, and to cite the file for every rule.Re-run that check when the repo updates, since weights can change.
Tip: Tell your agent to mark anything it cannot find in the code as unverified. A lot of X advice online is not in this repo.
The loadout for this repo
See the full tool stack, prompts and costs in Best AI setup for social media posts.
Related repos
- Anthropic Agent Skills: Public repo of Agent Skills: folders of instructions and scripts an agent loads when needed.
- OpenAI Codex CLI: OpenAI's open-source coding agent that runs in your terminal.
X Algorithm FAQ
What does the X algorithm reward most?
In home-mixer/params/param.rs, sharing a post via copy link has the highest positive weight (20), then reply, quote and share via DM at 5 each. A like is 0.66. Checked Oct 26, 2026.
Does the X algorithm penalize links?
We did not find a link penalty in the code. Opening a link has a small positive weight of 0.2. Links can still cost reach indirectly because people leave X instead of replying.
Is the X algorithm open source?
Yes. xai-org/x-algorithm is public on GitHub under the Apache-2.0 license.
Star counts change daily. Always read a repo's license and code before running it. All repos