Skip to content
Product

Explore Without Fear: Conversation Branching for Hypothesis Testing

Fork any conversation at any point to explore alternatives without losing your progress. JieGou's session branching turns linear chats into a tree of possibilities.

JT
JieGou Team
· · 6 min read

You’re 25 messages into a conversation. You’ve established context, made decisions, and arrived at a promising direction. Then a thought hits you: What if I tried a completely different approach?

In a traditional chat interface, you have two bad options. Start over and re-explain everything. Or abandon the alternative and hope your current path works out.

JieGou’s session branching gives you a third option: fork the conversation.

What is session branching?

Session branching lets you create a new conversation branch from any message in your history. The branch inherits all context up to that point — the system prompt, the message history, any compacted summaries — and continues independently from there.

Think of it as git branch for conversations.

Message 1 ─── Message 2 ─── Message 3 ─── Message 4 ─── Message 5

                                └─── Branch A: Message 4a ─── Message 5a

                                └─── Branch B: Message 4b ─── Message 5b

Both branches share the history from Messages 1-3. From Message 3 onward, they diverge completely. Changes in one branch don’t affect the other.

How to branch

Branching is a single action. In the conversation view:

  1. Hover over any message in the conversation
  2. Click the Branch icon
  3. A new branch is created from that point
  4. You’re taken to the new branch, ready to continue

The original conversation remains untouched. You can switch between branches at any time.

You can also branch from the API and SDK:

const branch = await jiegou.conversations.branch({
  conversationId: "conv_abc123",
  fromMessageId: "msg_xyz789",
  name: "Alternative approach — try SQL instead of NoSQL"
});

// Continue the branch with a new message
const response = await jiegou.conversations.send({
  conversationId: branch.id,
  message: "Let's reconsider the data model using PostgreSQL instead."
});

Use cases

A/B testing prompts

You’ve been refining a prompt for a content generation task. You want to compare two phrasings. Branch the conversation before your latest prompt, send version A in one branch and version B in the other, then compare the outputs side by side.

Setup context ─── Provide examples ─── Refine instructions

                                            ├─── Prompt A: "Write a concise summary..."

                                            └─── Prompt B: "Summarize the key points..."

Hypothesis testing

You’re analyzing data with the model’s help. You’ve cleaned the dataset and established the analysis framework. Now you want to test two hypotheses without contaminating either exploration.

Load data ─── Clean & validate ─── Define metrics

                                       ├─── Hypothesis 1: "Churn correlates with usage frequency"

                                       └─── Hypothesis 2: "Churn correlates with support tickets"

Each branch gets the clean dataset context. Each exploration is isolated.

Comparing models

Start a conversation with Claude Sonnet for initial exploration. Branch, and switch the branch to GPT-4o. Ask the same question in both branches. Compare reasoning approaches, output quality, and response times.

Safe exploration

Working on a production configuration? Branch before making risky changes. If the branch leads to a dead end, switch back to the main conversation and continue as if nothing happened.

Collaborative decision-making

Your team is discussing an architecture decision. Branch the conversation to explore each option independently. After the exploration, review both branches and merge the insights into a final decision.

Branch management

Branches aren’t disposable throwaways. They’re first-class conversation objects with full lifecycle support:

  • Naming — give branches descriptive names (“SQL approach,” “NoSQL approach”) for easy identification
  • Listing — see all branches for a conversation in a tree view
  • Switching — jump between branches without losing state
  • Comparison — view branches side by side to compare how they diverged
  • Archiving — archive branches you no longer need without deleting them

How branching works with compaction

Session branching integrates with JieGou’s iterative compaction system. When you branch from a compacted conversation:

  • The branch inherits the compacted summary as its foundation
  • The branch also inherits all intact recent messages from before the branch point
  • Each branch compacts independently as it grows
  • Compaction in one branch never affects another branch

This means you can branch from a 100-message conversation that’s been compacted twice, and the branch starts with the full compacted context — no information loss.

Branch comparison view

The comparison view shows two branches side by side, highlighting where they diverged:

Branch A (SQL)Branch B (NoSQL)
“The relational model gives us strong consistency…""Document storage lets us iterate on the schema…”
Estimated latency: 12ms p99Estimated latency: 8ms p99
Migration effort: 3 weeksMigration effort: 1 week

This makes it straightforward to evaluate trade-offs and reach a decision with evidence from both explorations.

Merging insights

Branches are independent, but insights aren’t siloed. You can reference findings from one branch in another:

  1. Open the branch with the insight you want to carry over
  2. Copy the relevant message or summary
  3. Switch to your target branch
  4. Paste it as context in your next message

We’re also building a dedicated merge assistant that will automatically synthesize findings across branches into a unified summary. This is on the roadmap for Q2 2026.

API and SDK support

Session branching is fully supported in the JieGou SDK and REST API. You can programmatically create branches, list branches for a conversation, and send messages to specific branches.

// List all branches for a conversation
const branches = await jiegou.conversations.listBranches("conv_abc123");

// Get the branch tree structure
const tree = await jiegou.conversations.getBranchTree("conv_abc123");

// Compare two branches
const diff = await jiegou.conversations.compareBranches({
  branchA: "conv_branch_001",
  branchB: "conv_branch_002"
});

This enables automated workflows that systematically explore alternatives — for example, a workflow step that branches a conversation, tries three different prompts, and selects the best result based on evaluation criteria.

Availability

Session branching is available on Pro plans and above. Each conversation can have up to 10 active branches on Pro, and unlimited branches on Team and Enterprise plans.

Branches count toward your conversation storage quota but not toward your LLM usage limits — only the messages you actually send in each branch consume tokens.

Start exploring

The best ideas often come from asking “what if?” Session branching makes that question free. Fork, explore, compare, and converge on the best path forward.

View your conversations

session-branching conversation hypothesis-testing power-user
Share this article

Enjoyed this post?

Get workflow tips, product updates, and automation guides in your inbox.

No spam. Unsubscribe anytime.