SpeakTrue

Conversation Workspace Plan

Status

Proposed implementation plan for a durable, replayable Turn-Based STS workspace across web, iOS, and Android.

Product Thesis

A communication turn should not disappear when the next recording begins. SpeakTrue should preserve the useful context around completed turns while retaining the speed of the current Finish & Speak flow.

The MVP is a revoicing workspace: captured speech becomes transcript text and generated speech. It is not a translation engine. In the current implementation, sts-realtime-finalize sends committed_transcript directly to tts-generate; source and spoken text are therefore identical unless a future transformation provider is explicitly added.

User Outcome

A user can:

  1. start a conversation without configuring a document or project;
  2. complete multiple turns with automatic or manual turn completion;
  3. see each completed turn in order;
  4. replay, share, or save any turn;
  5. leave and resume the conversation on another signed-in surface;
  6. delete a turn or the entire conversation.

Current-State Evidence

Scope

MVP

Later

Non-Goals

UX Contract

Conversation screen

Editing

Speak edited copy creates a derived turn or revision with a new artifact. It does not rewrite the captured transcript. The UI visually links the derived version to its source turn.

Failure recovery

Durable Data Model

Add a new migration; update 001_core_schema.sql only after the additive migration is accepted.

speech_conversations

Field Type Notes
id uuid Primary key
user_id uuid Owner; cascade on auth-user deletion
title text nullable User-editable; generated default stays local until saved
workflow_mode text Starts with live_interpreter
source_language_code text nullable Capture language hint
speech_language_code text nullable TTS language hint; does not imply translation
status text active, closed, deleted
turn_count integer Server-maintained convenience count
created_at / updated_at / last_activity_at timestamptz UTC timestamps

speech_conversation_turns

Field Type Notes
id uuid Primary key
conversation_id / user_id uuid Ownership enforced against parent
sequence_number integer Unique within conversation
transport_session_id uuid nullable Unique idempotency seam to sts_realtime_sessions
transcript_text text Captured final transcript
spoken_text text Text sent to TTS; equal to transcript in MVP
transformation_kind text none in MVP; no false translation claim
artifact_id / artifact_path text nullable Stable artifact identity/path
clip_metadata jsonb Canonical generation provenance
status text pending, ready, failed, deleted
derived_from_turn_id uuid nullable Links edited/re-spoken versions
created_at / updated_at timestamptz UTC timestamps

Do not persist audio_path or download_path; both are signed and must be resolved on demand.

Database protections

API Contract

Prefer handler factories with dependency injection and stable error codes.

New functions

Existing finalize extension

Extend sts-realtime-finalize with optional fields:

{
  "conversation_id": "uuid",
  "client_turn_id": "uuid"
}

After artifact persistence, call an owner-scoped database RPC that attaches the finalized session exactly once. The response keeps all existing artifact fields and may add:

{
  "conversation_turn": {
    "id": "uuid",
    "conversation_id": "uuid",
    "sequence_number": 3,
    "status": "ready"
  }
}

Old callers that omit conversation fields receive the existing response unchanged.

Stable new errors include conversation_not_found, conversation_closed, conversation_turn_conflict, and conversation_attach_failed. Provider errors retain current codes.

File Ownership Map

Backend

Web

iOS

Android

Vertical Slices

Slice Verification

Acceptance Gate

Rollback

Disable conversation_workspace_enabled to return clients to latest-turn behavior. Keep additive tables and optional response fields in place until all deployed clients are known to ignore or understand them. Do not roll back by deleting conversation records. A later cleanup migration can remove abandoned schema only after export and retention review.

Open Decisions

  1. Final product label for live_interpreter before translation exists.
  2. Default retention and whether deletion is immediate or recoverable.
  3. Whether a conversation auto-closes after inactivity.
  4. Whether original microphone recordings are ever opt-in attachments; MVP says no.
  5. Whether true translation belongs in this plan after MVP or in a separate provider/quality plan.