# Epic: Chat Experience

## Overview

This epic covers the core AI chat experience with personas, including text and
voice interactions.

## Business Value

- Enable personalized spiritual guidance through AI personas
- Provide accessible wisdom from diverse traditions
- Create engaging, conversational learning experiences
- Support multiple interaction modalities (text, voice)

---

## Stories

### US-CHAT-001: Browse Personas

**As a** seeker  
**I want to** browse available AI teacher personas  
**So that** I can find one that resonates with me

**Acceptance Criteria**:

- [ ] Grid/list view of personas
- [ ] Each card shows: name, tradition, teaching style, avatar
- [ ] Filter by tradition (Buddhist, Stoic, Sufi, etc.)
- [ ] Search by name or description
- [ ] "Try sample" button to preview style

**Priority**: P0  
**Points**: 5  
**Status**: ✅ Done

---

### US-CHAT-002: Start New Conversation

**As a** student  
**I want to** start a conversation with a chosen persona  
**So that** I can receive guidance on my questions

**Acceptance Criteria**:

- [ ] Select persona and click "Start Chat"
- [ ] Persona introduces themselves contextually
- [ ] Text input field ready for user message
- [ ] Clear indication of which persona is active
- [ ] Option to select voice/text mode

**Priority**: P0  
**Points**: 3  
**Status**: ✅ Done

---

### US-CHAT-003: Send Text Message

**As a** student  
**I want to** send text messages to the persona  
**So that** I can ask questions and receive answers

**Acceptance Criteria**:

- [ ] Text input accepts messages up to 2000 characters
- [ ] Send button or Enter key submits message
- [ ] Message appears in chat immediately
- [ ] Typing indicator shows persona is responding
- [ ] Response streams in token-by-token

**Priority**: P0  
**Points**: 3  
**Status**: ✅ Done

---

### US-CHAT-004: View Citations

**As a** researcher  
**I want to** see citations for claims in responses  
**So that** I can verify information and explore sources

**Acceptance Criteria**:

- [ ] Citations appear inline or as footnotes
- [ ] Click citation to see full source details
- [ ] Source includes: title, author, tradition, confidence
- [ ] Link to original source when available
- [ ] Toggle citation mode on/off

**Priority**: P0  
**Points**: 5  
**Status**: ✅ Done

---

### US-CHAT-005: Adjust Response Depth

**As a** practitioner  
**I want to** adjust the depth of responses  
**So that** I can get practical or scholarly answers as needed

**Acceptance Criteria**:

- [ ] Depth slider: Practical ↔ Scholarly
- [ ] Practical: Actionable, concise, experiential
- [ ] Scholarly: Detailed, cited, comparative
- [ ] Setting persists within conversation
- [ ] Can be changed mid-conversation

**Priority**: P1  
**Points**: 3  
**Status**: ✅ Done

---

### US-CHAT-006: Adjust Response Tone

**As a** seeker  
**I want to** adjust the tone of responses  
**So that** the teaching style matches my preference

**Acceptance Criteria**:

- [ ] Tone slider: Gentle ↔ Direct
- [ ] Gentle: Encouraging, nurturing, patient
- [ ] Direct: Clear, challenging, no-nonsense
- [ ] Setting affects persona's communication style
- [ ] Respects persona's authentic voice

**Priority**: P1  
**Points**: 3  
**Status**: ✅ Done

---

### US-CHAT-007: Continue Past Conversation

**As a** student  
**I want to** continue a previous conversation  
**So that** I can build on earlier discussions

**Acceptance Criteria**:

- [ ] List of past conversations in sidebar/menu
- [ ] Shows persona, title/preview, date
- [ ] Sorted by most recent
- [ ] Click to load full history
- [ ] Persona has context of previous messages

**Priority**: P1  
**Points**: 5  
**Status**: ✅ Done

---

### US-CHAT-008: Request Audio Response

**As a** seeker  
**I want to** hear the persona's response as audio  
**So that** I can listen during meditation or on the go

**Acceptance Criteria**:

- [ ] Audio toggle for each response
- [ ] TTS generates audio matching persona voice
- [ ] Audio plays inline with text
- [ ] Play/pause controls
- [ ] Audio continues in background

**Priority**: P1  
**Points**: 5  
**Status**: ✅ Done

---

### US-CHAT-009: Voice Input

**As a** practitioner  
**I want to** speak my questions  
**So that** I can have a more natural conversation

**Acceptance Criteria**:

- [ ] Microphone button in chat input
- [ ] Push-to-talk or VAD mode
- [ ] Real-time transcription preview
- [ ] Transcribed text sent as message
- [ ] Clear visual feedback during recording

**Priority**: P1  
**Points**: 5  
**Status**: ✅ Done

---

### US-CHAT-010: Real-Time Voice Chat

**As a** practitioner  
**I want to** have a real-time voice conversation  
**So that** it feels like talking to a teacher in person

**Acceptance Criteria**:

- [ ] Voice mode button activates duplex audio
- [ ] Low latency (< 500ms turn-around)
- [ ] Barge-in: can interrupt persona
- [ ] Visual indicator of who is speaking
- [ ] Fallback to text on poor connection

**Priority**: P1  
**Points**: 8  
**Status**: ✅ Done

---

### US-CHAT-011: Quick Actions

**As a** student  
**I want to** use quick action buttons  
**So that** I can easily ask for more detail or alternatives

**Acceptance Criteria**:

- [ ] "Explain more" button
- [ ] "Simpler please" button
- [ ] "Compare traditions" button
- [ ] "Give me a practice" button
- [ ] Actions appear after each response

**Priority**: P2  
**Points**: 3  
**Status**: ✅ Done

---

### US-CHAT-012: Export Conversation

**As a** researcher  
**I want to** export my conversation  
**So that** I can save or share the discussion

**Acceptance Criteria**:

- [ ] Export button in conversation menu
- [ ] Formats: PDF, Markdown, JSON
- [ ] Includes: messages, citations, timestamps
- [ ] Option to include/exclude user messages
- [ ] Respects privacy settings

**Priority**: P2  
**Points**: 3  
**Status**: ✅ Done

---

## Technical Notes

### Performance Requirements

- First token < 500ms
- Complete response (p50) < 2s
- Voice latency < 500ms round-trip

### Dependencies

- Conversation Service
- AI Service (orchestration)
- RAG Service (citations)
- TTS/STT Services (audio)

## Related Documentation

- [Persona Chat Spec](../specs/persona-chat-spec.md)
- [Voice Chat Spec](../specs/voice-chat-spec.md)
- [Chat API](../api/http-api.md#chat-api)
