# Mission Manifest — MS19 Chat & Terminal System

> Persistent document tracking full mission scope, status, and session history.
> Updated by the orchestrator at each phase transition and milestone completion.

## Mission

**ID:** ms19-chat-terminal-20260225
**Statement:** Implement MS19 (Chat & Terminal System) — real terminal with PTY backend, chat streaming, master chat polish, project-level orchestrator chat, and agent output integration
**Phase:** Planning
**Current Milestone:** MS19-ChatTerminal
**Progress:** 0 / 1 milestones
**Status:** planning
**Last Updated:** 2026-02-25T20:00Z

## Success Criteria

1. Terminal panel has real xterm.js with PTY backend via WebSocket
2. Terminal supports multiple named sessions (create/close/rename tabs)
3. Terminal sessions persist in PostgreSQL and recover on reconnect
4. Chat streaming renders tokens in real-time via SSE
5. Master chat sidebar accessible from any page (Cmd+Shift+J / Cmd+K)
6. Master chat supports model selection, temperature, conversation management
7. Project-level chat can trigger orchestrator actions (/spawn, /status, /jobs)
8. Agent output from orchestrator viewable in terminal tabs
9. All features support all 5 themes (Dark, Light, Nord, Dracula, Solarized)
10. Lint, typecheck, and tests pass
11. Deployed and smoke-tested at mosaic.woltje.com

## Existing Infrastructure

Key components already built that MS19 builds upon:

| Component                         | Status              | Location                             |
| --------------------------------- | ------------------- | ------------------------------------ |
| ChatOverlay + ConversationSidebar | ~95% complete       | `apps/web/src/components/chat/`      |
| LLM Controller with SSE           | Working             | `apps/api/src/llm/`                  |
| WebSocket Gateway                 | Production          | `apps/api/src/websocket/`            |
| TerminalPanel UI (mock)           | UI-only, no backend | `apps/web/src/components/terminal/`  |
| Orchestrator proxy routes         | Working             | `apps/web/src/app/api/orchestrator/` |
| Speech Gateway (pattern ref)      | Production          | `apps/api/src/speech/`               |
| Ideas API (chat persistence)      | Working             | `apps/api/src/ideas/`                |

## Milestones

| #   | ID   | Name                   | Status   | Branch                    | Issue                    | Started    | Completed |
| --- | ---- | ---------------------- | -------- | ------------------------- | ------------------------ | ---------- | --------- |
| 1   | MS19 | Chat & Terminal System | planning | per-task feature branches | #508,#509,#510,#511,#512 | 2026-02-25 | —         |

## Deployment

| Target    | URL               | Method                      |
| --------- | ----------------- | --------------------------- |
| Portainer | mosaic.woltje.com | CI/CD pipeline (Woodpecker) |

## Token Budget

| Metric | Value             |
| ------ | ----------------- |
| Budget | ~300K (estimated) |
| Used   | ~0K               |
| Mode   | normal            |

## Session History

| Session | Runtime         | Started           | Duration | Ended Reason | Last Task           |
| ------- | --------------- | ----------------- | -------- | ------------ | ------------------- |
| S1      | Claude Opus 4.6 | 2026-02-25T20:00Z | —        | —            | Planning (PLAN-001) |

## Scratchpad

Path: `docs/scratchpads/ms19-chat-terminal-20260225.md`
