Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 KiB
Feeds: an RSS/Atom reader agent
Status
Proposed. Phase 0, the fetch-and-parse layer, is built (for podcasts first; §2.1); nothing above it is.
Goal
A new agent — Feeds (AgentId::Feeds, slug feeds) — that subscribes to
arbitrary RSS/Atom/JSON feeds by URL, refreshes them in the background, and
presents their items as a read/unread river across every node in the ensemble.
Read state, starred state, and the subscription list follow the user, not the
device: mark an article read on the phone, and it is read on the laptop.
This is the concrete instance of a thing AGENTS.md's project overview already
names as a target: "which Twitter/X/BlueSky/Mastodon feeds have I read and/or
archived". Getting the read-state and item-identity model right here is the
part that generalises to those.
Non-goals (for this plan)
- A rendering engine for article HTML. Items render as cleaned plain text
via the existing
html2textpath. A real HTML/rich-text renderer is a separate, much larger piece of work — the Notes agent's markup IR (docs/notes-markup-rendering.md) is the natural place for it to land later, not here. - Full-text article extraction (Readability-style fetching of the linked
page when a feed only ships a summary). Deferred; the design leaves room for
it as a blob-backed artifact on
FeedItem. - Offline article snapshots. No
PrimaryContentblob onFeedItemin this plan, therefore no sync-policy row for the type (see §3.4). - Rewriting the podcast agent. Phase 6 sketches the convergence, but the reader must not be blocked on it.
1. What actually exists to reuse (and what doesn't)
The obvious assumption — "podcasts already do RSS, so parsing is done" — is wrong, and the plan depends on knowing that up front.
When this plan was written, the Podcasts agent never parsed a feed: it called
the keyed Podcast Index JSON API and keyed subscriptions by the directory's
numeric feed id. That changed with docs/podcasts-from-rss.md — podcasts now
read their own feeds through agents::feeds, which is this plan's phase 0 —
so the table below is what there is to reuse today.
So the reuse is real but it is not the parser:
| Reusable today | Where | How it's used here |
|---|---|---|
| TLS-pinned HTTP clients | crate::http::{build_async_client, build_blocking_client} |
Feed fetches. Uses webpki roots deliberately, because the platform verifier spuriously fails on Android — do not hand-roll a reqwest::Client. |
| HTML → text | podcast::clean_html_text (html2text) |
Rendering item bodies and feed descriptions. Move it to a shared home (§2.3). |
| Feed → item document shape | PodcastFeed (root doc) → PodcastEpisode (children), dedup on an external id property, LastFetchedAt on the parent |
Directly mirrored by Feed → FeedItem. |
| Batched property projection | podcast::list_podcast_feeds — one list_documents_by_type + one list_properties_for_documents, never a query per property |
The template for every projection in §4. |
Cover art as Thumbnail |
ffi.rs::store_podcast_cover_art writes a blob-backed ArtifactKind::Thumbnail |
Feed site icons, byte-for-byte the same path. |
| The agent screen skeleton | gui-app/src/agents/podcasts/ — mod.rs tabs + detail.rs + row/card components, using components::tabs::{tab_bar, tab_pill} |
The Feeds screen's structure (§6.1). |
| Deterministic document ids | documents::derived_id — the one helper every derivation goes through; podcast::episode_document_id is the closest existing shape |
The item-identity scheme in §3.3, which is the load-bearing decision in this design. |
The reuse direction is inverted from what the premise suggests. We build a
real feed fetch/parse module for the reader, and the podcast agent is the
candidate to adopt it later (phase 6), reading the PodcastFeedRssUrl it
already stores.
2. Layer 1: fetching and parsing
2.1 Built: agents::feeds::{parse, fetch}
Phase 0 landed first for podcasts (docs/podcasts-from-rss.md phase A). The
types and their reasoning are in the module docs; what this plan needs to know:
- The parser is the
rsscrate, notfeed-rsas first proposed. feed-rs 3.0 drops every element in a namespace it doesn't model, and fails the whole feed when apodcast:personhas a role or group outside its fixed list;rsskeeps unfamiliar elements and rejects nothing over one. It appears only inparse::parse, which adapts into our ownParsedFeed(aFeedChannelplusParsedItems). - Every namespaced element is kept as an
ExtensionElement— namespace URI, local name, attributes, text, children — on the channel or the item.content:encodedanddc:creatorare read intocontent_html/author;media:thumbnailand the rest are there to read withparse::find. - The guid fallback (§2.3) is
parse::item_guid: guid, then link, then blake3 of the title and the<pubDate>text, so a change to date parsing can never re-identify an item. A guid repeated within a feed keeps the first item. - Dates are RFC 2822 or RFC 3339, ignoring a weekday that disagrees with
the date; anything else is
None, never an error. - RSS only so far. Atom and JSON Feed parse to
FeedParseError::NotRss. Reading them is phase 1 work for this plan: adaptatom_syndication(thersscrate's sibling) and a serde JSON Feed reader into the sameParsedFeed, so nothing above the parser changes. fetch::fetchtakes the caller'sFetchLimits(body cap after decompression, total timeout) — this plan's 2 MiB / 30 s, not podcasts' — sends storedValidators, negotiates gzip, and reports the post-redirect URL. Whether a redirect was permanent is not known from it yet; telling a moved feed from a temporary redirect needs a redirect policy on the client.- The
html2texthelper moved tofeeds::html_to_text, as planned.
2.2 Module layout
rust/lib/src/agents/feeds/
mod.rs -- html_to_text; agent-level store operations + projections (§4) to come
parse.rs -- ParsedFeed/ParsedItem/ExtensionElement + the rss adapter
fetch.rs -- HTTP: conditional GET, redirects, size caps, errors
Parser tests write their feeds inline; fetch tests serve from a local axum.
Real-feed fixtures live with the agent that reads them
(agents/podcast/fixtures/).
2.3 The guid fallback
Item identity is the decision §3.3 rests on, so the order is worth restating:
<guid> (Atom <id>, once Atom is read), trimmed, when non-empty; the item
link; and as a last resort a hash of title and date-as-written. The last is
deterministic rather than random because two nodes parsing the same fetched
bytes must produce the same guid.
2.4 Fetch behavior
Refresh runs unattended against arbitrary third-party URLs, so the size cap is
not optional — an unbounded read is a trivial way to OOM a phone. The reader's
limits are 2 MiB and 30 s, as a const FetchLimits in the agent.
No unwrap/expect, and no catch_unwind-around-everything wrapper of the
kind podcast::search_podcasts uses — that pattern papers over panics instead
of removing them, and there is no reason to introduce a new instance of it.
3. Layer 2: the data model
Follows docs/data-model.md; that file gets new Feed and FeedItem sections
as part of this work.
3.1 Two new DocumentTypes
Feed {
properties:
title: String [LastWriteWins] -- Title kind (shared)
feed_url: String [LastWriteWins] -- FeedUrl; the XML URL, and the dedup key
site_url: String [LastWriteWins] -- FeedSiteUrl (optional)
description: String [LastWriteWins] -- FeedDescription (optional)
icon_url: String [LastWriteWins] -- FeedIconUrl (optional)
last_fetched_at: Timestamp [LastWriteWins] -- FeedLastFetchedAt
blob-backed artifacts:
icon: image/* (optional) -- Thumbnail kind
}
FeedItem {
properties:
guid: String [Immutable] -- FeedItemGuid; identity, §3.3
title: String [LastWriteWins] -- Title kind (shared)
link: String [Immutable] -- FeedItemLink
author: String [LastWriteWins] -- FeedItemAuthor (optional)
published_at: Timestamp [Immutable] -- FeedItemPubDate
artifacts:
content: FeedItemContent [LastWriteWins] -- FeedItemContent kind [Singleton]
read: ReadState [LastWriteWins] -- ReadState kind [Singleton]
starred: bool [LastWriteWins] -- Starred kind [Singleton]
}
Feed documents are roots, or children of a plain Collection when the user
groups them into folders. Collection already satisfies this — is_container()
is true for it and it takes children of any type — so folders need no new
type, and OPML <outline> groups map straight onto it (phase 5).
Children of a Feed are FeedItems. Deleting the feed deletes them, via the
tree's existing ownership semantics (delete_recursive).
Notes on specific kinds:
Titleis the shared generic kind for both types, notFeedTitle/FeedItemTitle. It passesdata-model.md's test for generalizing aPropertyKind: every consumer agrees onPropertyValue::TextandLastWriteWins.- Item titles are
LastWriteWins, unlikePodcastEpisodeTitle(which isImmutable). This is a deliberate divergence, not an oversight: publishers routinely correct article headlines and re-publish under the same guid, and a reader that shows the stale headline forever is visibly wrong. A podcast episode's title is tied to a fixed published audio artifact; an article's is not.guid,link, andpublished_atstayImmutable— those are the "immutable facts about origin" the terminology table describes. FeedUrlisLastWriteWins, notImmutable, so a permanent redirect (§2.4) can rewrite it.
3.2 Item content is an Artifact, and stays raw HTML
By data-model.md's Property-vs-Artifact test — "would a node missing this
value be in an error state, or is absence normal?" — the body is unambiguously
an Artifact. A node that has the item's title and date but not yet its body is
in a perfectly normal not-yet-synced state, and the body is content, not
infrastructure.
ArtifactKind::FeedItemContent, // Singleton, Storage::Inline, LastWriteWins
pub struct FeedItemContent {
/// The body exactly as the feed shipped it.
pub html: String,
/// Whether `html` came from a summary field rather than full content.
pub is_summary: bool,
}
Stored raw, cleaned at display time via clean_html_text. The podcast agent
does the opposite (cleans at fetch, stores text), which is a lossy one-way door:
once a real HTML renderer exists, every stored podcast description has already
had its links and structure destroyed. Cleaning at display costs an html2text
pass per item opened, which is cheap and cacheable in the view.
Security note. Storing raw third-party HTML is safe only because nothing
renders it as HTML — clean_html_text produces plain text. The day any modality
puts a feed body into a WebView or an HTML renderer, sanitization (ammonia or
equivalent) becomes mandatory, and stripping <script>, event handlers, and
remote-image tracking pixels is table stakes. This constraint belongs in a
comment on FeedItemContent so it isn't rediscovered the hard way.
3.3 Item identity: deterministic ids for items, random ids for feeds
This is the decision the design hinges on. Every node in the ensemble
refreshes feeds independently — there is no leader election, and adding one for
this would be a large detour. So two nodes will routinely fetch the same feed
before syncing. If each creates a fresh v4 DocumentID per item, then after
sync the ensemble holds two of every article, forever, with independent read
state. Dedup after the fact means matching on (parent, guid) and tombstoning
losers on every refresh — a permanent background chore that is wrong in exactly
the cases (concurrent writes, partial sync) it most needs to be right.
The fix already exists in this codebase, and the Podcasts agent is now the
worked example: podcast::episode_document_id derives an episode's id from
(feed document, item guid) through the shared documents::derived_id
helper, so independent nodes converge on one document with no coordination.
Feeds is the same shape under its own Domain:
pub fn feed_item_document_id(feed_id: &DocumentID, guid: &str) -> DocumentID {
DerivedKey::new(Domain::FeedItem).part(feed_id).part(guid).document_id()
}
A new Domain variant is the whole of it — the namespace, the separator, and
the canonicalization are the helper's, not this agent's (see
docs/data-model.md, "Derived ids, and why they must be frozen"). Created with
Document::with_id and Provenance::Syndicated, which exist for precisely
this.
Feed documents keep random v4 ids. The asymmetry is intentional, and the
reason is tombstones. A tombstone is permanent — sync's resurrection guard skips
a tombstoned id forever. If a feed's id were uuidv5(feed_url), then
unsubscribe → resubscribe to the same URL would derive an id the ensemble has
already permanently killed, and the feed could never be added again. Subscribing
is a rare, explicit, user-initiated act, so the concurrent-creation window is
small; a v4 id makes unsubscribe-as-tombstone correct, which is the behavior
that actually matters (unsubscribing on one node must not be undone by a peer
that still has the feed).
Two consequences to accept explicitly:
- Duplicate feeds are possible but bounded. If two nodes subscribe to the
same URL before syncing, the ensemble gets two
Feeddocuments (and, since item ids are namespaced by feed id, two item sets). A dedup pass — groupFeeddocuments by canonicalFeedUrl, keep the lowest id, tombstone the losers' subtrees — resolves it. Run it at the start of each refresh-all pass; it is a cheap grouped query, not a per-item scan. Phase 3. - Item tombstones are permanent, which is what retention wants. Retention (§5.3) tombstones items dropped from the feed; because their ids are deterministic, they can never come back while the subscription lives. That is the desired meaning of retention. A user wanting a clean re-fetch unsubscribes and resubscribes, which mints a fresh v4 feed id and therefore a fresh item id namespace — so the escape hatch works.
Canonicalizing FeedUrl (lowercase scheme+host, strip default port, strip
fragment, strip a trailing / on an empty path — but do not touch query
strings, which many feeds use meaningfully) happens once at subscribe time and
is stored canonical, so the dedup grouping is a plain string comparison.
3.4 Neither new type is hidden, and neither has blob content
-
Neither is hidden from listings. This was written against
DocumentType::is_derived(), one boolean answering three questions at once; ADR 0038 has since split it intoProvenance, and the variant this design wants exists:Provenance::Syndicated— deterministic id, listed, never tombstoned.FeedkeepsProvenance::User(§3.3: v4 id, purgeable, so unsubscribe-as-tombstone stays correct);FeedItemgetsSyndicated.One thing that section wanted is not on offer and should not be: feed items are not purgeable. Every deterministic id is un-purgeable, because a document tombstone is permanent and purging one would poison that id ensemble-wide. §3.3 argues the same point from the other side and concludes permanence is what retention wants, so the two paragraphs were already disagreeing; this is the resolution.
Do revisit whether
FeedItemshould be excluded from the default document listing by some other means — a few thousand items would swamp the Documents agent's list.SearchParamsgaining a type-exclusion is a smaller change than hiding them by provenance, and the Documents agent's existing type filter already lets a user narrow to them deliberately. -
has_blob_content()staysfalsefor both.Feed's only blob is aThumbnail, which the method's doc comment explicitly excludes (thumbnails sync eagerly regardless of policy).FeedItemhas no blob content in this plan. So neither type gets a row in the Sync policy tab — correct, since there would be nothing for a policy to govern. This changes the day offline article snapshots land asPrimaryContent.
3.5 Read and starred state are two artifacts, not one struct
ArtifactKind::ReadState, // Singleton, Inline, LastWriteWins
ArtifactKind::Starred, // Singleton, Inline, LastWriteWins
pub struct ReadState { pub read: bool, pub read_at: Option<Timestamp> }
// ArtifactValue::Starred(bool)
Bundling them into one LWW value would mean marking an item read on the phone
while starring it on the laptop loses one of the two edits. This is the same
reasoning data-model.md records for splitting PDF reading_position from
bookmarks ("the previous bundled ReadingState had exactly that flaw") — the
precedent is in the tree, already paid for once.
Absence of a ReadState artifact means unread. Unread is the overwhelmingly
common case, so this keeps the row count proportional to items the user actually
touched rather than to items fetched.
Unread counts are always derived, never stored. A stored count is a counter,
counters need CRDT semantics none of the three Property merge strategies
provide, and a LastWriteWins count would silently drift on every concurrent
mark-read. Count with a single grouped query over ReadState artifacts per feed
(§4).
3.6 Exhaustive-match sites to update
Adding two DocumentType variants and four artifact kinds touches these; the
compiler finds all the Rust ones, but the Kotlin string maps are silent:
lib/src/documents/document.rs—display_name,is_derived,is_container,has_blob_content(type_name/allcome free fromstrum).lib/src/documents/property.rs— the newPropertyKindvariants and theirmerge_strategyarms.lib/src/documents/artifact.rs— newArtifactKind/ArtifactValuevariants, plusarity,storage,merge_strategy, and the value→kind mapping.lib/src/ffi.rsandgui-app/src/agents/documents/document_detail.rsandsyn-daemon/src/commands.rs— each matchesArtifactValueto render a human-readable summary; all three need arms for the new kinds.gui-app/src/agents/documents/mod.rs— the three-letter type badge ("FEED"/"ITEM").android/.../documents/ui/DocumentList.kt— thedocTypestring → iconwhen(string-keyed, so no compiler help; add"feed","feed_item").lib/src/agents/mod.rs—AgentId::Feeds, its slug, and itsAgentRegistryentry (display_name: "Feeds",description: "Read RSS and Atom feeds",AgentType::Activity).gui-app/src/agent_sidebar.rsandgui-app/src/app.rs— icon and view routing;android/.../agents/Agent.ktandMainActivity.kt— the same two for Android (Icons.Default.RssFeed).- A new
rss.svgingui-app/assets/icons/(Lucide, matching the rest) plus anIcon::Rssentry in theicons!macro.
4. Layer 3: store operations, in lib, shared by every frontend
docs/data-model.md's "Where an agent's properties are read and written" is the
rule this section applies. It was written when podcasts was the offender and
comics the pattern done right: one shared projection in agents::comics, called
by both frontends.
Podcasts has since been consolidated (2026-08-09), so it is now a second
reference rather than the counter-example: agents::podcast owns the feed
projection (list_podcast_feeds, find_feed_by_url), the feed write path
(subscribe, and speed for what a podcast plays at), and both episode paths
(list_feed_episodes, ensure_episode_document); ffi.rs and gui-app only map
into their own view types.
Worth knowing what the duplication actually cost before it was closed, since
that is the argument for doing this on day one rather than later:
ffi.rs::subscribe_to_podcast and gui-app's subscribe wrote the same six
properties with the same guards, and had silently diverged — only the FFI
copy recorded the new document as present in the node-document index, so a
feed subscribed on desktop was invisible to it. Nothing detected that; it was
found by reading the two side by side. Consolidating also let the subscribe
write and its presence record share one transaction, which neither copy did.
Feeds follows comics from day one. Every function below lives in
agents::feeds and returns a shared struct; ffi.rs and gui-app map those
into their own view types and contain no property-reading logic of their own.
/// Projection of a Feed document, batched: one list_documents_by_type plus one
/// list_properties_for_documents — never a query per property.
pub struct FeedSummary {
pub document_id: DocumentID,
pub feed_url: String,
pub title: String,
pub site_url: Option<String>,
pub description: String,
pub icon_url: Option<String>,
pub last_fetched_at: Option<Timestamp>,
pub unread_count: usize,
pub item_count: usize,
}
pub struct FeedItemSummary {
pub document_id: DocumentID,
pub feed_id: DocumentID,
pub guid: String,
pub title: String,
pub link: Option<String>,
pub author: Option<String>,
pub published_at: Option<Timestamp>,
pub read: bool,
pub starred: bool,
}
pub fn list_feeds(store: &Store) -> Result<Vec<FeedSummary>, FeedError>;
/// Items of one feed, newest first. `unread_only` filters at the query level.
pub fn list_feed_items(store: &Store, feed_id: &DocumentID, unread_only: bool)
-> Result<Vec<FeedItemSummary>, FeedError>;
/// The cross-feed river, newest first, paged.
pub fn list_all_items(store: &Store, unread_only: bool, limit: usize, before: Option<Timestamp>)
-> Result<Vec<FeedItemSummary>, FeedError>;
/// Subscribe by URL: fetch once to validate and to learn the feed's title, then
/// create the Feed document and write its first batch of items.
pub async fn subscribe(store: &Store, node: NodePubkey, url: &str)
-> Result<DocumentID, FeedError>;
pub fn unsubscribe(store: &Store, feed_id: &DocumentID) -> Result<(), FeedError>;
/// Fetch and reconcile one feed. Idempotent: refreshing twice in a row with an
/// unchanged feed writes nothing and returns zeroes.
pub async fn refresh_feed(store: &Store, node: NodePubkey, feed_id: &DocumentID)
-> Result<RefreshOutcome, FeedError>;
pub struct RefreshOutcome { pub new_items: usize, pub updated_items: usize }
pub fn set_read(store: &Store, node: NodePubkey, item_id: &DocumentID, read: bool)
-> Result<(), FeedError>;
pub fn set_starred(store: &Store, node: NodePubkey, item_id: &DocumentID, starred: bool)
-> Result<(), FeedError>;
pub fn mark_feed_read(store: &Store, node: NodePubkey, feed_id: &DocumentID)
-> Result<usize, FeedError>;
/// The item body, cleaned to plain text for display. Returns None when the
/// content artifact hasn't synced to this node yet — a normal state, not an error.
pub fn item_body_text(store: &Store, item_id: &DocumentID) -> Result<Option<String>, FeedError>;
refresh_feed's reconciliation, stated precisely because this is where
duplicates and write amplification come from:
- Fetch + parse →
ParsedFeed. - Load existing children once (
list_children+ onelist_properties_for_documents) into aHashMap<guid, DocumentID>. - For each parsed item, compute
feed_item_document_id(feed_id, guid).- Not present, and not tombstoned → create the document with that id,
write its properties, write the
FeedItemContentartifact. - Not present, but tombstoned → skip. Retention already dropped it
deliberately;
is_tombstonedis the check. - Present → compare title/author/content against stored values and write
only the ones that changed. An unchanged refresh must produce zero
writes: every write bumps
modified_atand enqueues sync work, so a naive rewrite-everything refresh turns a quiet hourly poll into ensemble-wide sync churn.
- Not present, and not tombstoned → create the document with that id,
write its properties, write the
- Write
FeedLastFetchedAt, andTitle/FeedSiteUrl/FeedIconUrlif the feed's own metadata changed.
5. Refresh scheduling
5.1 A Feeds pass is not a sync pass
scheduler::run_all_passes is deliberately scoped to the sync planes, and its
module doc states it "has no opinion about when it should run beyond what its
caller decides." Feed refresh is not sync — it is an agent reaching out to the
public internet — and folding it into the sync scheduler conflates two things
that fail, retry, and get configured differently.
Instead: agents::feeds::refresh_due_feeds(store, node, now) -> Vec<RefreshOutcome>,
selecting feeds whose FeedLastFetchedAt is older than the refresh interval,
driven by the same caller that already drives run_all_passes (today
gui-app's timer). Feeds are refreshed sequentially with a small delay between
them, not concurrently — a reader with 200 subscriptions firing 200 simultaneous
requests on a phone radio is a battery and rate-limit problem, and the sync
scheduler's own per-peer sequential structure is the precedent.
Interval: a global default (30 minutes) as a new field on the per-node
Settings struct in SettingsStore. Per ADR 0018's dividing line, this is a
device-scoped choice — a phone on cellular and a home server should poll at
different rates — so it is SettingsStore, not AgentSettings. A per-feed
override (FeedRefreshIntervalMins, U32, LWW) is user-scoped and would be an
AgentSettings-adjacent property on the feed itself; defer it until asked for.
5.2 JobKind::FeedRefresh
Add one JobKind variant, display name "Feed refresh". Subject:
JobSubject::Document(feed_id) for one feed, JobSubject::None for a
refresh-all pass. This buys, for free, the exact behavior JobKind::BackgroundSync
documents: a user hammering the "Refresh" button dedups against the in-flight
scheduled pass rather than stacking N concurrent fetches, and the whole thing
shows up in the Jobs agent with progress like every other long-running
operation.
Conditional GET lands here too: FeedHttpEtag and FeedHttpLastModified as LWW
Text properties on the feed, sent as If-None-Match/If-Modified-Since, with
a 304 short-circuiting to RefreshOutcome::default(). These are synced
properties even though they describe this node's last fetch, which looks
wrong for about a second and then isn't: a node that receives a peer's validator
and gets a 304 has skipped a fetch whose items are already reaching it through
catalog sync, which is eager for properties and inline artifacts. The failure
mode is "fetched less often", not "missing data".
5.3 Retention
Unbounded growth is the default failure of every feed reader. Cap retained items
per feed (MAX_ITEMS_PER_FEED, 500) and drop by age (MAX_ITEM_AGE, 180 days),
whichever bites first, never dropping starred or unread items. Dropping is a
tombstone (§3.3), and the tombstone's permanence is the point. Run it at the end
of each refresh, in the same job.
6. Frontends
6.1 gui-app (gpui) — phase 2, the primary target
gui-app/src/agents/feeds/, mirroring the podcasts module's structure:
mod.rs -- FeedsView: header, tab bar, routing to sub-views
list.rs -- the item river (a virtualized list; a river is thousands of rows)
sidebar.rs -- subscription list with per-feed unread badges
reader.rs -- single-item view: title, byline, date, body text, "open original"
add_feed.rs -- URL entry + validation feedback
Tabs — components::tabs::{tab_bar, tab_pill}, per CLAUDE.md's cross-platform
iconicity rule, since these are sub-views within one screen, not app-level
destinations: Unread (default) / All / Starred. The subscription
sidebar sits alongside the list within the screen; selecting a feed scopes the
active tab to it.
Per CLAUDE.md's GUI conventions: named constants for spacing/color rather than
in-situ literals, functional subcomponents with meaningful names rather than one
long render, and copyable text elements. The item's link should use the
standard truncated-value-with-full-value-available component pattern the project
already applies to hashes.
Iterate with just check-gui-nix; just build-gui-nix only for final
verification. Ask the developer to run just gui and look at it — per
CLAUDE.md, do not attempt screenshot-based verification.
6.2 Android — phase 4
FeedsScreen.kt + a FeedsViewModel following the NavHost/ViewModel pattern in
ADR 0008, with a top-of-screen TabRow (not NavigationBar) carrying the same
three tabs. New uniffi surface on SyncNode in ffi.rs — list_feeds,
list_feed_items, subscribe_to_feed, unsubscribe_from_feed,
refresh_feed, set_item_read, set_item_starred, get_item_body — each a
thin call into agents::feeds, per §4.
Note for whoever picks this up: if just doctor reports no Android toolchain on
your machine, say so and stop rather than guessing whether the Kotlin compiles.
6.3 CLI/TUI — not in this plan
Podcasts has no CLI or daemon surface either. syn feeds list / syn feeds add <url> / syn feeds refresh would be genuinely useful on a headless node (which
is arguably the right place to run the refresh loop), but it needs daemon
protocol commands, so it is its own increment.
7. Testing
- Parser fixtures. Commit sample feeds under
agents/feeds/fixtures/, followingagents/comics_fixtures: an RSS 2.0 feed, an Atom feed, a JSON Feed, one withcontent:encoded+dc:creator, one with no<guid>on any item, one with three differently-broken dates, one with a CDATA-wrapped body.rstestcases assert the resultingParsedFeed. - Store-level tests with
test_support::{TestStore, initialized_store, test_node}, aslist_podcast_feeds_projects_stored_propertiesdoes:- Refresh twice against the same fixture →
new_itemsis zero the second time, and no propertymodified_atchanged. (The write-amplification guard.) - Two
Stores, both refreshed from the same fixture against the same feed document id → identical itemDocumentIDs. (The §3.3 convergence guarantee, which is the thing most worth a test.) - An item tombstoned by retention is not recreated by a later refresh that still lists it.
set_read/set_starredare independent: setting each on a differentStoreand merging loses neither.- Unread counts are correct with zero, some, and all items read.
- Refresh twice against the same fixture →
- No network in tests. Fetch-layer tests point at a local
axumserver, asfeeds::fetchandpodcast::cachedo. just unit-tests-rustfor the workspace;just lint-rust-nix(orjust lint-rustwhere the GUI's system libs exist), and read gui-app's warnings, which the workspace-root check never surfaces.
8. Phasing
Each phase is independently committable and leaves the tree working, per the
project's small-commit convention. Run just fmt-rust / just fmt-kotlin on
every commit.
| Phase | Content | Verifiable by |
|---|---|---|
| 0 | agents::feeds::{parse, fetch} + fixtures. No store, no UI, no enum changes. Built (RSS only; see §2.1). |
just unit-tests-rust |
| 1 | Atom and JSON Feed into ParsedFeed (§2.1). DocumentType::{Feed, FeedItem}, the new PropertyKinds/ArtifactKinds, all match sites in §3.6, agents::feeds's store ops and projections (§4). AgentId::Feeds in the registry. |
just unit-tests-rust, just lint-rust-nix |
| 2 | gui-app Feeds screen (§6.1): sidebar, river, reader, add-by-URL, mark read/starred, manual per-feed refresh. | just check-gui-nix, then developer runs just gui |
| 3 | JobKind::FeedRefresh, refresh_due_feeds, the refresh-interval setting, conditional GET, retention, the duplicate-feed dedup pass. |
tests + Jobs screen shows refresh jobs |
| 4 | Android: FFI surface + FeedsScreen/ViewModel + registry wiring. |
just gradlew build where the toolchain exists |
| 5 | OPML import/export, folders (Collection parents), feed icons as Thumbnail blobs, per-feed refresh override. |
tests + visual |
| 6 | Point the podcast agent's feed handling at agents::feeds::parse. No longer optional: planned in full in docs/podcasts-from-rss.md, which also needs a larger response cap than §2.4's. |
that plan's phases |
Phases 0–2 are the useful minimum: a working single-node reader. Phase 3 is what makes it pleasant, phase 4 what makes it an ensemble feature in practice.
9. Documentation to update alongside
docs/data-model.md—FeedandFeedItemsections, in the same shape asPodcastFeed/PodcastEpisode, plus the new artifact kinds.TODO.md— an### Feedssubsection under## Agents; note the phase-6 podcast convergence under### Podcast.- An ADR is probably warranted for §3.3 (deterministic ids decoupled from
is_derived, and the feed-vs-item asymmetry), since it establishes a pattern future agents that ingest external sources will copy, and the reasoning is not recoverable from the code. Write it if the decision survives implementation unchanged; otherwise this section is the record.
10. Open questions
- Should
FeedItembe excluded from the Documents agent's default listing? §3.4 argues yes, but not viais_derived. Wants a smallSearchParamschange; decide when the item count first gets uncomfortable rather than pre-emptively. Where should refresh actually run in a multi-node ensemble?Answered separately indocs/external-effects.md, which generalizes the question past Feeds to every agent that touches the network. Short version: because §3.3 makes item identity deterministic, "every node fetches" and "one node fetches" produce identical data, so coordination is a pure optimization that can be added without migrating anything. Feeds phase 3 should routerefresh_due_feedsthrough that document'sshould_run_here, keyedfeeds:refresh:<feed_id>, withFeedLastFetchedAtas the "last completed" input — it needs no new state because the property already exists. Phases 0–2 are unaffected and need not wait.- Full-text extraction for summary-only feeds. Would arrive as a
PrimaryContentblob onFeedItem, which flipshas_blob_content()to true and gives the type a sync-policy row. Noted so the eventual change is a known step, not a surprise.