Spec: the Assistant reads files (Base's Ask attachments, Equipo's half)
Links oficina/base design/ask-attachments docs/superpowers/specs/2026-11-26-ask-attachments-design.md, where Paul's rulings R1-R8 are recorded.
Human
Prompt
Equipo's half (accepting attachments on the Assistant route, the read_attachment tool, and keeping files readable for the rest of the conversation, plus a runner protocol bump) belongs in the Equipo repo, with a short Equipo-side spec that links Base's.
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
Equipo's half of Base's approved Ask attachments spec: the Assistant's send takes files, read_attachment, files for the rest of the conversation, hand-offs without files, protocol 32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+144
−0
docs/superpowers/specs/2026-11-26-assistant-attachments-design.md+144 −0
diff --git a/docs/superpowers/specs/2026-11-26-assistant-attachments-design.md b/docs/superpowers/specs/2026-11-26-assistant-attachments-design.md| new file mode 100644 |
| index 00000000..75a67410 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-26-assistant-attachments-design.md |
| @@ -0,0 +1,144 @@ |
| +# The Assistant reads files |
| + |
| +Status: approved by Paul on 2026-11-26 (Base's Ask attachments spec, with |
| +every recommendation). Read against Equipo main `478e0055`. |
| + |
| +This is Equipo's half of Base's spec: `oficina/base`, branch |
| +`design/ask-attachments`, |
| +`docs/superpowers/specs/2026-11-26-ask-attachments-design.md`. Base's spec |
| +records Paul's rulings (R1 to R8) and the person's experience. This one says |
| +what Equipo changes. The plan is |
| +`docs/superpowers/plans/2026-11-26-ask-attachments-slice1.md`. |
| + |
| +## What stays as it is |
| + |
| +- **Upload, limits, types, storage, previews and serving:** `internal/attach`, |
| + `chat/attachments.go` and `POST/GET /api/v1/attachments`. |
| + - Base relays these with the person's bearer and keeps no copy (R1). |
| + - The bytes stay in SQLite, not sealed. Sealing is a follow-up (R8). |
| +- **The relay to the runner:** `relayFiles`, attachment frames, `hydrate`, |
| + the runner's `Files` (checks, quota, 14-day keep) and the desk layout. |
| +- **Message views:** `withFiles` already fills `attachments` on every |
| + message in snapshots, pages and events, in every lane. |
| +- **Card answers** and **job threads** take words only. |
| + |
| +## Changes |
| + |
| +### A1. The Assistant's send takes files |
| + |
| +- `LaneStore.Send` (`chat/lane.go:50`) accepts `attachments`, as |
| + `Store.Send` does (`store.go:678-681`): |
| + - `checkFiles`, at most 5; |
| + - text may be empty when files come; |
| + - `linkFiles` in the send's transaction; |
| + - `sendHash` with the files, so a repeated key with other files is |
| + `409 idempotency_conflict`. |
| +- `project_id` stays refused. |
| +- **The runner must speak protocol 32** (`ProtocolAssistantFiles`, A5) for |
| + a send with files. A primary that last spoke an older protocol gets |
| + `409 runner_too_old`, and nothing is stored. A send without files keeps |
| + today's check (protocol 19). |
| +- **The snapshot gains `attachments`**, which is true when a send with |
| + files would pass that check (`GET /api/v1/assistant/snapshot`). Base shows |
| + the paperclip only when it is true. An older Equipo never sends it, so an |
| + older Equipo never gets offered files. |
| +- **Docs.** `docs/api/equipo-v1.md` ("Talk to the Assistant") and the |
| + OpenAPI file drop "takes words only". They describe files, `attachments` |
| + and the `409`. |
| + |
| +### A2. `read_attachment`, the Assistant's tool |
| + |
| +- `read_attachment {path, start}` joins `wire.AssistTools` and |
| + `provider.AssistTools`. `team_update` turns don't get it. |
| +- It runs on the runner (`bridge.go`), never on the instance, and reads |
| + the person's uploads desk (`OpenDesk(SessionRoot, person)`), where files |
| + stay for 14 days. |
| +- **It reads only the files the instance named for this turn:** the turn's |
| + own `attachments` and its `earlier` (A3). Any other path answers "No such |
| + attachment". |
| +- **What it returns:** |
| + - **Text, Markdown, CSV or JSON:** numbered lines from `start`, bounded as |
| + `readAttachment` does now. |
| + - **An image:** the image itself, scaled by `attach.ForModel`, as an MCP |
| + image content block. This needs `Bridge.Call` to return a result that |
| + can hold one image, and `mcp.go` to write it. |
| + - If an engine's MCP client drops image results, the tool answers |
| + "An image. It can be shown only in the turn it was attached." That |
| + was checked live for Codex in plan Task 1. |
| + - **A PDF:** "A PDF. Its text can't be read yet." Slice 3 reads PDFs. |
| + - **A file no longer on the runner:** "This file is no longer on this |
| + machine. Ask the person to attach it again." (R3) |
| +- **The turn's note** (`attachmentNote`) names `read_attachment` in the |
| + Assistant's lane, and `read_file` with repo `attachments` in the |
| + Coordinator's, as now. |
| +- **The rule version** (`assistRule`) moves on, so no Assistant session |
| + started under the old tool set is resumed. |
| + |
| +### A3. Files for the rest of the conversation |
| + |
| +- **The message frame gains `earlier`.** It goes only on the Assistant's |
| + person turns, and only at protocol 32 or later. |
| + - It lists the `AttachmentRef`s of the person's own Assistant messages |
| + sent in the last 14 days (the runner's keep), apart from this turn's, |
| + newest first, at most 20. |
| + - No bytes are sent again. They are on the runner already, unless its |
| + quota or sweep removed them. |
| +- **The runner checks each earlier file** on the uploads desk (size and |
| + SHA-256, as `heldFiles` does). It adds a second block to the note: |
| + "Files the person attached earlier in this conversation", each with its |
| + name, kind and size. |
| + - A file still held reads as "read it with read_attachment, path …". |
| + - A file no longer held reads as "no longer here; ask the person to |
| + attach it again". |
| + - This block is the person's data, framed like the first block, never |
| + instructions. |
| +- **The current turn's files** are still staged into the Assistant's own |
| + desk and shown as they are today: images in the frame, at most 5. |
| + |
| +### A4. A hand-off with files goes ahead without them (R6) |
| + |
| +- `teamRequest` (`handoff.go:219`) sends no files to the job's thread, as |
| + today. When the Assistant turn's messages carry files: |
| + - the result gains `files_left_behind` (a count); |
| + - the operation's description says the job can't see the person's files, |
| + and the Assistant should tell the person so; |
| + - the job's context gets a reference line from the instance: "The person |
| + attached N files to this request in their conversation. This job cannot |
| + see them." So the job never goes looking for them. |
| +- `SendJob` keeps refusing files. |
| +- Passing files into jobs is a later slice. |
| + |
| +### A5. Protocol 32 and older runners |
| + |
| +- **The constants.** `Protocol32`, `ProtocolAssistantFiles = Protocol32`, |
| + and `ProtocolCurrent = ProtocolAssistantFiles`. |
| +- **`wire.Encode` below 32:** |
| + - refuses an Assistant-lane `MessageCommand` with `attachments` |
| + (`ErrProtocol`); |
| + - drops `earlier`. |
| + - Coordinator and job frames are unchanged. |
| +- **`fenceLanes`.** When a primary connects below 32, it fails the person's |
| + in-flight Assistant turns whose messages carry files, with reason |
| + `runner_too_old`, and acks their message commands so none is sent. It |
| + already fails lanes below 19 and 22 the same way. |
| +- **The send check** (A1) keeps new ones from being made. |
| +- **A runner on 32 meeting an older instance** never sees `earlier` or |
| + Assistant files, and works as today. |
| + |
| +## Rollout |
| + |
| +- Equipo ships first. Base's slice 1 merges only after production Equipo |
| + serves `attachments` in the snapshot. |
| +- **Staging** (`scripts/staging-thin.py`), with the release built from this |
| + branch's merge: |
| + - `build`, then `release` (idle check, runners, then the instance); |
| + - `suite` with the new `assistant_attachments` scenario, and then |
| + `make staged-check`. |
| +- **Production.** `scripts/upgrade-thin.sh <version>` (plan), then |
| + `--execute`, on docs-t1: |
| + - The primary runner is upgraded first, in step 3, and then the instance. |
| + - Under AGENTS.md, a green staging run with no waiver needs no one's go. |
| + The agent runs it, then tells Paul. |
| +- **Worker runners** (Paul's Mac, `paulequipo`) don't run the Assistant. |
| + They are brought to the same version afterwards by running the install |
| + command again, so every runner speaks 32. |