claude-code - 💡(How to fix) Fix /clear command in VS Code extension does not purge model context [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#53401Fetched 2026-04-26 05:16:46
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

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.

Error Message

  • /clear should not be available in the VS Code extension if it cannot reliably purge context (with a clear error message if invoked).

Root Cause

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.

Fix Action

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.

RAW_BUFFERClick to expand / collapse

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).

extent analysis

TL;DR

The /clear command in the Claude Code VS Code extension does not actually reset the model's working context, but using the "Open in New Tab" feature or fully exiting and relaunching the extension can start a fresh conversation.

Guidance

  • To verify the issue, follow the steps to reproduce and check if the model recalls content from before the /clear command.
  • As a workaround, use the "Open in New Tab" feature from the Command Palette or keyboard shortcut Ctrl+N (if enabled) to start a fresh conversation.
  • Consider reporting the issue to the extension developers to request official support for the /clear command or its removal to avoid confusion.
  • Be cautious when using the /clear command, as it may lead to unintended costs due to extra tokens charged against the prior conversation.

Example

No code snippet is provided as it is not necessary for this issue.

Notes

The /clear command is not documented for the VS Code extension, and its behavior may not be officially supported. The workaround provided may not be a permanent solution, and users should be aware of the potential limitations.

Recommendation

Apply the workaround by using the "Open in New Tab" feature or fully exiting and relaunching the extension to start a fresh conversation, as this is the most reliable method to ensure a clean context.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

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.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING