Skip to content

feat: Chat Sessions — persistent conversational chat with agents #3983

@OneStepAt4time

Description

@OneStepAt4time

Chat Sessions — Persistent Conversational Chat with Agents

Why

Lower friction interaction with agents. Currently users must create a session, send a message, poll for transcript. Chat sessions make it feel like iMessage — open a conversation, type, get a response. No setup, no babysitting.

Concept

  • A Chat Session is a persistent conversation between a user and an agent
  • Messages go back and forth naturally (user → agent → user)
  • Each chat message creates an agent task in the background
  • Chat sessions persist across messages, like a messaging thread

DB Schema

CREATE TABLE chat_session (
  id TEXT PRIMARY KEY,
  workspace_id TEXT NOT NULL,
  agent_key TEXT NOT NULL,
  creator_id TEXT NOT NULL,
  title TEXT NOT NULL DEFAULT '',
  status TEXT NOT NULL DEFAULT 'active' CHECK(status IN ('active', 'archived')),
  created_at TEXT NOT NULL DEFAULT (datetime('now')),
  updated_at TEXT NOT NULL DEFAULT (datetime('now'))
);

CREATE TABLE chat_message (
  id TEXT PRIMARY KEY,
  chat_session_id TEXT NOT NULL REFERENCES chat_session(id) ON DELETE CASCADE,
  role TEXT NOT NULL CHECK(role IN ('user', 'assistant')),
  content TEXT NOT NULL,
  task_id TEXT,  -- links to agent task if applicable
  created_at TEXT NOT NULL DEFAULT (datetime('now'))
);

API Endpoints

  • POST /v1/chat — create chat session (pick agent)
  • GET /v1/chat — list user chat sessions
  • GET /v1/chat/:id — get session with messages
  • POST /v1/chat/:id/messages — send message (triggers agent response)
  • DELETE /v1/chat/:id — archive session
  • PATCH /v1/chat/:id — update title

Real-time

  • SSE events for new chat messages
  • Typing indicator when agent is processing
  • Session read/unread state

Frontend

  • Chat page: session list sidebar + message thread
  • Message bubbles: user on right, agent on left
  • Input bar at bottom with send button
  • New chat button: pick agent, start conversation

Acceptance Criteria

  • CRUD API for chat sessions and messages
  • Send message triggers agent task and returns response
  • SSE events for new messages
  • Dashboard chat page with session list and message thread
  • Tests for API endpoints
  • npm run gate passes

Reference

Competitive analysis: references/multica-competitive-analysis.md §2.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2backenddashboarddeferredDeferred until concrete demand — not actively worked onenhancementNew feature or requestphase-4Phase 4 - Enterprise GA (NOT ACTIVE)tests

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions