/clear command in VS Code extension does not purge model context
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
- Have a substantial conversation in the VS Code Claude Code extension (long enough that context is non-trivial).
- Type
/clearand submit. - Conversation visually appears cleared.
- 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?").
- The model references content from before the
/clear— context was not actually purged.
Expected behavior
Either:
/clearshould fully purge the model's working context (matching the CLI behavior), or/clearshould 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).
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
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
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.
Confirming, neither the conversation nor the context gets cleared resulting in balooning context.
This issue was fixed as of version 2.1.129.
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.