[BUG] Input history should be scoped to session, not shared across all sessions started in the same directory
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?
Summary
When running multiple Claude Code instances in the same directory, each instance gets its own session (separate session ID, separate context), yet up-arrow input history is shared in real-time across all instances. This is confusing and undermines the mental model users need to develop for effective LLM interaction.
Current Behavior
- Running
claudetwice in the same directory creates two separate sessions (different session IDs) - However, up-arrow history is shared in real-time between them
- Pressing up-arrow in one terminal shows commands typed in the other terminal's session
Expected Behavior
Input history should be scoped to the session, not the directory. Each session should have its own history that:
- Only shows commands typed in that session
- Is restored when using
/resumeto continue that session
Why This Matters
1. Contradicts shell conventions
Standard shell behavior (bash, zsh) maintains per-terminal history during a session. You don't see another terminal's commands via up-arrow in real-time. Claude Code's behavior is more confusing than standard shells, not less.
2. Breaks resume semantics
If history were per-session, /resume would restore both the conversation context and the relevant input history—you'd get back exactly where you left off. Currently, sessions are separate but history is shared, which is the worst of both worlds.
3. Undermines the LLM mental model
Effective LLM use requires understanding "context"—the conversation history that Claude can see and reference. Up-arrow reflecting session-scoped history would reinforce this: "these are the things I said in this context."
Showing commands from another session (that this Claude instance has no knowledge of) suggests a shared memory that doesn't exist, teaching users the wrong mental model about what Claude can reference.
Common Use Case Affected
Running a second Claude instance to ask questions about the codebase while another instance is doing work. This is read-only and doesn't require a separate checkout/worktree, but the shared history makes it confusing to work with both sessions.
What Should Happen?
Two separate claudes run in the same directory, but with different sessions, should not share real time history.
Up arrow in session 1 in terminal 1 should not see a prompt just types in session 2 in terminal 2
Error Messages/Logs
Steps to Reproduce
cd ~/project
claude
hello1
/status
will see that in session 1
--
cd ~/project
claude
hit up arrow - will see hello1
/status
will see in session 2
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.15
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗