Archilyzer · Source

archilyzer

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

commit c721c02f1041b22a26054b6698bca74a61f7a624
parent 8ba7657eb1df378dff0949f8901ff54792ff9220
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 13 Oct 2026 10:17:27 -0400

plans: release 27 S0 — the iteration naming hazard, research in the plan (S3b, S11), the survey's facts

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mplans/FACTS.md | 13+++++++++++++
Mplans/release-27.md | 110+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
2 files changed, 113 insertions(+), 10 deletions(-)

diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -178,6 +178,19 @@ A grep for either word finds all three; read the file before assuming which. | `citedMoments` | `common/publish/reportMedia.ts` | The moments a site's reports cite, one per span, with the citations that cite each. | | Compose's `citedSite` | `common/publish/composeReports.ts` `resolveSiteReports` | The local `isCitedSite(site)` (renamed from `cited` in release 23). | +**A generated report is an ITERATION (`i1`, `i2`, …), and every other word for it is taken** (release 27): + +| Word | What it already means | Where | +| --- | --- | --- | +| version | The report FORMAT version (`Report.version`) | `common/lib/report/schema.ts` | +| revision | A published article's history entry ("Revision N", one git commit per write) | `common/lib/report/revisions.ts` | +| draft | An article in the registry that is not in the published list | `common/lib/report/registry.ts` | +| take | One of umtool's alternative renders of a video | `umtool/app/api/report/takes/` | +| iteration | One generation's result plus its provenance (kind, model, parent, feedback, cost) | `common/lib/report/iterations.ts`, `transcripts/reports/<id>/iterations/<n>/` | + +The stopgap in `~/reports/local-reports/` called iterations "versions" (`seed_version.py`, `runs/*/v<n>`); nothing +in the repo does. + **Never publish a path segment named `.git`.** wrangler's Pages upload drops `**/.git` (and `**/node_modules`) SILENTLY, and Cloudflare's managed rules block `/.git/` requests. The source mirror is `/source/archilyzer.git/` for that reason (release 12, below). A mirror named `.git` would diff --git a/plans/release-27.md b/plans/release-27.md @@ -1,7 +1,7 @@ # Release 27 — report and video generation inside the application Status: **RATIFIED 2026-10-13 — D1–D9 as recommended** (r27 = move + test; strict quotes for generated, `inexact` a warning -for existing; the qwen sweep pipeline ported). Next: S0. This plan supersedes slices Q1–Q5 of `plans/local-llm-report-media.md`. Its +for existing; the qwen sweep pipeline ported). Research runs were added at ratification (S3b, S11; below). S0 landed on `r27/integration`. This plan supersedes slices Q1–Q5 of `plans/local-llm-report-media.md`. Its Q0 record, rulings and scope changes stand, and are the inputs here. ## Start here (the implementing session) @@ -41,6 +41,46 @@ Its lessons are in this plan's tables. Don't re-derive them. **Sonnet 5.5** (the default API model) returns a 400 for any of these: a non-default temperature, a forced `tool_choice`, or `thinking: disabled`. Use `thinking: between_tools`. Its thinking blocks are signed, so never edit history once one is present. +## Added at ratification: research (operator, 2026-10-13) + +Research by local or API agents, as in the Candace work: find archive.org files and download them, add channels and +individual posts or videos for complete context, then report. +- Each run's autonomy is selectable: propose-and-approve, auto within limits, or autonomous. +- It may propose archive.org imports, new channels, posts, and transcription or persisting. +- It is part of release 27 (slices S3b and S11). + +## Facts found (survey, 2026-10-13) + +- **No Anthropic HTTP client exists.** The digest's metered lane shells out to the Claude Code CLI (`common/lib/digestApps.ts` `claudeCode`). +- **The ollama call** is `ollamaDirect.run` in `digestApps.ts`. `acquireLlmSlot` (`common/controller/llmWorkers.ts:76`) verifies the model tag. `"llm"` is a WorkerKind, not a queue; the new queues are `draft:local` and `draft:api`. +- **GPU arbitration:** + - `digestYield.ts` makes digests yield to transcription. + - `ttsFile.ts:397,404` (`transcriptionOnGpu`, `waitForGpu`) makes TTS wait for transcription. + - TTS and ollama do not arbitrate with each other: a shared arbiter is new work. +- **Job and ops plumbing:** + - Kinds are in `common/jobs/jobKinds.ts` (`JobKindMeta`). + - Ops are adapters only (`editor/app/api/ops/_lib.ts`), one route per action. The action list is `scripts/archilyzer-ops.mjs` `ACTIONS`. + - Jobs are read through `editor/app/api/ops/_jobs.ts`. +- **Settings:** a new key goes into `siteSettingsSchema` (`common/lib/settingsSchema.ts:1708`, order = file order). Docs are regenerated with `archilyzer settings example`. +- **The registry:** `common/lib/report/registry.ts` (`writeArticle` 486, `patchArticle` 441, `configureArticle` 344, `withArticleStoreLock` 265). History is git commits ("Revision N", `report/revisions.ts`). +- **verify-quotes** scores token recall against a 0.6 threshold (`common/lib/citations/verify.ts:34`). That is why a reversed quote passed at 0.85. +- **MCP handlers are module-private.** Only `TOOLS` and `createServer` are exported (`mcp/src/server.ts:336,1210`); use the SDK's in-memory transport. +- **`moment_base` is null for private builds.** It comes from `momentBaseFor` (`server.ts:164`), and a private site has no `siteUrl` (`common/lib/corpus.ts:306`). +- **umtool:** + - `lib/jobs.ts` runs steps as detached process groups, with cancel and a 15-minute timeout. + - `report-to-video/build-video.mjs` exports `buildVideo` (4100) and `build-podcast.mjs` exports `buildPodcast` (275). + - The editor-call pattern is `narrate-via-editor.mjs` / `fetch-via-editor.mjs`. + - The manifest writers are in `lib/report/manifest.mjs`. + - e2e is `umtool/e2e/*.spec.ts`, with an editor stub on `EDITOR_STUB_PORT`. +- **The four owed bugs, located:** + - The title `foot` is never set (`convertManifest.ts:428`) and its render has no guard (`render-cards.mjs:112`). + - A trailing Coverage section becomes a bare chapter card (`convertManifest.ts` ~264). + - Window coverage ignores `pad` (`fetchWindows.ts:379`, `fetchWindowManaged.ts:171`). + - `umtool build --dry` resolves paths from cwd (`umtool/lib/report/driver.mjs:14,416`). + - Also: `prepare --article` always includes every published article (`common/publish/reportHost.ts:156`). +- **Tests:** `node:test` via `tsx --test` per package, plus root `test:scripts` for `.mjs`. The gates are `pnpm typecheck`, `pnpm test`, `docs env|files|cli --check`, `settings example --check` and `pnpm e2e:all`. +- **The test kit (S0):** `common/testing/` — the fake Anthropic and ollama servers, the synthetic corpus and sweep fixtures; see its README. Importable as `yt-dlp-transcript-common/testing/<path>`. common's test glob now reaches three levels (`lib/report/draft/*.test.ts`). + ## Why The work is proven, but it runs in the wrong place. Since 2026-10-11, reports, revisions, narration and videos have @@ -115,6 +155,31 @@ It now has to become the application. That means: - A strict check is added: every quoted fragment verbatim (normalized) in the record's text within ±90 s. - It refuses a generated quote, and verify-quotes reports it as a new status `inexact` (D3). - Claims never carry quoted words. convertSweep makes every quoted span before a link that link's quote. This is enforced by the op engine and the prompts. +- **Research** (added 2026-10-13, operator) means doing what the Candace work did, on qwen or the API: find relevant + archive.org files and download them; add channels and individual posts or videos for complete context; then report. + - **A research run is an iteration of kind `research`**, in phases: + - **discover:** search the corpus, the web and archive.org, and read item file lists; + - **propose:** acquisitions, each with its reason and evidence links; + - **acquire:** each one an editor job, paced and polite, on the platform queues; + - **wait:** resumable, showing the jobs it waits on; + - **continue:** a `sweep` iteration over the widened scope, including the new channels. + - **Autonomy is chosen per run** (default from settings): + - `propose`: the operator approves each acquisition in umtool, yes or no per item; + - `limits`: imports into existing channels under the caps run on their own, and the rest waits for approval; + - `auto`: the agent enqueues it all itself, still through the editor. + - **Limits** are `settings.generation.research.{maxItemsPerRun, maxGbPerRun, maxTranscribeHours}`, and whether new channels and post walks need approval. + - **What it may propose:** + - archive.org search and import (`searchArchiveOrgItems` in `common/controller/archiveOrgImport.ts:236`, plus `archive.org/metadata` reads, `import-archive-org`, `import-video`); + - new channels (`create-channel`, always created on NO site: private); + - posts (`fetch-posts` including the older walk, `capture-posts`, and a NEW `import-post {slug, url}` for one X or Bluesky post); + - transcription and persisting (`transcribe-one`, priority bumps, `persist-videos`). + - **Proposal state lives in the iteration** (`proposals.json`): each one's action, args, reason, evidence, status (proposed, approved, rejected, enqueued, done or failed) and jobId. + - **Standing rules hold:** + - polite scraping (one stream, real gaps, back off on a 429, the editor's holds and cooldowns); + - no yt-dlp or gallery-dl by hand; + - X channels never go on a site; + - no re-fetching expired Twitch VODs; + - subjects the operator marks local-only stay on no site. - **Claude Code integration** (D8): - MCP tools `generation_policy` and `generate`. `generate` enqueues `report-draft` through the editor, like `enqueue`. - `sweep_plan` / `ask_plan` read the policy. When a task routes to `api` or `local`, the plan tells Claude Code to call `generate`, wait, and REVIEW the result instead of doing the work itself. @@ -135,19 +200,23 @@ It now has to become the application. That means: | S7 | Pipeline chain and owed bugs | umtool chain over an iteration (above). `reports prepare --article <id> --only`. Capture this article's posts. `to-manifest`: title `foot` (`convertManifest.ts:428` + a guard at `render-cards.mjs:112`), no silent Coverage end card, the parent seed. `fetch-windows` folds `pad` into coverage (`fetchWindows.ts:379`, `fetchWindowManaged.ts:171`). `umtool build --dry` resolves from the module, not cwd (`driver.mjs:14,416`). Dedupe (segments and voices only). | S4 | unit per bug; `umtool` build e2e | | S8 | umtool UI | `/articles/new`: question, a channel picker over the editor's channels, model, caps. The article's **Iterations** tab: the list, current article and current video, new iteration (target report or video, model, feedback), copy with model, per-step model, cancel, cost, live job progress from `/api/ops/job`. `/articles/<id>/compare?a=&b=`: side by side, with ops applied and refused. The policy panel (writes `generation` through the editor's settings action). `/drafts` redirects. | S6 S7 | e2e: `article-new.spec`, `article-iterations.spec`, `article-compare.spec` over the editor stub + fake LLM | | S9 | Claude Code balance | MCP `generation_policy` and `generate` (enqueue + follow). `instructions.ts`: the routing step in `sweep_plan` / `ask_plan`, plus review guidance. `.claude/commands/gen.md`. `archilyzer gen policy\|preset\|set\|run` (CLI over the same settings). | S6 | mcp unit; protocol test lists the tools | -| S10 | Migration, docs, retire | `archilyzer reports import-local-runs` (dry run by default): the stopgap's kept runs become iterations (D9), and `generation.json` becomes settings. OPERATING.md "Generate and iterate". `umtool/docs/authoring.md` "Generating with a model". REPORT.md. CHANGELOG. `plans/STATE.md`. The stopgap's RUNBOOK points here. | S8 S9 | the import's dry run reviewed by the operator | +| S3b | Research tools | Agent and editor actions `archive-search` (over `searchArchiveOrgItems`) and `archive-item` (the metadata file list, sizes and formats), read-only and paced. The NEW editor action `import-post {slug, url}`: one X post through the existing gallery-dl path, or one Bluesky post by URI, into the channel's posts archive. Acquisition tools for the agent, each mapped to its existing editor action and checked against the run's autonomy and limits before it is enqueued. | S0 | unit against a fake archive.org and the editor stub | +| S11 | Research runs | Task `research`: the phases, `proposals.json`, autonomy and limits, resuming while it waits on jobs. Approve, reject and enqueue through `pnpm ops research-approve {article, iteration, ids, approve}`. "Continue" starts the sweep iteration over the widened scope. The `generation.research` settings. The MCP `generate` accepts task `research`. umtool: the research queue in the Iterations tab (yes/no per proposal, live acquisition job status, continue) and the autonomy selector on `/articles/new`. | S5 S6 S3b; its UI after S8 | unit; e2e `article-research.spec` (fake LLM + editor stub) | +| S10 | Migration, docs, retire | `archilyzer reports import-local-runs` (dry run by default): the stopgap's kept runs become iterations (D9), and `generation.json` becomes settings. OPERATING.md "Generate and iterate". `umtool/docs/authoring.md` "Generating with a model". REPORT.md. CHANGELOG. `plans/STATE.md`. The stopgap's RUNBOOK points here. Docs include "Research". The test runs (about 320 MB) are deleted after the operator's OK. | S8 S9 S11 | the import's dry run reviewed by the operator | -**Dependency graph.** +**Dependency graph.** S0 → {S1, S2, S3, S3b, S4}; S5 ← S1–S4; S6 ← S5; S7 ← S4; S8 ← S6+S7; S9 ← S6; S11 ← S5+S6+S3b +(its UI after S8); S10 ← S8+S9+S11. ``` S0 ─┬─ S1 ─┐ - ├─ S2 ─┼─ S5 ─ S6 ─┬─ S8 ─┐ - ├─ S3 ─┤ └─ S9 ─┼─ S10 - └─ S4 ─┴─ S7 ──────── S8 ┘ + ├─ S2 ─┼─ S5 ─ S6 ─┬─ S8 ─────┐ + ├─ S3 ─┤ ├─ S9 ─────┼─ S10 + ├─ S3b ┼───────────┴─ S11 ────┘ + └─ S4 ─┴─ S7 ──────── S8 ``` **Lanes.** At most three Opus implementers at once, each in its own worktree from `r27/integration`: -- **Phase 1:** lane A S1, lane B S2 then S3, lane C S4 then S7. +- **Phase 1:** lane A S1; lane B S2 → S3 → S3b; lane C S4 → S7. - **Phase 2:** S5 then S6 (one implementer, since they share the job's surface). -- **Phase 3:** S8 and S9 in parallel, then S10. +- **Phase 3:** S8 ∥ S9 ∥ S11 (S11's umtool queue lands after S8), then S10 (whose docs include "Research"). Each slice is merged `--no-ff` as it finishes, with its suites re-run. @@ -155,7 +224,7 @@ Each slice is merged `--no-ff` as it finishes, with its suites re-run. - `pnpm typecheck`, `pnpm test`, `docs env|files|cli --check`, `settings example --check`. - The four builds through the heavy slot (capped). -- `pnpm e2e:all`: editor, export, umtool (with the three new specs) and homepage. A red is re-run alone; a red that stays red blocks. +- `pnpm e2e:all`: editor, export, umtool (with `article-new`, `article-iterations`, `article-compare` and `article-research`), the editor's `report-draft` spec, and homepage. A red is re-run alone; a red that stays red blocks. - **Live smoke** (operator's key, ≤ $3, through the UI): - a Sonnet 5.5 sweep on a small channel; - a report iteration and a video iteration; @@ -163,7 +232,9 @@ Each slice is merged `--no-ff` as it finishes, with its suites re-run. - a copy-with-model compare; - the chain to a video and podcast; - a cancel mid-step; - - `/gen` from Claude Code routing one task to the API. + - `/gen` from Claude Code routing one task to the API; + - a small research run in `propose` mode on a public subject (archive.org search, one small item approved and + imported, then continue into a sweep). - Privacy greps on `main..r27/integration`, counts only: - no session links; - no key-like strings (`sk-ant-`); @@ -171,6 +242,22 @@ Each slice is merged `--no-ff` as it finishes, with its suites re-run. - no `~/.config/archilyzer` contents; - the source mirror's `--check`. +## Record + +### S0, as shipped (2026-10-13, orchestrator) + +`r27/integration` from `main` `9f05d557`, in the worktree `/home/user/Projects/r27-integration` (ports 4700–4720). + +| Commit | What | +| --- | --- | +| `f88aaf8d` | `common/testing/`: the fake Anthropic and ollama servers, the synthetic corpus (`synth-kitchen`, `synth-other`, invented posts), six sweep.md variants, three derived reports and manifests, `regenerate.ts`; the `./testing/*` export; common's test glob reaches three levels | +| (this commit) | FACTS "A generated report is an ITERATION"; this plan brought up to the ratified text (research: S3b, S11; the survey's facts; graph, lanes, smoke) | + +Gates: common tsc clean; common tests 3827/3827 (9 new, `testing/fakes.test.ts`). + +Found: as committed, the `paragraphs` fixture manifest shows two of the owed bugs (no title `foot`; Coverage a bare +chapter card). S7 fixes them and regenerates it. + ## Rollout - Fast-forward `main`. @@ -232,6 +319,9 @@ Each slice is merged `--no-ff` as it finishes, with its suites re-run. ## Not in this release +- Release 28: the remaining media tasks (clip selection and order, on-screen titles, teaser, flips, threads, YouTube + title and description, proposed verdicts) on the same machinery. + - The A7 leftovers: 42 post screenshots and 2 windows (`~/reports/release-26/scripts/a7-fill-media.sh`). - Deleting the candalyzer site. - The hub tombstone.