--continue loads oldest messages instead of most recent in large sessions

Resolved 💬 4 comments Opened Apr 16, 2026 by alexandrehsantos Closed Apr 19, 2026

Bug Description

When using claude --continue on a large session (8.6 MB, ~2,377 messages, 0 compaction summaries), the resumed conversation context shows messages from weeks ago (the beginning of the session) instead of the most recent messages.

Steps to Reproduce

  1. Have a long-running session with many messages (~1,000+ user messages, ~1,350+ assistant messages)
  2. The session file has no compaction/summary entries ("type":"summary" count = 0)
  3. Run claude --continue from the project directory
  4. The conversation context shown is from the earliest messages in the session, not the most recent ones

Expected Behavior

--continue should prioritize loading the most recent messages into the context window. When a session is too large to fit entirely, it should truncate from the beginning (oldest messages), not from the end (newest messages).

Actual Behavior

The context window is filled with the oldest messages from the session file. Recent work (in this case, API key creation and testing done the same day) is completely absent from the resumed context. The model responds based on topics from weeks ago.

Session Details

  • Session file size: 8.6 MB
  • Entry counts: assistant: 1351, user: 1026, system: 395, progress: 364, file-history-snapshot: 302, queue-operation: 244, attachment: 210, last-prompt: 32, permission-mode: 27
  • Compaction/summary entries: 0
  • --resume <session-id> exhibits the same behavior

Environment

  • Claude Code CLI (latest)
  • Linux (Ubuntu)

Workaround

None for the affected session. Starting a new session is the only option. Extracting conversation content directly from the .jsonl file can recover the lost context.

Suggestion

When loading a session that exceeds the context window:

  1. Prioritize recent messages over old ones
  2. Or auto-compact the session on resume, summarizing old messages and keeping recent ones intact

View original on GitHub ↗

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