oficina / base Public
Files in Ask
Status: approved by Paul on 2026-11-26, with every recommendation. Revised after Fable's plan review of 2026-11-26 (B1 to B6, Equipo's E1, and the nits). 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 can_attach). A runner never seen counts as one that can't. | A Base that offers files and then fails at send. | | D4 | PDFs are accepted in slice 1. A PDF's chip says "Ask can't read PDFs yet" before sending, and the Assistant says so too. Slice 3 reads them and drops the line. | Leaving PDFs out of the picker. That needs Base-side type checks and words that slice 3 throws away. | | D5 | Refused files never take Ask down (Fable B1, B2). When a send with files is refused because the runner can't take them, Ask stays ready: the paperclip goes, and the chips say why. A stale upload, refused at send, is marked "attach it again" on its chip. Words always still send. | Showing the whole chat's "needs an update" state for a file. | | D6 | Remove frees the upload (Fable E1, B6). Equipo gains a delete for unsent uploads, and Base calls it on Remove. Chips don't survive a reload: when the page goes away, Base asks Equipo, as best it can, to delete what was never sent. The 24-hour drop catches the rest. | Evicting the oldest unsent upload. That silently drops a file the person may still mean to send from another tab. | | D7 | Base decides what is shown inline, not Equipo (Fable B4). Only PNG, JPEG, WebP and GIF are served inline. Everything else is a download, and any type outside the nine is application/octet-stream. | Passing Equipo's headers through on Base's origin, where the session lives. | | D8 | A paste with words pastes the words (Fable B5, B8). Files are attached only when the clipboard holds no words beyond the files' own names (plan P12). Word, Excel, Pages and Numbers put a picture of the selection beside its text, and a table pasted from Excel stays a table. | Attaching every image on the clipboard. |
1. What exists today
1.1 Equipo
- The Assistant refuses files. The API doc says it "takes words only, so a message with
attachmentsis422 invalid_input" (docs/api/equipo-v1.md:157). - The refusal is inLaneStore.Send(internal/equipo/chat/lane.go:51), which also passes no files tosendOrigin(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 inContent-Type, the name inContent-Disposition. Its ID then goes in the message'sattachments(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/previewcheck that the file is the person's. They answer withnosniffand 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. -
relayFilesqueues each file as 128 KiBattachmentframes 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 withread_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
textandkeytoPOST /ask/messages(templates/partials/chat.html:61).ask.jssends the same form asfetchwith JSON accepted (ask.js:1614-1626). - Native.
AskModel.send()posts the same form (AskModel.swift:292,API/Client.swift:52-53). - Server.
askSendbounds the form at 64 KiB and callsequipo.Client.Sendwith{"text","idempotency_key"}(internal/web/ask_relay.go:118-135,internal/equipo/chat.go:298-303). - The client.
callhandles 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.Messagehas no attachments field (chat.go:32-38), andproject()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 ablob: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 rastrilloblobs(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, withacceptlisting 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, but only when the clipboard holds no words beyond the files' own names (D8). - A paste with words pastes the words, and 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. - Files upload two at a time, in order. A busy answer is retried by itself. - Once an image is up, its chip shows the thumbnail Base serves. - A refusal shows on the chip in words, and so does a PDF's "can't read yet" line (D4). - Remove deletes the upload in Equipo too (D6). - A phone photo over 40 megapixels (48 MP cameras) is refused until slice 2 resizes on the device. On the web, share it as a smaller image.
- 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. If the files are refused at send, the chips say why and the words can still go (D5).
- 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. - The viewer takes focus and gives it back on Close. Finished and refused uploads are announced.
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/Attachmentsdraws 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-TypeandContent-Disposition. - A slot first. It takes one of 4 process-wide slots before it reads the body. It then reads under a 60 s read deadline, to at most 10 MiB plus 1 byte. A body over 10 MiB is refused before Equipo is called, and a stalled body loses its slot when the deadline passes. - Waiting. A request that waits more than 10 s for a slot gets503withRetry-After. The page retries by itself. - The relay. It goes to Equipo'sPOST /api/v1/attachmentswith the person's bearer and a 60 s limit, and answers with Equipo's JSON (id,kind,name,media_type,size,width,height). - Refusals. Equipo's refusals (attachment_too_large,_type,_heic,_pixels,_limit) come back ascode, and Base has words for each. - Checks. It makes the same session and state checks as every Ask write. - Remove:
DELETE /ask/attachments/{id}relays Equipo's delete of an unsent upload. A404counts as done.POST /ask/attachments/discardtakes the page's unsent IDs from a beacon when the page goes away, and deletes them as best it can. - Read:
GET /ask/attachments/{id}and/{id}/previewstream from Equipo with the person's bearer, never throughcall. - What Base allows (D7). Onlyimage/png,image/jpeg,image/webpandimage/gifare inline. The other five types areattachment, and anything else isapplication/octet-streamasattachment./previewserves images only. - Headers. Base always setsnosniffand a sandbox CSP. - Caching. Previews areCache-Control: private, max-age=3600withVary: Cookie. Originals areno-store. - Failures. Equipo's error body never comes through. - A401drops the link and answers404. - A5xxor a timeout answers502with no body. - An<img>then shows itsalt. - Send:
POST /ask/messagestakes up to 5attachmentsfields.Client.Sendsends them, and text may be empty when there are any. - Runner can't take files. Equipo's409 attachments_unavailable(orrunner_too_old) on a send with files answers409withfiles: "unavailable"and leaves Ask ready (D5). - Stale upload. Equipo's422on a send with files answers422withfiles: "stale". - State and events. -
equipo.MessagegainsAttachments, andproject()and/ask/statekeep it. No Equipo URL ever reaches a client: each builds/ask/attachments/{id}. -/ask/stategainscan_attach, from Equipo's snapshot. - Turn failures. A failed turn's
attachment_unavailable,runner_storage_fullandrunner_too_oldreasons get their own words in the status line. - The native apps show a person's files as a line of names until slice 2. That build ships before or with the web release, so no installed app draws an empty bubble.
- 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 send takes files. The Assistant's send route accepts
attachments. Files need the person's primary runner to be seen on the new protocol; otherwise the answer is409 attachments_unavailable, with nothing stored. The snapshot sayscan_attach. - E2. Deleting unsent uploads.
DELETE /api/v1/attachments/{id}deletes an unsent upload. - E3.
read_attachment. The tool reads text by line, inside a frame that says it is data and not instructions. It shows an image again, and says a PDF can't be read yet. - E4. Files across the conversation. Each later turn lists the person's files from up to 14 days of this conversation. The tool reads them from the runner's copy, and says so when a file has gone (R3).
- E5. Hand-offs. 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
personon 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: a sent file stays (R2). An unsent upload is deleted on Remove, when the page goes away (as best it can), or after 24 hours (D6). When a member is removed from Base, nothing of theirs is left in Base.
6. Slices
- 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).
- Mac and iPhone (R5).
- PDFs (Equipo). The text by page, and a scanned PDF's first pages as images.
- Later: - files for jobs (R6); - removing a file (R2); - sealing the bytes in Equipo (R8); - files into Oficina apps (R7).