[FEATURE] Context exhaustion should not create separate sessions, preserve session identity across compaction continuations

Resolved 💬 2 comments Opened Mar 12, 2026 by samoht9277 Closed Mar 13, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

When working on a long task (building a feature, debugging, etc.), context exhaustion causes Claude Code to create a brand new session with a summary/plan of the previous one as its first message. This means a single logical conversation gets split into multiple separate sessions.

What happens:

  1. Start a session, /rename it to something meaningful like "auth-refactor"
  2. Work for a while, context fills up
  3. Context gets exhausted, Claude Code creates a new session starting with "# Plan: Continue implementing auth refactor on branch X..."
  4. If context exhausts again, yet another session is created
  5. /resume now shows 2-3+ separate sessions for what was one continuous piece of work

The problems this creates:

  • Session sprawl: A single feature can generate multiple sessions, cluttering /resume
  • Custom names don't carry over: /rename only applies to the original session. Continuations get auto-generated names (relates to #25090, #26121)
  • No parent-child linking: There's no way to know which sessions are continuations of which. They appear as completely unrelated conversations
  • Confusing /resume experience: When resuming work the next day, you have to guess which of the 2-3 sessions with similar descriptions is the "latest" continuation
  • Related to #26832 which reports the same issue specifically for Plan mode transitions, but this affects any long-running session

Proposed Solution

A session should maintain its identity across context exhaustion. Specifically:

  1. Compact in-place whenever possible: Instead of creating a new session, summarize and continue in the same session file with the same session ID. This already works for normal compaction but not for full context exhaustion.
  1. If a new session file must be created, chain them: Add a parentSessionId field so continuations are linked. /resume should show them as one logical session (e.g., show only the latest continuation, or group them together).
  1. Propagate metadata to continuations: If the parent session has a custom-title, the continuation should inherit it automatically. Same for tags and other metadata.
  1. Single entry in /resume: Regardless of how many times context was exhausted, the user should see one session entry that resumes from the latest continuation point.

Current Workaround

Manually /rename each continuation session after it's created, and remember which one is the latest. Not great.

Version

2.1.74

View original on GitHub ↗

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