claude-code - 💡(How to fix) Fix Up-arrow prompt history is shared across concurrent Claude Code tabs in the same directory

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

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.

Root Cause

Root cause (from inspection)

Code Example

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

---

// ~/.claude/settings.json
  { "commandHistoryScope": "session" }  // values: "session" | "directory" (current) | "global"
RAW_BUFFERClick to expand / collapse

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:

    // ~/.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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING