Skip to content

An open-source, faster Devin alternative

TypeScript

Remove the build notes: they live in the knowledge repository

Igor Zalutski via Computer45862aa770e1
diff --git a/TRIAGE_WEB_NOTES.md b/TRIAGE_WEB_NOTES.md
deleted file mode 100644
index 313296f8..00000000
--- a/TRIAGE_WEB_NOTES.md
+++ /dev/null
@@ -1,98 +0,0 @@
-# Triage (web): design notes
-
-> **Hidden for now.** The Board ships first; Triage returns with the attention
-> step. The `computer/triage` route and the rail link (with its count) are
-> removed, so the screen is unreachable, and the new-session home lists the
-> open asks again as it did before Triage (each `AskCard` names its session).
-> `Triage.tsx`, `triage.ts`, `AnswerDock.tsx` and their tests stay in place,
-> unrouted. `RailLink` keeps its `badge` prop for the count. To bring it back,
-> revert the commit "Hide Triage: unroute the screen, drop the rail link,
-> Home lists asks again".
-
-Second pass on the Triage screen (ux-spec 3). What the screen does is
-unchanged; how it is arranged and answered is redesigned. Same family as the
-Board's visual pass (WORK_WEB_NOTES.md): Inter, `text-sm` (14/20) for names
-and body, `text-xs` (12/16, 12/20) for everything quiet, warm neutral tokens,
-1px `border`, `rounded-lg`/`rounded-xl` panels, a 4/8 px rhythm, tabular
-numerals for ages, amber only for "needs you".
-
-## The person's loop
-
-They arrive with 3-10 things waiting, each worth 5-30 seconds. Their eyes go:
-headline (what is needed) -> the thing to decide on (the command, the options,
-the secret) -> the agent's last words for context -> one click. Nothing of
-that requires scrolling, and nothing on screen offers two ways to do the same
-thing.
-
-Prior art: Claude Code / Cursor permission prompts (the exact command, one
-click to allow, typing means "no, do this instead"); GitHub's review box (one
-text field; the verdict is the submit choice); Slack interactive messages
-(the dialog's own buttons, a typed reply declines); Linear Triage and
-Superhuman (one item at a time, auto-advance, calm density).
-
-## Layout
-
-- Left list (320 px): "Needs you" (count in amber), then "Set aside", then
- "Agents working". Only "Needs you" is a primary heading (`text-sm`
- medium); the other two are quiet (`text-xs` medium, muted) and their rows
- are muted. A row: a 14 px glyph for the kind of ask (approval, question,
- secret, reply), the headline (`text-sm`, one line), the age (`text-xs`
- tabular, right), and the thread name under it (`text-xs` muted).
-- Main column, 720 px of content, centred, three bands:
- 1. Header (fixed): thread name (a link to the session) and age, `text-xs`
- muted; then the headline, `text-xl` semibold, at most two lines.
- 2. Excerpt (scrolls): no frame. The agent's last words sit at the bottom,
- directly on the dock (the column is bottom-aligned, chat order); older
- turns scroll up under a soft fade and "N earlier messages" heads them.
- The "where it stopped" rule is kept, quieter.
- 3. The answer dock (fixed to the bottom with air around it).
-
-## One answer dock, shaped by the ask
-
-One card: the ask attached on top, one text box, one footer. Typing is
-always the free-form answer to whatever was asked; there is never a second
-input. The footer's left holds the quiet "Set aside"; its right holds the
-verdict.
-
-| Ask | Attached on top | Footer actions | Typing + Enter |
-|---|---|---|---|
-| Approval | Tool label and target (file, cwd, server) on one line; the exact command / diff / file content / arguments in a mono block, wrapped, scrolling past 12 lines | Deny, "Allow for this session" (when `alwaysAllows`), Allow (primary) | The verdict buttons give way to Send: the message declines the call and tells the agent what to do instead (a steer, which declines open asks with the message) |
-| Plan approval (ExitPlanMode) | The plan, rendered, scrolling | Keep planning, "Approve, ask before edits", "Approve, accept edits" | Same as approval |
-| Question | Options as full-width rows: label and description; single choice answers on click, multiple choice toggles with check boxes | Send (enabled once something is chosen or typed) | Free-form answer to the question (`answers[].text`); typed text alongside a clicked option goes with it as a note |
-| Secret | Key glyph, the secret's name (mono), its purpose; "Add in Secrets" button. A masked field can replace the button in place later | Send | A message to the agent (declines the request) |
-| Reply (plain text turn, future `attention.reason = reply`) | nothing | Send | The reply |
-| Answered elsewhere | "Answered elsewhere" and Next replace the attachment | Send | An ordinary message (queued) |
-
-Answering advances to the next ask at once. A one-line confirmation of what
-was sent ("Allowed · Rotate the staging password") shows above the next
-headline for a few seconds and blocks nothing. A failed send keeps the text
-and the ask on screen, with "Not sent · Retry" in the footer. Empty list:
-a calm "All clear".
-
-## What an approval ask carries (API)
-
-`approval: { toolName, callId, input, title, alwaysAllows }`. `input` is the
-tool's raw input: Bash `{command, description?, timeout?}` (Codex adds
-`cwd`); Edit `{file_path, old_string, new_string}` or `{file_path, diff}`;
-MultiEdit `{file_path, edits[]}`; Write `{file_path, content}`; ExitPlanMode
-`{plan}`; MCP and Calvin tools their arguments. `title` is Claude Code's
-permission title or "Claude wants to use <tool>". The reason/description the
-Slack prompt shows is not in the API payload, and neither is the working
-directory for Claude sessions.
-
-## Headlines
-
-The headline says what is needed in the person's words, from the payload,
-never the tool's id: Bash uses its `description`, else "Run <program
-[subcommand]>" (setup lines, `cd x &&`, `sudo`/`env`/`VAR=` prefixes
-skipped); Edit/Write "Edit <file>"/"Write <file>"; a plan "Review the plan";
-an MCP tool "Merge pull request · github". The Board, the session list and
-the transcript's closed-ask line use the same words ("Wants to run psql").
-The session view's ask card reuses the same approval detail.
-
-## Work items
-
-Triage does not name the work item an ask belongs to. The session screen's
-header does ("Work: 114 Title" chips, from `GET /work/sessions/{id}/items`),
-and the thread name in Triage's header links there. Adding the chip to
-Triage's header is one `<SessionWork id>` away if wanted.
diff --git a/WORK_API_NOTES.md b/WORK_API_NOTES.md
deleted file mode 100644
index b4762d50..00000000
--- a/WORK_API_NOTES.md
+++ /dev/null
@@ -1,234 +0,0 @@
-# Work API: as built, and where it differs from tech-design 1, 2, 3.2, 3.6, 3.10, 4 and 5
-
-Build step 3, the service side. This file covers the shapes and headers, how the index follows the repository, what each operation costs in GitHub calls, and each place where the code differs from the design text or where the design was ambiguous and the simplest reading was chosen.
-
-## Shapes
-
-- `Repository` is `{ installationId: string, owner, name, branch, problem: string | null, problemMessage: string | null }`.
- - `problem` is a stable code: `repository_not_found`, `branch_not_found`, `access_denied`, `installation_removed`, `unavailable`.
- - `problemMessage` is GitHub's words, for people.
-- `GET /work/repository` returns `{ repository: Repository | null }`.
-- `PUT /work/repository` returns the same shape.
-- `GET /work/repositories` returns, for the repository picker, `{ installations: [{ id, accountLogin, accountType, settingsUrl, repositories: [{ id, owner, name, private, defaultBranch, pushedAt: string | null }], truncated, problem, problemMessage }] }`.
- - One entry per active GitHub installation of the organization, in one call. `id` is the value `PUT /work/repository` takes as `installationId`.
- - `settingsUrl` is the installation's page on GitHub (`/organizations/<login>/settings/installations/<id>`, or `/settings/installations/<id>` for a user), built here so the web derives nothing.
- - Repositories are sorted by `pushedAt`, newest first, never-pushed last, then by name. At most 500 per installation are read; `truncated` says more exist. The cap applies in GitHub's order, before the sort, so with more than 500 the newest may be among those left out.
- - An installation GitHub reports gone or suspended comes back with its `problem` and no repositories. GitHub not answering is 503 `unavailable`.
- - Nothing is stored and the index's write chain is not used; the installation tokens are cached as for the index's own reads. Scope: `work:read`.
-- `GET /work/items?stage=open` returns `{ repository, head, asOf, building, items: Item[] }`, with an `ETag` header.
-- `GET /work/items?stage=closed[&cursor&limit]` returns `{ items: Item[], nextCursor: string | null }`.
-- `GET /work/items/{n}` returns `{ item: Item, body: string }`.
-- `GET /work/items/{n}/history[?cursor]` returns `{ revisions: [{ sha, url, at, authorName, summary, sessionId: string | null }], nextCursor }`.
- - Newest first, 30 per page.
- - The cursor is a keyset on `(at, sha)`.
-- `GET /work/sessions/{id}/items` returns `{ items: Item[] }`: the items whose commits name the session in a `Session:` trailer, by its `cs_` id or its runner key, numbered order, at most 50.
- - The session must be one the caller may see (the Computer object's `work.refs` op answers its id and key). Otherwise, or for an id that is not `[A-Za-z0-9_-]{1,128}`, it is 404 `session_not_found`.
- - It is for the session screen's "Work:" chips. Scope `work:read`; the edge allows `GET` on it.
-- In `Item`:
- - `owner` is `{ email, name, id, source: "declared" | "derived" } | null`.
- - `declared` is the doc's `owner:` frontmatter.
- - `derived` is the author of the item's latest commit that was not a bulk edit, else of its latest commit of any kind, else null. The name drops a trailing " via Computer"; `name` and `id` resolve the email to a member as for the author, and the commit's name is the fallback.
- - `mine` holds for a derived owner too.
- - `lastActivityAt` is the item's latest commit that touched at most 5 item files (`BULK_ITEMS`). A commit touching more is a bulk edit: it moves `updatedAt` only. Null when the index has read no such commit (also before the walk dates the item).
- - `active` is `lastActivityAt` within 14 days (`RECENT_DAYS`), or `attention` is set (a linked session the caller may see is running or waiting). The index computes the first part (`recent`), the Worker composes the second.
- - `updatedAt`, `createdAt`, `closedAt` and `closedBy` are null until the walk (below) has read the commit that settles them. They are never a placeholder date.
- - A move to `done/` that has not been dated yet leaves `closedAt` and `closedBy` null. They are not taken from the newest commit.
-- Errors use the usual envelope: `{ error: { code, message, requestId, retryable, ... } }`.
- - A read that needs GitHub and does not get an answer within 5 s is 503 `unavailable` with `retryAfterMs`, plus a `Retry-After` header. This covers a closed item's body read for the first time, and history before the walk is done.
-
-## Headers
-
-- `ETag` on the open list.
- - It is `"<head|none>-<sha256/16 of [index version, recent open items, sessions stamp, caller member, caller email]>"`.
- - The count of recent open items moves the tag when an item ages out of `active` with no commit and no session write.
- - The index version moves on every write that changes output, including pull request state.
- - The sessions stamp is a counter in the Computer object (`work_stamp`). AFTER INSERT/UPDATE/DELETE triggers on `sessions` and `people` move it, so every write moves it, including the ones that leave `updated_at` alone (for example an `owner_name` change). Triggers were chosen so that no write path can forget to bump it.
- - The tag is checked before the list is read or composed. An unchanged poll costs two stamp calls (the index and the Computer object) and no SQL beyond them.
-- `Work-As-Of` is the time the index last saw the branch head. It is on every Work read, 200 and 304. On a 304 the client keeps its body and takes the new `Work-As-Of`.
-- The api-edge forwards `Work-As-Of` back and exposes it to CORS (`cloudflare-workers/api-edge/src/computer_api.ts`). `Idempotency-Key` was already forwarded and allowed.
-- `Idempotency-Key` is validated on PUT but not stored, because the PUT is naturally idempotent.
-
-## Requests
-
-- `stage` is required.
- - `stage=open` returns everything and refuses `cursor` and `limit` with a 400.
- - For `stage=closed`, items come highest number first. The default `limit` is 50 and the maximum is 100.
-- Unknown query parameters and unknown PUT fields return 400 `invalid_request`, with `field` set.
-- The PUT body:
- - `installationId` is a string; a PUT accepts a string or a positive integer;
- - `owner` is a GitHub login;
- - `name` uses GitHub's repository charset (`[A-Za-z0-9._-]`, not `.` or `..`);
- - `branch` follows `git check-ref-format --branch` (`branchName` in `api.ts`).
-- `owner` must be the installation's account (`accountLogin` from the Account object's `getGitHubInstallation`). Otherwise the PUT is 400 `invalid_request` with `field: "owner"` and `reason: "owner_mismatch"`.
-- A stored problem never refuses a PUT. The PUT checks the repository afresh and clears the problem.
-- Other `setRepository` errors are 400 `invalid_request` with `reason` and `field`, or 503 `unavailable`.
-- An unbound `WORK_INDEX` is 503 with `retryAfterMs` 5000.
-- **Decision for the owner:** any member may set the repository, as the design says. Nothing narrows it to admins.
-
-## Contract deviations
-
-- `Item.sessions[]` is `{ id, title, ownerName, status }`. The `status` field is added; the web client treats it as optional.
-- `unpublished` is always `false`. Unpublished work (3.7) is not built yet.
-- The `attention` of an item comes only from open asks:
- - `needs_you`: the caller's session with the oldest open ask;
- - `waiting_on`: another person's session with the oldest open ask;
- - `working`: a running or starting session, using the latest activity.
-
- `name` is the session owner's name, including for `needs_you`.
-
-## Composition
-
-- The design names two Computer-object calls, `briefs` and `people`. They are one `work.context` op, so a page costs one round trip. It returns `{ sessions, people, callerEmails }`.
-- `work.stamp` is the second op. It only reads the counter.
-- The email lookups in `briefs.ts` go through indexes: `sessions(lower(owner_email))`, `sessions(owner_user_id)`, `sessions(owner_id)` and `people(lower(git_email))`.
-- Briefs carry `status` and `openAskAt`, not the 3.7 attention, aside or unpublished fields.
-- `mine` is true when the item owner's email is in `callerEmails`. `callerEmails` holds:
- - the email the edge asserted;
- - the `owner_email` of the caller's sessions;
- - the `people.git_email` linked to the caller's sessions.
-
- Emails matching "noreply" are dropped.
-- Other people's private Slack sessions are left out of `items[].sessions` and out of history. Their `sessionId` is null. A trailer that names a Slack runner key is mapped to the public session id.
-- (S7) The edge now asserts `user_name` and `user_email` for dashboard (cookie) callers too, from `users` joined to `org_memberships`. Two effects:
- - sessions created from the dashboard now store the owner's name and email;
- - `me` and the actor name on dashboard writes become the member's name, where they were empty before.
-
-## Scopes
-
-- The new scopes are `work:read` (all GETs) and `work:write` (PUT).
-- Both are named-only, like `secrets:write`. Wildcard, legacy and `sandbox:*` keys do not get them. The dashboard gets every scope.
-- The edge's `KEY_SCOPES` and `COMPUTER_SESSION_KEY_SCOPES` are unchanged, so keys created by the CLI or a session lack the work scopes until someone decides they should have them.
-- A session principal can read but is refused on PUT (`computer_principal`).
-
-## Portability
-
-- `index.ts`, `item.ts`, `github.ts` and `platform.ts` name no platform.
- - They use `platform.ts`: `IndexStore` (exec and transaction), `Clock`, `Scheduler` and `Fetch`.
- - `index-do.ts` is the only file that imports `cloudflare:workers`. It adapts `ctx.storage.sql`, `transactionSync`, the alarm and `waitUntil`.
-- The tests run the index on `node:sqlite` (`test/fixtures/work-platform.ts`). That store refuses more than 100 bind parameters, as Durable Object SQL does.
-- A boundary test in `work-index.test.ts` fails if any of the four files names `cloudflare:`, `SqlStorage`, `DurableObject`, `ctx.storage`, `Date.now`, `setTimeout` or a bare `fetch(`.
-
-## GitHub
-
-- Every request is aborted after 10 s, body included.
-- 429, and a 403 that is a rate limit, pause that resource until its reset.
- - A 403 is a rate limit when it has `retry-after`, `x-ratelimit-remaining: 0`, or a body that says "rate limit", "abuse" or "secondary".
- - The pause is at least 60 s.
- - There are two resources, `core` (REST) and `graphql`, each with its own pause. A GraphQL limit stops only the pull request refresh.
-- Only "Resource not accessible by integration" (`access_denied`) and a 404 (`repository_not_found` / `branch_not_found`) are permanent. Any other 403 or 5xx is transient: no problem is stored, and the next look tries again.
-- A stored problem heals itself. The alarm retries it after 1 minute, doubling to 1 hour, and clears it on the first success.
-- Renamed repositories:
- - A redirect means the repository was renamed. The index reads `/repos/{owner}/{name}` and stores the new owner and name.
- - A 404 on the stored name is retried once by the stored repository id (`/repositories/{id}`) before it becomes `repository_not_found`.
-- `spare()` (a fifth of the quota left) gates the build, the advance, the open fill, the walk and closed reads.
-- (S10) The pull request token is narrowed to the linked repositories under the installation's account, lowercased and sorted. A link to another account's repository is never asked and shows as unreadable.
-
-## Index (3.2, 3.6)
-
-Tables:
-- `items`, with `stage` as a column and indexed;
-- `files`: when two files claim the same number, the open file wins, then the lowest path;
-- `links`;
-- `commits`: what a listing or a detail read gave, and for which folder it was listed;
-- `revisions`: one per item per commit;
-- `pulls`;
-- `meta`.
-
-A schema version change drops the derived tables and keeps the setting.
-
-### The first build
-1. The ref, the root tree, and the `work/` and `done/` trees.
-2. A row for each file. Open bodies are read in batches of 50, continued by the alarm. Closed bodies are read on first view.
-3. No commit calls. Dates and authors are null.
-
-The walk fills them, with one `commits?path=work` and one `commits?path=done` listing paged back from the head, then the details of each listed commit.
-
-### An advance (head moved from cursor C to H)
-1. `compare/C...H` (one page; commits are not paged).
- - A status other than `ahead` or `identical`, meaning C is not an ancestor of H, starts a rebuild. Links of the items that remain are kept.
-2. The changed item files:
- - from compare's file list when it has fewer than 300 entries;
- - otherwise compare's list may be cut, so the root tree at H is read, and only the folder trees whose sha moved since the last build or advance. Unchanged folders cost nothing, whatever the size of the range.
-3. Blobs are read only for changed items: open ones always, closed ones when there are 50 or fewer.
-4. One transaction writes the rows. A changed item's `updatedAt` becomes null, and a stage move nulls `closedAt` and `closedBy`, until the walk dates them.
-5. A one-commit range takes its dates, authors and trailers from compare itself. A longer range queues a listing of each touched folder at H, and the advance runs one page of each plus at most 10 commit details. The alarm continues the rest: 2 pages and 10 details per tick, while `spare()`.
-6. A listing stops at the first commit already listed for that folder, or at a short page.
-7. Each detailed commit is applied in its own transaction:
- - revisions and links;
- - `updatedAt` is the latest commit, with its author;
- - `lastActivityAt` and the derived owner are the latest commit that touched at most 5 item files, with its author;
- - `createdAt` and the author come from the add, or from a rename from a non-item path;
- - `closedAt` and `closedBy` come from the latest move into `done/`.
-
- Order does not matter, so the walk may meet commits in any order.
-8. A commit's files come from `commits/{sha}` at 300 per page, up to 10 pages.
-
-### History
-- History is served from `revisions`.
- - Once the walk is done it costs no GitHub call.
- - It follows renames and the move to `done/`, because each revision is filed under the item number.
-- Before the walk is done, the item's known paths are each asked `commits?path=…&sha=head` for the missing commits, within 5 s, and merged by `(at, sha)`.
-
-### Pull requests
-- At most one GraphQL query of 50 every 5 minutes while the board is read.
-- Order: links never asked first, then the oldest `checked_at`.
-- `merged` and `closed` are final and never asked again. `unreadable` is asked again after a day.
-
-### Reads
-- Reads never wait on the index's write chain.
-- A read whose head check is older than 10 s starts a look in the background and answers from what is stored.
-
-## Call budgets (GitHub requests)
-
-Measured with the fake GitHub in `work-index.test.ts`. The fake enforces the real limits: compare at 300 files, `per_page` at most 100, commit files at 300 per page, content-addressed trees.
-
-| Operation | Calls |
-| --- | --- |
-| PUT repository | 2: the repository and the branch ref. |
-| GET repositories | 1 page of 100 per installation, up to 5 (500 repositories), plus a token when none is cached. |
-| First build, 150 open + 500 closed | 154: 1 ref + 3 trees + 150 blobs. No commit calls. |
-| Walk after that build | 5: 2 folder listings, then 3 pages of the import commit's 650 files. |
-| Advance over 500 commits (400 non-item files, 100 item edits) | 115: 1 ref + 1 compare + 2 trees (root, `work/`) + 100 blobs + 1 listing page + 10 details. No rebuild. |
-| The walk finishing that range | 91, over later alarms. |
-| Advance over one commit | 3: ref + compare + one blob per changed item. |
-| Walk of 150 items over 300 one-item commits | 306: 5 listing pages (4 of `work/`, 1 of `done/`) + 301 details. Activity and derived owners add nothing. |
-| Board poll, unchanged | At most 1 ref per 10 s window, plus the two stamp calls (no GitHub). A 304. |
-| Item page | 0, or 1 blob the first time a closed item is opened. |
-| History once walked | 0. |
-
-## Activity and owners
-
-- Both come from the per-commit file lists the walk and the advance already read, so they cost no GitHub call. The first build stays 154 calls for 150 items; a walk of a few hundred commits is about one listing page per 100 commits per folder plus one detail per commit (306 for 300), spread over alarm ticks by the quota guard.
-- Until the walk has dated an item, its `lastActivityAt` and derived owner are null, and it is dormant unless a session is at work. On a first build this lasts until the walk is through.
-- **Decision: the walk is not capped by age.** It also gives history, the author, `createdAt` and `closedAt`, and a cap would leave the derived owner to bulk commits only. Activity older than 14 days is dormant whatever its depth. GraphQL history was considered and not used: it has no file lists (bulk edits cannot be told apart) and would be a second code path.
-- `SCHEMA_VERSION` is 3: the tables are dropped and rebuilt once on deploy (new item columns `updated_name`, `updated_email`, `activity_at`, `activity_name`, `activity_email`).
-
-## Session: trailers (what a link needs)
-
-- The knowledge repository's `prepare-commit-msg` hook (`computer/hooks/knowledge/prepare-commit-msg`) adds `Session: $SP_SESSION_ID`. `SP_SESSION_ID` is the session's `cs_` id, or its runner key when it has none yet (`runner/session-secrets.ts`). The hook is installed by `syncKnowledgeHooks` (`computer/src/workspaces/knowledge-hooks.ts`) at housekeeping and on workspace setup; worktrees share it.
-- Gaps, read from the code and not run: a commit through an editor (no `-m`/`-F`) gets no trailer; Codex has `SP_SESSION_ID` only through `BASH_ENV`, so only in bash; a repository cloned on demand (`checkoutRepos`) has no hook until the next housekeeping.
-- On a dev stack a link appears when: the stack's computers run a bundle of this branch (they pull `calvin-latest.bundle` every 5 minutes); the repository is set with `PUT /work/repository` and the index is bound; housekeeping has installed the hook; the host is at v4; the commit is made with `-m`/`-F` in the session's worktree and pushed; the index has walked it. A Slack session's links are visible only to its owner.
-
-## Limitations
-
-- The walk stops a folder's listing at the first commit it has already listed. Commits that a merge brings in and that are older than an already-listed commit can be missed. The knowledge repository is mostly linear, and a rebuild re-lists everything.
-- Before the walk is done, history asks GitHub by the paths the index knows. A name an item had before a rename it has not walked yet is not known.
-- (S8) The duplicate-number warning already names the hidden files. Unchanged.
-
-## Remaining
-
-- A Work API docs page. The scope rows were added to `docs/api/overview.mdx`.
-- OpenAPI: none exists in the repo.
-- SDK types.
-- Grafana panels for the new `work` route family.
-- Whether `KEY_SCOPES` should include `work:read`.
-
-## [V] items
-
-Nothing was verified against live GitHub or Slack.
-
-- Line 131 (the ids in Slack session trailers): either form works, because the server resolves runner keys.
-- Line 175 (the App's contents-write grant): not needed for step 3.
-- Line 177 (GraphQL with an installation token): exercised only against the fake GitHub.
-- Line 231 (plain proxy call): not part of this step.
-- Whether GitHub's 403 bodies for secondary limits always contain the words matched above, and whether `response.redirected` is set for a renamed repository through a Worker's fetch. Both follow GitHub's docs, and the 404 path by id covers the second if not.
diff --git a/WORK_WEB_NOTES.md b/WORK_WEB_NOTES.md
deleted file mode 100644
index 5bc24ad5..00000000
--- a/WORK_WEB_NOTES.md
+++ /dev/null
@@ -1,197 +0,0 @@
-# Work board and item page (web): choices made
-
-Build step 3, web side. The code follows tech design 3.10 and 3.11. Where the
-contract left something open, the simplest reading was taken, and it is
-written down here.
-
-## API shapes assumed
-
-The calls go to the `/api` base with the dashboard cookie, like the session
-routes: `/api/managed-agents/computer/work/...`. The schemas are in
-`web/src/managed-agents/work/api.ts`. Every object is loose, so the server can
-add fields without breaking the screens.
-
-- `GET /work/repository` returns `{repository: Repository | null}`.
-- `PUT /work/repository`:
- - Body: `{installationId, owner, name, branch}`.
- - Returns `{repository}`.
- - Sends an `Idempotency-Key` header.
- - The picker sends the chosen installation's `id`, the repository's `owner` and `name`, and its `defaultBranch` as `branch`. There is no branch input.
-- `GET /work/repositories` returns `{installations: [{id, accountLogin, accountType, settingsUrl, repositories: [{id, owner, name, private, defaultBranch, pushedAt}], truncated, problem, problemMessage}]}`, repositories already sorted most recently pushed first.
- - The picker (`RepositoryCombobox` in `RepositorySetting.tsx`) is a combobox like GitHub's and Vercel's, replacing the earlier list of Select buttons. The trigger shows the current `owner/name` (with a lock when private). It opens a popover the trigger's width: a search that filters as you type, then a list of at most 260px, with one row per repository showing a check on the current one, a lock when private and the pushed time. Arrow keys and Enter choose. There is no cmdk in the web, so the listbox is built by hand with aria roles. The popover is `ui/popover.tsx`, a thin wrapper over the `radix-ui` package already installed, so there is no new dependency.
- - With more than one installation the rows are grouped by account, and each group header has its own "Adjust access" link. With one, the footer reads "Missing a repository? Adjust GitHub App access" plus a refresh. Both links open the installation's `settingsUrl` in a new tab.
- - The list is read again whenever the window regains focus (`refetchOnWindowFocus: 'always'`, past the 30 s default `staleTime`), so coming back from GitHub after granting access shows the new repository.
- - Choosing the current repository again does nothing, unless it has a problem: then it saves again, which is how "Choose again" retries a missing branch.
- - When the list loads with no installation, "Connect GitHub" starts the managed GitHub App install in a new window (the same flow as Connections and the Computer page).
- - Choosing a repository when one is already set asks first ("Switch the board to owner/name?"). The wording follows the server's `setRepository`: the index is rebuilt from the new repository's default branch, nothing is written to either repository, and switching back is possible. Whether agents then write new items to the new repository was not checked, so the dialog does not say.
-- `Repository` is `{installationId: string|number, owner, name, branch, problem?: string|null, problemMessage?: string|null}`.
- - A non-empty `problem` means the repository cannot be read; the board then says so and links to settings.
- - `problem` is a stable code (`access_denied`, `repository_not_found`, `installation_removed`, `installation_suspended`, `branch_not_found`, `github_app_not_configured`). The code is never shown: the web shows `problemMessage` when present, else its own sentence for a known code (`repositoryProblem` in `board.ts`), else a general one.
-- `GET /work/items?stage=open` returns `{repository, head, asOf, building, items}`.
- - It is polled every 15 seconds with `If-None-Match: <last ETag>`.
- - A 304 keeps the cached page. `apiFetchResponse` now passes a 304 back to the caller instead of throwing; this is the one change to the shared client. It returns the `Response`, so the caller reads headers from a 304 as from a 200.
- - The server sends the index's current `asOf` in a `Work-As-Of` header on both 200 and 304. The web reads it on both: on a 200 it overrides the body's `asOf`, on a 304 it replaces only the stored `asOf` and keeps the page (`keepOpenItems`). Without it, a quiet board would freeze `asOf` and say "As of N ago" after 5 minutes.
- - When `repository` is null, the board shows its first-visit message ("First visit" below) with the repository combobox, or Connect GitHub when no installation grants anything.
-- `GET /work/items?stage=closed&limit=50[&cursor=]` returns `{items, nextCursor}`.
- - It is fetched once the repository is set, with "Load more" following `nextCursor`.
-- `GET /work/items/{n}` returns `{item, body}`. It is polled every 15 seconds.
-- `GET /work/items/{n}/history[?cursor=]` returns `{revisions, nextCursor}`. It is fetched only while the History tab is open.
-- `GET /work/sessions/{id}/items` returns `{items}`: the items whose commits name the session. The session screen's header reads it once a minute at most (`SessionWork.tsx`, no retry) and shows nothing on any error.
-- `Item` and `Revision` follow the contract field for field.
- - Item sessions are `{id, title, ownerName, status}`; `status` is required, one of `starting | running | waiting | idle | suspended`.
- - `owner` is `{email, name, id, source: 'declared' | 'derived'}`. `derived` comes from recent commits (the server's choice); `mine` is the server's for both.
- - `lastActivityAt` (the item's own last change, bulk edits left out) and `active` are the server's. The web compares no dates for them.
- - `updatedAt` may be null while not known yet. Such an item sorts last within its group and shows no time (card and item header).
- - `closedAt` and `closedBy` may be null on a closed item. The card and header then say just "Closed" with no time (or the `updatedAt` time when only that is known), and the item shows in the Closed column only with "Show older".
-- Any 404 from a `/work` route reads as "not available yet" (section 4), except a 404 with code `item_not_found` on the item page: that reads "No item 123", with a link back to the board.
-
-## Beyond the contract, or left out
-
-- Session state: `status` is now in the contract. Details shows the sessions screens' status dot and their word in lower case (working, starting, idle, asleep), with "waiting for an answer" for `waiting`, because the session may be someone else's.
-- Related items are not in the contract, so they are not shown.
-- Close and Reopen are left for step 5. The places for them are marked with comments:
- - The Ready to close card's action slot (`Card` children).
- - The closed card.
- - The item header next to "View on GitHub".
-- "New session on this item" is left out, because the dashboard has no link pattern that opens a session with a prefilled prompt. `computer/sessions` reads no prompt parameter.
-- The reason a closed item was closed is not in the contract. Closed cards show "Closed by X" when `closedBy` is set, and otherwise "Closed".
-
-## Presentation choices (no derived state)
-
-The web renders the server's `stage`, `readyToClose`, `attention`, `mine`, `warnings` and `unpublished`. The client only filters, orders and words them.
-
-- Columns:
- - In progress is `stage=open` with `!readyToClose`.
- - Ready to close is `stage=open` with `readyToClose`.
- - Closed is `stage=closed`.
- - Within a column, items with `attention.state = needs_you` come first, then `lastActivityAt` (else `updatedAt`) newest first.
-- Attention: only `needs_you` is coloured (amber). Waiting reads "waiting on X · 3h" and working reads "agent working"; both are grey.
-- Dormant: open items with `active: false`. Each open lane (In progress, Ready to close) shows its active items and ends with a quiet "Dormant (N)" toggle, collapsed by default; the lane's count is the active count. Open lanes are kept in the address (`?dormant=progress,ready`). It is a view, not a stage. The toggle's hover text says what dormant means: "No change of their own in two weeks and no session at work". The client has no threshold; the old stale constant is gone.
-- Time on an open card: `lastActivityAt`, else `updatedAt`, so a bulk retag does not make a dormant item look fresh.
-- Owner: avatar and name on the card. A derived owner is muted, with a dashed avatar ring and the hover text "Name · From recent commits"; the item page says "(from recent commits)". No owner shows nothing.
-- Sessions: the card's activity line links each linked session (a status dot, hover "title · owner · status") to `/computer/sessions/{id}`; Details on the item page already did.
-- Session screen: the header shows "Work: 114 Title" chips (two at most, then "+n") linking to the items the session's commits name.
-- Closed column: by default it shows items with `closedAt` in the last 7 days. "Show older" (kept in the address as `?older=1`) shows every fetched closed item.
-- Address state: the tab (`?tab=everyone`; Mine is the default), the text filter (`?q=`) and the tag filter (`?tag=`) all live in the address. Tags on cards set the tag filter.
-- Mine empty: shown when Mine has nothing, Everyone has something and no filter is set. It links to Everyone.
-- Index age: shown as "As of Nm ago" when `asOf` is more than 5 minutes old. While `building` it reads "Reading owner/name…". `problem` appears in red with a Settings link.
-- Item page:
- - The frontmatter and a leading `# Title` are removed from `body` before rendering, because the header already shows the title and the aside shows the fields.
- - Relative links in the doc resolve against `item.url` on GitHub. `AgentMarkdown` gained an optional `resolveUrl` prop for this.
-- The item page tab is kept in the address (`?tab=history`).
-- Pull request dot colours use the status tokens:
- - open: running (green)
- - draft: stopped (grey)
- - merged: hibernated (blue)
- - closed: error
- - unknown: outline
-- Where things live:
- - `KnowledgeRepositorySection` (`KnowledgeRepository.tsx`, props `{id?}`) is the stateful setting and can be mounted anywhere. Its Repository row is the combobox itself (there is no Change or Cancel), with "Open on GitHub" as a trailing icon button. Below it are the branch and its state: "Up to date · read N ago at <short SHA>", "Reading the working docs for the first time…" while building, or the problem sentence in red with a fix per code (Reconnect GitHub for a removed or suspended installation, the installation's `settingsUrl` for a missing repository or denied access, choose again for a missing branch, a note that it is ours for `github_app_not_configured`).
- - It is the second section of the organization Settings page, as `/settings#work-repository`. The Computer page is not the place: it shows the setup wizard until setup is complete. The board's no-repository state (`BoardIntro`) embeds the combobox itself.
- - The Settings page was redesigned with it. `components/settings.tsx` holds the shared anatomy: `SettingsSection` (title, one sentence, one panel), `SettingsRow` (three columns on shared edges: a 10rem label, the value, and a trailing action at the panel's right edge; on a phone the label stacks above the value) and `SettingsAction` (the one trailing action style, a quiet ghost button). The sections are Organization, Knowledge repository, Members and Agent environment. The name shows Save and Cancel only once changed, and Escape resets it. Members and invitations have a "…" menu holding Remove or Revoke; your own row has none and is tagged "You".
- - The GitHub repository and commit links are built in the web (`https://github.com/owner/name`, `/commit/<head>`); a `url` on `Repository` from the API would remove that.
- - Queries more than one screen reads (`useOpenItems`, `useRepository`, `useGrantingInstallations`) live in `queries.ts`, so tests that mock `./api` reach them.
- - The board's header names the repository it reads as a quiet link to that setting (underlined on hover), also while the first read runs; when the repository has a problem the link reads "Settings".
- - The rail gains one link, "Board" (`/computer/work`). It is shown unconditionally like Secrets; the page itself redirects when the organization has no computer.
-
-## First visit
-
-Before the board has cards it explains itself (`BoardIntro.tsx`). The three
-lanes are drawn behind one message as placeholders: their names, and cards as
-dashed outlines with grey bars, still, fading out downwards (only the first
-lane below `lg`). The message is a raised panel, 34rem wide, over them.
-
-- Steps: a quiet line, "Connect GitHub · Choose a repository · Track a first
- item", done ones checked, the current one in the foreground.
-- 1, GitHub not connected (`GET /work/repositories` lists no installation):
- "The work your team and its agents have in progress. Each card is a
- markdown file in a git repository. Agents read and update those files as
- they work, so there is nothing to keep in sync by hand." Then the example
- tree, then "Knowledge repository: the one repository where that work is
- written down: `work/` for open items, `done/` for closed ones." and the one
- action, Connect GitHub (primary). While the list loads the action is a
- skeleton, so the copy does not jump.
-- 2, connected, no repository: the same copy, the action is the combobox,
- with "Any repository works. Nothing is written to it until an agent tracks
- something."
-- 3, a repository with no items, open or closed: "Nothing is tracked in
- owner/name yet. A card appears here for each file in its `work/` folder.
- Ask an agent to track something, in any session, and it writes the first
- one:", an example ask ("Track the usage billing work: what is done and what
- is left."), the tree of that repository with `work/1-usage-billing.md`, and
- Start a session (primary, `/computer/sessions/new`). The quiet alternative
- is "Or add a file to `work/` on GitHub": GitHub's new-file page with
- `work/1-usage-billing.md` and the item's shape filled in (`owner:` the
- viewer's email, `# Title`, the line on where it stands, `## Left` with
- `- [ ]`), from `newItemUrl` in `board.ts`. No tabs or filter in this state.
-- 4, the first read (`building` with nothing read yet): no steps, a spinner,
- "Reading owner/name for the first time. Each file in `work/` and `done/`
- becomes a card. They show here once the first read is done."
-- The tree is monospace and muted; a dashed line runs from its first open
- file to a small card of the same item, which hides below `sm`. The names
- follow what agents are told (`computer/src/workspaces/knowledge.ts`):
- `work/NN-slug.md`, `done/`, `owner:`, `## Left`. A new number is one more
- than the highest in `work/` and `done/`, so the first item is 1.
-- A repository with a problem and no items keeps the lanes and the red
- header, as before.
-
-## Preview mock
-
-`web/src/api/mock-work.ts` holds invented data. Pick a scenario with `?work=no-github|none|empty|mine-empty|building|problem|missing`. `no-github` has no repository and no installation.
-
-- The open-items poll goes through `workOpenItemsResponse`, which answers as the server does: an ETag over the page without `asOf`, a 304 while that ETag matches, and `Work-As-Of` on both.
-- `problem` sends `access_denied` with a `problemMessage`; `&problem=<code>` sends another code, without a message.
-- `/repositories` lists eight repositories under `acme` and two under `acme-labs`, the preview's two installations. `?work=none` shows the combobox alone. The preview's organization (`api/mock.ts`) has four members and two invitations, so the Members section has something to show.
-- Item 31 has an unknown `updatedAt`; closed item 8 has no `closedAt` or `closedBy`.
-- Owners are mixed: declared, derived (muted) and none. Items 3, 5, 6, 7, 10 and 11 are dormant; 5 was touched yesterday by a bulk edit only, 11 has an idle session. `/sessions/{id}/items` answers from the mock items' sessions, so the session screens show Work chips.
-- An unknown item number answers 404 `item_not_found`.
-
-## Visual pass
-
-A second pass on arrangement and type only; what the screens show and do is
-unchanged. It stays in the dashboard's family: Inter, `text-sm` (14/20) for
-names and `text-xs` (12/16 or 12/20) for everything quiet, the warm neutral
-tokens, 1px `border` lines, `rounded-lg` panels. The benchmark is the calm and
-regularity of Linear's board and issue page, not its features.
-
-- Grid: three equal stage lanes on one grid (`lg:grid-cols-3`), one stack of
- cards each. Each lane is a tinted region (`bg-muted/60`, darker than the
- shell in the dark theme) that runs the full height of the board, with its
- header inside it, so the three stages read as three regions at a glance.
- Lanes are 16px apart; cards inside a lane are 8px apart. Below `lg` the
- lanes stack.
-- Lane header: stage name (`text-sm` medium) and count (muted, tabular) on the
- left; the note on the right (`text-xs` muted). The "N need you" note is the
- one place the header uses the amber accent.
-- Card anatomy, fixed order, three tiers:
- 1. Identity line (`text-xs`, muted, 20px): number, at most two tags and
- "+n", then on the right the doc-problem and unpublished icons and the
- owner's avatar.
- 2. Title (`text-sm` medium, 20px lines, at most two lines), then the state
- line (`text-xs` muted, 20px lines, at most two lines; left out when the
- doc has none).
- 3. Activity line (`text-xs`, muted, 20px): the attention marker on the
- left (or "Closed by X" on a closed card); on the right a pull-request
- icon with one dot per pull request (state on hover), the session count
- with an icon, and the age, right-aligned and tabular.
-- Spacing: 12px card padding; 8px between tiers, 4px between title and state.
- The activity line sits 12px below the text above it.
- Every line box is 20px, so cards differ in height only by whole lines.
-- Tags: sans, 11px, hairline border, no fill, instead of filled monospace
- pills. Two at most on a card; the rest are counted and listed on hover.
-- Colour: only "needs you" is coloured (amber). Doc problems and unpublished
- changes are grey icons on the card (words and colour on the item page).
- Pull request dots keep their state colours, as the spec asks for state.
-- Dormant (when unfolded): the card loses its raised surface and sits flat on
- the lane with a dashed border, its title dimmed.
-- Item page: a neutral stage pill, then one metadata line with dot
- separators (a dot that wraps to the start of a line is clipped away). Only
- "needs you" and the doc problem keep their colour there; "unpublished
- changes" is grey with words. The doc is held to 42rem with 32px before each
- section heading; task lists have drawn boxes instead of bullets, and done
- items are muted. The aside is 20rem, set off by a rule, and sticky. In
- Details, session and pull request dots sit in a 20px column that lines up
- with the People avatars. History is a timeline: a hollow dot on the
- summary's first line, the age on the right of that line, then a single
- non-wrapping meta line (author · session · commit) where only the author
- truncates.