Skip to content

Feature: Persist Project Chat Sessions and Messages with ElectricSQL + TanStackDB #49

@imharrisonking

Description

@imharrisonking

Description

Persist chat sessions and messages for project-scoped chat using ElectricSQL + TanStackDB. Sessions must be scoped by both workspace_id and project_id, with live sync behavior in the client.

Acceptance Criteria

  • Chat sessions persist with workspace_id and project_id associations.
  • Chat messages persist and reload correctly on refresh.
  • Assistant responses stream and reconcile into persisted message content.
  • Live updates sync via Electric shapes/TanStackDB collections.
  • Session titles are auto-generated (from first message heuristic) and stored.

Tasks

  • Add/confirm DB schema for chat_sessions and chat_messages.
  • Add Electric shapes for session/message tables.
  • Add TanStackDB collections and queries for sessions/messages.
  • Persist user message on send and assistant message on stream completion/reconciliation.
  • Ensure project-scoped session querying is enforced in data access layer.
  • Add tests for persistence + sync behavior.
  • Update docs with schema and data flow notes.

Tracer Bullet Reference

Validated by tracer bullets for project streaming + multi-session UX.

Additional Context

Workspace id is available via user.workspaceId in app context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions