# The X Algorithm Exposed: What Really Drives Engagement (With Code Proof)

*X recently made their algorithm public on GitHub, and as Haxz, we've analyzed every line of code to bring you the real story - no BS, just facts backed by actual code from* [*the official repository*](https://github.com/twitter/the-algorithm)*.*

### The Truth About What Makes or Breaks Your Tweets

We spent weeks diving through X's open-sourced algorithm to understand exactly what boosts your content and what kills it. Here's what we found, with receipts straight from the code.

***

### 1. The Engagement Predictions That Actually Matter

The algorithm predicts multiple outcomes for every tweet, then combines them into a final score. Here's exactly what it's looking for:

#### The Big Winners (Positive Signals)

```scala
// From PredictedScoreFeature.scala
object PredictedFavoriteScoreFeature    // Likes
object PredictedReplyScoreFeature        // Replies  
object PredictedRetweetScoreFeature      // Retweets
object PredictedVideoQualityViewScoreFeature // Video views >50%
object PredictedGoodClickConvoScoreFeature  // Quality clicks
```

**What this means:** Every tweet gets scored on the probability of getting likes, replies, retweets, and meaningful engagement. These scores are then weighted and combined.

#### The Silent Killers (Negative Signals)

```scala
// From PredictedScoreFeature.scala
object PredictedNegativeFeedbackV2ScoreFeature
object PredictedReportScoreFeature
```

If the algorithm predicts people will click "See fewer" or report your tweet, you're dead in the water.

***

### 2. The Video Advantage Is Real

**Videos longer than 10 seconds get special treatment:**

```scala
// From PredictedScoreFeature.scala
object PredictedVideoQualityViewScoreFeature {
  override def isEligible: Boolean = {
    val isVideoDurationGte10Seconds = 
      (features.getOrElse(VideoDurationMsFeature, None).getOrElse(0) / 1000.0) >= 10
    hasVideoFeature && isVideoDurationGte10Seconds
  }
}
```

**Action item:** Post videos over 10 seconds to unlock the Video Quality View (VQV) scoring boost. The algorithm specifically tracks if viewers watch at least 50% of your video.

***

### 3. The "See Fewer" Death Penalty

This is the nuclear option that destroys your reach:

```scala
// From FeedbackFatigueScorer.scala
val DurationForDiscounting = 140.days
private val ScoreMultiplierLowerBound = 0.2  // 80% penalty!
```

**What happens when someone clicks "See fewer":**

* You get an immediate 80% reach penalty to that user
* It takes 140 days to fully recover
* The penalty affects everyone who liked, retweeted, or follows you

**How to avoid it:** Never post divisive, annoying, or low-quality content. One "See fewer" can haunt you for months.

***

### 4. Stop Spamming - The Algorithm Punishes Repetition

```scala
// From AuthorBasedListwiseRescoringProvider.scala
val decayFactor = 0.5  // Default
val floor = 0.25       // Minimum score

// Formula: Each additional tweet gets progressively less reach
// 1st tweet: 100% score
// 2nd tweet: 62.5% score  
// 3rd tweet: 43.75% score
// 4th tweet: 34.375% score
```

**The math:** Your 4th tweet in a row gets only 34% of the reach of your first. Space out your posts!

***

### 5. Out-of-Network Penalty

```scala
// From RescoringFactorProvider.scala
object RescoreOutOfNetwork {
  def factor: Double = 0.75  // 25% penalty for non-followers
}
```

**Translation:** Tweets to people who don't follow you get a 25% reach penalty. Build your follower base first!

***

### 6. Replies

```scala
// From RescoringFactorProvider.scala
object RescoreReplies {
  def factor: Double = 0.5  // 50% penalty for replies!
}
```

**Fact:** Replies get HALF the reach of original tweets. Make your replies count or post original content instead.

***

### 7. The "GM" Tweet Problem (Why It Actually Hurts)

We found the duplicate content detection system:

```scala
// From TweetLabelRules.scala
object DuplicateContentTweetLabelDropRule
    extends DuplicateContentTweetLabelRule(Drop(TweetLabelDuplicateContent))

object DownrankSpamReplyTweetLabelRule
    extends NonAuthorWithTweetLabelRule(
      Drop(Unspecified),
      TweetSafetyLabelType.DownrankSpamReply
    )
```

**Why "gm" tweets fail:**

* Everyone replying "gm" triggers spam detection
* Repetitive content gets flagged as `DuplicateContent`
* Low-quality interactions hurt your engagement score
* The algorithm learns to suppress your "template" content

***

### 8. Giveaways = Engagement Spam (Don't Do It)

The algorithm has specific detection for engagement farming:

```scala
// From UserLabel.scala
case object EngagementSpammer extends UserLabelValue
case object EngagementSpammerHighRecall extends UserLabelValue

// This drops your content for non-followers!
object EngagementSpammerNonFollowerWithUqfRule
    extends NonFollowerWithUqfUserLabelDropRule(EngagementSpammer)
```

**What triggers engagement spam detection:**

* "RT + Follow to win" patterns
* Artificial engagement spikes
* Mass follow/unfollow behavior
* Repetitive giveaway posts

**The penalty:** Once flagged as `EngagementSpammer`, you're penalized across:

* Home timeline
* Recommendations
* Search results
* Notifications
* Everything

***

### 9. Media Tagging Doesn't Directly Boost (But...)

```scala
// From TweetMediaFeaturesExtractor.scala
val mediaTagScreenNames = getMediaTagScreenNames(mediaTags.tagMap)
featuresWithMediaEntity.copy(
  mediaTagScreenNames = Some(mediaTagScreenNames),
  numMediaTags = Some(numMediaTags.toShort)
)
```

**The truth about tagging:**

* No direct ranking boost found in code
* BUT tagged users get notified -> early engagement
* Early engagement triggers positive feedback loop
* Works best with active communities (like NFT projects)

***

### 10. The 24-Hour Window

```scala
// From multiple sources
val MaxTweetAgeHoursParam = 24.hours
val earliestTweetId = SnowflakeId.firstIdFor(Time.now - maxTweetAgeHours)
```

**Critical:** Tweets older than 24-48 hours get dramatically reduced distribution. The first hour is EVERYTHING.

***

### What To Do (Backed by Code)

1. **Add videos over 10 seconds** - Unlocks VQV scoring
2. **Space out your tweets** - Avoid the author diversity penalty
3. **Build genuine followers** - Reduces out-of-network penalty
4. **Post when audience is active** - Maximize the crucial first hour
5. **Create conversation starters** - Replies boost your engagement score
6. **Use images and media** - Tracked and slightly favored
7. **Stay consistent with topics** - Builds stronger SimCluster embeddings

### What NOT To Do (Will Kill Your Reach)

1. **Never trigger "See fewer"** - 140-day penalty
2. **Don't spam multiple tweets** - Each one gets 50% less reach
3. **Avoid "gm" chains** - Triggers duplicate content detection
4. **No giveaways** - Flags you as engagement spammer
5. **Don't post mainly replies** - 50% reach penalty
6. **Avoid repetitive content** - Duplicate detection kills reach
7. **Don't rely on viral-only** - Build followers or face 25% penalty

***

### The Bottom Line

The X algorithm is sophisticated but predictable. It rewards genuine engagement, punishes spam-like behavior, and has long memory for negative signals. Focus on quality over quantity, build real relationships, and respect the timing windows.

Most importantly: The algorithm changes, but these core principles remain. Create content people actually want to see, and the algorithm will work for you, not against you.

***

*This analysis is based on X's open-source algorithm available at* [*github.com/twitter/the-algorithm*](https://github.com/twitter/the-algorithm)*. All code snippets are directly from the repository. Follow Haxz for more no-BS technical breakdowns.*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://intel.haxz.xyz/the-x-algorithm-exposed-what-really-drives-engagement-with-code-proof.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
