Technical docs

Cowork

Public reference generated from tech docs/cowork.md.

Overview

Support reference for the org Cowork route (`/cowork`).

What Cowork is

- Storage-backed workspace for opening org files and chatting with an AI teammate side-by-side. - Storage remains the source of truth: uploads, deletes, shares, and edits affect the same org files used elsewhere. - Opening a file from `/storage` routes into Cowork with `/cowork?path=...`.

Layout

- Desktop: collapsible tree, document/media panel, and a fixed chat column with two desktop states: - `Chats` history view in the sidebar slot - active chat view after the user opens a conversation or starts a new one - Mobile: full-screen panels using the shared mobile bottom bar: `Menu`, `Tree`, `Doc`, `Chat`, `History`. - Mobile opens on the `History` panel by default. The universal mobile `Chats` item opens `/cowork?coworkPanel=history`; `Files` opens `/cowork?coworkPanel=tree`. - Mobile supports swipe navigation between panels, arrow-key tab movement in the Cowork bar, and chat links back into Cowork documents switch the mobile view to `Doc`. - While the viewport mode is being detected, Cowork shows a `Loading workspace` skeleton instead of rendering the wrong shell first. - Cowork is keyed by the current org in the route layer, so switching orgs resets the workspace state instead of carrying the previous org's selection forward. - If users return to Cowork without a `?path=` deep link, the workspace can restore the last selected file for that org. On mobile, restore waits until the `Doc` panel is visible, then opens the restored file in `Doc`.

Tree behavior

- Tree collapse state is stored in local storage under the Cowork tree-collapse key. - Expanded folder state is also stored per organization in local storage and restored when users revisit Cowork. - A `?path=...` deep link opens that item, forces the tree open for the load, then removes the query param from the URL. - Dragging files or folders onto a folder in the tree uploads into that folder. - Tree context menu uses storage actions for copy path, new subfolder, share, delete, and download. - File rows download the selected file directly. - Folder rows download the selected folder as a browser-generated `.zip` archive. - Folder zip downloads currently fail if the folder contains more than `500` files.

File handling

- Editable in Cowork: existing `.txt` and `.md` only. - Spreadsheet fallback: `.csv` and `.xlsx` open a download-only spreadsheet panel. - Inline media preview: - Images: `.jpg`, `.jpeg`, `.png`, `.gif`, `.webp`, `.svg`, `.bmp`, `.avif` - Video: `.mp4`, `.webm`, `.ogv` - Audio: `.mp3`, `.wav`, `.ogg`, `.aac`, `.flac`, `.m4a`, `.opus` - Other files can still be selected from the tree, but Cowork shows an unsupported preview state with `Download`. - Cowork document states include empty selection, loading, unsupported preview, too-large preview, not found, generic error, and ready. - Spreadsheet fetches are blocked for previews above `10 MB`, so large spreadsheets fall back to download-only behavior.

Document editing

- Cowork edits existing files only; it does not create new documents through the editor endpoint. - Autosave runs after about `1s` of inactivity. - Save also runs on blur and `Cmd+S` / `Ctrl+S`. - Header status states: `Saving…`, `Saved`, `Updated remotely`, `Save failed`. - If the open file is updated through websocket events, Cowork reloads it and briefly shows `Updated remotely`. - If the open file is deleted, Cowork clears the selection and removes the stored restored-path value for that org. - Save failures show an inline retry hint that points users back to `Cmd+S` / `Ctrl+S`. - Current code confirms `.txt` and `.md` path restrictions. The file-content endpoint itself is for existing files only; the `10 MB` limit is enforced on upload and spreadsheet preview, not as a separate confirmed document-edit rule. - Cowork document live refresh listens to `storage_file.updated`, `storage_file.deleted`, `storage_file.renamed`, and `storage_file.moved`. - When the open document is renamed or moved, Cowork remaps the active path to the new location instead of dropping the selection. - If a rename or move happens while the document is still loading, Cowork reloads the new path. If a save was already in progress, Cowork re-queues the save against the remapped path. - Spreadsheet and media selections clear on delete. Their selected paths also remap on rename and move. - On revisit without an explicit deep link, Cowork checks whether the stored selected file still exists before restoring it.

Header actions

- Current document/media/spreadsheet header menu actions are `Copy link` and `Download`. - On mobile, the document header keeps tree access as `Open file tree`, and panel navigation otherwise happens through the bottom bar.

Chat behavior

- Users must select an AI teammate before chatting. - The picker uses active AI teammates only. - The selected teammate is persisted per org and user in local storage. - Conversation actions are `History` and `Settings`, plus `New conversation` in the overflow menu once there is an active conversation to reset. - When a teammate is selected, the chat header also shows a dedicated `New conversation` button. - On mobile, `History` is also a dedicated bottom-tab panel. - On desktop, the chat column opens in a `Chats` history view until the user opens a conversation or starts a fresh chat. - Desktop and mobile both use the same shared history/chat module and the same merged Cowork history list across active AI teammates. - Cowork history only shows AI-teammate conversations for active teammates in the current org. This is intentionally the same teammate-only filtering used by the shared `Chats` surface. - The history view shows recent-teammate chips for starting a new chat without opening an existing thread. - History includes a `Search` field. - Entering 3 or more characters automatically searches AI-teammate internal-chat conversations for the current org user. - Search results can match conversation titles or message content, and message matches can show an excerpt with the matched text highlighted. - Selecting a history row opens that conversation, switches the selected teammate, and shows the active chat view. - Starting a fresh chat from a teammate chip switches to that teammate and explicitly opens a blank conversation. - The history screen stays mounted while the chat screen is active, so returning to history keeps the current search/list state. - When a stored file or deep-linked file is auto-opened on mobile, Cowork switches to the `Doc` panel automatically. - Voice mode is available only when the selected teammate has a `tts_model`. - Cowork uses the shared internal-chat surface with the welcome state suppressed inside the Cowork panel.

Storage APIs used by Cowork

- `GET /api/organizations/{orgId}/storage?path=...` - `POST /api/organizations/{orgId}/storage/upload` - `DELETE /api/organizations/{orgId}/storage/file?path=...` - `POST /api/organizations/{orgId}/storage/folder` - `GET /api/organizations/{orgId}/storage/folder/share?path=...` - `POST /api/organizations/{orgId}/storage/folder/share` - `DELETE /api/organizations/{orgId}/storage/folder/share` - `GET /api/organizations/{orgId}/storage/file/content?path=...` - `PUT /api/organizations/{orgId}/storage/file/content` - `GET /api/organizations/{orgId}/internal-chat/conversations/search?q=...&limit=...`

Support notes

- Cowork is the primary open-file experience for non-folder Storage items. - Spreadsheet preview is unavailable in Cowork today; spreadsheets are download-only there. - Folder sharing in Cowork uses the same folder-sharing rules as Storage, including root-share restrictions.

Start building your AI team