API for chat project sharing (experiment `chat-projects`). Builds on
#30479 (merged).
Owners share a project with users, groups, or the whole organization
(the Everyone group, ID = organization ID). Chats in a shared project
stay private.
| Role | Project and instructions | Memories | ACL | Delete |
|---------|--------------------------|------------|------|--------|
| `use` | read | read/write | read | no |
| `admin` | read/write | read/write | edit | no |
Only the owner, and administrators whose role grants delete, can delete
a project.
- **API:** `GET`/`PATCH .../chats/projects/{project}/acl`, same shapes
as `/chats/{chat}/acl`, plus SDK methods. Project responses include the
caller's `permissions` (`update`, `delete`, `share`); the UI hides edit
and delete accordingly.
- **Listing:** `GET /chats/projects` returns owned and shared projects.
Removes `GetChatProjectsByOwnerID`.
- **Chat access:** creating a chat in a project, and loading its memory
and instructions on each turn, requires the chat owner to own the
project or have an ACL grant (`chatd.ChatProjectUsableBy`). Role grants
don't count. If the grant is removed, existing chats lose memory and
instructions on their next turn.
- **Validation:** users and groups must be in the project's
organization; keys must be canonical UUIDs; callers can't change their
own role; the owner can't be added. Migration `000624` drops a user's
grants when they leave the organization, so rejoining doesn't restore
access.
- **Instructions:** readers who can't edit get 403 instead of 404, and
the UI hides editing.
- **Agent prompt:** memories are visible to and editable by sharees, so
the agent is told not to save secrets or personal details.
Known gap: project deletion still detaches chats, and a sharee's open
sidebar keeps showing them until reload. #30683 replaces this.
Not included: share notifications, `/acl/available`, sharing UI.
<details>
<summary>Decision log</summary>
- `use` grants memory read/write over HTTP, because agents in a sharee's
chats can already write memories. Making the agent read-only for sharees
was the alternative (@f0ssel chose sharees changing memories through
use).
- An administrator with `share` can grant themselves access and then use
the project. Accepted to keep access control simple (@f0ssel).
</details>
> Generated by Coder Agents.
- Experiment, behind `chat-projects` (off by default). First of three
stacked PRs: #29301 (memory), #29583 (UI). This PR is API only; the
screenshots below are from the UI in #29583.
- CRUD under
`/api/experimental/organizations/{organization}/chats/projects/{project}`.
`GET /api/experimental/chats/projects` lists the caller's projects
across all organizations.
- `project_id` on chat create and as a chat list filter. A chat joins a
project only at creation; there is no move.
- Projects are identified by ID. Names are display labels (64
characters, description 1024) with no uniqueness constraint. An optional
`icon` URL (usually an emoji image under `/emojis`) is capped at 256
characters and audited.
- A user can own at most 100 projects across all organizations; creating
another answers 409. Creates count and insert under a per-owner advisory
lock so concurrent requests cannot overshoot.
- Projects are private to their `owner_id`. Members may only create
their own, and a chat can only be bound to a project its owner owns. An
unreadable or foreign project on chat create answers 404 so IDs cannot
be probed; a project from another organization answers 400.
- Permissions ride on the `agents-access` role next to chats (after
#30004), so whoever can use Coder Agents can use projects. Owners and
org admins reach every project.
### Examples
Create a project in an organization:
```http
POST /api/experimental/organizations/{organization}/chats/projects
{"name": "Platform", "description": "Infra and deploy work", "icon": "/emojis/1f680.png"}
```
```json
{
"id": "7c0e4a3e-5b1f-4f7d-9a51-2f3c8f6d2b10",
"organization_id": "bb640d07-ca8a-4869-b6bc-ae61ebb2fda1",
"owner_id": "0ed9befc-4911-4ccf-a8e2-559bf72daa94",
"name": "Platform",
"description": "Infra and deploy work",
"icon": "/emojis/1f680.png",
"created_at": "2026-09-30T15:04:05Z",
"updated_at": "2026-09-30T15:04:05Z"
}
```
List the caller's projects across organizations with `GET
/api/experimental/chats/projects` (an array of the object above). Update
with `PATCH .../chats/projects/{project}` and any of `name`,
`description`, `icon`; delete with `DELETE`, which detaches its chats.
Create a chat in the project, and list only its chats:
```http
POST /api/v2/chats
{"organization_id": "bb640d07-…", "project_id": "7c0e4a3e-…", "content": [{"type": "text", "text": "Plan the deploy"}]}
GET /api/v2/chats?project_id=7c0e4a3e-…
```
At the limit:
```json
409 {"message": "You can have at most 100 chat projects. Delete a project to create another."}
```
<details>
<summary>Screenshots (UI from #29583)</summary>





</details>
---
Generated with Coder Agents on behalf of @f0ssel.
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>