commit 893451fb3be46a5b8ecd28d9f04e6c515aeeb7c4
parent f3796b3c4ad879c278a888deda02076690a17b0c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 19 Oct 2026 13:44:26 -0400
plans: release 37 — Wayback pages, non-video Wayback captures as first-class records (plan)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 143 insertions(+), 0 deletions(-)
diff --git a/plans/release-37/wayback-pages.md b/plans/release-37/wayback-pages.md
@@ -0,0 +1,143 @@
+# Wayback pages — non-video Wayback Machine captures as first-class records (plan)
+
+Operator, 2026-10-19 (during a research case): "you should plan out a real first class feature for non-video
+wayback captures". Today a Wayback capture enters the corpus only when it is a capture OF A VIDEO (`import-video` with
+a `web.archive.org` URL → yt-dlp's extractor → `wayback.json`). Everything else a case leans on — a Tumblr post from
+2014, a deleted X account, a Google Doc that was taken down after a legal letter, a forum post, a personal site, a
+channel's old About page — can only be cited as a bare `page` citation (`{url, title?, archiveUrl?}`, CITATIONS.md):
+no record, no text in search, no moment page, no screenshot, nothing the MCP can read. `detectPlatform` already says
+page captures are "a different kind of record" (common/lib/platform.ts / detectPlatform.mjs ~45); README.md:190 calls
+them "a source of their own". This plan makes them that source.
+
+## The rules it is built under
+
+- **The UI works without AI.** Scanning, choosing, importing, re-checking and citing are buttons; no model anywhere.
+- **Polite.** Every request to archive.org goes through `ArchiveOrgClient`'s pacing (one stream, 2 s gap, 429/503
+ waited out) on the `platform:archive.org` queue. CDX listings are paged and bounded; a scan never fetches bodies.
+- **Reuse the posts store.** A page capture is a `Post` on a new platform, so shards, `posts-archive` dedupe,
+ `upsertPosts`, the LMDB `posts` sub-DB, search, export, `get_post`, the `/m/<channel>/<id>/` moment page,
+ `capture-posts` screenshots and `copyCitedPostCaptures` all work with no new reader.
+- **Private by rule where the source is.** A capture of x.com/twitter.com follows `social.x.visibility` exactly as X
+ posts do; every other capture is public like any channel, and a private site holds anything.
+- **Provenance is never lost.** Every record carries the original URL, the capture timestamp, the replay URL and the
+ raw (`id_`) URL; citations show "Original (may be gone)" + "Wayback Machine copy, <date>" (`waybackCitationLinks`).
+
+## What a record is
+
+A **page record** = one captured state of one page. Channel platform: `"webpage"` (added to `Platform`,
+`PostPlatform`, `POST_PLATFORM_VALUES`, `isPostPlatform`, `postPlatformLabel` → "Web page", `parsePost`,
+channel-config coercions + `channelConfigSchema.ts`, CHANNEL.md regenerated).
+
+`Post` gains one optional object, the way `forum?` exists today:
+
+```
+page?: {
+ originalUrl, captureTs, waybackUrl, rawUrl, // = WaybackProvenance (common/lib/wayback.ts:129)
+ title?, mimetype?, digest?, status?, // from CDX
+ kind: "generic" | "tumblr-post" | "tumblr-index" | "tweet" | "x-profile" | "forum-post" | "gdoc" | "yt-about" | …,
+ publishedAt?, // the content's own date when the extractor can read it
+ versionOf?, // id of the first capture of the same originalUrl
+}
+```
+
+- `id` = `<captureTs>-<short hash of originalUrl>` for a whole page; an extractor that splits one capture into many
+ records (a Tumblr index, an X profile timeline, a forum page) uses the item's own id (`tumblr-<postId>`,
+ `tweet-<statusId>`, `kf-<postId>`) so the same item seen in two captures is ONE record (upsert, latest wins, first
+ capture kept in `page.firstSeenTs`).
+- `createdAt` = `publishedAt` when known, else the capture time (the sort key is "when it was said", not "when the
+ crawler came by"); `uploadDate` derived as today.
+- `author` = the page's author when the extractor knows it (Tumblr blog, X handle, forum member), else the host.
+- `text` = the extracted readable text; `links[]`, `media[]` (images with their own Wayback URLs) from the page.
+- `threadId` = hash(originalUrl) so the versions of one page group as a thread (`groupIntoThreads`), and a tweet's
+ conversation groups the way X records do.
+- On disk beside the shards: `channels/<slug>/pages/<captureTs>-<hash>/raw.html.gz` + `capture.json`
+ (`{originalUrl, captureTs, digest, mimetype, bytes, sha256, fetchedAt, extractor, extractorVersion}`) — the raw body
+ is kept so an improved extractor re-derives records offline (`archilyzer wayback pages reextract <slug>`).
+
+## What a channel is
+
+A **Wayback pages channel** = a named scope of captures: `config.wayback = {targets:[{url, match:"exact"|"prefix"|
+"host"|"domain", from?, to?, mime?:["text/html"], include?, exclude?}], collapse:"digest"}`. Examples: a Tumblr blog (host, a date range), an X profile (prefix), a
+Google Doc (prefix), a Newgrounds user page (host), a group's old site (domain), a YouTube channel's About page
+(exact), one blog post (exact).
+Created from the New channel form ("Wayback pages" — detected for a `web.archive.org` URL that is not a video, or
+chosen; targets edited as rows), or `pnpm ops create-channel` with a `web.archive.org/web/*/<target>*` URL (handling as for
+other social channels). One target per channel is the common case; several are allowed (one person's sites).
+
+## Slices (dependency graph: S1 → S2 → {S3, S4} → S5; S3 and S4 run in parallel)
+
+### S1 — the client, the record, one-page import (`wayback-pages/core`)
+- `WaybackClient.getCapture(ts, url, {raw:true})` (the `id_` form) through the same `ArchiveOrgClient` gap; a 2 MB
+ cap (configurable), text/html + text/plain + application/json only; redirects followed inside web.archive.org only.
+- The record shape above, platform registration, `pages/` storage, the generic extractor (a real main-content
+ extraction over `htmlReader.ts` — strip Wayback's injected toolbar/scripts, nav, footer; keep headings, paragraphs,
+ link text, image alts; title; `<meta>` dates/authors/og: tags), and `upsertPosts`.
+- `import-page {slug, url}` — a Wayback replay URL (or `{url: original, at: "YYYYMMDD[hhmmss]"}` → nearest capture via
+ CDX): an ops action, a job kind on `platform:archive.org` (`needsText`), a CLI, a channel-page "Import a capture"
+ field. Refused when the capture is a video (points at `import-video`).
+- Tests: `fakeWayback.mjs` extended with `id_` HTML bodies (a generic article, a page whose capture is the toolbar
+ wrapper), CDX for them; extractor unit tests; the job end to end on the fake.
+
+### S2 — scan and choose (`wayback-pages/scan`)
+- `wayback-scan {slug, dryRun?}`: CDX over every target (paged with `showResumeKey`, `collapse=digest`, status 200,
+ mime filter, date bounds, a hard row cap per run with resume) → `channels/<slug>/wayback-scan.json`: every distinct
+ (url, digest) with first/last capture, count by year and by path prefix. No bodies.
+- Channel page **Captures** tab: the scan as a table (path, first/last seen, versions, imported?), filters by year and
+ path, select → **Import selected** (one `import-page` job each, queued on archive.org's pace), **Import all in
+ range**. Shows what is already imported and what changed since.
+- The download lane does NOT pick these up automatically (no unattended crawling of a host) unless the channel opts in
+ with `wayback.auto: true` (then the lane imports new scan rows at the archive.org pace).
+- Tests: CDX paging + resume on the fake; dedupe by digest; the table's e2e spec.
+
+### S3 — site extractors (`wayback-pages/extractors`, parallel with S4)
+One module per kind, each a pure function `(html, captureUrl) → records[]`, versioned, unit-tested on fixtures saved
+from synthetic pages (no real captures committed):
+- **Tumblr**: a post page → one `tumblr-post` record (post id, date, tags, reblog-of, body, images); a blog index /
+ archive page → one record per post on it (with the index's capture as provenance).
+- **X / Twitter**: an old-layout profile capture (2012–2022 HTML timeline) → one `tweet` record per tweet on it
+ (status id, date, text, reply/quote refs — the shape X posts already use, so threads join); a status page →
+ one tweet; the new JS layout's captures that hold only the shell → a `generic` record flagged "no content in this
+ capture". Private by `social.x.visibility`.
+- **Forums (XenForo)**: reuse `parseXenforoThreadPage` (common/social/xenforoParse.ts:673) on a captured thread page
+ → `forum-post` records that merge with a live forum channel's ids when the thread is the same.
+- **Google Docs**: `mobilebasic` / `pub` / `preview` captures → the document's text with headings; the edit-page shell
+ → flagged as no content (and the scan suggests the `mobilebasic` URL to look for).
+- **YouTube channel About / channel page**: description, links, join date, counts → one `yt-about` record per capture
+ (how a channel described itself in 2014 vs now).
+- **Generic** stays the fallback for everything else (Newgrounds pages, personal sites, articles).
+
+### S4 — renders, citations, moment page (`wayback-pages/cite`, parallel with S3)
+- `capture-posts` on a webpage channel renders the capture's replay URL (`if_` modifier: no toolbar) in the existing
+ headless Chromium (`playwrightRuntime.ts`, `forumSession.ts`) → `posts-media/<id>/shot.png`, full page and, for a
+ split record, clipped to the item's element (the `shootForumPost` pattern); images saved through their own Wayback
+ URLs.
+- The moment page and every citation surface show the capture: text, shot, "Original (may be gone)", "Wayback
+ Machine copy, <date>", the version list ("4 captures of this page; text changed on …").
+- A `page` citation that carries `archiveUrl` gets an **Import this capture** action in the report editor that turns
+ it into a `post` citation of the new record (the old one kept as the fallback), and `reports-prepare` copies the
+ shot like any post capture.
+- MCP: `get_post` returns `page`; `search_transcripts` can filter `platform: "webpage"`; `/corpus.json` lists the
+ channel kind.
+
+### S5 — liveness and saving what is still up (`wayback-pages/live`)
+- `check-post-availability` for webpage records = the ORIGINAL URL's state (HEAD/GET through `webPacer`, never
+ Wayback): `available` / `deleted` (404/410, a platform's "doesn't exist" page) / `error` — "deleted" now means the
+ Wayback copy is the only copy, and reports say so with the existing source-gone labels.
+- **Save Page Now** (optional, behind archive.org S3 keys in settings): "Ask the Wayback Machine to capture this now"
+ on a live page or a whole scan target, paced, the resulting capture imported — for pages likely to be taken down.
+- `find-copy` learns page citations: a cited page whose original is gone → the nearest capture imported.
+
+## Out of scope (named so they are not assumed)
+archive.today / archive.ph (a second archive with no CDX; a later source on the same record shape), WARC import
+(the same `pages/` storage would take it), crawling live sites directly (web-fetch stays read-only), video captures
+(stay `import-video`).
+
+## First case
+A private research site: a person's old blog, their X/Twitter accounts, a since-deleted document and account,
+their Newgrounds and group sites, two channels' About pages, a third party's blog post — the target list lives with
+the case's research notes, not here.
+
+## Gates
+Unit (extractors on synthetic fixtures, client pacing, CDX paging, upsert of split records), common + editor suites,
+an editor e2e for the Captures tab and Import selected, docs (`OPERATING.md` "Import from … the Wayback Machine",
+COMMANDS.md, CHANNEL.md, FACTS "page records", CITATIONS.md), CHANGELOG. No real archive.org in any test.