Ctrl+R reverse search limited to recent ~18h window; older prompts unreachable despite 'everywhere' scope

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 4 comments · opened Jun 24, 2026 · closed Aug 20, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Summary

Ctrl+R reverse prompt-search ("Search prompts") only surfaces roughly the last ~18 hours (~150 prompts) of history, even with scope set to "everywhere". Prompts from days/weeks/months ago are unreachable, despite a complete on-disk history. This contradicts the documented behavior, and it's a change from how it used to work (older versions surfaced much older prompts).

Expected (per docs)

The interactive-mode docs state Ctrl+R searches "prompts from all previous sessions, not just the current one," with Ctrl+S cycling scope this session → this project → all projects. With scope on all-projects ("everywhere"), the full history should be searchable.

Actual

  • Scope reads "Search prompts · everywhere", yet the oldest reachable match for a common word (e.g. deploy) is only ~18h old.
  • Searching a phrase known to occur many times in older history (a frequently re-sent reminder block) returns no real match — the fuzzy matcher instead returns unrelated recent prompts (best-effort junk), indicating the target simply isn't in the searchable set.

Environment

  • Claude Code v2.1.187
  • macOS (Darwin arm64)
  • ~/.claude/history.jsonl: 26,301 entries spanning 266 days — complete and intact.
  • The legacy per-project history arrays in ~/.claude.json are now empty (history appears to have migrated to history.jsonl).

Evidence the data isn't lost

The target prompts are present in ~/.claude/history.jsonl (verified via grep/jq) with full text and timestamps; they are simply outside the reverse-search window. So this is a search-depth/window limitation, not data loss.

Repro

  1. Use Claude Code heavily for weeks (so history.jsonl accumulates thousands of entries).
  2. Ctrl+R, set scope to "everywhere" (Ctrl+S).
  3. Search for a word/phrase you know you used more than ~24h ago.
  4. Observe: only recent (~18h) prompts are searchable; older ones never appear, and the fuzzy matcher returns unrelated entries.

Question

Is the recent-window cap intended (e.g. a performance truncation to avoid scanning large history files)? If so, it contradicts the docs and should be documented and ideally made configurable (a setting to search the full history.jsonl). If not, it's a regression — Ctrl+R previously reached prompts from weeks/months ago.

Likely cause

A silent change to index/search only a recent slice of history rather than the full history.jsonl. No changelog entry across v2.1.175–v2.1.187 mentions a search-depth cap or recent-window behavior.

View original on GitHub ↗

3 Comments

achton · 3 months ago

I can confirm this bug on Linux too. I definitely consider it a recent regression, because it worked fine for me until recently. Maybe a week or two ago it was working.

byrondover · 2 months ago

I can confirm this bug on Claude Code CLI 2.1.217.

bcherny collaborator · 1 month ago

Thanks for the detailed report — this was a real bug, and it's already fixed in a recent release.

What I tried (Linux): seeded ~/.claude/history.jsonl with 3,000 prompts spanning 300 days, opened Ctrl+R with scope set to "everywhere", and searched for words that only occur in old entries.

  • On v2.1.187 (your version) I reproduced exactly what you describe: only prompts from roughly the last 18 hours matched; anything older returned "No matching prompts".
  • On v2.1.233 (current release) the same search finds prompts from 2 days to 10 months back — the picker now scans the full history.jsonl (up to a very large size bound, on the order of tens of thousands of prompts) and shows "Searching older prompts…" while it streams in the rest.

So the recent-window cap was not intended, and it's gone in a recent release (changelog). Please update to the latest version — closing; reply to reopen if you still hit this on 2.1.233 or later.

🤖 Generated with Claude Code

Showing cached comments. Read the full discussion on GitHub ↗