Spec: files in Ask, with Paul's rulings of 2026-11-26
Base relays uploads and reads to Equipo with the person's bearer and keeps no copy. Equipo ships first; the paperclip shows only when the snapshot says attachments. Equipo's half is oficina/equipo design/assistant-attachments.
Human
Prompt
Paul approved the attachments spec with every recommendation. Turn the draft into the real spec, with the rulings recorded in a Decisions section, and put it on the hub.
From this commit's own message. The prompt ledger has no entries for it — which is what a squashed, rebased or amended commit looks like, and what every commit looks like in a repo without a ledger.
Summary
Adds the approved design for attaching files in Ask: Equipo holds the bytes, Base relays, rulings R1-R8 recorded in Decisions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+256
−0
docs/superpowers/specs/2026-11-26-ask-attachments-design.md+256 −0
diff --git a/docs/superpowers/specs/2026-11-26-ask-attachments-design.md b/docs/superpowers/specs/2026-11-26-ask-attachments-design.md| new file mode 100644 |
| index 0000000..1ab0ebc |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-26-ask-attachments-design.md |
| @@ -0,0 +1,256 @@ |
| +# Files in Ask |
| + |
| +Status: approved by Paul on 2026-11-26, with every recommendation. Read |
| +against Base main `0a6e8bc` and Equipo main `478e0055`. |
| + |
| +Paul's ruling (2026-11-26): "Definitely want to attach files in Ask and the |
| +assistant read them if necessary." |
| + |
| +Equipo owns the Assistant's half: `oficina/equipo`, branch |
| +`design/assistant-attachments`, spec |
| +`docs/superpowers/specs/2026-11-26-assistant-attachments-design.md`. The slice 1 |
| +plans are `docs/superpowers/plans/2026-11-26-ask-attachments-slice1.md` in each |
| +repo. |
| + |
| +**The short version.** Equipo already has the whole attachment pipeline for |
| +its own conversation (the Coordinator's): upload, type sniffing, limits, |
| +relay to the runner, and images shown to the model. Its runner even stages |
| +files for Assistant turns. The one thing that refuses them is the Assistant's |
| +send route. So Ask uses Equipo's attachments as they are. Base stores no |
| +bytes: it relays uploads and reads with the person's own bearer, as it |
| +already relays every other Ask call. No new store, and no CARLOS bucket for |
| +Base. |
| + |
| +## Decisions |
| + |
| +Paul ruled on 2026-11-26, approving every recommendation of the draft: |
| + |
| +| # | Ruling | |
| +|---|---| |
| +| R1 | **Equipo holds the bytes, and Base keeps no copy.** Base relays uploads and reads with the person's bearer, and caches nothing on the server. | |
| +| R2 | **A sent file can be removed, but later, not in slice 1.** Nothing in the suite deletes a message yet either. | |
| +| R3 | **The Assistant can read a file for 14 days,** while the runner holds it. After that it says the file has gone and asks the person to attach it again. There is no machinery to send it to the runner again. | |
| +| R4 | **No attaching without script in slice 1.** The paperclip shows only with script. The rest of Ask works without script as now, and that includes seeing files in the thread. | |
| +| R5 | **Native copies Equipo's attachment code into BaseKit now.** It moves into the shared kit when a third app needs it. | |
| +| R6 | **A job sees the files the person attached,** in a later slice. Until then the hand-off goes ahead without them, and the Assistant says the job can't see them. | |
| +| R7 | **Putting a file into an Oficina app through `use` waits.** It needs each app's operations to take a file, which is its own spec. | |
| +| R8 | **Encrypting Equipo's attachment bytes is a follow-up.** It doesn't block slice 1. | |
| + |
| +Design decisions that follow from these: |
| + |
| +| # | Decision | Rejected | |
| +|---|---|---| |
| +| D1 | **Equipo's limits and types, unchanged:** 10 MiB a file, 5 a message, and nine types. | Bigger limits for Ask. The relay frames and the runner's quota are sized for these. | |
| +| D2 | **The runner reads the files,** on Paul's own machines, through the frames that exist. Equipo gives the Assistant a `read_attachment` tool. | Base extracting text and sending it as words. That puts the bytes through Base and loses the "data, not instructions" framing. | |
| +| D3 | **Equipo ships first. Base shows the paperclip only when Equipo says the person's runner can take files** (the snapshot's `attachments`). | A Base that offers files and then fails at send. | |
| +| D4 | **PDFs are accepted in slice 1,** and the Assistant says it can't read them yet. Slice 3 reads them. | Leaving PDFs out of the picker. That needs Base-side type checks and words that slice 3 throws away. | |
| + |
| +## 1. What exists today |
| + |
| +### 1.1 Equipo |
| + |
| +- **The Assistant refuses files.** The API doc says it "takes words only, so |
| + a message with `attachments` is `422 invalid_input`" |
| + (`docs/api/equipo-v1.md:157`). |
| + - The refusal is in `LaneStore.Send` |
| + (`internal/equipo/chat/lane.go:51`), which also passes no files to |
| + `sendOrigin` (`lane.go:69`). |
| + - Job threads refuse the same way (`jobs.go:135-137`). |
| + - Attachments were a non-goal of the Assistant's first slice |
| + (`2026-11-12-equipo-assistant-design.md:27`). |
| +- **The Coordinator's conversation takes files.** Each file is uploaded |
| + with `POST /api/v1/attachments`: the bytes as the body, the type in |
| + `Content-Type`, the name in `Content-Disposition`. Its ID then goes in the |
| + message's `attachments` (`equipo-v1.md:97-99`, `chat/http.go:78-80`). |
| + These routes take the person bearer Base already holds. |
| +- **Limits** (`internal/attach/attach.go:20-94`): |
| + - 10 MiB a file, and 5 a message. |
| + - Images at most 12,000 px a side and 40 MP. |
| + - PNG, JPEG, WebP, GIF, PDF, plain text, Markdown, CSV and JSON. The type |
| + is sniffed from the bytes. |
| + - HEIC is refused (`attachment_heic`), and an image's location is |
| + stripped. |
| + - Unsent uploads are kept 24 hours, at most 20 a person |
| + (`chat/attachments.go:27-31`). |
| +- **Storage.** The bytes are in Equipo's SQLite (`chat_attachment_data`, |
| + `chat/attachments.go:35-62`). They are not sealed, and a sent file is |
| + never deleted. |
| +- **Reading a file.** `GET /api/v1/attachments/{id}` and `/preview` check |
| + that the file is the person's. They answer with `nosniff` and a sandbox |
| + CSP. Images are served inline, and anything else as a download |
| + (`attachments_http.go:86-110`). |
| +- **Messages carry their files** in snapshots and events. Both go through |
| + `withFiles` (`store.go:271-276`, `1016-1027`), so Assistant messages will |
| + too, once files can be linked to them. |
| +- **How a runner gets the bytes.** |
| + - `relayFiles` queues each file as 128 KiB `attachment` frames before the |
| + message frame. Each chunk is read from SQLite only as it is sent |
| + (`store.go:389-390`, `attachments.go:240-291`). |
| + - The runner checks each file and keeps it read-only for 14 days, under a |
| + 500 MB quota a person (`runner/thin/files.go:25-82`). |
| + - An Assistant turn links its files into its own desk |
| + (`assistant.go:142-166`). |
| +- **What the model sees today.** |
| + - Images go in with the message, scaled to 1568 px (`claude.go:745`, |
| + `codex.go:193-202`). |
| + - Text files are meant to be read with `read_file` |
| + (`bridge.go:160-166`, `504-536`). |
| + - PDFs "cannot be read here yet" (`claude.go:722`). |
| +- **Three gaps for the Assistant.** |
| + - It has no `read_file` (`runner/provider/actions.go:184-186`). |
| + - Nothing reads PDFs. |
| + - A file is seen in its own turn only. |
| + |
| +### 1.2 Base |
| + |
| +- **Web.** The composer is a plain form that posts `text` and `key` to |
| + `POST /ask/messages` (`templates/partials/chat.html:61`). `ask.js` sends |
| + the same form as `fetch` with JSON accepted (`ask.js:1614-1626`). |
| +- **Native.** `AskModel.send()` posts the same form |
| + (`AskModel.swift:292`, `API/Client.swift:52-53`). |
| +- **Server.** `askSend` bounds the form at 64 KiB and calls |
| + `equipo.Client.Send` with `{"text","idempotency_key"}` |
| + (`internal/web/ask_relay.go:118-135`, `internal/equipo/chat.go:298-303`). |
| +- **The client.** `call` handles JSON only, reads at most 4 MiB of an |
| + answer, and times out after 20 s (`equipo.go:107-144`). |
| +- **Messages lose their files on the way.** `equipo.Message` has no |
| + attachments field (`chat.go:32-38`), and `project()` keeps only that |
| + shape (`ask_relay.go:442-466`). |
| +- **Images must come from Base's own origin.** The CSP is |
| + `img-src 'self' data:` (`internal/web/oficina.go:107`), so a `blob:` URL |
| + is refused as well. |
| + |
| +### 1.3 Other Oficina apps |
| + |
| +- **Where the bytes go.** Slides (`internal/slides/assets.go:75-82`, |
| + 20 MiB) and Mapa (`2026-11-17-mapa-images.md`, 10 MiB) put them in the |
| + app's own CARLOS bucket, through rastrillo `blobs` |
| + (`blobs/s3.go:60-75`). |
| +- **How readers fetch them.** Only through the app, which checks scope. |
| + Presigned URLs failed against `img-src 'self'`, and the bucket has no CORS |
| + rule. |
| +- **Sealing.** Mapa and Docs seal the bytes; Slides does not. |
| +- **Base needs none of this.** Equipo is the store here (R1). |
| + |
| +## 2. What the person sees |
| + |
| +### 2.1 Web (the Ask page and the docked panel) |
| + |
| +- **The paperclip.** It sits in the composer's actions, left of Send. It |
| + shows only with script and only when the snapshot says `attachments`. |
| + - It opens a file picker: several files, with `accept` listing the nine |
| + types. |
| + - On an iPhone, Safari then offers the photo library and the camera, and |
| + hands a photo over as JPEG. |
| +- **Drop and paste.** |
| + - Files dropped on the composer are attached. An outline shows while |
| + something is dragged over it. |
| + - A pasted image (a screenshot) or a copied file is attached. |
| + - A rich-text paste stays Markdown, as now (`ask.js:1676`). |
| +- **Chips.** Each file gets a chip above the text field: a file mark, its |
| + name and size, a progress ring while it uploads, and Remove. |
| + - Each file uploads at once. |
| + - Once an image is up, its chip shows the thumbnail Base serves. |
| + - A refusal shows on the chip in words. |
| +- **Sending.** Send waits for the uploads to finish. Text may be empty when |
| + a file is attached. A sixth file is refused at the chip. |
| +- **In the thread.** The person's bubble shows a row of thumbnails, then |
| + file pills (a mark, the name and the size), then the text. |
| + - A thumbnail opens full size in a sheet. |
| + - A pill downloads the file. |
| + - Both come from Base. Without script the thumbnails and pills still show, |
| + and a thumbnail opens the image itself. |
| + |
| +### 2.2 Mac and iPhone (slice 2) |
| + |
| +- The Mac gets a paperclip in `Composer`. Files can be dropped on the |
| + composer or the window, or pasted with ⌘V. |
| +- The iPhone gets a `+` with Photos, Camera and Files. |
| +- Both get the same chips, as Equipo's `EquipoKit/Attachments` draws them |
| + (R5). |
| + - HEIC, TIFF and anything over 2560 px becomes JPEG on the device. |
| +- Bubbles show thumbnails and pills. A tap opens Quick Look on the Mac, or a |
| + preview with Share on the iPhone. |
| +- Until slice 2, the apps show a person's files in the thread as a plain |
| + line of names, so no bubble is ever empty. |
| + |
| +## 3. Base's changes (slice 1) |
| + |
| +- **Upload:** `POST /ask/attachments`, with the raw body, `Content-Type` and |
| + `Content-Disposition`. |
| + - The body is held to 10 MiB plus 1 byte, and a body over 10 MiB is |
| + refused before Equipo is called. |
| + - Base relays it to Equipo's `POST /api/v1/attachments` with the person's |
| + bearer, at most 4 at a time, with a 60 s limit. |
| + - It answers with Equipo's JSON (`id`, `kind`, `name`, `media_type`, |
| + `size`, `width`, `height`). |
| + - Equipo's refusals (`attachment_too_large`, `_type`, `_heic`, `_pixels`, |
| + `_limit`) come back as `code`, and Base has words for each. |
| + - It makes the same session and state checks as every Ask write. |
| +- **Read:** `GET /ask/attachments/{id}` and `/{id}/preview` stream |
| + Equipo's answer through, with the person's bearer. They never go through |
| + `call`. |
| + - Base keeps Equipo's `Content-Type` and `Content-Disposition`. |
| + - Base sets its own `nosniff`, sandbox CSP and `Cache-Control: private`. |
| +- **Send:** `POST /ask/messages` takes up to 5 `attachments` fields. |
| + `Client.Send` sends them, and text may be empty when there are any. |
| +- **State and events.** |
| + - `equipo.Message` gains `Attachments`, and `project()` and `/ask/state` |
| + keep it. No Equipo URL ever reaches a client: each builds |
| + `/ask/attachments/{id}`. |
| + - `/ask/state` gains `attachments` (true or false), from Equipo's |
| + snapshot. |
| +- **Turn failures.** A failed turn's `attachment_unavailable` and |
| + `runner_storage_full` reasons get their own words in the status line. |
| +- **Copy review** of every new string, before release. Base never names |
| + Equipo (Review 8). |
| + |
| +## 4. Equipo's changes (slice 1, ships first) |
| + |
| +In short. The Equipo spec has the detail. |
| + |
| +- **E1.** The Assistant's send route accepts `attachments`. |
| + - A send with files to a runner older than the new protocol is |
| + `409 runner_too_old`, and nothing is stored. |
| + - The snapshot says `attachments: true` when the person's runner can take |
| + them. |
| +- **E2.** A `read_attachment` tool. It reads text by line, shows an image |
| + again, and says a PDF can't be read yet. |
| +- **E3.** Each later turn lists the person's files from the last 14 days in |
| + this conversation. The tool reads them from the runner's copy, and says so |
| + when a file has gone (R3). |
| +- **E4.** A hand-off from a turn with files goes ahead without them. The |
| + Assistant is told to say the job can't see them (R6). |
| + |
| +## 5. Privacy, retention and deletion |
| + |
| +- **Who can read the bytes:** |
| + - the person, through Base, which checks the session and uses that |
| + person's bearer; |
| + - Equipo, which checks `person` on every read; |
| + - the person's own runner, which gets only their files, on their own desk. |
| + - Nobody else. Base stores and caches nothing on the server. |
| +- **What reaches a model provider.** The runner sends images, and the text |
| + the model reads, to the model the runner uses (Claude or Codex under |
| + Paul's plans). It already does this for the Coordinator. |
| +- **Retention:** |
| + - Unsent uploads: 24 hours in Equipo. |
| + - Sent files: as long as the message, in Equipo, not sealed (R8). |
| + - Runner copies: 14 days. |
| + - Base: none. |
| +- **Deletion:** none in slice 1 (R2). When a member is removed from Base, |
| + nothing of theirs is left in Base. |
| + |
| +## 6. Slices |
| + |
| +1. **Web, and Equipo's half.** Equipo E1 to E4. In Base: the relay, the |
| + send, state and events, the thread, the composer, the browser tests and |
| + copy review. Equipo ships first (D3). |
| +2. **Mac and iPhone** (R5). |
| +3. **PDFs** (Equipo). The text by page, and a scanned PDF's first pages as |
| + images. |
| +4. **Later:** |
| + - files for jobs (R6); |
| + - removing a file (R2); |
| + - sealing the bytes in Equipo (R8); |
| + - files into Oficina apps (R7). |