🎥 Watch the demo video to see our state-based chat replay system in action.
The Challenge: Recording AI Chat Conversations
At Alchemyst AI, we faced a critical challenge in AI conversation analysis: how do we effectively record and replay AI chat conversations? This wasn't just about debugging—we needed to analyze how real users interact with our AI system to continuously improve the experience.
While many teams default to rrweb for session replay, we quickly realized it wasn't the right fit for our specific needs in AI chat analytics.
Why Not rrweb?
Traditional session replay tools like rrweb have limitations for AI chat systems:
- ❌ Records raw DOM events (clicks, scrolls, UI changes)
- ❌ Heavy on performance and storage
- ❌ Doesn't capture conversation logic or state
For AI chat systems, tracking UI events misses the point. We don't just care about where users click—we care about the conversation flow, context, and AI decision points.
Our Solution: State-Based Recording
Instead of tracking DOM events, we built a state-based recording system specifically designed for chat interactions:
- âś… Smart Snapshots: Only capture meaningful changes (new messages, AI responses)
- âś… Efficient Storage: Use diffs instead of full logs
- âś… Semantic Replay: Restore conversation flow, not just UI visuals
The Architecture: How It Works
1. State Capture
Chat State → Change Detector → Meaningful? → Snapshot
The system monitors the chat state and creates snapshots only when meaningful changes occur.
2. Snapshot Storage
Current State → Diff Engine → {
fullState: {...},
diff: {...},
timestamp: ...
}
Each snapshot efficiently stores both the complete state and a diff from the previous state.
3. Replay Engine
Timeline Control → State Rebuilder → UI Sync
During playback, the system:
- Reconstructs conversation state step by step
- Syncs with timeline controls
- Maintains perfect replay fidelity
4. Interactive Controls
The replay interface provides:
- 🎛 Interactive timeline navigation
- ⏩ Variable speed playback
- đź’¬ Clear message visualization (User vs AI)
The Benefits
Our state-based approach delivers key advantages:
-
Performance
- Smaller storage footprint
- Faster replay loading
- Lower CPU usage
-
Analysis
- Debug AI decision points
- Track conversation patterns
- Identify improvement areas
-
User Experience
- Smooth playback controls
- Accurate conversation replay
- Easy sharing and collaboration
Why This Matters
By focusing on state instead of clicks, we can:
-
Debug More Effectively
- Pinpoint exact conversation states
- Understand AI decision flow
- Reproduce edge cases reliably
-
Improve AI Quality
- Analyze conversation patterns
- Identify training opportunities
- Measure improvements
-
Build Better Experiences
- Understand user behavior
- Optimize conversation flows
- Enhance AI responses
The Results
Our purpose-built replay system has transformed how we:
- Debug AI interactions with precision
- Improve conversation quality through data-driven insights
- Build better user experiences based on real interactions
That's why at Alchemyst AI, we chose to build our own solution rather than using rrweb—because sometimes the best tool is the one you build specifically for your needs.
Tags
AI Development
System Architecture
Performance Optimization
Chat Analytics
State Management
Technical Deep Dive