Ably Introduces Conversation Tree Branching for Non-Linear AI Chat
Key Takeaways
- ▸Non-linear conversation history is fully preserved without context pollution through a tree-based structure
- ▸Branches are first-class in the wire format and React hooks, enabling intuitive regeneration and editing workflows
- ▸Multiple users can view different branches simultaneously while sharing a single underlying tree
Summary
Ably has introduced conversation tree branching in its @ably/ai-transport library, enabling developers to build AI chat applications that preserve non-linear conversation history. Rather than losing previous responses or polluting context with failed attempts, the library exposes a tree structure where branches are first-class citizens—explicitly handled in the wire format, React hooks, and persisted on the channel alongside linear messages.
The tree is implemented using three message headers: msgId, parentId, and optional forkOf. This allows conversations to branch naturally when users regenerate assistant responses, edit their own messages, or compare different phrasings. Users can navigate between sibling branches at any fork point without losing any conversation history.
The feature directly addresses a common pain point in AI pair-programming: when a developer wants to try an alternative approach, they previously had to either keep failed attempts in context (polluting future turns) or lose them entirely. With conversation tree branching, all variations are preserved in the underlying tree structure, enabling seamless navigation and comparison.
- Enables better AI pair-programming by allowing developers to explore multiple solution paths and easily backtrack


