/branch from a rewound session leaks rewinded messages into the new session's /rewind picker
Describe the bug
When you /rewind a session and then /branch from it, the new branched session's /rewind picker shows messages that were rewound away in the parent session — they reappear in chronological order mixed in with the active messages. The parent session correctly hides these rewound messages, but the child session resurrects them.
Steps to reproduce
- Session A: chat with Claude. The conversation has messages 1 → 2 → 3 → 4 → 5
- In Session A,
/rewindto message 3, restore conversation - Continue chatting in Session A, producing new messages 4' → 4'' → 4'''
- At this point, Session A's
/rewindpicker shows only: 1 → 2 → 3 → 4' → 4'' → 4''' (messages 4 and 5 are gone, as expected) - Run
/branch sessionBfrom Session A - In Session B, open
/rewind
Expected behavior
Session B's /rewind picker should show the same active history as Session A:
1 → 2 → 3 → 4' → 4'' → 4'''
Actual behavior
Session B's /rewind picker shows the old rewound messages (4, 5) resurrected and mixed in chronologically:
1 → 2 → 3 → 4 → 4' → 4'' → 4''' → 5
The original messages 4 and 5 — which were explicitly rewound away in Session A — leak back into Session B's history.
Why this matters
This is confusing and dangerous. From the user's perspective:
- Session A tells me messages 4 and 5 are gone — I rewound them
- I branch, expecting a clean copy of my current state
- The new session suddenly resurrects messages I explicitly chose to leave behind
It breaks the mental model of "branch = copy current state." It also makes /rewind in the branched session harder to use — the history list is polluted with ghost messages that shouldn't be there, interleaved with real ones in chronological order.
Root cause analysis
The JSONL files are append-only. /rewind does not truncate the file — it marks messages as "rewound" via an internal pointer, and the UI hides them. /branch copies the entire raw JSONL file without transferring or re-applying the rewind pointer, so the new session sees all messages including the rewound ghosts.
Proposed fix
When /branch copies session history, it should respect the parent session's rewind state. Ideally, ask the user:
"This session has rewound messages. When creating the branch, do you want to:" - A) Keep only the active conversation (discard rewound history) - B) Include the full history including rewound messages
This gives users control. Some might want the full history in the branch for reference; others want a clean copy of their current state. Currently there's no choice and no warning.
Environment
- Claude Code v2.1.114
- Windows 11
- CLI
Related issues
- #55347 — same root cause (JSONL append-only, rewind doesn't fork)
- #32631 — Conversation Branching spec (long-term fix)
- #27242 — UI can't access preserved data after branch navigation
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗