# Tasks — MS19 Chat & Terminal System

> Single-writer: orchestrator only. Workers read but never modify.

| id          | status      | description                                                                                                                                                                                       | issue | repo    | branch                         | depends_on                                      | blocks                                          | agent        | started_at | completed_at | estimate | used | notes                                                            |
| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ------- | ------------------------------ | ----------------------------------------------- | ----------------------------------------------- | ------------ | ---------- | ------------ | -------- | ---- | ---------------------------------------------------------------- |
| CT-PLAN-001 | done        | Plan MS19 task breakdown, create milestone + issues, populate TASKS.md                                                                                                                            | —     | —       | —                              |                                                 | CT-TERM-001,CT-TERM-002,CT-CHAT-001,CT-CHAT-002 | orchestrator | 2026-02-25 | 2026-02-25   | 15K      | ~15K | Planning complete                                                |
| CT-TERM-001 | not-started | Terminal WebSocket gateway & PTY session service — NestJS gateway (namespace: /terminal), node-pty spawn/kill/resize, workspace-scoped rooms, auth via token                                      | #508  | api     | feat/ms19-terminal-gateway     | CT-PLAN-001                                     | CT-TERM-003,CT-TERM-004,CT-ORCH-002             |              |            |              | 30K      |      | Follow speech gateway pattern                                    |
| CT-TERM-002 | not-started | Terminal session persistence — Prisma model (TerminalSession: id, workspaceId, name, status, createdAt, closedAt), migration, CRUD service                                                        | #508  | api     | feat/ms19-terminal-persistence | CT-PLAN-001                                     | CT-TERM-004                                     |              |            |              | 15K      |      |                                                                  |
| CT-TERM-003 | not-started | xterm.js integration — Replace mock TerminalPanel with real xterm.js, WebSocket connection to /terminal namespace, resize handling, copy/paste, theme support                                     | #509  | web     | feat/ms19-xterm-integration    | CT-TERM-001                                     | CT-TERM-004                                     |              |            |              | 30K      |      | Install @xterm/xterm + @xterm/addon-fit + @xterm/addon-web-links |
| CT-TERM-004 | not-started | Terminal tab management — Multiple named sessions, create/close/rename tabs, tab switching, session list from API, reconnect on page reload                                                       | #509  | web     | feat/ms19-terminal-tabs        | CT-TERM-001,CT-TERM-002,CT-TERM-003             | CT-VER-001                                      |              |            |              | 20K      |      |                                                                  |
| CT-CHAT-001 | not-started | Complete SSE chat streaming — Wire streamChatMessage() in frontend, token-by-token rendering in MessageList, streaming state indicators, abort/cancel support                                     | #510  | web     | feat/ms19-chat-streaming       | CT-PLAN-001                                     | CT-CHAT-002,CT-ORCH-001                         |              |            |              | 25K      |      | Backend SSE already works, frontend TODO                         |
| CT-CHAT-002 | not-started | Master chat polish — Model selector dropdown, temperature/params config, conversation search in sidebar, keyboard shortcut improvements, empty state design                                       | #510  | web     | feat/ms19-chat-polish          | CT-CHAT-001                                     | CT-VER-001                                      |              |            |              | 15K      |      | ChatOverlay ~95% done, needs finishing touches                   |
| CT-ORCH-001 | not-started | Project-level orchestrator chat — Chat context scoped to project, command prefix parsing (/spawn, /status, /jobs, /kill), route commands through orchestrator proxy, display structured responses | #511  | web     | feat/ms19-orchestrator-chat    | CT-CHAT-001                                     | CT-ORCH-002,CT-VER-001                          |              |            |              | 30K      |      | Uses existing /api/orchestrator/\* proxy                         |
| CT-ORCH-002 | not-started | Agent output in terminal — View orchestrator agent sessions as terminal tabs, stream agent stdout/stderr via SSE (/agents/events), agent lifecycle indicators (spawning/running/done)             | #511  | web     | feat/ms19-agent-terminal       | CT-TERM-001,CT-ORCH-001                         | CT-VER-001                                      |              |            |              | 25K      |      | Orchestrator already has SSE at /agents/events                   |
| CT-VER-001  | not-started | Unit tests — Tests for terminal gateway, xterm component, chat streaming, orchestrator chat, agent terminal integration                                                                           | #512  | web,api | feat/ms19-tests                | CT-TERM-004,CT-CHAT-002,CT-ORCH-001,CT-ORCH-002 | CT-DOC-001                                      |              |            |              | 20K      |      |                                                                  |
| CT-DOC-001  | not-started | Documentation updates — TASKS.md, manifest, scratchpad, PRD status updates                                                                                                                        | #512  | —       | —                              | CT-VER-001                                      | CT-VER-002                                      | orchestrator |            |              | 10K      |      |                                                                  |
| CT-VER-002  | not-started | Deploy + smoke test — Deploy to Portainer, verify terminal, chat streaming, orchestrator chat, agent output all functional                                                                        | #512  | —       | —                              | CT-DOC-001                                      |                                                 | orchestrator |            |              | 15K      |      |                                                                  |

## Summary

| Metric          | Value             |
| --------------- | ----------------- |
| Total tasks     | 12                |
| Completed       | 1 (planning)      |
| In Progress     | 0                 |
| Remaining       | 11                |
| Estimated total | ~250K tokens      |
| Milestone       | MS19-ChatTerminal |

## Dependency Graph

```
PLAN-001 ──┬──→ TERM-001 ──┬──→ TERM-003 ──→ TERM-004 ──→ VER-001 ──→ DOC-001 ──→ VER-002
           │               │                    ↑
           │               └──→ ORCH-002 ───────┘
           │                      ↑
           ├──→ TERM-002 ────────→ TERM-004
           │
           ├──→ CHAT-001 ──┬──→ CHAT-002 ──→ VER-001
           │               │
           │               └──→ ORCH-001 ──→ ORCH-002
           │
           └──→ CHAT-002 (also depends on CHAT-001)
```

## Parallel Execution Opportunities

- **Wave 1** (after PLAN-001): TERM-001 + TERM-002 + CHAT-001 can run in parallel (3 independent tracks)
- **Wave 2**: TERM-003 (after TERM-001) + CHAT-002 (after CHAT-001) + ORCH-001 (after CHAT-001) can overlap
- **Wave 3**: TERM-004 (after TERM-001+002+003) + ORCH-002 (after TERM-001+ORCH-001)
- **Wave 4**: VER-001 (after all implementation)
- **Wave 5**: DOC-001 → VER-002 (sequential)
