Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit f779978dbb85578adf3ac2a58b74cfb60a00126e
parent 1b6aaf57d191781788efd0bd0a9836c288cabf9a
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 18 Nov 2026 02:05:33 -0500

x-trending: OPERATING, the changelog and the plan say what slice 2 does

Judge, keep and watch a library in OPERATING (with the jar rule said plainly: a watch does not cover a night nobody presses Refresh in), the editor's changelog, and the feature brief's slice 2 as built.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
MOPERATING.md | 67++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Meditor/CHANGELOG.md | 22++++++++++++++++++++++
Mplans/x-trending.md | 48++++++++++++++++++++++++++++++++----------------
3 files changed, 120 insertions(+), 17 deletions(-)

diff --git a/OPERATING.md b/OPERATING.md @@ -628,6 +628,9 @@ pnpm ops read-x-trending --json '{"slug":"trending","url":"https://x.com/i/trend pnpm ops read-x-trending --json '{"slug":"trending","url":"https://x.com/i/trending/1900000000000000001","topic":"Kettle festival"}' --wait pnpm ops read-x-trending --json '{"slug":"trending","reparse":"tr-01JA0000000000000000000000"}' --wait pnpm ops get trending trending --topic kettle-festival --limit 50 +pnpm ops judge-trending --json '{"slug":"trending","set":[{"id":"1900000000000001001","state":"keep","note":"the opening"}]}' +pnpm ops watch-trending --json '{"slug":"trending","topic":"kettle-festival","on":true,"intervalMinutes":30,"hours":48}' +pnpm ops watch-trending --json '{"slug":"trending","topic":"kettle-festival","on":false}' ``` - **X trending library** in the New channel form's Platform (`"platform": "x-trending"`) makes a private posts @@ -675,7 +678,8 @@ pnpm ops get trending trending --topic kettle-festival --limit 50 `reparse-x-trending` job: X is asked nothing, so it needs no fresh jar. `read.json` is written when a read starts and again when it ends, so any capture can be parsed again; one left with its answers and no record takes `"url"` beside `"reparse"` to say which page it was. A read that is still queued or running is not - reparsed: ask once it has finished. + reparsed: ask once it has finished. The job asks again when it starts, and parses nothing if the read is + running by then. - **How a read ends**, in the job's last line (`@@read-x-trending {…, "sentence"}`): - `Read …: N posts on the page, M new, in topic "…"`. - `Read saved, nothing recognised: …`: the answers held no post the parser knows. Not a failure, no X alert; the @@ -700,6 +704,67 @@ pnpm ops get trending trending --topic kettle-festival --limit 50 sentence. Which job is X's is decided by its channel's platform, not by the queue it was put on; a capture that takes no screenshot (`"shots": false`, and neither the avatars nor the context alone) opens no browser, so it neither blocks a press nor is blocked by one. Refresh the cookies first, then read. +- **A browser that will not close is killed, by its own pid.** The pid is the one Chromium wrote into the + profile's `SingletonLock`, and it is signalled only when that process's command line names this exact profile + directory. Anywhere but Linux, or when that check does not hold, nothing is killed: the browser is closed again + and the job's log says why. + +### Judge, keep and watch a library + +- **Judge a post**: **Keep / Drop / Later** under each post on the library's page (the operator), or + `judge-trending` (`"by": "agent"` unless told `"operator"`). `"state"` is `keep`, `drop`, `later`, or + `undecided`, which removes the judgement: a post with none is undecided. `"thread": "<root post id>"` judges a + whole thread (`get trending` gives each post's `thread`); a post's own judgement comes before its thread's. + Judgements are in `channels/<slug>/trending/judgements.json`, with who decided, when and the note. +- **An agent's judgement is a suggestion.** An agent's write over a judgement the operator made is skipped for + that id and named in `skipped`; the rest of the ask is written. The operator overturns anything. +- **Keep archives the post.** The posts that became keep go into one `capture-posts` job on X's queue: a + screenshot, the post's context, a reply's thread shot, and its media. `"archive": false` marks only. If the + capture is refused (a stale jar, the X alert, X cooling down) the judgement is written all the same and + `archive.error` says why; `capture-posts {"slug", "ids", "thread": true, "keptMedia": true}` archives them later. +- **Drop deletes nothing.** The post, its capture and its media stay, and a later keep puts it back. Nothing in + this release removes a capture. +- **A library's media comes from X's media CDN and is kept once.** The saved capture of the read that showed a + post names where the CDN serves its files, so the capture job asks the CDN for them: no login, no page, one file + after another 1–2 s apart, under X's 15-minute cooldown. Only `pbs.twimg.com` and `video.twimg.com` are ever + asked. Each file is stored once, by its SHA-256, in `channels/<slug>/trending/media-store/`, with a hardlink at + `trending/posts-media/<id>/<name>` and an entry in `trending/media-index.json`. The same bytes on two posts, or + in two topics, are one file; an address the library has seen is linked without a fetch. Exact duplicates only: + the same video at another quality is another file. +- **What is owed.** A job fetches at most 40 files or 200 MB; the rest is owed and the next capture of those posts + asks again. For a post nobody has kept, a file over `maxVideoMb` (100 MB) is not fetched and is owed until the + post is kept, as is a file the capture names no CDN address for. A kept post has no per-file cap, and a file the + CDN cannot serve is downloaded the logged-in way. `get trending` shows each post's `capture` and `mediaOwed`. +- **How the CDN can refuse.** A 429 stops the job at once and leaves X alone for 15 minutes. A 403 or a 404 + marks that file and the job moves on. Nothing retries by itself. +- **The media is not in the media tier and is never committed.** No posts channel's `posts-media/` is tiered, + and a library's is not either: it stays on the corpus disk beside the library's text. `trending/.gitignore` + keeps `posts-media/` and `media-store/` out of the corpus's git repo. +- **Watch a topic**: **Watch** on the topic (the operator) or `watch-trending {"slug", "topic", "on": true}`. + The topic's trending page is read again every `intervalMinutes` (15–1440, default 30) until `hours` from now + (1–168, default 48), each tick the same single `read-x-trending` job. The editor scans once a minute and starts + at most one read per scan, the watch longest overdue, and none while a read or capture of that library is + queued or running. X's 5-minute gap between jobs applies, and a tick is a read and then a capture, so four + watched topics at 30 minutes run closer to every 40. A topic of several trending pages reads one page per + tick, in turn. At most 4 topics of a library are watched at once. +- **A watch runs only while X's cookie jar is under its limit (60 minutes).** The editor never refreshes the jar + by itself, because a refresh is a visit to X. When the jar goes stale the watch pauses: nothing is queued, X's + jar-age banner goes up on the dashboard and /cookies, and **/review** lists the paused watches. It resumes at + the first scan after **Refresh cookies** on /cookies. So a watch does not cover a night nobody presses Refresh + in. The X alert, X cooling down after a rate limit and a missing profile pause it the same way. +- **New posts of a watched topic get their media at once.** After a read into a watched topic, one capture job + takes the read's new posts: their media only, from the CDN, with no page opened. `"shots": true` (**Screenshot + everything new**) also screenshots each new post, a page load apiece. +- **Gone from the page.** A post a page showed before and does not show at a read that reached the page's end is + recorded `gone` with that read's time, and shown as "Gone from the page at …". It is not called deleted: a + trending page is a ranked list, and a post leaves it by being outranked too. A read that stopped at a cap, was + cancelled or failed says nothing. A post shown again is no longer gone, and the absence is kept as history. +- **A watch ends** at its end time, when it is switched off, or when X no longer has the topic's last trending + page (trending pages expire); each with a sentence in `get trending` (`watch.sentence`). +- **The library's settings**: `watch-trending {"slug", "settings": {"maxVideoMb", "intervalMinutes", "hours", + "maxTopics"}}`. `{"slug", "tick": true}` runs one scan now. +- **A restart.** A tick left queued when the editor stops is cancelled; the scan starts another at its next pass, + jar permitting. `ARCHILYZER_IDLE_BOOT` does not arm the scan at all. ## Transcribe diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,28 @@ # Changelog ## [Unreleased] +- **A trending library can be judged, archived and watched.** + - **Keep / Drop / Later** under each post on a library's page, or `pnpm ops judge-trending`. A thread can be + judged by its root post. An agent's judgement never replaces the operator's: it is skipped for that post and + reported. Drop deletes nothing. + - Keep archives the post: one capture job takes a screenshot, the post's context, a reply's thread shot and its + media. + - A library's media comes from X's media CDN, with no login and one file at a time, and each file is stored + once however many posts or topics carry it (`trending/media-store/`, hardlinked per post). A job fetches at + most 40 files or 200 MB; a file over 100 MB waits until its post is kept. A rate limit from the CDN stops the + job and leaves X alone for 15 minutes. + - **Watch** on a topic, or `pnpm ops watch-trending`: the topic's trending page is read again every 30 minutes + for 48 hours (both adjustable; at most 4 topics a library), and the media of new posts is fetched at once. + "Screenshot everything new" is per topic. + - **A watch runs only while X's cookie jar is under 60 minutes old.** The editor does not refresh the jar by + itself, so a watch pauses when the jar goes stale and resumes after Refresh cookies on /cookies. It does not + cover a night nobody refreshes in. /review lists paused watches. + - A post a trending page stops showing is marked "Gone from the page at …". That is not a claim it was deleted. + - A browser that will not close is now killed by its process id, checked against the profile it holds. + - `pnpm ops get trending` and the MCP's `x_trending_topics` / `x_trending_posts` show each topic's watch and each + post's thread, judgement, capture and gone mark. + - Everything this adds stays private: `trending/.gitignore` keeps the media out of the corpus's git repo, and no + site, build, report or video project is given a judgement, a capture or a watch. - **X trending pages can be read into a private library.** A new kind of channel, **X trending library** in the New channel form's Platform (`"platform": "x-trending"`), holds the posts X's trending pages (`x.com/i/trending/…`) show, grouped into your topics. Read one page with **Read a trending page** on the library's channel page, or diff --git a/plans/x-trending.md b/plans/x-trending.md @@ -116,22 +116,38 @@ These are rulings, not reasons. A later ruling overturns an earlier one only whe - **Looking.** `pnpm ops get trending <slug>` and the MCP tools `x_trending_topics` / `x_trending_posts`. -## Slice 2: keep posts, save media once, watch a topic - -- `judge-trending` writes `trending/judgements.json` through one writer; a keep enqueues the existing - `capture-posts` job for that post (media, screenshot, context, thread shot). -- `capture-posts` takes a posts root, so a library's captures land in `trending/posts-media/<id>/` and - its availability in `trending/posts-availability.json`. -- Media: fetched from the CDN addresses in the saved capture inside the capture job (on X's queue, files - 1 to 2 s apart, the cooldown checked between posts), hashed, and kept once in - `trending/media-store/<aa>/<sha256>.<ext>` with a hardlink at `posts-media/<id>/<name>`; - `trending/media-index.json` maps hash → bytes, source addresses and posts. `trending/.gitignore` - keeps both directories out of the corpus repo. -- `watch-trending` and the watch scan (`common/controller/xTrendingWatch.ts`); "gone from the page" - marks; the jar pause with X's jar-age alert and a "Paused watches" section on /review. -- A hung browser is killed by pid (the profile's `SingletonLock`, checked against the process's command - line; never a pid that does not name that exact profile directory). A reparse refuses inside the job - while the read is still running. +## Slice 2, as built + +- **`judge-trending`** (`common/lib/xTrending/judgements.ts`, the one writer of `trending/judgements.json`): + per post or per thread, with who decided, when and a note. The listing gives each post's `thread` and its + own judgement, else its thread's. A keep starts one `capture-posts` job for the posts that became keep. +- **`capture-posts` on a library** (`common/controller/capturePosts.ts`): by the marker alone, the archive + check, the captures (`trending/posts-media/<id>/`) and the availability sidecar + (`trending/posts-availability.json`) are rooted under `trending/`. `keptMedia` is refused for a post that + is not kept. +- **Media** (`common/social/xTrendingMedia.ts`, `common/lib/xTrending/mediaStore.ts`): the parser reads + each post's CDN addresses from the saved capture (`mediaSourcesOf`, X's two media hosts only); the capture + job's media half fetches them with no login, 1 to 2 s apart, under the cooldown, a per-file cap and the + job's budget; each file is a hardlink to its blob in `trending/media-store/<aa>/<sha256>.<ext>`, and + `trending/media-index.json` maps hash to bytes, addresses and posts, and remembers addresses found over + the cap. A media half says whether it is owed to the next capture or until the post is kept. + `removeXTrendingPostCapture` removes a capture and only the blobs nothing else links to; no door calls it. +- **Watch** (`common/lib/xTrending/watch.ts`, `common/controller/xTrendingWatch.ts`): `trending/watch.json`, + `watch-trending`, a scan on its own timer armed below the idle gate, at most one read per scan, pauses + with a reason when X would refuse, the jar never refreshed. A read's end tells the watch + (`noteXTrendingWatchRead`) and queues one capture for a watched topic's new posts + (`xTrendingWatchFollowUp`). `gone` marks are written by `recordXTrendingRead` for a read that reached the + page's end. +- **/review** lists paused watches (`common/views/review.ts` `pausedWatchRows`). +- **The kill** (`common/social/profileBrowserPid.ts`) and the reparse's refusal inside its job. +- **Pins.** `common/bin/xTrendingPrivacy.test.ts`, `common/publish/xTrendingReportDoor.test.ts`, + `mcp/src/xTrendingPrivacy.test.ts` and `umtool/lib/report/xTrendingLibrary.test.mjs` plant a kept, + captured and watched post (`common/lib/xTrending/__fixtures__/slice2Library.ts`) and look for it in what + each door gives out. + +**Left for later slices.** The purge door (button and `pnpm ops` twin). The library's settings have no form: +`watch-trending {"settings"}` sets them. A watched topic's media that failed (a 403, a 404) is not asked for +again by the watch; keeping the post asks again. ## Slice 3: the judge view