Skip to content

[BUG] Command history from other sessions appears when using arrow keys in a new session #23276

Closed as not planned

Description

@jaried

[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

  1. Open multiple terminals, run claude in each terminal
  2. Enter some different commands in each session (e.g., "help" in terminal 1, "model" in terminal 2)
  3. In one of the sessions, enter /exit to exit
  4. In the same terminal, run claude -c to resume the session
  5. Press Up/Down arrow keys to browse command history
  6. 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.

Activity

  1. amit777 commented on Feb 7, 2026

    @amit777

    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.

  2. albinowax commented on Feb 23, 2026

    @albinowax

    This is definitely a regression.

  3. watsonix commented on Apr 16, 2026

    @watsonix

    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 : (

  4. watsonix commented on Apr 17, 2026

    @watsonix

    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).

  5. Reithan commented on May 15, 2026

    @Reithan

    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.

  6. github-actions commented on Jun 13, 2026

    @github-actions

    Closing for now — inactive for too long. Please open a new issue if this is still relevant.

  7. github-actions commented on Aug 16, 2026

    @github-actions

    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.

  8. locked as resolved and limited conversation to collaborators on Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:tuibugSomething isn't workinghas reproHas detailed reproduction stepsplatform:windowsIssue specifically occurs on WindowsstaleIssue is inactive

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions