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

Status Fixed / completed
Maintainer reply ✓ Yes — claude[bot]
Activity 6 comments · opened Apr 26, 2026 · closed May 6, 2026
💡 Likely answer: A maintainer (claude[bot], contributor) responded on this thread — see the highlighted reply below.

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 ↗

6 Comments

github-actions[bot] · 4 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/53316
  2. https://github.com/anthropics/claude-code/issues/45578
  3. https://github.com/anthropics/claude-code/issues/48951

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

davedawkins · 4 months ago

I don't think this is a duplicate of those issues - I'm seeing the same thing. Closest is #48951 but I'm not in plan mode

harrybuck · 3 months ago

There's no need to be in plan mode. The clear command is simply a no-op. This one is important functionality and super-reproducible. Just fix it.

vpicone · 3 months ago

Confirming, neither the conversation nor the context gets cleared resulting in balooning context.

claude[bot] contributor · 3 months ago

This issue was fixed as of version 2.1.129.

github-actions[bot] · 2 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.