oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1# Dynamic specialists slice 1: a Design specialist that shows its work
2
3Spec: `docs/superpowers/specs/2026-11-28-dynamic-specialists.md` (rev 3.2,
4approved, Paul's rulings in its section 7). Build branch
5`specialists-slice-1` from `design-dynamic-specialists` with current main
6merged. Two halves on one branch: **1a** the renderer and a static
7`render_page`; **1b** `design-v1` with scope, routing and screenshots.
8Revision 3.1: Astra plan rounds 1 (NOT READY, 11 findings), 2 and 3
9(READY AFTER FIXES, 1 finding each) are folded in.
10
11Finish line (after a release, Paul's): Paul asks the coordinator for a
12Patrix design overhaul. A card proposes "Design for Patrix"; he taps Add;
13the coordinator records an explore task and starts it with Design; Design
14writes up to four mockup options under `mockups/<task>/` on the task's
15branch, renders them, and the task page and direction card show the
16screenshots. He taps Build this with a note naming the option he wants.
17
18Not in slice 1: taste notes, reviewer profiles, running-app renders,
19`.equipo/render.json`, fonts, Mac and Linux arm64 renderers, Engineering
20using `render_page`, `suggest_note`, a continuation after a team-wide Add.
21
22## Facts the plan rests on (main 55e192cf)
23
24- Protocol is 35 (`ProtocolChangeDiffs`); the next migration is 0115.
25 Whoever lands second renumbers.
26- `Authorize` (`internal/equipo/chat/runners.go:595`) is every lease's
27 start and purpose check; `authorizeResearch` sits there.
28 `AuthorizePublication` (`transfers.go:283`) confirms a worker commit's
29 push. `startTask` (`tasks.go:1017`) refuses a task that has any step.
30- `researchGrant` finds the one active `research-v1` row; `cancelResearch`
31 cancels every Research step and is the only revocation path.
32- The thin runner commits and pushes Engineering's work itself; its
33 `submit_candidate` and `ask_person` are fixed-text tools
34 (`thin/mcp.go:219`). Provider profiles fix an exact tool list
35 (`provider/actions.go:91`, with the old `submit_render`), Claude's
36 launcher accepts only those (`claude/launcher.go:140`), and native file
37 permissions are per specialist (`claude/answers.go:249`).
38 `specialistRun.research` binds kept images read only at `/research`.
39- Engineering runs under bubblewrap with `--unshare-pid` and
40 `--new-session` (`provider/policy.go:686`). Processes inside may start
41 nested namespaces (Claude's own Bash sandbox), all descendants of the
42 sandbox's first process.
43- `exportPreview` (`thin/preview.go:236`) exports `release/preview.json`'s
44 output from git objects; `scanPreview` runs the pinned gitleaks over an
45 export.
46- `gitleaksSHA256` is linked by ldflags (`Makefile:290`).
47 `build-instance-release.sh` embeds a fixed asset list, and the asset
48 reader caps a file at 128 MiB (`install_assets.go:77`).
49- `scripts/ci-chromium.json` pins `chromium-headless-shell`
50 156.0.8078.79-1~deb13u1 and only what a Debian image lacks: essential
51 packages such as `libc6` come from the CI image
52 (`ci-chromium-pin.py:117`).
53- Research uploads are staged and marked kept only after the final report
54 validates them (`research_results.go:244`, `:547`); the task-file route
55 serves only kept, complete files.
56- Turn kinds are person, `move_in`, `explore` and `housekeeping`;
57 `propose_specialist` runs only in a live person turn.
58- The direction card's answers are Build, Try again (with a note) and
59 Drop; Build creates a change task (`explore.go:281`).
60
61## Rules for every task
62
63Tests first: write the failing test, run it, see it fail for the right
64reason. Then the code. Then a mutation check for each guard: break the
65guard, see its test fail, restore it. The commit body records the test
66command, the failure seen, and each mutation and its result. Targeted
67`go test ./pkg/... -run TestX` while working; `make ci` once at the end.
68`CGO_ENABLED=0`, Go caches at their defaults, scratch in on-disk
69`$TMPDIR`, servers on 127.0.0.1. New strings go into `copy.go` marked
70pending. Migrations are additive.
71
72## Half 1a: the renderer (Linux amd64 only)
73
741. **Spike first, on docs-t1.** Build a throwaway tree from the full
75 runtime closure (task 2's list, including the loader and libc) and run
76 the headless shell, its own sandbox on, inside a bubblewrap launch
77 shaped like task 5 with no host `/usr`. It must render a fixture page.
78 If Chromium's sandbox cannot start there, stop and report: the spec
79 forbids `--no-sandbox`, and that is Paul's call. Record the result and
80 the exact bubblewrap arguments in the commit.
812. **Pin the full closure.** `scripts/ci-chromium-pin.py` also writes
82 `internal/release/renderer.json` for amd64: the browser packages of
83 `ci-chromium.json` at the same versions plus every essential package
84 they need (no pruning of the base), so the tree runs with nothing from
85 the host. A test fails when a browser package or version differs
86 between the two files. Nothing at runtime downloads anything.
873. **Tree and manifest (release build).** `scripts/build-renderer-tree.py`
88 fetches the pinned debs (sha256 checked), unpacks them into one tree,
89 and writes `MANIFEST`: one sorted line per entry, `file <path> <sha256>
90 <mode>`, `link <path> <target>` or `dir <path>`. Links must be relative
91 and resolve inside the tree. A deterministic gzip `renderer.tar.gz`
92 holds both. The Makefile links the manifest's sha256 into the runner as
93 `release.rendererSHA256`; the release manifest's Linux target gains
94 `RendererSHA256`. Tests: same inputs give the same bytes; a bad deb
95 hash, an escaping or absolute link fails; no pin linked means
96 `unpinned`.
974. **Verify.** `release.VerifyRenderer(dir, pin)`: `MANIFEST`'s sha256 is
98 the pin; every entry exists with that type, hash and mode; links as
99 listed; nothing extra; nothing group or world writable. Tests: tampered
100 byte, extra file, missing file, link retargeted, mode widened, manifest
101 swapped with a matching tree. Astra reviews this task.
1025. **Sandbox launch.** Package `internal/runner/render`, `launch_linux.go`,
103 with the spike's arguments: `--unshare-all` (never `--share-net`),
104 `--die-with-parent`, `--new-session`, `--clearenv`, `--cap-drop ALL`;
105 the verified tree read only as the root's `/usr` and loader paths, the
106 export read only at `/site`, `/out` read-write, a tmpfs `/tmp`, a fresh
107 `/proc`, a minimal `/dev`; no home, runner state or credentials; every
108 inherited descriptor closed except the browser and status pipes. Inside,
109 `equipo-runner render-sandbox` serves `/site` on 127.0.0.1 and starts
110 the browser with `--remote-debugging-pipe` and `--host-resolver-rules`
111 mapping every other host to not found. Tests (Linux, skipped without
112 bubblewrap): from inside, a public IP, the host's tailnet address and a
113 listener the test opens on the host's 127.0.0.1 are unreachable; a
114 parent descriptor is not visible; the environment is empty; `/site` is
115 read only; an external redirect is reported, not followed. Astra
116 reviews this task.
1176. **Browser driver.** A small CDP client over the pipe (stdlib only).
118 Per page: viewport (phone 390x844, tablet 834x1194, desktop 1440x900),
119 navigate, wait for load then network idle (at most 5 s), capture (full
120 page clipped at 10,000 px), console errors (20), failed loads (30:
121 external blocked, not found, font), same-site anchors answering 404
122 (30), the accessibility tree outlined to 8 KiB, the title. Output: a
123 JSON report and PNGs in `/out`. 60 s and 2 GiB per call, killed on
124 overrun. Fixture sites: console error, CDN script, web font, broken
125 link, a very tall page, a script that never ends (`timeout`), a page
126 that kills the renderer (`crashed`).
1277. **Release delivery, install and verify-installed.**
128 `build-instance-release.sh` embeds `renderer.tar.gz` (amd64); the asset
129 reader allows that one name up to 384 MiB and the usual 128 MiB for the
130 rest. Install assets serve it on Linux. `setup/install.go`,
131 `install-v1.sh`, `upgrade-thin.sh`, `cutover-thin.sh` and
132 `cutover-finish-thin.sh` unpack it to `<runner dir>/renderer/<first 12
133 of pin>/` through a temporary directory and a rename, verify it, render
134 the fixture page with tasks 5 and 6, and refuse on any failure.
135 `verify-installed` does the same check and fixture render. Mac and
136 arm64 installs neither need nor check one. Old trees are removed by
137 name. Tests: as `scanner_install_test.go` and
138 `verify_installed_test.go`, plus one install from a release built by
139 the real script into `$TMPDIR` (Linux, skipped without bubblewrap).
1408. **Health.** The runner reports `ToolHealth.Renderer` on Linux amd64:
141 `ok` only when `VerifyRenderer` passes and a fixture render has
142 succeeded with this tree since the runner started; `missing`,
143 `mismatch` or `unpinned` otherwise. It rechecks the files before each
144 render. Mac and arm64 send nothing. `status` says a bad renderer needs
145 the runner updated, not another try. Tests: each state; a tree that
146 verifies but cannot render is not `ok`.
1479. **Workspace snapshot.** For `tree: work` the runner pauses the step,
148 then does everything inside the pause: it reads the workspace's
149 `release/preview.json` with `readPreviewConfig`'s rules and copies the
150 output directory into a runner-private stage by `exportStatic`'s rules,
151 opening every path with `openat2` and `RESOLVE_BENEATH |
152 RESOLVE_NO_SYMLINKS` from the workspace root, regular files only, caps
153 applied. The pause: SIGSTOP to every descendant of the step sandbox's
154 first process (which covers nested namespaces), rescanning until every
155 one reads stopped in `/proc/<pid>/stat` and no new one appears; then
156 the copy; then SIGCONT to all on every exit path, panics included. The
157 10-second bound covers stopping and copying; past it the runner
158 resumes and refuses with `busy`. No git index is used and nothing is
159 written to the workspace or branch, a simplification of the spec's
160 private index with the same guarantees. No cgroup is frozen. Tests: a
161 writer that appends a counter every millisecond, from a nested
162 namespace too, makes no progress between pause and resume; a link at
163 any depth is not followed; files outside the output are not copied;
164 SIGCONT after an injected panic and after the bound; mutation: skip one
165 descendant and the writer test fails. Astra reviews this task.
16610. **`render_page` (runner side, no profile yet).** Strict input (`tree`,
167 up to 6 `pages` of path, viewport, `full_page`, and `compare`). `base`
168 exports the task's base commit with `exportPreview` (`no_site` without
169 `release/preview.json`); `work` uses task 9. `scanPreview` runs over
170 every export first: a finding refuses with `secrets`, an unusable
171 scanner with `scanner` (two codes the spec did not list; both refuse
172 before any render). One render at a time per runner; per step 20 calls
173 and 60 captures (`too_many`), counted in the step's state so a restart
174 keeps them. Each PNG is decoded and re-encoded by the runner
175 (downscaled until at most 2 MB). `compare` pairs the trees' captures
176 with a changed-pixel ratio and a diff PNG. Captures go to the step's
177 render directory. The text reply lists captures and reports, every
178 page string quoted under a "from the rendered page" label, bounded,
179 control characters stripped. Tests: each code, bounds, the label, a
180 hostile PNG re-encoded.
181
182Checkpoint: half 1a ends green on its own (`go test` of the touched
183packages) and is pushed before 1b starts.
184
185## Half 1b: Design
186
18711. **Wire, protocol 36 (`ProtocolDesign`).** `DispatchCommand` gains
188 `SpecialistID`, `SpecialistRevision`, `SpecialistProject`, `Profile`
189 and `Capabilities`; `LeasePurposeRender`; the final report's `Options`
190 [{name, captures [{id, sha256, tree_digest}]}] (at most 4 options, 12
191 captures); a `render_file` chunk frame (as `research_file`);
192 `AnswerCard.Note` on Build; `Specialist.Project`; `propose_specialist`'s
193 `project`. Encode refuses a dispatch with a specialist id, and a render
194 lease check, below 36. Tests: round trips, refusals below 36, bounds.
19512. **Menu and pack.** `design-v1`: capabilities `branch.edit` and
196 `page.render`, tools `render_page`, `submit_candidate`, `ask_person`,
197 a `Pack` digest. `web.research` stays exclusive. `Describe` words for
198 the two capabilities. The pack `internal/specialist/packs/design-v1.md`
199 is our own discipline drawing on impeccable's method (its licence
200 checked and recorded in the commit), plus reading the project's
201 `DESIGN.md` as quoted context and the mockup layout (`mockups/<task>/`,
202 one page per option, `release/preview.json` naming the folder). Paul
203 reviews the pack once (task 21).
20413. **Executable policy for Design.** A `design` action profile in
205 `provider/actions.go` with exactly `render_page`, `submit_candidate`
206 and `ask_person` (no `submit_render`); Claude's launcher and allowlist
207 accept it; native file permissions add read-only access to `/render`
208 and nothing else beyond Engineering's. The golden test of task 12 also
209 pins this policy. Tests: a real Claude launch with a fake model (as the
210 step tests do) lists exactly those tools and reads a capture from
211 `/render`; a write there is refused; Engineering's policy is unchanged.
21214. **Storage, migration 0115.** `chat_specialists.project_id` ("" team);
213 `chat_tasks.maker_specialist_id`; `chat_steps.specialist_id`,
214 `specialist_revision`, `specialist_project`, `specialist_caps`,
215 `design_runs` (see task 17); `chat_task_files.source` (`research` or
216 `render`), `option` and `tree_digest`. Models, schema, migration check.
217 Team records, never `scope.Owned`.
21815. **Proposal, scope and continuation.** `propose_specialist` takes
219 `design-v1` and an optional `project` (a project the person already
220 has; "" is the team). One open proposal and one active row per profile
221 and scope. A Not now on that profile and scope in the last 7 days
222 refuses (an owner can still add from the team page). The card shows
223 name, scope and each capability's words. A project-scoped Add, in its
224 transaction, queues one turn of a new kind `specialist_added` in the
225 proposing turn's lane, keyed by the card (a second Add or a retry
226 queues nothing). Its opening carries the instance's record ("Paul added
227 Design for Patrix") under Equipo's label and quotes the person's
228 message from the proposing turn under the person's label. That turn
229 is bound to the card: `record_task` only in the card's project (no
230 `add_project`, `create_project` or implicit add), `start_task` only for
231 a task this turn recorded and only with the card's specialist, whose
232 grant `grantFor` still finds; every other mutation is refused. A
233 team-wide Add queues nothing (the coordinator's reply says it was
234 added). Tests: member can't add; stale revision; double tap; decline
235 window; the labels; the bound tools called with another project,
236 another task, another specialist, and after a revoke. Astra reviews
237 this task.
23816. **Grants for every specialist.** `grantFor(profile, project)`
239 generalises `researchGrant`: the active row for that profile and
240 project, else the team row; grants exactly the profile's capabilities,
241 unrevoked, at its revision, given by its approver, an owner now.
242 Research resolves against the task's project the same way. Dispatch
243 writes the step's full binding (id, revision, project, capabilities)
244 and appends a `specialist.used` audit row. `Authorize` refuses a step
245 whose binding no longer equals `grantFor` for its task's project
246 (start and `LeasePurposeRender`); `authorizePublication` does the same
247 before a push. `RevokeSpecialist` cancels the steps bound to that
248 specialist only (Research ones as today, maker ones as an ordinary
249 cancel) and withdraws their pending publications. Tests: revoke
250 between dispatch and start, between two renders, between commit and
251 push; approver demoted; profile missing from the menu; project row
252 over team row; revoking one project's Design leaves another's running.
253 Astra reviews this task.
25417. **Routing, the autonomy limit and recovery.** `status` lists active
255 specialists (id, profile, name, brief, scope) and
256 `runner.tools.renderer`. `start_task` takes an optional `specialist`
257 id: active, grant usable, scope the task's project or the team,
258 profile a maker. The task records `maker_specialist_id`; fix rounds,
259 retries, Try again and the task Build this creates use it (the step
260 kind stays `engineering`). Placement sends a Design step only to a
261 runner at 36 with the renderer `ok` and a Claude connection, else it
262 waits with `design_runner`. **Limit:** the task counts Design attempts
263 (first runs, retries, fix rounds) since the person last acted on it (a
264 message in its thread or an answer on its cards), stored on the task;
265 the fourth is not dispatched and the step is held for the person
266 through the existing held-step card. **Recovery:** after a revoke, once
267 every attempt of the task's Design steps is terminal and has its
268 termination proof (`Terminated`, whatever its state, done included)
269 and the task is not `busy` (`explore.go:175`), the task's creator
270 gets one card, "Design was removed. Hand this task to
271 Engineering?"; their tap, checked against both again in its
272 transaction, clears the maker and queues Engineering. Coordinator
273 surface as places did:
274 schemas and descriptions, the Claude allowlist,
275 `provider.ConverseTools`, `MutationKinds`, the opening's sentence and a
276 new `houseRule`. Tests: each refusal; Try again keeps Design; Build's
277 task inherits it; the fourth attempt held; the counter reset by a
278 message; a terminal attempt (cancelled or done) without its termination
279 proof blocks the recovery card and the tap, and allows them once the
280 proof arrives.
28118. **The Design step (runner).** A dispatch with profile `design-v1` runs
282 Engineering's step with task 13's policy, the pack and brief as the
283 prompt, `/render` bound read only, and the tools live: `render_page`
284 (each call first a `LeasePurposeRender` check), `submit_candidate`
285 (records options; the runner still commits and pushes at the end),
286 `ask_person` (as today). Before the final report, the named captures go
287 up as `render_file` chunks. Claude only. Tests: a refused render lease
288 stops rendering and says why; uploads are bound to the attempt.
28919. **Captures, task page and direction card (instance).** As Research:
290 chunks for the step's current attempt are staged, never served; the
291 final report's options, capture ids, hashes and tree digests are
292 validated against the staged files, the PNG fully decoded within
293 bounds, and the binding checked with `grantFor` in that transaction;
294 only then are the files kept. The task page shows kept captures by
295 option; the direction card shows them too. With more than one option,
296 Build needs a note (the person's words, at most `MaxDirectionNote`)
297 that goes into the new task's brief quoted as theirs. Web UI: day
298 theme, token colours, attribute grammar, scriptless forms, no split
299 screen, no coloured left-border accents. Native: check how direction
300 cards render; a multi-option Build without a note is refused as a card
301 conflict telling them to open it on the web. Tests: revoke during
302 upload, a foreign capture id, an incomplete upload, a PNG that passes
303 its signature but not decoding, Build with and without a note.
30420. **End to end.** A thintest contract: a primary at 36 with the
305 renderer `ok` (a fake renderer) and a Claude connection. The person
306 asks for a Patrix design overhaul; the fake coordinator proposes
307 `design-v1` for Patrix; the owner taps Add; the continuation records an
308 explore task and starts it with Design; the dispatch carries the
309 binding; the fake model renders, writes options and submits; captures
310 are kept; the task page and direction card show them; Build with a
311 note creates the change task with Design as maker. Refusals: revoke
312 mid-step, runner at 35, renderer not `ok`, member tap, decline window.
31321. **Copy.** See below.
314
315## Copy
316
317New strings (the Design card, capability and scope words, the
318continuation's record line, `design_runner`, the held limit, the recovery
319card, the Build note prompt and refusal, gallery labels, renderer status
320words) go into `copy.go` marked pending and into
321`/home/paulca/.cache/specialists-1-copy.json` as copy-review entries,
322with the evidence file
323`docs/superpowers/plans/2026-11-28-dynamic-specialists-slice-1-copy.md`, as
324places slice 1 did. Luna reviews them all and its text is applied; the
325cards and the pack go to Paul. The builder never marks copy accepted:
326acceptance happens only through the repository's own copy flow, and the
327pending-copy gate stays red until then.
328
329## Reviews and the round limit
330
331Astra (`gpt-6-astra`, effort high, read-only) reviews this plan, tasks 4,
3325, 9, 15 and 16 as they finish, and the whole branch at the end. Each
333review gets at most three rounds. After a third round's findings are
334fixed, the fix is recorded here and not reviewed again; a finding that
335needs a product decision goes to Paul.
336
337## Verification and handoff
338
339`make ci` once at the end, after the branch review. Push
340`specialists-slice-1`; no merge, release or deploy. The controller report
341lists the commits, the mutation checks, Astra's verdicts, the copy file
342and what happens after release: an agent-run upgrade (whose
343verify-installed renders the fixture page on the production runner), then
344Paul asks for the Patrix design overhaul and taps Add.
345
346## Astra plan round 1: NOT READY (11 findings, all taken)
347
348Full closure pinned and the spike moved first (1); the pause covers every
349descendant, is verified, and holds the config read and rooted copy (2);
350a Design executable policy (3); release delivery with a size bound and a
351real-build install test (4); the continuation bound to the card (5); the
352full binding stored and cancellation by specialist (6); a recovery card
353(7); staged captures validated by the final report (8); the three-attempt
354limit (9); `ok` needs a fixture render and verify-installed renders one
355(10); no delegated acceptance by the builder (11).
356
357## Astra plan round 2: READY AFTER FIXES (1 finding, taken)
358
359Recovery waits for the task to be not `busy`, so a cancelled Design
360attempt must have its termination proof before Engineering can start,
361checked again at the tap.
362
363## Astra plan round 3: READY AFTER FIXES (1 finding, taken; round limit)
364
365A Design attempt that completed (not only one cancelled) also needs its
366termination proof before the recovery card or its tap. Fixed in task 17
367and not reviewed again.
368
369## Build notes (2026-11-29)
370
371Built on `specialists-slice-1` from `design-dynamic-specialists` with main
3728bd40ed1 merged. Protocol 36; migrations 0115 to 0118.
373
374- Task 1 gate: PASS. Chromium's own sandbox runs inside the render sandbox
375 on docs-t1 with nothing from the host's `/usr` (commit 79b79d7c records
376 the arguments and the 98 packages).
377- Astra task reviews (round limit three): task 4 READY at round 2; tasks
378 5, 9, 15 and 16 READY at round 3. Whole branch: NOT READY (7 Important,
379 2 Minor), then NOT READY (2 open), then READY at round 3.
380- Task 9 ruling: the pause is defence in depth, not a boundary against a
381 hostile process inside the step (it already chooses what the work tree
382 renders). No seccomp in slice 1; after the copy, while still paused, every
383 copied path is checked again and any change refuses with `busy`.
384- Copy: Luna reviewed all 27 strings (6 changed). Everything stays COPY
385 REVIEW PENDING; the cards and the Design pack wait for Paul
386 (`2026-11-28-dynamic-specialists-slice-1-copy.md`).
387- `make ci` once, then fixes for its three findings of ours; still red on
388 pending copy (by design) and on `TestBrowserGitHubManifestCSP`, which
389 fails the same way at the branch base on docs-t1.
390- Not built here: the Swift changes were not compiled (no Xcode on
391 docs-t1); native screenshots on the task page; a team page Add.
392
393## Merge with main (2026-11-30)
394
395Main cfe54cfc merged (b320a698). Main took protocol 36 (lookups) and 37
396(Mac Engineering, slice F) and migrations 0115-0117 and 0120, so Design
397is now **protocol 38** (`ProtocolDesign`, the current protocol) and its
398migrations are **0121-0124**. Read 38 for 36 and 0121-0124 for 0115-0118
399above. A Mac worker refuses a specialist-bound dispatch; a Design task on
400a Mac-only project would wait on the renderer (untested). Copy: Paul’s 15
401strings and the pack approved unchanged, Luna's 12 accepted by delegation
402(see the copy file).
403