# πŸ—ΊοΈ Chat Switchboard β€” Roadmap **See also:** - [ARCHITECTURE.md](ARCHITECTURE.md) β€” Core services design (Notes, KBs, Tasks, Channels, Embeddings) - [EXTENSIONS.md](EXTENSIONS.md) β€” Extension system spec (Browser/Starlark/Sidecar tiers, tools, surfaces) ## Current State: v0.5.4 ### βœ… Done **Backend (Go)** - [x] PostgreSQL schema + auto-migrations (go:embed, startup) - [x] JWT auth with refresh token rotation - [x] Chat CRUD + message persistence - [x] Streaming completion proxy (OpenAI + Anthropic + Venice + OpenRouter) - [x] Per-user + global API config management - [x] Admin endpoints (users, providers, models, settings, stats) - [x] Rate limiting, error middleware, request logging - [x] Health check endpoint (includes schema_version) - [x] EventBus with WebSocket hub - [x] Provider capability system (known models, heuristic detection, resolution chain) - [x] Dynamic max_tokens resolution (no more hardcoded 4096) - [x] User + admin provider model listing with capabilities **Frontend (Vanilla JS)** - [x] Collapsible sidebar with time-grouped chat history - [x] User menu flyout (Settings, Admin, Debug, Sign Out) - [x] Model selector with capability badges (output, context, tools, vision, thinking) - [x] Client-side known model table with backend overlay - [x] Streaming SSE display with smart scroll - [x] Full markdown rendering (marked.js + DOMPurify) - [x] Thinking block display (``/`` tags) - [x] Settings modal (profile, chat prefs, provider management) - [x] Admin modal (users, providers, models with cap badges, settings, stats) - [x] Debug modal (console intercept, network log, state inspector) - [x] EventBus client with exponential backoff + max retries - [x] Export (Markdown, JSON, Text) - [x] Vendor libs with CDN fallback (SCIF-safe) - [x] 3-stage Dockerfile (Go build β†’ vendor download β†’ nginx) **CI/CD (Gitea Actions)** - [x] Three-env pipeline (dev/test/prod) - [x] Dev: upgrade test β†’ schema validate β†’ wipe β†’ fresh install test - [x] Backend auto-migrates on startup (no CI migration step) - [x] Shared PG safety (_dev suffix guard on wipe) - [x] Post-deploy schema verification via /api/v1/health **Architecture Design (v0.5.4)** - [x] ARCHITECTURE.md: core services spec (13 sections) - [x] EXTENSIONS.md: three-tier extension system spec - [x] Terminology: Roles, Teams, Channels, Message Tree, etc. - [x] "Everything is a channel" β€” chat is a channel with type:'direct' - [x] Conversation forking (message tree via parent_id) - [x] Auth strategy (builtin/mTLS/OIDC) - [x] Classification banners (CSS custom props) ### Implementation Phasing **See ARCHITECTURE.md Β§10 for the authoritative implementation sequence.** Phases 1–8, from channel foundation through RBAC. --- ## Phase 1: Real-Time Foundation ### 1.1 WebSocket Hub **Priority:** HIGH β€” blocks Channels, typing indicators, live updates - [ ] WebSocket upgrade endpoint (`/ws`) - [ ] Connection manager (register, unregister, broadcast) - [ ] Room-based pub/sub (per-chat, per-channel, global) - [ ] JWT auth on WebSocket handshake - [ ] Heartbeat / ping-pong keepalive - [ ] Reconnection handling (frontend) - [ ] Message types: `chat.message`, `chat.typing`, `user.presence`, `system.notify` ### 1.2 Live Chat Updates - [ ] New messages pushed via WebSocket (not just SSE streaming) - [ ] Typing indicators - [ ] Chat list updates when other sessions create/delete chats - [ ] Online user presence --- ## Phase 2: Channels ### 2.1 Backend - [ ] Channel model (name, description, type: public/private/DM, creator) - [ ] Membership model (user_id, channel_id, role: owner/member) - [ ] Channel messages (extends message model with channel_id) - [ ] CRUD endpoints: `/api/v1/channels`, `/api/v1/channels/:id/messages` - [ ] @mention parsing β€” users and AI models - [ ] AI response triggered by @model-name mentions - [ ] WebSocket broadcast per channel room ### 2.2 Frontend - [ ] Channels section in sidebar (below chats, collapsible) - [ ] Channel creation modal (name, description, public/private) - [ ] Member management (invite, remove, role change) - [ ] Message display with user avatars and @mention highlighting - [ ] AI responses inline with user messages - [ ] Unread count badges --- ## Phase 3: Plugin System ### 3.1 Architecture (see discussion below) - [ ] Plugin manifest format (`plugin.json`) - [ ] Plugin lifecycle (install, enable, disable, uninstall) - [ ] Plugin storage (per-plugin isolated DB namespace or key-value) - [ ] Hook system (pre-completion, post-completion, on-message, on-channel-message) - [ ] Admin UI for plugin management (install, configure, enable/disable) - [ ] Plugin API (what plugins can access: messages, user context, settings) ### 3.2 Built-in Plugin: Web Search - [ ] Tool-use integration in completion flow - [ ] Search provider abstraction (DuckDuckGo, SearXNG, Brave) - [ ] Results injected into context ### 3.3 Built-in Plugin: Token Counter - [ ] Per-message token estimation - [ ] Per-chat cost tracking - [ ] Provider-specific pricing data --- ## Phase 4: Notes & Knowledge Base ### 4.1 Notes - [ ] Note model (title, content, folder, tags) - [ ] CRUD endpoints - [ ] Folder organization - [ ] Full-text search (PostgreSQL `tsvector`) - [ ] Markdown editor in frontend - [ ] Link notes to chats ### 4.2 RAG (Retrieval Augmented Generation) - [ ] Document upload (PDF, DOCX, TXT, MD) - [ ] Chunking strategies (recursive, semantic) - [ ] Embedding generation (OpenAI, local models) - [ ] pgvector storage and similarity search - [ ] Context injection in completion flow - [ ] Per-KB toggle in chat settings --- ## Phase 5: Polish - [ ] Chat search / filter in sidebar - [ ] Message editing - [ ] Chat folders / pinning - [ ] Bulk chat operations - [ ] Keyboard shortcuts (Ctrl+K command palette) - [ ] PWA manifest + offline shell - [ ] Performance: lazy load chat history, virtual scroll for long chats --- ## Future - Desktop app (Tauri) - Smart model routing (cost/quality/latency auto-selection) - Workflow builder (visual DAG for chaining models + tools) - Plugin marketplace - SSO/SAML - Audit logging - Multi-tenant SaaS mode --- ## Plugin / Extension Architecture **Moved to dedicated documents:** - [EXTENSIONS.md](EXTENSIONS.md) β€” Full extension system spec with three tiers (Browser JS, Starlark sandbox, Sidecar containers), manifest format, browser tool bridge, surface/mode system, and implementation roadmap. - [ARCHITECTURE.md](ARCHITECTURE.md) β€” Core backend services that extensions build on: Notes, Knowledge Bases, Tasks, Channels, Embeddings, and Folders/Projects. Includes data models, sequencing, and admin controls.