commit 1a8e8371df93261c065df13c0785146ac77f49da
parent 48ec5623c422ac27ea9d2134d7d29f32a80dafac
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 13 Oct 2026 13:26:56 -0400
plans: release 27 S11, as shipped (the backend) — research runs; CHANGELOG bullets
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,6 +1,9 @@
# Changelog
## [Unreleased]
+- **Research runs: the editor finds what an article's archive lacks and asks for it.** `pnpm ops report-draft --json '{"task": "research", "article", "question", "channels"?, "autonomy"?}'` runs a research iteration: a model searches the corpus, the web and archive.org (an item's file list included), then proposes each acquisition it needs (an archive.org import, a video, a new channel, a post, a transcription, a persist) with its reason, evidence links and estimated size. Under `propose` every one waits for your yes or no; under `limits` imports into existing channels under the caps run at once; under `auto` everything runs, through the editor's own queues and holds, until a cap. A new channel is always created on no site, an X channel is never put on one, and a Twitch VOD is never fetched, in every mode. The proposals are kept in the iteration's `proposals.json`.
+- **`pnpm ops research-approve` settles a research run.** `{"article", "iteration", "ids": ["p01", …], "approve": true | false, "note"?}` runs the approved proposals through the editor (past the run's autonomy and caps, never past a standing rule) or rejects them; with no ids it answers the run's state. Every call first checks the jobs of what was enqueued, so the run moves from waiting to ready as they finish. `report-draft {"task": "sweep", "article", "iteration": <the research run>}` then continues it: a sweep over the run's channels and every channel it acquired into, its question by default (refused while the run still waits, unless `"force": true`).
+- **New settings: `generation.research`** (SETTINGS.md): a research run's default autonomy (`propose`), and its limits — 20 items, 5 GB and 6 hours of transcription a run, new channels and post walks waiting for approval under `limits`. `generation.routes.research` says where a research run runs (`api` in the balanced preset); a settings file from before keeps its preset.
- **Reports and their revisions can be generated by the editor: `pnpm ops report-draft`.** `{"task": "sweep", "article", "question", "channels"}` drafts a new report of an article as its next iteration; `{"task": "revise-report" | "revise-video", "article", "iteration", "feedback"}` revises one; `{"task": "narrate", "article", "iteration"}` drafts the narration of an iteration's video cut; `"copyOf": N` runs iteration N again on another `"model"`. Each is a **Report draft** job on /jobs, on the Claude API (`draft:api`) or the local model (`draft:local`) by the model, and `pnpm ops job cancel` stops one. Every quote a model writes must be the transcript's words within 90 seconds of its link, or the finding is dropped; links cite the archive, never the platform. The answer names the job and the iteration; the job's log ends with the outcome. Needs a restart of the editor.
- **Spending on the Claude API is capped.** A job is capped by its task ($5 a sweep, $2 a revision, $1 a narration, or the `maxUsd` it asks for, never above `settings.generation.caps.max`), and the editor refuses a job once the day's API spend (UTC) has reached `caps.daily` ($20), naming the day's total. Each finished API job adds its spend to a ledger beside the checkout (`.generation/usage.jsonl`), which is where the day's total comes from.
- **New settings block `generation`** (SETTINGS.md): where each task runs (`code` = Claude Code, `api`, `local`, with the presets `code`, `balanced`, `api`, `local`), the models, the caps, the API key FILE (mode 600; the key itself is refused as a setting and never stored), and where video projects live (`projectsRoot`, which `umtool chain` now reads too).
diff --git a/plans/release-27.md b/plans/release-27.md
@@ -472,6 +472,49 @@ Gates:
- Editor build: the e2e prebuild's capped `next build` (heavy slot, 5 GB) at `12a4f48c`, 72 s, clean. (A standalone `next build` waited 33 min under the 6000 MB floor at 5.1–5.5 GB available and was stopped; the e2e run's build is the same app.)
- e2e `report-draft.spec.ts` + `digest.spec.ts`, one run: 18 passed, 0 failed, 41.5 s (report-draft 3 in 0.6 s, digest 15 in 21.2 s). The first attempt timed out in the heavy-slot queue and was re-run.
+### S11, as shipped — the backend (2026-10-13, lane G, `r27/research`)
+
+Research runs, on `r27/research` from `r27/integration` `5962c543`. The umtool queue lands after S8.
+
+| Commit | What |
+| --- | --- |
+| `ae2ed4dd` | `report/draft/tasks/research.ts`; `report/draft/research/state.ts`; `decide.ts` (the auto ruling); `controller/researchRuns.ts`; `report-draft` task `research` and the continuation; `settings.generation.research` and `routes.research`; the editor's `research-approve` route and `_researchEditor.ts`; ACTIONS row, help, COMMANDS.md, SETTINGS.md; tests and `testing/draft/runs/research.json` |
+| (this commit) | this record; the CHANGELOG bullets |
+
+- **The task** (`research`, an iteration of kind `research`): one agent run.
+ - It reads the corpus (`list_channels`, `search_transcripts`, `enumerate_matches`, `get_video_metadata`, `channel_coverage`, `get_post`; a local model gets three of them), `editor_channels` (every channel the editor archives), the web, and archive.org through the editor's `archive-search` / `archive-item`.
+ - It then calls S3b's acquisition tools. Each call is judged by `decideAcquisition`, then enqueued through the editor, left waiting, or refused.
+ - `proposals.json` (`{format, version, autonomy, limits, spent, proposals}`) is written on every change. The iteration's `research` key is `{autonomy, phase, notes, continuedBy?}`.
+ - A research iteration has no report. It ends `done` with its acquisitions, also when some still wait.
+- **Phases:** `discover` (the job runs), `wait` (a proposal waits for a yes or no, or an enqueued one's job has not ended), `ready` (nothing pending), `continued`.
+ - Nothing waits in a process. Every read through `research-approve`, and every continuation, first refreshes the enqueued acquisitions from their editor jobs (`getJobEntry`). All of a proposal's jobs done makes it `done` with `doneAt`. One failed, cancelled, lost (`archived`) or unknown makes it `failed`, naming the job.
+- **Autonomy (ruled 2026-10-13):**
+ - `auto` lifts the approval flags. The caps are hard ceilings: past one, or of unknown size, a proposal waits.
+ - Under `limits`, `newChannelsNeedApproval` and `postWalksNeedApproval` decide whether a new channel or a post walk waits. A priority bump always waits.
+ - An import's `estimate.transcribeHours` counts against `maxTranscribeHours`.
+ - The standing rules refuse in every mode.
+- **`pnpm ops research-approve {article, iteration, ids?, approve?, note?}`** → `{outcomes, research}`:
+ - `approve: true` runs each proposal through the editor (`runApprovedProposal`: past the autonomy and caps, never past a standing rule).
+ - `false` rejects it, with the note as why. No ids: the run's state.
+ - A run whose job is queued or running is refused: its proposals are the job's until it ends.
+ - Writes are serialized per run in the process.
+- **Continue = `report-draft {task: "sweep", iteration: <research n>}`**, chosen over a new ops verb.
+ - The sweep's parent is the research run. Its question is the run's, and its channels are the run's plus every channel a done acquisition wrote into (a created channel, an import's, a post's, a persisted item's); each can be given instead.
+ - Refused while the run waits, unless `force` (what is done so far).
+ - At the ask, a build must hold the widened channels (a channel on no site is in none until the operator puts it on a site and builds it). A build older than the last acquisition is answered as a `warnings` line.
+ - The run records `continuedBy`.
+- **The research job's editor is the editor itself.** `_researchEditor.ts` calls the ops route handlers in process, with a Request carrying the editor's worker token. An acquisition therefore meets the same door, holds and queues as `pnpm ops`, and the editor needs no URL of its own.
+- **Settings:**
+ - `generation.research {autonomy: "propose", maxItemsPerRun: 20, maxGbPerRun: 5, maxTranscribeHours: 6, newChannelsNeedApproval: true, postWalksNeedApproval: true}`.
+ - `generation.routes.research`: `api` in `balanced` and `api`, `local` in `local`, `code` in `code`. A settings file without it takes the research route of the preset its other routes match, so its preset is unchanged.
+ - A research job's cap is `caps.sweep`.
+
+Gates:
+- tsc clean (all packages).
+- common 3984/3984 (8 new: `research/runs.test.ts` 7, `generationSettings` 1; the S3b test now pins the auto ruling); mcp 323/323; editor unit 282/282 (6 new, `_researchRuns.test.ts`); `test:scripts` 851 pass + 3 skipped.
+- `docs env|files|cli --check`, `settings example --check`: clean.
+- Editor build (heavy slot, 5 GB cap): clean in 49 s, `/api/ops/research-approve` and `/api/ops/report-draft` built. No editor e2e: the route has no spec of its own (its door and the job are in `_researchRuns.test.ts`).
+
## Rollout
- Fast-forward `main`.