More on Tokens: Branching Explained (And Why Claude Never Notices You Created One)
Published: December 4, 2025 • 5 min read
Yes, I know, it's the third blog post on tokens but I can't help it. The new perspective that you get when working with AI is just incredible when you understand how tokens work and how they affect everything.
This blog post is going to be a short one though since I'll only be talking about how branching affects your context window.
Quick Recap: What is a Context Window?
If you are reading this and have no clue what a context window is, I highly suggest that you check out this blog post.
The context window is the sum total of memory that you have when you start a new conversation with an LLM. The unit of measurement for this memory is called tokens.
Here is a quick summary of how it works:
- When you start a new conversation in Claude, you open a "context window"
- Any prompts (and files) that you send to Claude get added to the context window
- Any response generated by Claude gets added to the context window as well
- The inputs (messages/prompts and files) and outputs (Claude's responses) use up tokens which fill up the context window of that chat
Now that we have that out of the way, what happens when you create a branch when communicating with Claude?
What is Branching?
Just to clarify what I mean by "branch": every time you edit a message that you already sent to an LLM or you click on the retry button and the model generates a new response, that new response creates a new branch.
Here is one way to visualize it:
Messages 1 ──→ 2 ──→ 3 ──→ 4 ──→ 5 [Original Path - ABANDONED]
│
└──→ 3' ──→ 4' ──→ 5' [New Branch - ACTIVE]
↑
You edited Message 3
The Key Question: Do Abandoned Tokens Count?
Now you may be wondering: do the messages and responses from a branch that has been "abandoned" take up space in your context window?
The answer is no, they don't.
What happens is that when you edit or retry a previous message and create a branch:
- The abandoned branch's tokens disappear from your context window
- The new branch continues from the edit point with only the content up to that point
Here's a good way to visualize it:
Messages 1 ──→ 2 ──→ 3 ──→ 4 ──→ 5 [Original Path - ABANDONED]
│
└──→ 3' ──→ 4' ──→ 5' [New Branch - ACTIVE]
↑
You edited Message 3
Context Window: Only contains 1 → 2 → 3' → 4' → 5'
Abandoned tokens from original 3 → 4 → 5 are gone
Detailed Token Visualization
A more detailed view of this in terms of tokens:
Original Path:
Msg 1 ────→ Msg 2 ────→ Msg 3 ────→ Msg 4 ────→ Msg 5
[500] [1,200] [2,100] [3,400] [5,000]
│ │ │ │ │
└── +700 ────┴── +900 ───┴── +1,300 ─┴── +1,600 ─┘
tokens tokens tokens tokens
You Edit Message 3... New Branch Created:
Msg 1 ────→ Msg 2 ────→ Msg 3 ────→ Msg 4 ────→ Msg 5 ← ABANDONED
[500] [1,200] [2,100] [3,400] [5,000] (tokens gone)
│
└────→ Msg 3' ────→ Msg 4' ────→ Msg 5' ← ACTIVE
[2,300] [3,600] [4,800]
│ │ │
└── +1,300 ──┴── +1,200 ─┘
What Claude Actually Sees
Before branch: 1 → 2 → 3 → 4 → 5 = 5,000 tokens
After branch: 1 → 2 → 3' → 4' → 5' = 4,800 tokens
↑
Branch point resets to 1,200 tokens
Everything after = fresh start
A Note on Computational Costs
Now you should note that despite the fact that the abandoned branch's tokens disappear from your context window, there are still computational costs attached to the abandoned tokens because they were generated after all.
Connection to LLM Instance Cloning
In this blog post where I first introduced LLM Instance Cloning, I mentioned that I created multiple branches within one conversation after I hit the token limit just so I could continue using my perfectly trained Claude instance. This ended up confusing me because I had a hard time tracking which branch contained which context.
Well, it turns out that Claude never even notices that you created a branch.
It only ever sees a linear path of the current active branch. Each branch is essentially a new conversation from the branch point.
Summary
I hope this was an enjoyable read for you.
As always, thanks for reading!