Up-arrow prompt history is shared across concurrent Claude Code tabs in the same directory

Status Closed — duplicate
Reported on v2.1.139
Maintainer reply None cached
Activity 3 comments · opened May 12, 2026 · closed May 16, 2026

Summary

Running multiple Claude Code instances in separate terminal tabs (same working directory) causes them to share the same up-arrow prompt history. Pressing Up in tab A surfaces prompts I typed in tab B, and vice versa.

Related to (but not exactly the same as) #15631 — that issue asks for per-session scoping; this one focuses on the concurrent-tab UX, which is the most common multi-session scenario for me.

Repro

  1. Open terminal tab A in ~/some-project, run claude
  2. Open terminal tab B in ~/some-project, run claude (separate session)
  3. Type a prompt in tab A, submit
  4. Switch to tab B, press Up arrow
  5. Observed: the prompt from tab A appears in tab B's input
  6. Expected: each tab's up-arrow recalls only that tab's prompts (or at least gives me a setting to opt into that)

Root cause (from inspection)

~/.claude/history.jsonl is a single global file. Each line records project (cwd) and sessionId. Up-arrow appears to filter by project only — not by sessionId or PID — so all concurrent instances in the same directory share the recall pool.

Example entries already include the session ID; the data needed for per-session filtering is right there:

{"display":"...","project":"/path/to/repo","sessionId":"a9bb95e1-..."}

Why it matters

  • I keep multiple Claude tabs open for parallel work in the same repo (one debugging, one refactoring, one writing tests). Their prompt histories should not bleed across.
  • Up-arrow becomes noisy: I scroll past prompts I never typed in this tab.
  • Privacy/safety smell: a forked or shared terminal can surface prompts from a sibling session.

Requested fix

Either:

  • (A) Filter up-arrow history by sessionId by default, OR
  • (B) Add a setting:

``json
// ~/.claude/settings.json
{ "commandHistoryScope": "session" } // values: "session" | "directory" (current) | "global"
``

/clear should continue to behave as today regardless of the setting.

Environment

  • Claude Code: 2.1.139
  • Platform: macOS (Darwin 24.5.0)
  • Shell: zsh
  • Terminal: multiple concurrent tabs

References

  • #15631 (open) — per-session history scoping
  • #32400 (closed, stale) — same ask
  • #7702, #15630, #20064 — older duplicates

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗