[BUG] Forking a session re-creates context cache
Resolved 💬 3 comments Opened Mar 31, 2026 by michaelheiser-aiwyn Closed May 15, 2026
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using /branch, claude code seems to re-create the cache instead of reading from it, is it expected that context cache might not be easily shared between sessions?
What Should Happen?
Sessions with shared prefixes should share the context cache.
Error Messages/Logs
Steps to Reproduce
1) Create a warmed session in claude code (choose any large-ish file)
❯ head /var/log/syslog -1000 | claude
2) Fork/ branch the session in claude code
/branch
3) Ask something in the new session,
What are we doing here
4) check usage stats of the warmed and the branched sessions
❯ npx ccusage session -O -b -i 97aae588-7518-45ff-b710-5a69e6bdf358
...
┌───────────┬─────────────────┬───────────┬───────────┬───────────────┬─────────────┬─────────────┐
│ Timestamp │ Model │ Input │ Output │ Cache Create │ Cache Read │ Cost (USD) │
├───────────┼─────────────────┼───────────┼───────────┼───────────────┼─────────────┼─────────────┤
│ 2026 │ claude-opus-4-6 │ 2 │ 28 │ 71,867 │ 12,463 │ $0.00 │
│ 03-30 │ │ │ │ │ │ │
├───────────┼─────────────────┼───────────┼───────────┼───────────────┼─────────────┼─────────────┤
│ 2026 │ claude-opus-4-6 │ 2 │ 127 │ 71,867 │ 12,463 │ $0.00 │
│ 03-30 │ │ │ │ │ │ │
└───────────┴─────────────────┴───────────┴───────────┴───────────────┴─────────────┴─────────────┘
❯ npx ccusage session -O -b -i 76781672-ed1a-4483-bf60-ceaa10b605ad
....
┌───────────┬─────────────────┬───────────┬───────────┬───────────────┬─────────────┬─────────────┐
│ Timestamp │ Model │ Input │ Output │ Cache Create │ Cache Read │ Cost (USD) │
├───────────┼─────────────────┼───────────┼───────────┼───────────────┼─────────────┼─────────────┤
│ 2026 │ claude-opus-4-6 │ 2 │ 28 │ 71,867 │ 12,463 │ $0.00 │
│ 03-30 │ │ │ │ │ │ │
├───────────┼─────────────────┼───────────┼───────────┼───────────────┼─────────────┼─────────────┤
│ 2026 │ claude-opus-4-6 │ 2 │ 127 │ 71,867 │ 12,463 │ $0.00 │
│ 03-30 │ │ │ │ │ │ │
├───────────┼─────────────────┼───────────┼───────────┼───────────────┼─────────────┼─────────────┤
│ 2026 │ claude-opus-4-6 │ 3 │ 29 │ 69,946 │ 12,463 │ $0.00 │
│ 03-30 │ │ │ │ │ │ │
├───────────┼─────────────────┼───────────┼───────────┼───────────────┼─────────────┼─────────────┤
│ 2026 │ claude-opus-4-6 │ 3 │ 592 │ 69,946 │ 12,463 │ $0.00 │
│ 03-30 │ │ │ │ │ │ │
├───────────┼─────────────────┼───────────┼───────────┼───────────────┼─────────────┼─────────────┤
│ 2026 │ claude-opus-4-6 │ 3 │ 52 │ 72,229 │ 12,463 │ $0.00 │
│ 03-30 │ │ │ │ │ │ │
├───────────┼─────────────────┼───────────┼───────────┼───────────────┼─────────────┼─────────────┤
│ 2026 │ claude-opus-4-6 │ 3 │ 243 │ 59 │ 84,692 │ $0.00 │
│ 03-30 │ │ │ │ │ │ │
└───────────┴─────────────────┴───────────┴───────────┴───────────────┴─────────────┴─────────────┘
The Cache gets re-created in the branch and we do not hit a cache read immediately in the branched session.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.1.88
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗