commit 3dae2118baf51497aeeec6227f166168464c7b2b
parent e2a4b325bcbe60df155ea1c67df3f4b907d1ebe6
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 00:40:24 -0400
plans: umtool redesign — P2a, as shipped; CHANGELOG
The engine's commits, gates (unit 734, test:scripts 882, capped build, full
umtool e2e 308/1/6 with the one red a base flake), and the inbox over the real
REPORTS_ROOT: 825 rows, 518 blocking until a piece is marked done (35 with
quartering-diet done, 11 with the looks-done suggestions accepted).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 113 insertions(+), 1 deletion(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,6 +1,10 @@
# Changelog
## [Unreleased]
+- **umtool's decisions API carries the inbox: each decision's piece, group and one action.** `GET /api/browse/decisions` still answers one row per decision (`items[]`, each row's `project`, `href` and `counts` as before; a note's `href` still ends in `note=<id>`), and each row now also names its `piece` — `a:<site>/<report>` for an article and the video projects made from it, `p:<project>` for a project no article claims — its `category`, its `group` (Your call → Review → Blocking → Notes → Open → Ready to finish → Quiet), one `action` whose label names the result ("Make i3 current", "Adjudicate claim", "Answer note"), the piece's `lifecycle` and `hidden`. A new `groups` key holds the same rows as cards, one per piece and kind, with counts; `hidden` counts the rows on parked or done pieces. Five decisions are read from disk for the first time: `iteration-ready` (a finished iteration newer than the current one), `iteration-failed` (with what it spent), `research-proposal` (an acquisition waiting on a yes or no, read from `proposals.json`, never through the editor), `link-ambiguous` and `looks-done`.
+- **umtool: a piece can be parked or marked done.** `POST /api/pieces/lifecycle {piece, state}` sets `active`, `parked` or `done`, kept in `REPORTS_ROOT/.umtool/lifecycle.json` with when and by whom; a parked or done piece's decisions stay in the list, `hidden`. "Looks done" — a song with every cut, a final video with a `share-*` batch, a published article with its video — is only ever a suggestion (a `looks-done` decision) and never sets it. `GET /api/pieces` lists every piece with its stage, lifecycle, linked projects and how many decisions wait on it.
+- **`umtool inbox [--all] [--json]`** prints the decisions grouped and ranked as the inbox shows them, one card per piece and kind, and how many are hidden; `--all` lists the hidden ones and the quiet group.
+- **umtool links an article's video by its iterations first.** A project an article's iteration made (`projectDir`) is that article's, and no other article matches it by slug, so a generated article no longer lists its own `…/i1` as "possible"; `current.video` picks the one its Cut opens, and a project outside the reports root is listed as not reachable here. Then a manifest's `article`, then a unique slug in the article's workspace — the only step that can be ambiguous.
- **Articles, iterations, report-video projects and takes can be deleted, and every delete shows its plan first.** `archilyzer reports delete <id>` prints what would go — each path with its size, what is kept and why, and anything that stops it — and deletes nothing until `--apply`; `--iteration <n>` deletes one iteration. Deleting an article removes its directory (report, video, history, notes, iterations), each iteration's video project under `settings.generation.projectsRoot` and its staged exports. A published article is refused unless `--force`, which unpublishes it first; an article with a running iteration is always refused. An iteration is refused while it is the current article or video, the one the article's report came from, running, or the parent or original of another iteration, and its number is never given out again. The usage ledger, the shared prepared-media cache and the corpus's git history are kept. The same deletes run over HTTP as `pnpm ops delete-article {id, force?, dryRun?}` and `pnpm ops delete-iteration {id, n, dryRun?}`, which answer a refusal as a 409 with the plan.
- **umtool: Delete article, `Delete i<n>`, Delete project and `Delete take <id>`.** Each button reads the plan, shows it (what goes with sizes, what is kept, what refuses) and deletes only on **Confirm delete**; **Keep it** closes it. **Delete article** is on an article's page (one in the making too) and returns to `/articles`, which says what went; `Delete i<n>` is on each iteration of the Iterations tab. **Delete project** on a report-video project removes its directory, and its `out/` or deliverables on the media drive when they are its own copy; it is refused while a job works in the project, for an article's current video, and — unless you tick **delete anyway** — for a project whose manifest names an article with a video attached. `Delete take <id>` removes `takes/<id>/`; the take whose manifest is the project's own needs **delete anyway**, and its verdict and notes are kept.
- **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.
diff --git a/plans/umtool-redesign.md b/plans/umtool-redesign.md
@@ -346,6 +346,114 @@ P0 design ─► P1 foundation ─┬─► P3 inbox/work/tools/URLs ─┬─
| Phase | Branch | State |
|---|---|---|
| P0 design | — (`~/reports/umtool-redesign/canvas.html`) | in progress |
-| P2a engine | `ux/p2a` | in progress |
+| P2a engine | `ux/p2a` | shipped on the branch, awaiting review and merge |
| P1, R1, P3 | — | wait for P0 sign-off |
| P2b, P4a, P5, R3, P4b, P6 | — | wait for r28 on `main` |
+
+### P2a, as shipped
+
+**What.** The engine behind the Inbox and Work, with no UI change: pieces, a lifecycle, the generation era's
+decisions, and the grouping, all as data.
+
+- **Piece ids** (`umtool/lib/pieces/ids.mjs`): `a:<site>/<report>` (site may be `articles`), `p:<project>`, and
+ `c:<case>` reserved. A bare `x/y` never parses, so a two-segment id is never ambiguous.
+- **Linking** (`umtool/lib/articles/links.mjs`), in the plan's order:
+ 1. An iteration's `projectDir` links its project, and CLAIMS it: no other article can match it by slug.
+ `current.video` picks the cut. A `projectDir` outside `REPORTS_ROOT` is listed in `unreachable`.
+ 2. The manifest's `article` key.
+ 3. A unique slug in the article's workspace. Only this step yields `possible`.
+
+ The iterations are read as plain JSON (`projectDir`, `current.json`'s `video`), so `umtool notes` links the same
+ way. `/articles` and `/sites` rows carry `via`, `cut`, `how` and `unreachable` (additive). `clearLinksCache`
+ bumps an epoch.
+- **Pieces** (`umtool/lib/pieces.ts`):
+ - Every article: the sites', the store's, and those in the making.
+ - Every project no article claims.
+ - For each: stage, linked projects, `possible`, `unreachable`, and why it looks done.
+ - A project is owned by the strongest link, then by list order.
+ - The graph is memoised 15 s and dropped when the links-cache epoch moves. The lifecycle is read fresh.
+- **Lifecycle** (`umtool/lib/lifecycle.mjs` + `.ts`):
+ - `active | parked | done`, stored in `REPORTS_ROOT/.umtool/lifecycle.json` as `{state, at, by?}`.
+ - Every write goes to a temp file and is renamed into place, serialised. An unreadable file is never overwritten (409).
+ - `POST /api/pieces/lifecycle`: 400 for a bad id or state; 404 for an unknown piece, a `c:`, or a project an
+ article owns, naming the owner. `GET /api/pieces` gives each piece with its decision counts by group.
+- **Decisions** (`umtool/lib/inbox.ts`, `umtool/lib/inbox/groups.mjs`):
+ - `GET /api/browse/decisions` keeps `items[]` one row per decision. `project`, `href` (a note's still ends in
+ `note=<id>`) and `counts` are unchanged.
+ - Each row gains `piece`, `category`, `group`, `action {label, href}`, `lifecycle` and `hidden`.
+ - Two new keys: `groups` (cards, one per piece and kind) and `hidden`.
+ - New disk sources:
+ - `iteration-ready`: done, could be current, newer than current.
+ - `iteration-failed`: not superseded by a later live iteration. Spend is the iteration's `usage`, else the
+ ledger joined on `jobId`.
+ - `research-proposal`: `readResearchState`, status `proposed`.
+ - `link-ambiguous` and `looks-done`.
+ - Groups: Your call → Review → Blocking → Notes → **Open** → Ready to finish → Quiet. **Open** was added for the
+ open decisions the plan did not place (a variant with no verdict, a link to choose).
+ - `openDecisions()` and the pages that call it are unchanged.
+- **CLI:** `umtool inbox [--all] [--json]` runs `bin/inbox.ts` through tsx.
+
+| Commit | What |
+|---|---|
+| `2abb6ee9` | links: iterations, then manifest, then slug; claimed projects never a slug match; unreachable listed |
+| `6498c072` | piece ids, the lifecycle store, the inbox's grouping and ranking (pure, unit-tested) |
+| `d78b7e15` | pieces, `lib/inbox.ts` (disk sources, annotation), the decisions route, `/api/pieces`, `/api/pieces/lifecycle`, `umtool inbox` |
+| `a7bda172` | `e2e/inbox-engine.spec.ts`; `test:scripts` runs `lib/pieces` and `lib/inbox` |
+| `64c3ac84` | an unreadable site, store or disk source never takes the decisions down |
+| `d51b85ea` | `docs/cli.md` lists `umtool inbox` |
+
+**Gates.**
+
+| Gate | Result |
+|---|---|
+| `pnpm --filter umtool typecheck` | clean |
+| repo-wide `tsc --noEmit` | clean |
+| umtool unit tests (`node --test` over `umtool/lib/**/*.test.mjs` and `report-to-video/*.test.mjs`) | 734 tests: 732 pass, 2 skip. 22 are new: ids 5, lifecycle 6, groups 5, links 6 |
+| `pnpm run test:scripts` | 882 tests: 880 pass, 2 skip |
+| `next-build-trace.test.mjs` | 10/10, against the capped build |
+| mcp | 343/343 |
+| capped umtool `next build` (corpus linked, `MemoryMax=5G`) | exit 0, ~18 s compile. The `/api/pieces` and decisions route traces hold 792 files, none from the corpus or a dot-dir |
+| full umtool e2e | 308 passed, 1 failed, 6 skipped, 5.5 min. The four new `inbox-engine` specs passed |
+| `browse.spec.ts` alone | on `ux/p2a`: 22/23. On the base `604d43c1`, in a temporary worktree: one run 23/23, one run 22/23. Both reds are the same test |
+
+The one red is `browse.spec:342` ("a new song gets the shape…"). `/browse/gamma` 404s right after
+`/api/projects/new` scaffolds it, red and green on the base alike. Release 24 recorded it as a flake. No P2a module
+is on its path: the page and the scaffold route import none of `lib/pieces`, `lib/inbox`, `lib/lifecycle` or
+`links.mjs`. The suspected cause is the 1 s project-walk memo, held per module instance, outliving
+`invalidateProjects()`. That is not verified.
+
+**The real `REPORTS_ROOT`, read-only.**
+- Run offline with tsx on 2026-10-13/14, over the primary's corpus and a scratch copy of the umtool cache.
+- No `lifecycle.json` was written; `~/reports/.umtool` does not exist.
+
+| Measure | Value |
+|---|---|
+| Total rows | 825 = today's 797 + 28 new (1 `iteration-ready`, `api-shondo-recent` i1, $1.14; 1 `link-ambiguous`, `polemic-flips` and two `takes/*` projects; 26 `looks-done`: 25 published store articles with their video + the `pokemon` song). No `iteration-failed` and no `research-proposal` exist on disk |
+| Severity | 518 blocking, 181 open, 126 info. Blocking is still 518: nothing is parked yet |
+| Pieces | 57: 30 article, 27 project. 25 linked projects; none unreachable; no project linked to two articles |
+| Timing | warm `readInbox` 138–578 ms. Disk sources add ~6 ms over `openDecisions()` |
+
+Actionable decisions per group (decisions / cards):
+
+| Group | Today, no lifecycle | `p:quartering-diet` done | Plus the 26 looks-done pieces done |
+|---|---|---|---|
+| Your call | 0 / 0 | 0 / 0 | 0 / 0 |
+| Review | 1 / 1 | 1 / 1 | 1 / 1 |
+| Blocking | **518 / 33** | **35 / 32** (483 hidden) | **11 / 8** (507 hidden) |
+| Notes | 14 / 1 | 14 / 1 | 14 / 1 |
+| Open | 140 / 16 | 104 / 14 | 102 / 12 |
+| Ready to finish | 26 / 26 | 26 / 26 | 0 / 0 |
+| Quiet (collapsed) | 126 / 84 | 104 / 82 | 34 / 27 |
+
+**Found and left.**
+- `quartering-diet` does NOT look done by the plan's signals. It has its final mp4 but no `share-*` batch, so the
+ 483 stay blocking until the operator marks it done. One POST does it.
+- 24 of the 26 looks-done articles carry one blocking `manifest-invalid` on their linked project (no `channelSlug`
+ or a dead origin, in `hasan-leads/*` and `piratesoftware-polemics/*`). Accepting the suggestions hides them.
+- With no `current.json`, every done iteration is `iteration-ready`. The fixture's zeta shows i1, i2 and i3 as one
+ card of 3.
+- `looks-done` and the other new kinds are severity `open`, so `counts.open` rises by 28. `counts.blocking` is
+ unchanged.
+- Not built here: drafts (r28 `draftsView`), running jobs and `askEditor`'s timeout and memo (P2b). No UI: the
+ dashboard and `/browse/decisions` still read `openDecisions()`.
+