Branching

Your thinking isn't linear.
Your AI shouldn't be either.

Every conversation becomes a tree, not a line. Fork at any point to explore "what if" scenarios. Compare outcomes side-by-side. Merge the best ideas.

Save tokens by branching, not restarting

In a linear chat tool, exploring 5 different approaches means copying context 5 times. With Bonsai, you branch from a shared ancestor — the context is loaded once. Each new branch only costs the new messages.

Linear Chat

1.2M

tokens for 5 explorations

Bonsai Branching

200K

tokens for 5 explorations

That's an 83% reduction. On production workloads, this translates to real money.

Token Usage: 5 ExplorationsBranching TreeRRootABCDEExploration A: 40K tokensExploration B: 15K tokensExploration C: 38K tokensExploration D: 12K tokensExploration E: 42K tokensTotal: ~200K tokensLinear Chat123456Each new exploration includesfull conversation historyMessage 1 + Message 2 + ...Total: ~1.2M tokensBonsai Branches Save 83% on Tokens1.2M → 200K tokens = 1M tokens saved per sessionAt $5/M tokens = $5 saved per deep-research session83%Shared context reused across branches
bonsai-tui — conversation treeUser: Initial prompt"Design a microservice..."Branch AService architecture~4K tokensAPI designDB schemaBranch BDeployment strategy~6K tokensDocker configCI/CD setupContinueDeeper on architecture~8K tokensMerge PointBranch A1 + B1 mergedContexts combined● Active: Branch BClick to switch branches3 branches18K total tokensvs 120K linear85% saved● Branch A● Branch B● Continue⊕ Merge
Branch from Any Point

Branch at any message in a conversation

Hit a fork in your thinking? Branch. Want to test a different prompt strategy? Branch. Need to explore what the alternative model would say? Branch. No context lost, no history discarded.

Instant Fork

Create a branch from any message in the tree with one click.

Short IDs

Conversations and branches get short numeric IDs — no UUIDs to copy.

Visual Tree

See the entire conversation topology as an interactive graph.

Rewind & Replay

Jump to any point in history. Your progress is never lost.

Merge & Graft

Recombine your best ideas

Merge branches within a conversation to synthesize learnings from parallel paths. Graft messages across conversations to cross-pollinate insights between different projects.

Merge Branches

Combine divergent exploration paths back together with bridge prompts.

Graft Messages

Inject messages from one conversation into another. Cross-project context transfer.

Branch Diff

Compare two branches side-by-side. See exactly where they diverged.

Verbatim or Transformed

Copy messages raw, or pipe them through an LLM for transformation during merge.

Merge & GraftBranch PointsRootA1A2A3B1B2MergeMerge NodeBranch A3 + B2 → Merged ContextGraftT1T2Graft T2 → T1Result: Conversation T1now includes T2's subtreeas a child conversationWhy Context Recombination MattersMerge: Combine two branches into a single conversation — preserves both paths' contextGraft: Insert one conversation tree into another — enables reusable sub-trees across projectsNo other AI tool lets you recombine conversation histories after branching
variant comparisonGGPT-4o2.1sImplement a Redis-backedrate limiter in Go withmiddleware support.package limiterimport ("context""time")Full implementation shown...CClaude 4 Opus3.4sHere's a rate limiterusing Go's sync packagewith Redis backend.type RateLimiter struct { client *redis.Client limit int window time.Duration}Full implementation shown...VariantCDeepSeekKeep best⌨ Merge
Variants & A/B Testing

A/B test prompts in parallel

Every message can have multiple variants — original, edited, regenerated, or generated in parallel by different models. Activate the best one. Discard the rest. Never lose a good idea.

Parallel Execution

Send the same prompt to GPT-4o, Claude, and Gemini — all at once.

Variant Carousel

Swipe between sibling responses. Drag to reorder.

String-level Diff

Compare two variants with unified, inline, or side-by-side diff views.

Non-destructive

Toggling variants never deletes alternatives. Experiment freely.

Stop scrolling. Start branching.

Join developers who've moved from linear chat to tree-based AI exploration.