/clear command in VS Code extension does not purge model context

Resolved 💬 6 comments Opened Apr 26, 2026 by WolvenRA Closed May 6, 2026

Description

In the Claude Code VS Code extension, running the /clear command appears to visually clear the conversation, but the model's working context is not actually reset. After running /clear, the model can still recall and reference content from prior to the clear command, indicating the underlying context was not purged.

Environment

  • Claude Code: VS Code extension (not the terminal CLI)
  • OS: Linux (WSL2 from Windows)
  • Model: Claude Opus 4.7 (1M context)

Steps to reproduce

  1. Have a substantial conversation in the VS Code Claude Code extension (long enough that context is non-trivial).
  2. Type /clear and submit.
  3. Conversation visually appears cleared.
  4. Send a new message asking the model to recall something from before the clear (e.g., "what's our current state?" or "what did we just commit?").
  5. The model references content from before the /clear — context was not actually purged.

Expected behavior

Either:

  • /clear should fully purge the model's working context (matching the CLI behavior), or
  • /clear should not be available in the VS Code extension if it cannot reliably purge context (with a clear error message if invoked).

The current behavior is misleading: the visual presentation suggests a reset, but the model retains everything.

Workaround

Use Open in New Tab from the Command Palette (Ctrl+Shift+P → "Claude Code: Open in New Tab"), or keyboard shortcut Ctrl+N if enableNewConversationShortcut is enabled in settings. This reliably starts a fresh conversation. Fully exiting and relaunching the extension also works.

Additional notes

The /clear command is not documented for the VS Code extension. If it's not officially supported, the extension should either remove it from the available / command list or surface a clear behavior note to users. The current state — silently visible-only — is the worst of both worlds: users believe they have a fresh context when they don't, which can lead to confused interactions with the model and unintended cost (extra tokens charged against the prior conversation).

View original on GitHub ↗

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