Skip to content

Dedupe

When ten sites report the same news, the stream shows one card, not ten (SI-540). The card is the story’s first item, with “+9 sources” under it. Code: the stage in pipeline/stages/dedupe.ts, stories and the stream’s part in services/stories.ts, the card’s list in StoryCoverage.svelte.

Stories

A story groups the items of several sources that report the same event. It’s shared, like items: whether two items report the same thing doesn’t depend on who reads them. Each item is in at most one story (items.story_id). The story’s items, oldest first, are its timeline: the story’s page shows it, and you can follow a story for its updates (stories.md).

Column
stories.title The title of the item that started the story
stories.created_at, updated_at When it started, and when an item last joined it
items.story_id The item’s story. Null: no other source reported it, or not yet
items.story_match How it joined: url (the same canonical URL), jev, or fallback (GPT-6 Luna, when jev failed). Null for the item that started the story
items.story_same jev’s probability that it’s the same story, 0–1. Null for a URL match
items.story_joined_at When the item joined its story (SI-553, stories.md)
user_items.story_split The user split the item from its story

Migration 0016_story_dedupe.

How an item joins a story

The dedupe stage runs after keywords and before summarize. It’s an item stage: one check per item, for every user the stage is on for. In this order:

  1. Nobody sees it. When the gate filtered the item out for every user (and none marked its source Always show), it’s skipped: grouping it isn’t worth a call.
  2. The same URL. An item of another source with the same canonical URL is the same article. The item joins its story, with no call.
  3. Candidates. The title’s words (without stop words, in English and German) are looked up in the full-text index (SI-530). Hits count when they’re from another source, in the same users’ streams, published within 3 days, and share two words with the title, or one name of six letters or more (“Nvidia”). Hits of one story count once. The best 3 go on.
  4. jev confirms. For each candidate, best first, one jev call asks same and sufficient, the questions of jev’s reference same-story command. jev reads the item and up to three items of the candidate’s story (title and the first 1,200 characters of text), so a story is checked once, not item by item. The item joins at same ≥ 50 % and sufficient ≥ 80 %: the SI-513 spike found 9 of 11 duplicates this way, with no false merges, also across languages. Low sufficient means one side is a teaser: no merge rather than a guess.
  5. The fallback. When jev fails, GPT-6 Luna answers the same two questions, yes or no.

The stage takes a batch’s items one at a time, oldest first. Two new items of one story in the same batch: the first starts the story, the second finds it. In parallel they’d start two.

Each call is a once() memo named after the candidate story, so a crash doesn’t pay twice, and a rerun with another shortlist doesn’t reuse an answer about another story. An item that’s in a story already isn’t checked again.

The step’s note in Executions says what happened: “Same story as “…”: 93 %”, “Same URL as “…””, “No other coverage”, or “No same story among 3 checked, closest 21 %”.

In the stream

  • One card per story. The stream shows a story as its earliest item you can see: in your stream, from a source you follow and haven’t paused, not filtered out by the gate, not split. When that item is filtered out or its source unfollowed, the next one stands for the story. Coverage that arrives later doesn’t move the card.
  • “+2 sources” at the end of the card’s foot opens the list of the story’s other items, oldest first, each with its source. A title opens that item in Hotaru; Story timeline at the end opens the story’s page (stories.md).
  • Counts match the cards: the unread count, the “new items” pill and the tag filter count a story once. Mark all as read marks the story’s other items read too.
  • Read state is per item. Reading the card reads its item; the story’s other items stay hidden behind it, read or not.
  • Filtered, Starred and search list every item, also those of a story.

Split from story

When grouping was wrong, open the item (from “+N sources”, search, or the reader) and press Split from story. It shows as its own card again, and the story goes on without it. Put back into its story undoes it. A split is yours alone: other users still see the story.

PATCH /api/v1/items/:id with { "storySplit": true } (or false), updateItem() in the SDK.

Ranking

Story size, how many sources you follow carry the story, is a part of the For you rank: log2 of the size, at most 2. Two sources are one point, four or more two. Its factor is in Settings → Ranking (ranking.md).

Costs

About $0.056 per 1,000 checks (jev, ~1,350 tokens in). Items with no candidate, or with the same URL, cost nothing; most items have no candidate. At most three checks per item: at 500 items a day with a third of them checked once, about $0.30 a month. Over the monthly budget, the stage is skipped and items stay apart (costs.md).

API

Stream items and GET /api/v1/items/:id carry:

Field
storySize Sources you follow that carry the story, the item’s own included. 1 without a story
alsoCoveredBy The story’s other items you can see, oldest first: { itemId, title, url, sourceTitle, publishedAt }
storySplit You split the item from its story

In the For you order, rank.story is the story’s part in points.

Not yet

  • Embeddings. The shortlist uses title words, which finds stories that share names. A story told in other words (“CEO steps down” against “leadership change”) isn’t a candidate. Embeddings would find those; the provider choice is still open.
  • New developments. jev’s reference command also asks whether an item is a new development or adds facts (development, addition). The story timeline (SI-553) would use them; for now every item of a story counts the same.
  • Hidden video kinds. A story’s earliest item is chosen without the Shorts and live-stream setting, so a hidden Short can stand for a story. Stories of videos are rare.
  • A gate rerun. When the gate is run again and changes its verdict, the story’s card follows at once (it’s chosen when the stream is read), but the item doesn’t get a dedupe check it skipped before.