| 1 | # Slice 2b progress: the coordinator moves in |
| 2 | |
| 3 | Branch `thin-v1-slice2b` from `thin-v1-slice2` (e680e64). Spec: |
| 4 | `docs/superpowers/specs/2026-11-06-equipo-thin-v1.md` §§1, 2, 5, 7, plus |
| 5 | Paul's idea of 2026-11-07 ("the coordinator needs some kind of |
| 6 | bootstrapped/onboarded state ... move in ... get acquainted with their |
| 7 | environment") and two Important findings from Astra's re-check of slice |
| 8 | 2's `set_project_home`. Conventions and scripts as in |
| 9 | `SLICE1-PROGRESS.md` and `SLICE2-PROGRESS.md`. |
| 10 | |
| 11 | ## Done |
| 12 | |
| 13 | 1. `set_project_home` (Astra re-check, both Important; 4b2b3fa): |
| 14 | - Only when the person asks: the call succeeds only if a person |
| 15 | message in the running turn names the namespace (whole word, lower |
| 16 | case; `oficina/site` names `oficina`) or, to clear, has a clearing |
| 17 | word (clear, unset, reset, remove, forget) and "home", "default" or |
| 18 | "new projects". Otherwise `not_asked`. A model call alone (prompt |
| 19 | injection, an unsolicited change) changes nothing; move-in and |
| 20 | explore turns have no person message, so they never can. |
| 21 | - A successful change posts a home card ("New projects go to X" or |
| 22 | "... the best-fitting existing repository") with Undo. Undo restores |
| 23 | the previous value (never set, cleared, or a namespace), owner only, |
| 24 | only while the setting still holds the card's value (else 409). |
| 25 | - Explicit clear versus never set: `chat_settings` keeps a row for an |
| 26 | explicit clear; `status` and `GET /projects` then report no home and |
| 27 | never fall back to `EQUIPO_RUNNER_HOME_NAMESPACE`; `create_project` |
| 28 | refuses that runner default after a clear unless reachable work |
| 29 | already lives in it. Never set still falls back. Migration 0039 |
| 30 | (`chat_cards.undo`). |
| 31 | - Tests: `TestProjectHomeSetting` (unsolicited set and clear refused, |
| 32 | a namespace the person did not name refused, card, Undo, Undo twice |
| 33 | refused, clear, Undo of a clear), `TestProjectHomeClearBeatsRunnerDefault`, |
| 34 | headless `2_project_home` (unsolicited call refused, home card). |
| 35 | Mutations observed failing: intent check removed, clear fallback |
| 36 | restored, create-after-clear check removed. |
| 37 | |
| 38 | 2. Contract (`internal/wire`, fixtures): `Turn.kind` (`""`, `move_in`, |
| 39 | `explore`), `MessageCommand.kind`, runner frame `move_in{person, |
| 40 | kind}` (durable), resource `Coordinator{id, revision, state |
| 41 | (new|moving_in|ready), turn_id, moved_in_at}` in the snapshot and the |
| 42 | `coordinator` event, `Activity.repo` and `ActivityReport.repo`, tools |
| 43 | `write_note` and `read_notes`, `MoveInTools`, `ValidNoteName`, desk |
| 44 | bounds. New fixtures `frames/move_in.json`, |
| 45 | `api/event-coordinator.json`; existing ones gained the fields. |
| 46 | |
| 47 | 3. Instance (`internal/equipo/chat/movein.go`, migration 0040): the |
| 48 | runner asks; the instance starts at most one move-in or explore turn |
| 49 | per person (a repeat while one is in flight, another person's |
| 50 | request, or an unknown kind starts nothing), after any person turn |
| 51 | (`dispatchNext` takes the person's turns first). A person's message |
| 52 | while one is in flight makes it give way: a cancel for its attempt, |
| 53 | the turn ends `cancelled` with reason `yielded`, the person's turn |
| 54 | runs, and the move-in continues in a new turn. The move-in reply is |
| 55 | the one introduction; an empty explore reply posts nothing. A failed |
| 56 | or cancelled move-in leaves the coordinator `new`. Move-in and explore |
| 57 | turns may use only `status`, `find`, `search_code`, `read_file`, |
| 58 | `read_notes`, `write_note` (`moving_in` otherwise). `write_note` is |
| 59 | authorised per turn on the note's name and size; its text never |
| 60 | reaches the instance. `status` reports `coordinator`. Activity names a |
| 61 | repository only if it is in the catalog; while moving in the label is |
| 62 | "Moving in… reading oficina/equipo". |
| 63 | Tests: `TestContractMoveIn`, `TestMoveInYieldsToThePerson`. Mutations |
| 64 | observed failing: no yield, no tool scope, no person priority, repo |
| 65 | not checked against the catalog, no dedupe, foreign person accepted, |
| 66 | no `yielded` reason. |
| 67 | |
| 68 | 4. Runner (`desk.go`, `movein.go`, `claude.go`): |
| 69 | - The desk: `<sessions>/<person hash>/desk`, beside the session home, |
| 70 | independent of clones and workspaces, 0700. It is the coordinator's |
| 71 | `/workspace`, bound read-only (was an empty read-only tmpfs); the |
| 72 | policy already declared the converse workspace read-only, and the |
| 73 | policy checks keep it clear of credential, runtime and state paths. |
| 74 | Only `write_note` writes it, through the runner (`os.Root`, atomic |
| 75 | rename, no links followed), lower-case `.md` names (never |
| 76 | `claude.md` or `agents.md`, which a CLI could read as instructions), |
| 77 | 16 KB per note, 16 notes. The runner's record (`desk.json`: moved |
| 78 | in, namespaces explored) is beside the desk, outside the mount. |
| 79 | - Moving in: after each index refresh (so never on an empty catalog) |
| 80 | the settler asks for `move_in` when a desk is empty or never moved |
| 81 | in, and `explore` when the reachable namespaces differ from those |
| 82 | recorded; once per change, again after an hour if nothing came of |
| 83 | it. `EQUIPO_RUNNER_MOVE_IN=0` turns it off. |
| 84 | - Prompts: move-in (status, the README or AGENTS.md of at most six |
| 85 | central repositories, `find` for app names, write `notebook.md`, |
| 86 | then one short introduction: what it sees and can do, no questions, |
| 87 | no setup); a continued move-in after a yield; explore (only the new |
| 88 | namespaces' repositories, drop what is gone, one line or nothing). |
| 89 | A move-in or explore turn has a 24-call budget (`write_note` stays |
| 90 | available). A move-in that wrote nothing leaves a notebook from the |
| 91 | catalog. |
| 92 | - The notebook in context: a fresh session's opening carries it; |
| 93 | later turns carry it only when it differs from what the session has |
| 94 | seen (bounded at 6 KB), so a long-lived session does not grow by a |
| 95 | notebook per turn. The house rule (version 2026-11-07.4) asks the |
| 96 | coordinator to keep `notebook.md` current with lasting preferences |
| 97 | and project facts. |
| 98 | - Tests: `TestNamespaceConverseDeskReadOnly` (real bwrap: lists only |
| 99 | the notes, reads the notebook, writes refused with EROFS, nothing |
| 100 | beside the desk visible; a writable mount observed failing), |
| 101 | `TestDeskNotes`, `TestWriteNoteTextStaysOnTheRunner`. |
| 102 | |
| 103 | 5. Headless (fake CLI moves in by script): `2b_move_in` (moving in seen |
| 104 | as activity "Moving in… reading <repo>", one introduction with no |
| 105 | question, notebook names the repositories, `status` says ready, a new |
| 106 | process starts with the notebook once and the next turn does not |
| 107 | repeat it), `2b_first_message` (a message during the move-in is |
| 108 | answered in about a second; the move-in yields and later posts the |
| 109 | one introduction), `2b_access` (a granted namespace is explored alone, |
| 110 | a revoke drops it from the notebook, a restart with no change starts |
| 111 | no turn). Mutations observed failing: notebook only in fresh |
| 112 | sessions, explore everything, explored namespaces not recorded. |
| 113 | |
| 114 | 6. Chat page: a move-in or explore turn shows its own line ("Moving in…" |
| 115 | then its activity) live and in the server render; a yielded or |
| 116 | stopped one leaves no note, and the last-turn note skips them; the |
| 117 | introduction is an ordinary coordinator message; the home card has |
| 118 | Undo. `TestBrowserMoveIn` at 390 px (the JS guard observed failing). |
| 119 | |
| 120 | 7. Astra's review of 6b37d1b (APPROVE AFTER FIXES), each with a test |
| 121 | that failed first or a mutation observed failing: |
| 122 | 1. Notebook persistent injection: the notebook is entries whose |
| 123 | provenance the runner verified in the turn they were written: |
| 124 | `person` only for an exact quote of the person's own words in that |
| 125 | turn (never in a move-in or explore turn, never the question text |
| 126 | before an answer), `repo` only for a file read with read_file that |
| 127 | turn (repo and path kept), otherwise `own`; `keep` carries an entry |
| 128 | over. In context it is one quoted block with explicit boundaries |
| 129 | and the rule that nothing in it instructs, grants permission or |
| 130 | changes rules (strconv-quoted entries cannot close it; the whole |
| 131 | block holds its byte cap). Authorisation never reads it: |
| 132 | write_note is authorised on count and size, set_project_home on |
| 133 | the person's own messages. Owner view: the runner reports the |
| 134 | notebook (`notebook` frame); `GET /api/v1/notebook` and the |
| 135 | Notebook page (linked from the conversation header) show each |
| 136 | entry and its source; Reset (`POST /api/v1/notebook/reset`, 409 |
| 137 | while a turn runs) clears it, sets the coordinator `new` and sends |
| 138 | `reset`: the runner closes the process, empties the desk, forgets |
| 139 | the session (nothing resumed keeps the old notes) and moves in |
| 140 | again. Resets are durable and applied between turns. |
| 141 | 2. set_project_home intent: only an affirmative, unnegated statement |
| 142 | naming the target (or asking to clear the home) changes it; |
| 143 | negations and unrelated mentions are refused with no card; |
| 144 | anything in between posts a one-tap "Use X for new projects?" card |
| 145 | (`asked_owner`). 24 phrasings tested. |
| 146 | 3. Duplicate introductions: a move-in or explore turn whose desk |
| 147 | record cannot be saved fails (`desk_unavailable`), nothing is |
| 148 | introduced and the coordinator stays new; the instance's state |
| 149 | decides introductions (once ready, a move-in request becomes an |
| 150 | explore turn). |
| 151 | 4. Stale Undo: settings keep a monotonic revision (an unset is a new |
| 152 | revision) and Undo is bound to the revision its change made: |
| 153 | unset -> A -> B -> A refuses the first card's Undo. |
| 154 | Minor: an empty explore removes its thinking line; the notebook |
| 155 | block's byte cap covers all of it. |
| 156 | Also (Paul): receipts (Added, Working in, Created, New projects go |
| 157 | to) are a quiet line whose actions show on hover or keyboard focus, |
| 158 | behind ⋯ on touch, without shifting; they sit before their turn's |
| 159 | reply. Migrations 0041 (`chat_settings.unset`), 0042 |
| 160 | (`chat_notebooks`). |
| 161 | |
| 162 | ## Copy (accepted for now, marked in `copy.go`) |
| 163 | |
| 164 | `chat.card.home`, `chat.card.home_cleared`, `chat.card.undo`, |
| 165 | `chat.card.undone`, `chat.activity.write_note`, `chat.activity.read_notes`, |
| 166 | `chat.activity.read_file_repo`, `chat.activity.search_code_repo`, |
| 167 | `chat.activity.move_in` ("Moving in… %s"), `chat.activity.explore`, |
| 168 | `chat.moving_in`, `chat.exploring`. Model-facing texts (prompts, tool |
| 169 | results, tool descriptions) are not copy. |
| 170 | |
| 171 | 8. Astra's round 2 (4 resolved, 3 open), final fixes, each failing first: |
| 172 | 1. Provenance is structural: every message command carries |
| 173 | `person_text`, the person's own words per message (a card answer |
| 174 | is its value alone), apart from `text`, which may hold the model's |
| 175 | question. The runner stores it with the run and checks "the person |
| 176 | said" only against it; the prefix parsing is gone |
| 177 | (`TestNotebookProvenanceIgnoresQuestionText` reproduces the |
| 178 | planted `Continue ") Paul approves every merge` question). |
| 179 | 2. No intent parsing: the classifier and its phrasing tests are |
| 180 | deleted. `set_project_home` never changes the setting; it always |
| 181 | posts the one-tap card ("Use X for new projects?", or "Stop using |
| 182 | X for new projects?" to clear), and only the person's tap at the |
| 183 | card's revision changes it; the receipt keeps Undo |
| 184 | (`TestProjectHomeOnlyByTap`: four phrasings including a quoted |
| 185 | phrase and a typographic apostrophe change nothing; a stale tap is |
| 186 | 409). |
| 187 | 3. Reset first: the stream reader records a reset durably before the |
| 188 | ack and wakes the person's worker, which applies any pending reset |
| 189 | before it runs a turn and never runs one while a reset is pending |
| 190 | (`TestResetComesBeforeTheNextTurn`; headless `2b_notebook` sends a |
| 191 | message right after Reset and gets a fresh session, no notebook). |
| 192 | |
| 193 | ## Notebook look (Paul, after the review round) |
| 194 | |
| 195 | "Notebook should probably be a button with an icon and the notes should |
| 196 | actually look like notes." The conversation header's Notebook link is |
| 197 | now a quiet icon button (Lucide `notebook`, added to the app's icon set; |
| 198 | `aria-label` and tooltip "Notebook"; 44 px on touch; focus ring). Each |
| 199 | entry is a note card: the note first in readable prose, a small caption |
| 200 | with its source and day, a paper surface (hairline border, a gentle |
| 201 | tint of the accent, soft shadow, no stripe) from the existing tokens; |
| 202 | what the person said is set as their quote. Notes stack in columns on a |
| 203 | desktop and in one column at 390 px; Reset is a quiet text button below |
| 204 | with its help line. `TestBrowserNotebookLook` checks both widths and |
| 205 | both themes and Tab to the button; screenshots before and after in |
| 206 | `docs/mockups/built/2026-11-07/notebook-{before,after}-{conversation,notebook}-{390,1280}-{light,dark}.png`. |
| 207 | |
| 208 | ### Copy for review |
| 209 | |
| 210 | - `chat.card.home_ask_clear`: "Stop using %s for new projects?" (was |
| 211 | "Clear where new projects go?"). |
| 212 | |
| 213 | - `chat.notebook.own`: "Coordinator's note" (was "Its own note"). |
| 214 | - `chat.notebook.link` ("Notebook") is now also the button's accessible |
| 215 | name and tooltip. |
| 216 | - `chat.notebook.repo` ("From %s") now names the file as |
| 217 | repo/path, for example "From oficina/equipo/README.md". |
| 218 | |
| 219 | ## Decisions |
| 220 | |
| 221 | - The move-in is a turn like any other (Design A): it reuses dispatch, |
| 222 | tool authorisation, activity, timing and cancel. Giving way kills the |
| 223 | attempt (the slice 1 cancel path) rather than relying on a CLI |
| 224 | interrupt; the next turn resumes or starts a session, and the notes |
| 225 | already written survive. |
| 226 | - The desk is mounted read-only even though the coordinator has no |
| 227 | native file tools: it is the cwd the CLI sees, and nothing in the |
| 228 | namespace can plant a file the next session would read. |
| 229 | - "First contact" is the runner's: a desk that is empty or never moved |
| 230 | in. A person who writes first is answered first; the move-in follows. |
| 231 | |
| 232 | ## Staging |
| 233 | |
| 234 | Release a6039ff (built by `make release`, deployed to equipo-staging |
| 235 | with `--swap hold`, both staging runner units installed), real Claude CLI |
| 236 | 2.1.312. Later commits change tests and docs only. One full suite run, |
| 237 | all green (231 s), 17 counted model turns, plus Paul's runner moving in |
| 238 | by itself: about 18 live turns of the 25 allowed. |
| 239 | - Paul's staging coordinator moved in on its own about 80 s after the |
| 240 | runner started (index refresh first): a 1.3 KB notebook naming him, |
| 241 | the oficina namespace, the products (Equipo, Suite, Docs, Sheets, |
| 242 | Slides, Calendar, Calls, Memoria, Fichas, Home, Alta, Estilo, ...) and |
| 243 | where each lives, Woodstar as not reachable, and his house rules from |
| 244 | oficina/docs AGENTS.md. His runner stays running. |
| 245 | - `2b_move_in` (suite person, desk reset): moved in, activity "Moving |
| 246 | in… reading …", one introduction with no question: "I'm all set up. I |
| 247 | can see the Oficina suite. It has Docs, Sheets, Slides, Calendar, |
| 248 | Calls (meet), memoria, fichas and the shared home and suite |
| 249 | repositories, plus Equipo itself and the estilo design system. I can |
| 250 | read the code to answer questions about how any of these apps works. |
| 251 | I can also pick the right project for new work and keep track of what |
| 252 | you like along the way. I can't change code yet; that comes in a |
| 253 | later version." Notebook 1.7 KB, names equipo. |
| 254 | - `2b_first_message`: "Hello. Who are you, in one sentence?" sent while |
| 255 | moving in was answered in 3.96 s; the move-in gave way and later |
| 256 | posted its one introduction. |
| 257 | - `2b_access` is fake-only (no live grant). |
| 258 | - Slice 1 and 2 scenarios all green after it: first token cold 3.10 s, |
| 259 | warm 1.45 s, cold resume 3.61 s; `2_project` first text 3.4 s. |
| 260 | - The full run wrote `releases/staged/a6039ff.json` (ignored build |
| 261 | output). Not required this slice; the final build is staged before |
| 262 | production. |
| 263 | |
| 264 | Review round, release c662662 (deployed, both runners installed), |
| 265 | `2b_move_in`, `2b_first_message` and `2b_notebook` (skipped live): all |
| 266 | green, 4 counted turns plus about 2 automatic (each runner's first |
| 267 | start after the upgrade). The suite's notebook came back as 5 repo |
| 268 | entries naming the README each came from and 5 own notes; the reply |
| 269 | while moving in took 3.66 s. Paul's staging notebook was in the old |
| 270 | format, so after the upgrade his runner explored (nothing new) and |
| 271 | seeded 18 own entries from the catalog; Reset on staging's Notebook |
| 272 | page makes it move in afresh. |
| 273 | |
| 274 | ## Open issues |
| 275 | |
| 276 | - Giving way kills the move-in's process (the slice 1 cancel path): |
| 277 | the person's reply is a cold start (3.96 s live), and if the move-in |
| 278 | had not finished a turn yet the reply comes from a fresh session (the |
| 279 | opening and catalog, not the partial move-in). A CLI interrupt would |
| 280 | keep the process; not built. |
| 281 | - `own` entries are still the model's words. They are labelled as its |
| 282 | own note, quoted, bounded and never authority, but a hostile README |
| 283 | can still shape what the coordinator writes there; Reset clears it. |
| 284 | - Every home change now takes one tap, even a clear request; it is a |
| 285 | rare action. |
| 286 | - Slice 3 additions (agent-wide forge credential, grants seen within a |
| 287 | minute, a self-resolving grant card with the real command) are left |
| 288 | for slice 3: they change the forge credential path. |
| 289 | - Commit 32e5138 (thinking-line mockups) was added to this branch by |
| 290 | another session; its DOM calls got exact dead-reference |
| 291 | allowances so CI stays green. |
| 292 | - After an explicit clear, `create_project` refuses the runner's |
| 293 | default namespace only when no reachable repository lives there. |
| 294 | - A failed move-in leaves the coordinator `new`; the runner asks again |
| 295 | after the next index refresh (hourly) or a restart. |
| 296 | - Explore after a live grant or revoke is not exercised on staging. |
| 297 | - CI flakes seen on docs-only commits (both pass locally every time): |
| 298 | `internal/tryequipo` `TestReview(Unconfirmed)ExpiredAccountSignsIn` |
| 299 | (`provider_account_busy`, the old try-equipo wizard; untouched here) |
| 300 | and `TestHeadlessCopyRotation` (its one-shot lock check could land in |
| 301 | a background rotation from slice 2's prewarm; it now waits up to 3 s |
| 302 | for the lock, which a lock held for the session still fails). |
| 303 | |
| 304 | ## Blockers |
| 305 | |
| 306 | None. |
| 307 | |