Skip to content

Ranking

For you orders the stream by what you care about, next to the chronological stream (SI-542). It weighs your keywords, your sources, the gate’s scores and how fresh an item is. Every card says why it’s where it is. Code: services/ranking.ts, the order in services/items.ts, the card’s breakdown in RankWhy.svelte. In the app: For you in the stream’s order menu (/?sort=foryou), and Settings → Ranking (/settings/ranking).

Newest first stays the default, and it doesn’t change.

The formula

Each part gives points. A point doubles an item’s standing, and freshness takes one point per half-life of age. So an item with one more point counts as much as one a half-life younger.

Part Points From
Keywords The sum of the item’s keyword weights, in hundreds, kept within ±2. +100 is one point. Paused keywords don’t count keywords.md
Source log2 of the source’s weight: Much more +1, More +0.58, Neutral 0, Less −1, Much less −2 sources.md
Signal From −1 (0) through 0 (50) to +1 (100) scores.md
Facts The same, plus your claim check’s adjustment (SI-551): up to +0.3 for supported claims, down to −0.6 for disputed ones research.md
Hype The other way round: Hype 0 is +1, Hype 100 is −1
Story log2 of how many of your sources carry the story, at most 2: two sources +1, four or more +2. 0 for an item in no story dedupe.md
Freshness Minus the age in half-lives: −1 a half-life after publishing The publish date, or when Hotaru found an undated item

Each part is multiplied by your factor for it, then they are added up: the rank.

A part with nothing to go on gives 0, not a penalty. An item with no keywords yet, or that the gate hasn’t scored, ranks as a neutral item of its age. So new items aren’t buried. The score sorts are different: they put unscored items last.

Example

With the default factors, an item 12 hours old, with “Svelte” (+80) and “Rust” (+60), from a source weighed More, Signal 75, no Facts score, Hype 90:

Part Points
Keywords +1.4
Source +0.6
Signal +0.5
Facts 0
Hype −0.8
Story 0
Freshness −0.5
Rank +1.2

Your factors

Settings → Ranking sets how much each part counts, stored per account (user_settings.preferences.ranking):

  • A factor per part, from Off (0) to × 3, in steps of 0.25. × 1 is the default.
  • Freshness: after how long an item loses a point: 6 or 12 hours, 1, 2 or 4 days, or a week. The default is a day. Shorter keeps For you close to the news; longer lets a good item from last week rise above a so-so one from this morning.
  • Reset to defaults sets the sliders back; Save stores them.

Nothing is stored

The rank is worked out each time the stream is read, from the weights as they are then. Changing a keyword’s weight or pausing it (SI-537), a source’s weight (SI-538), or a factor here counts at the next load. The agent will change weights the same way (SI-549).

In the stream

  • For you is an order, like Signal or Least hype: in the order menu (“For you” then reads in the count line), for Unread and All, with a tag, a keyword and the score bounds. The counts, the “new items” pill and Mark all as read are the same as in any other order. Starred and Filtered keep their own order.
  • Why? On each card in For you, at the end of its keywords and scores, “Why? +1.2” opens the breakdown: each part’s points, what it comes from (“Svelte +80, Rust +60”, “More”, “75”, “no score”), and the rank. Points that help are in firefly light, points that hurt in ember. A link goes to Settings → Ranking.

How the order is made

The stream sorts in SQL. rankKey() builds the key, and rankBreakdown() explains it in TypeScript. A test checks that the two agree.

The key doesn’t depend on now. Ordering by quality − age / half-life is the same as ordering by quality + publish time / half-life, because now is the same for every item. So the key is the quality parts plus the publish time in half-lives since 1 January 2026, in thousandths of a point, as an integer. It doesn’t move while the reader pages, and the cursor (<key>:<publishedAt ms>_<itemId>) holds it exactly. The breakdown shows freshness relative to now, so its parts read naturally.

Cost. Like the score sorts, it isn’t served by an index: SQLite works out the key for each of the user’s items in the view and sorts them. The keyword part is one key range in item_keywords per item. With 30,000 unread items of three keywords each, a page takes about 65 ms, against 17 ms sorted by Signal and under 1 ms newest first.

API

GET /api/v1/stream?sort=foryou The For you order. Each item carries rank: { total, keywords, source, signal, facts, hype, story, freshness }, in points, already weighed with your factors. Works with unread, tag, keyword and the score bounds, and pages with cursor
GET /api/v1/ranking Your factors: { keywords, source, signal, facts, hype, story, halfLifeHours }
PUT /api/v1/ranking Changes any of them (write token). A factor goes from 0 to 3, halfLifeHours from 1 to 720 (whole hours); anything else is a 400

The SDK: stream({ sort: 'foryou' }), rankingSettings() and setRankingSettings().

Not yet

  • Votes and labels (SI-544, SI-545) as parts of the rank. They change the keyword and source weights instead, through the feedback loop (feedback.md).
  • Learning the factors from votes.
  • Why? in the reader: the breakdown is on the cards only.