[Feature Request] /clear --keep-session: clear conversation context without creating a new session

Resolved 💬 5 comments Opened Mar 5, 2026 by Loong0x00 Closed Apr 18, 2026

Summary

Currently, /clear resets the conversation and creates a new session. There is no way to simply clear the conversation history while keeping the same session identity.

Use Case

When using Claude Code as a general-purpose assistant across multiple tasks within one working session, I frequently want to:

  1. Clear the accumulated conversation context (to free up context window)
  2. Without starting a brand new session

The current behavior of /clear creates a new session ID and loses session-level state, which feels like "starting over" rather than just "clearing the chat."

/compact is an alternative, but it compresses rather than clears — the summarized context from previous tasks still pollutes the window when switching to unrelated work.

Proposed Solution

Add a flag to /clear, e.g.:

/clear --keep-session

or a separate command like /reset:

  • Clears the conversation messages array (same as current /clear)
  • Keeps the current session ID and session metadata
  • Still loads CLAUDE.md and memory files (as usual)

This is essentially: "forget what we talked about, but don't create a new session."

Alternatives Considered

  • Using /compact — doesn't fully clear, summarized context accumulates
  • Using /clear — works but creates a new session unnecessarily
  • Writing important info to memory files — helps, but doesn't address the core UX issue of session identity discontinuity

Environment

  • Claude Code 2.1.69
  • Arch Linux

View original on GitHub ↗

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