You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Command history from other sessions appears when using arrow keys in a new session #23276
[BUG] Command history from other sessions appears when using arrow keys in a new session
Preflight Checklist
I have searched existing issues and this hasn't been reported yet
This is a single bug report
I am using the latest version of Claude Code (2.1.50)
What's Wrong?
When multiple Claude Code sessions are running concurrently in different terminals, after exiting one session with /exit and resuming it with claude -c, the command history (accessed via Up/Down arrow keys) contains command history from other concurrent sessions, not just the current session.
What Should Happen?
The Up/Down arrow key command history should only show commands from the current session, not mixed with commands from other concurrent sessions.
Steps to Reproduce
Open multiple terminals, run claude in each terminal
Enter some different commands in each session (e.g., "help" in terminal 1, "model" in terminal 2)
In one of the sessions, enter /exit to exit
In the same terminal, run claude -c to resume the session
Press Up/Down arrow keys to browse command history
Observe that commands from other concurrent sessions appear in the history
Is this a regression?
Unknown - not sure if this worked differently in previous versions.
Claude Code Version
2.1.50 (Claude Code)
Platform
Claude API (anthropic)
Operating System
Windows 10
Terminal/Shell
Windows Terminal
Additional Information
This causes confusion when resuming a session as users may accidentally execute commands intended for a different session. Each session should maintain its own isolated command history.
Reacted by amit777, Hafez, Rick van Hattem, James Kettle, watson Ξ, Clyde C Brown, Reithan and Gavin Golden
Following up on my earlier comment — I dug into this more.
Root cause:~/.claude/history.jsonl is a single global append-only file. Each entry already has a sessionId field, but the up-arrow recall doesn't filter by it — it only sorts current-session entries first (since ~v2.1.72). So other sessions' prompts still appear when you keep pressing up.
Scale of the issue in practice: My history.jsonl is 2.8MB with 10K entries across 204 session IDs and 32 projects. I run 3-4 concurrent named sessions (different projects/roles). The cross-contamination is constant.
The fix should be straightforward: Filter by sessionId on read in the TUI's history population. The data model already supports it — no schema change needed. A commandHistoryScope: "session" | "project" | "global" setting in settings.json would let users choose their preference (see #15631).
Related issues for anyone tracking this:#15631 (best feature request tracker), #5691 (keystroke cross-contamination), #7702 (same-folder context sharing), #36091 (CLAUDE_CODE_SKIP_PROMPT_HISTORY regression that also breaks transcripts).
Seeing this again today. And also getting permission prompts from one session in a different session.
Along with /clear deleting session history now, it seems like someone really fubared the session handling.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.
Activity
amit777 commentedon Feb 7, 2026
This is very annoying if you are multitasking in multiple windows. It feels like there should be a setting for global vs session specific history.
albinowax commentedon Feb 23, 2026
This is definitely a regression.
watsonix commentedon Apr 16, 2026
I am seeing this on OSX on 2.1.85 (Claude Code)
👎
Actually new issue for me ... it did coincide with trying to use the /chrome computer use skill, but happens whether thats enabled or not now : (
watsonix commentedon Apr 17, 2026
Following up on my earlier comment — I dug into this more.
Root cause:
~/.claude/history.jsonlis a single global append-only file. Each entry already has asessionIdfield, but the up-arrow recall doesn't filter by it — it only sorts current-session entries first (since ~v2.1.72). So other sessions' prompts still appear when you keep pressing up.Scale of the issue in practice: My
history.jsonlis 2.8MB with 10K entries across 204 session IDs and 32 projects. I run 3-4 concurrent named sessions (different projects/roles). The cross-contamination is constant.The fix should be straightforward: Filter by
sessionIdon read in the TUI's history population. The data model already supports it — no schema change needed. AcommandHistoryScope: "session" | "project" | "global"setting insettings.jsonwould let users choose their preference (see #15631).Related issues for anyone tracking this: #15631 (best feature request tracker), #5691 (keystroke cross-contamination), #7702 (same-folder context sharing), #36091 (
CLAUDE_CODE_SKIP_PROMPT_HISTORYregression that also breaks transcripts).Reithan commentedon May 15, 2026
Seeing this again today. And also getting permission prompts from one session in a different session.
Along with
/cleardeleting session history now, it seems like someone really fubared the session handling.github-actions commentedon Jun 13, 2026
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
github-actions commentedon Aug 16, 2026
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.