# Projects

**Projects** are organizational containers that group channels,
knowledge bases, notes, and files. They follow the scope model
(personal, team, global).

### Project CRUD

```
GET    /projects                    → { "data": [...] }
POST   /projects                    ← { "name", "description", "scope", "team_id", "persona_id", "system_prompt" }
GET    /projects/:id                → project object
PUT    /projects/:id                ← partial update
DELETE /projects/:id
```

Project object:

```json
{
  "id": "uuid",
  "name": "Q3 Research",
  "description": "...",
  "scope": "personal|team|global",
  "owner_id": "uuid",
  "team_id": "uuid|null",
  "persona_id": "uuid|null",
  "system_prompt": "...|null",
  "is_archived": false,
  "channel_count": 5,
  "created_at": "...",
  "updated_at": "..."
}
```

### Channel Association

```
GET    /projects/:id/channels                   → { "data": [channel objects] }
POST   /projects/:id/channels                   ← { "channel_id": "uuid" }
DELETE /projects/:id/channels/:channelId
PUT    /projects/:id/channels/reorder            ← { "channel_ids": ["uuid1", "uuid2"] }
```

A channel can only belong to one project. `POST` performs an atomic
move if the channel is already in a different project.

### KB Association

```
GET    /projects/:id/knowledge-bases             → { "data": [KB objects] }
POST   /projects/:id/knowledge-bases             ← { "kb_id": "uuid" }
DELETE /projects/:id/knowledge-bases/:kbId
```

KBs bound to a project are automatically available to every channel
in that project (see §5.7 resolution chain).

### Note Association

```
GET    /projects/:id/notes                       → { "data": [note objects] }
POST   /projects/:id/notes                       ← { "note_id": "uuid" }
DELETE /projects/:id/notes/:noteId
```

### Project Files

```
GET  /projects/:id/files                         → { "files": [...] }
POST /projects/:id/files                         ← multipart/form-data
```

Project-level file uploads (distinct from workspace files and channel
attachments).

### Admin Project Management

```
GET    /admin/projects                           → { "data": [...] }
DELETE /admin/projects/:id
```

Cross-instance visibility for platform admins. BYOK personal projects
remain private (admin can delete but not read content).

---
