# X trending pages, in a private library Lanes `lane/x-trending` (slice 1, merged 2026-11-17) and `lane/x-trending-2` (slice 2). This is the brief for the whole feature: what was asked, what is ruled, what slice 1 built, and what slices 2 to 4 are. ## The ask An agent operating Archilyzer (through `pnpm ops` and the MCP, with nobody in the loop if desired) looks through X's trending pages (`https://x.com/i/trending/`), archives the interesting threads and their media, stores each piece of media once however many posts or topics carry it, and organises what it found by topic. The operator then browses and judges the library, and nothing is on any site until a person publishes it. ## Rulings These are rulings, not reasons. A later ruling overturns an earlier one only when it says so. **Privacy** - A trending library is PRIVATE: on no site, in no build, export, index shard, `corpus.json`, `llms.txt` or remote MCP surface, until a deliberate publish step. Every publishing door refuses it by its marker. - No real person's, channel's or the operator's name or handle, no hostname, home path or real trending id, in code, fixtures, tests, docs or commit messages. Fixtures are invented. - The raw capture of a read is never committed and never served. **X safety** - All X traffic goes through the editor's X queue (`platform:twitter`), its pace, its hold and backoff, the X alert and the fresh-jar rule. One trending page read is ONE job. Never a burst. - A 429 stops the job at once and leaves X alone for 15 minutes: reads, captures, watch ticks and media fetches all honour that cooldown. Nothing retries by itself. - Development and tests use fixtures and the fake profile browser only. No test opens a socket. - The page reader MAY be the connected profile's Playwright browser. It reads the JSON the page itself fetches, never builds a request of its own, scrolls gently under a cap, and saves the raw capture so parsing never needs a second read. - THE JAR RULE STANDS FOR THE WATCH. The editor never refreshes X's cookie jar by itself: a refresh is a person's press on /cookies. A watch therefore runs only while the jar is under 60 minutes old. It pauses when the jar goes stale and resumes at the first scan after a Refresh, so **a watch does not cover the night unattended**. A tick that exports the profile's cookies itself is NOT built, not even behind a switch. **The library** - A topic is an entity inside the library, not a channel. The operator's topics may merge several trending pages and need not carry X's titles. - A read archives nothing: it lists posts. Media, a screenshot and thread context are fetched for posts marked keep, and for new posts of a watched topic (media at once; screenshots when the topic says so). - Every step is an editor job or action with a `pnpm ops` twin, and an MCP read tool where an agent needs to look. The UI works with no model. - Curated and corpus files have one writer each. A media file is removed with `removeMediaFile`. **Judging** - States are `keep | drop | later`. No entry means undecided; clearing a judgement removes the entry. - A judgement records who decided (`agent` or `operator`) and when, with an optional note. A thread can be judged too: its key is its root post's id, and a post's effective judgement is its own, else its thread's. - An agent's judgement is a suggestion. An agent's write never overrides an operator's: it is skipped for that id and reported. - WHICH JUDGEMENT IS IN FORCE is one rule, in one function (`xTrendingEffectiveJudgement`): the operator's entry, for the post or its thread, always outranks an agent's about the same post, whatever the order in time; between two entries of the same hand the post's own outranks its thread's. `by` is the caller's word: the ops route cannot tell who asks, so an agent is trusted to say "agent"; the operator's hand is the page's buttons and slice 3's judge view. - Drop deletes nothing and is reversible. Purging a dropped post's capture is the operator's press (slice 3). **Media** - Stored once, deduplicated by content hash across posts and topics. Exact duplicates only: the same video at another quality is another file. - The media CDN addresses already in the saved capture are preferred over logged-in page loads. The logged-in fallback runs only for posts marked keep. - Deleting a post never deletes media another post still uses. - Watch media includes videos up to a per-file cap (100 MB, `config.xTrending.maxVideoMb`); larger ones are owed until the post is kept. One capture job fetches at most 40 files or 200 MB; the rest is owed. - A library's media is not in the media tier (no posts channel's `posts-media/` is): it stays on the corpus disk, beside the library's text. **Watch** - A per-topic switch with an interval and an end time. Defaults: 30 minutes, 48 hours, at most 4 watched topics per library. Each tick is the same single read job. - A post seen before and absent from a read that reached the page's end is recorded as "gone from the page at